Skip to content

Commit a67c318

Browse files
committed
meson: define PROJECT_VERSION as the "bare" project version
Let's not use atoi() if we can simply provide the project version as a number. In C code, this is the numerical project version. In substitutions in other files, this is just the bare substitution. The "PACKAGE_" prefix is from autotools, and is strange. We call systemd a "project", and "package" is something that distros build. Let's rename. PACKAGE_URL is renamed to PROJECT_URL for the same reasons and for consistency. (This leave PACKAGE_VERSION as the stringified define for C code.)
1 parent d2aaf13 commit a67c318

File tree

7 files changed

+11
-10
lines changed

7 files changed

+11
-10
lines changed

meson.build

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ libudev_version = '1.6.11'
2020
# names, sometimes. Not all variables are included in every
2121
# set. Ugh, ugh, ugh!
2222
conf = configuration_data()
23+
conf.set('PROJECT_VERSION', meson.project_version())
2324
conf.set_quoted('PACKAGE_VERSION', meson.project_version())
2425

2526
substs = configuration_data()
26-
substs.set('PACKAGE_URL', 'https://www.freedesktop.org/wiki/Software/systemd')
27-
substs.set('PACKAGE_VERSION', meson.project_version())
27+
substs.set('PROJECT_URL', 'https://www.freedesktop.org/wiki/Software/systemd')
28+
substs.set('PROJECT_VERSION', meson.project_version())
2829

2930
want_ossfuzz = get_option('oss-fuzz')
3031
want_libfuzzer = get_option('llvm-fuzz')

src/core/systemd.pc.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ containeruidbasemax=@containeruidbasemax@
3636

3737
Name: systemd
3838
Description: systemd System and Service Manager
39-
URL: @PACKAGE_URL@
40-
Version: @PACKAGE_VERSION@
39+
URL: @PROJECT_URL@
40+
Version: @PROJECT_VERSION@

src/libsystemd/libsystemd.pc.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ includedir=@includedir@
1414

1515
Name: systemd
1616
Description: systemd Library
17-
URL: @PACKAGE_URL@
18-
Version: @PACKAGE_VERSION@
17+
URL: @PROJECT_URL@
18+
Version: @PROJECT_VERSION@
1919
Libs: -L${libdir} -lsystemd
2020
Cflags: -I${includedir}

src/libsystemd/sd-hwdb/hwdb-util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ static int trie_store(struct trie *trie, const char *filename, bool compat) {
367367
int64_t size;
368368
struct trie_header_f h = {
369369
.signature = HWDB_SIG,
370-
.tool_version = htole64(atoi(PACKAGE_VERSION)),
370+
.tool_version = htole64(PROJECT_VERSION),
371371
.header_size = htole64(sizeof(struct trie_header_f)),
372372
.node_size = htole64(sizeof(struct trie_node_f)),
373373
.child_entry_size = htole64(sizeof(struct trie_child_entry_f)),

src/libudev/libudev.pc.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ includedir=@includedir@
1414

1515
Name: libudev
1616
Description: Library to access udev device information
17-
Version: @PACKAGE_VERSION@
17+
Version: @PROJECT_VERSION@
1818
Libs: -L${libdir} -ludev
1919
Cflags: -I${includedir}

src/test/test-path-util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ static void test_hidden_or_backup_file(void) {
531531

532532
static void test_systemd_installation_has_version(const char *path) {
533533
int r;
534-
const unsigned versions[] = {0, 231, atoi(PACKAGE_VERSION), 999};
534+
const unsigned versions[] = {0, 231, PROJECT_VERSION, 999};
535535
unsigned i;
536536

537537
for (i = 0; i < ELEMENTSOF(versions); i++) {

src/udev/udev.pc.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Name: udev
22
Description: udev
3-
Version: @PACKAGE_VERSION@
3+
Version: @PROJECT_VERSION@
44

55
udevdir=@udevlibexecdir@

0 commit comments

Comments
 (0)