From: Karel Zak Date: Thu, 19 Mar 2026 19:53:41 +0000 (+0100) Subject: liblastlog2: generate lastlog2.h from template X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=98a935e7d97d033869423e7edb2c8bf381d8ade9;p=thirdparty%2Futil-linux.git liblastlog2: generate lastlog2.h from template Convert lastlog2.h to lastlog2.h.in and add LIBLASTLOG2_VERSION, LIBLASTLOG2_MAJOR_VERSION, LIBLASTLOG2_MINOR_VERSION, and LIBLASTLOG2_PATCH_VERSION defines to follow the same pattern as libmount, libfdisk, libsmartcols, and libblkid. Update both autotools (configure.ac, Makemodule.am) and meson (liblastlog2/meson.build) to generate the header. Signed-off-by: Karel Zak --- diff --git a/Makefile.am b/Makefile.am index 4ac3b2e57..02db4061e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -43,7 +43,7 @@ ul_libblkid_incdir = $(top_builddir)/libblkid/src ul_libmount_incdir = $(top_builddir)/libmount/src ul_libsmartcols_incdir = $(top_builddir)/libsmartcols/src ul_libfdisk_incdir = $(top_builddir)/libfdisk/src -ul_liblastlog2_incdir = $(top_srcdir)/liblastlog2/src +ul_liblastlog2_incdir = $(top_builddir)/liblastlog2/src ul_libuuid_incdir = $(top_srcdir)/libuuid/src bashcompletiondir = @bashcompletiondir@ diff --git a/configure.ac b/configure.ac index 499c382ff..4c824eb12 100644 --- a/configure.ac +++ b/configure.ac @@ -1322,6 +1322,9 @@ UL_REQUIRES_HAVE([liblastlog2], [sqlite3], [sqlite3 library]) AC_SUBST([SQLITE3_LIBS]) AC_SUBST([LIBLASTLOG2_VERSION]) +AC_SUBST([LIBLASTLOG2_MAJOR_VERSION], $PACKAGE_VERSION_MAJOR) +AC_SUBST([LIBLASTLOG2_MINOR_VERSION], $PACKAGE_VERSION_MINOR) +AC_SUBST([LIBLASTLOG2_PATCH_VERSION], $PACKAGE_VERSION_RELEASE) AC_SUBST([LIBLASTLOG2_VERSION_INFO]) AM_CONDITIONAL([BUILD_LIBLASTLOG2], [test "x$build_liblastlog2" = xyes]) AM_CONDITIONAL([BUILD_LIBLASTLOG2_TESTS], [test "x$build_liblastlog2" = xyes && test "x$enable_static" = xyes]) @@ -3124,6 +3127,7 @@ libblkid/src/blkid.h libfdisk/docs/Makefile libfdisk/docs/version.xml libfdisk/src/libfdisk.h +liblastlog2/src/lastlog2.h libmount/docs/Makefile libmount/docs/version.xml libmount/src/libmount.h diff --git a/liblastlog2/meson.build b/liblastlog2/meson.build index 9f0f76c69..d14872a1d 100644 --- a/liblastlog2/meson.build +++ b/liblastlog2/meson.build @@ -1,8 +1,22 @@ cc = meson.get_compiler('c') pkg = import('pkgconfig') -dir_liblastlog2 = include_directories('src') +dir_liblastlog2 = include_directories('.', 'src') + +defs = configuration_data() +defs.set('LIBLASTLOG2_VERSION', pc_version) +defs.set('LIBLASTLOG2_MAJOR_VERSION', pc_version.split('.')[0]) +defs.set('LIBLASTLOG2_MINOR_VERSION', pc_version.split('.')[1]) +defs.set('LIBLASTLOG2_PATCH_VERSION', pc_version.split('.')[2]) + +configure_file( + input : 'src/lastlog2.h.in', + output : 'lastlog2.h', + configuration : defs, + install : build_liblastlog2, + install_dir : get_option('includedir') / 'liblastlog2', +) + lib_lastlog2_sources = ''' - src/lastlog2.h src/lastlog2P.h src/lastlog2.c '''.split() @@ -45,8 +59,6 @@ if build_liblastlog2 ) meson.override_dependency('lastlog2', lastlog2_dep) - install_headers('src/lastlog2.h', subdir : 'liblastlog2') - foreach lastlog2_test: lastlog2_tests test_name = 'test_lastlog2_' + lastlog2_test exe = executable( diff --git a/liblastlog2/src/.gitignore b/liblastlog2/src/.gitignore new file mode 100644 index 000000000..0ef02ac38 --- /dev/null +++ b/liblastlog2/src/.gitignore @@ -0,0 +1 @@ +lastlog2.h diff --git a/liblastlog2/src/Makemodule.am b/liblastlog2/src/Makemodule.am index 04b8e9745..6ec3b7d62 100644 --- a/liblastlog2/src/Makemodule.am +++ b/liblastlog2/src/Makemodule.am @@ -1,6 +1,6 @@ -# includes +# lastlog2.h is generated, so it's stored in builddir! lastlog2incdir = $(includedir)/liblastlog2 -lastlog2inc_HEADERS = liblastlog2/src/lastlog2.h +nodist_lastlog2inc_HEADERS = liblastlog2/src/lastlog2.h usrlib_exec_LTLIBRARIES += liblastlog2.la diff --git a/liblastlog2/src/lastlog2.h b/liblastlog2/src/lastlog2.h.in similarity index 93% rename from liblastlog2/src/lastlog2.h rename to liblastlog2/src/lastlog2.h.in index 280f387d6..bc8ce23ee 100644 --- a/liblastlog2/src/lastlog2.h +++ b/liblastlog2/src/lastlog2.h.in @@ -32,6 +32,11 @@ extern "C" { #endif +#define LIBLASTLOG2_VERSION "@LIBLASTLOG2_VERSION@" +#define LIBLASTLOG2_MAJOR_VERSION @LIBLASTLOG2_MAJOR_VERSION@ +#define LIBLASTLOG2_MINOR_VERSION @LIBLASTLOG2_MINOR_VERSION@ +#define LIBLASTLOG2_PATCH_VERSION @LIBLASTLOG2_PATCH_VERSION@ + #define LL2_DEFAULT_DATABASE _PATH_LOCALSTATEDIR "/lib/lastlog/lastlog2.db" #include