From dbdc3ee28c535e7ef21d32872bd6c1f2bf0a9ab7 Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Wed, 14 Jan 2026 17:20:25 +0100 Subject: [PATCH] meson: unify pkgconfig files merge all pkgconfig-found libraries into a single one and redirect all existing lib files to the merged variant. the clean separation between libraries is largely fictional anyway because the main config block is in libstore and cannot reasonably be moved out, or because libutil has assumptions built into its behavior that libmain later establishes, or because libexpr messes with global boehmgc configuration. nearly every kind of layering violation imaginable can be found *some*where in lix, and not pretending that this is not the case will let us clean up some of them. this will also allow us to merge these libraries at the meson level which is itself necessary to make rust code easier to integrate. Change-Id: I172f8a08d5d90ded0a0a99fd9e0fa5d804db00a7 --- lix/libcmd/lix-cmd.pc.in | 4 +--- lix/libcmd/meson.build | 16 ------------- lix/libexpr/lix-expr.pc.in | 4 +--- lix/libexpr/meson.build | 17 ------------- lix/libfetchers/lix-fetchers.pc.in | 3 +-- lix/libfetchers/meson.build | 16 ------------- lix/libmain/lix-main.pc.in | 4 +--- lix/libmain/meson.build | 15 ------------ lix/libstore/lix-store.pc.in | 4 +--- lix/libstore/meson.build | 17 ------------- lix/libutil/lix-util.pc.in | 5 +--- lix/libutil/meson.build | 16 ------------- lix/lix.pc.in | 12 ++++++++++ lix/meson.build | 29 +++++++++++++++++++++++ meson.build | 26 +++++++++++--------- subprojects/nix-eval-jobs/meson.build | 6 +---- subprojects/nix-eval-jobs/src/meson.build | 6 +---- 17 files changed, 64 insertions(+), 136 deletions(-) create mode 100644 lix/lix.pc.in diff --git a/lix/libcmd/lix-cmd.pc.in b/lix/libcmd/lix-cmd.pc.in index 30b3ca0a8..96bd3c2ff 100644 --- a/lix/libcmd/lix-cmd.pc.in +++ b/lix/libcmd/lix-cmd.pc.in @@ -5,6 +5,4 @@ includedir=@includedir@ Name: Lix (libcmd) Description: Lix Package Manager (libcmd) Version: @PACKAGE_VERSION@ -Requires: lix-base lix-util lix-store -Requires.private: lix-fetchers lix-expr lix-main @BOEHM_IF_FOUND@ libeditline lowdown ncurses -Libs: -L${libdir} -llixcmd +Requires: lix diff --git a/lix/libcmd/meson.build b/lix/libcmd/meson.build index 93713b41b..3ba822fcd 100644 --- a/lix/libcmd/meson.build +++ b/lix/libcmd/meson.build @@ -73,19 +73,3 @@ liblixcmd = declare_dependency( ], link_with : libcmd, ) -meson.override_dependency('lix-cmd', liblixcmd) - -# FIXME: not using the pkg-config module because it creates way too many deps -# while meson migration is in progress, and we want to not include boost here -configure_file( - input : 'lix-cmd.pc.in', - output : 'lix-cmd.pc', - install_dir : libdir / 'pkgconfig', - configuration : { - 'prefix' : prefix, - 'libdir' : libdir, - 'includedir' : includedir, - 'PACKAGE_VERSION' : meson.project_version(), - 'BOEHM_IF_FOUND' : boehm.found() ? 'bdw-gc' : '', - }, -) diff --git a/lix/libexpr/lix-expr.pc.in b/lix/libexpr/lix-expr.pc.in index ea71ea43d..a917a04f7 100644 --- a/lix/libexpr/lix-expr.pc.in +++ b/lix/libexpr/lix-expr.pc.in @@ -5,6 +5,4 @@ includedir=@includedir@ Name: Lix libexpr Description: Lix Package Manager (libexpr) Version: @PACKAGE_VERSION@ -# dependencies on boost is omitted since it is optional (only required by some headers) -Requires: lix-base lix-util lix-store lix-fetchers @BOEHM_IF_FOUND@ -Libs: -L${libdir} -llixexpr +Requires: lix diff --git a/lix/libexpr/meson.build b/lix/libexpr/meson.build index 4659cbbcf..f9fa057be 100644 --- a/lix/libexpr/meson.build +++ b/lix/libexpr/meson.build @@ -349,20 +349,3 @@ liblixexpr = declare_dependency( ], link_with : libexpr, ) - -meson.override_dependency('lix-expr', liblixexpr) - -# FIXME: not using the pkg-config module because it creates way too many deps -# while meson migration is in progress, and we want to not include boost here -configure_file( - input : 'lix-expr.pc.in', - output : 'lix-expr.pc', - install_dir : libdir / 'pkgconfig', - configuration : { - 'prefix' : prefix, - 'libdir' : libdir, - 'includedir' : includedir, - 'PACKAGE_VERSION' : meson.project_version(), - 'BOEHM_IF_FOUND' : boehm.found() ? 'bdw-gc' : '', - }, -) diff --git a/lix/libfetchers/lix-fetchers.pc.in b/lix/libfetchers/lix-fetchers.pc.in index 513b1c0d5..7d9a22e8d 100644 --- a/lix/libfetchers/lix-fetchers.pc.in +++ b/lix/libfetchers/lix-fetchers.pc.in @@ -5,5 +5,4 @@ includedir=@includedir@ Name: Lix libfetchers Description: Lix Package Manager (libfetchers) Version: @PACKAGE_VERSION@ -Requires: lix-base lix-util lix-store -Libs: -L${libdir} -llixfetchers +Requires: lix diff --git a/lix/libfetchers/meson.build b/lix/libfetchers/meson.build index 48ced31e2..d6067c091 100644 --- a/lix/libfetchers/meson.build +++ b/lix/libfetchers/meson.build @@ -92,20 +92,6 @@ endif install_headers(libfetchers_headers, subdir : 'lix/libfetchers', preserve_path : true) -# FIXME: not using the pkg-config module because it creates way too many deps -# while meson migration is in progress, and we want to not include boost here -configure_file( - input : 'lix-fetchers.pc.in', - output : 'lix-fetchers.pc', - install_dir : libdir / 'pkgconfig', - configuration : { - 'prefix' : prefix, - 'libdir' : libdir, - 'includedir' : includedir, - 'PACKAGE_VERSION' : meson.project_version(), - }, -) - liblixfetchers = declare_dependency( include_directories : include_directories('../..'), sources : libfetchers_settings_header, @@ -116,5 +102,3 @@ liblixfetchers = declare_dependency( ], link_with : libfetchers, ) - -meson.override_dependency('lix-fetchers', liblixfetchers) diff --git a/lix/libmain/lix-main.pc.in b/lix/libmain/lix-main.pc.in index 3478263a3..6c2ab68df 100644 --- a/lix/libmain/lix-main.pc.in +++ b/lix/libmain/lix-main.pc.in @@ -5,6 +5,4 @@ includedir=@includedir@ Name: Lix libmain Description: Lix Package Manager (libmain) Version: @PACKAGE_VERSION@ -Requires: lix-base lix-util -Requires.private: lix-store -Libs: -L${libdir} -llixmain +Requires: lix diff --git a/lix/libmain/meson.build b/lix/libmain/meson.build index c256ab2fe..8d64ac9a9 100644 --- a/lix/libmain/meson.build +++ b/lix/libmain/meson.build @@ -41,18 +41,3 @@ liblixmain = declare_dependency( ], link_with : libmain, ) -meson.override_dependency('lix-main', liblixmain) - -# FIXME: not using the pkg-config module because it creates way too many deps -# while meson migration is in progress, and we want to not include boost here -configure_file( - input : 'lix-main.pc.in', - output : 'lix-main.pc', - install_dir : libdir / 'pkgconfig', - configuration : { - 'prefix' : prefix, - 'libdir' : libdir, - 'includedir' : includedir, - 'PACKAGE_VERSION' : meson.project_version(), - }, -) diff --git a/lix/libstore/lix-store.pc.in b/lix/libstore/lix-store.pc.in index a039dba3b..bd25a915f 100644 --- a/lix/libstore/lix-store.pc.in +++ b/lix/libstore/lix-store.pc.in @@ -5,6 +5,4 @@ includedir=@includedir@ Name: Lix libstore Description: Lix Package Manager (libstore) Version: @PACKAGE_VERSION@ -Requires: lix-base lix-util -Requires.private: @AWS_SDK_IF_FOUND@ capnp-rpc libcrypto libcurl libarchive libseccomp sqlite3 -Libs: -L${libdir} -llixstore +Requires: lix diff --git a/lix/libstore/meson.build b/lix/libstore/meson.build index 8fefda253..71c9caa99 100644 --- a/lix/libstore/meson.build +++ b/lix/libstore/meson.build @@ -404,20 +404,3 @@ liblixstore = declare_dependency( ], link_with : libstore, ) - -meson.override_dependency('lix-store', liblixstore) - -# FIXME: not using the pkg-config module because it creates way too many deps -# while meson migration is in progress, and we want to not include boost here -configure_file( - input : 'lix-store.pc.in', - output : 'lix-store.pc', - install_dir : libdir / 'pkgconfig', - configuration : { - 'prefix' : prefix, - 'libdir' : libdir, - 'includedir' : includedir, - 'PACKAGE_VERSION' : meson.project_version(), - 'AWS_SDK_IF_FOUND' : aws_sdk.found() ? 'aws-cpp-sdk-core aws-cpp-sdk-s3 aws-cpp-sdk-transfer' : '', - }, -) diff --git a/lix/libutil/lix-util.pc.in b/lix/libutil/lix-util.pc.in index 4b392f47d..df5cba9fe 100644 --- a/lix/libutil/lix-util.pc.in +++ b/lix/libutil/lix-util.pc.in @@ -5,7 +5,4 @@ includedir=@includedir@ Name: Lix libutil Description: Lix Package Manager (libutil) Version: @PACKAGE_VERSION@ -# dependencies on boost, libarchive, nlohmann_json are omitted since they are optional (only required by some headers) -Requires: lix-base -Requires.private: libbrotlidec libbrotlienc libcpuid libarchive libcrypto -Libs: -L${libdir} -llixutil +Requires: lix diff --git a/lix/libutil/meson.build b/lix/libutil/meson.build index ee2b6991a..8decfa44c 100644 --- a/lix/libutil/meson.build +++ b/lix/libutil/meson.build @@ -399,20 +399,6 @@ endif install_headers(libutil_headers, subdir : 'lix/libutil', preserve_path : true) -# FIXME: not using the pkg-config module because it creates way too many deps -# while meson migration is in progress, and we want to not include boost here -configure_file( - input : 'lix-util.pc.in', - output : 'lix-util.pc', - install_dir : libdir / 'pkgconfig', - configuration : { - 'prefix' : prefix, - 'libdir' : libdir, - 'includedir' : includedir, - 'PACKAGE_VERSION' : meson.project_version(), - }, -) - # Used by libstore and libfetchers. liblixutil = declare_dependency( include_directories : include_directories('../..'), @@ -436,5 +422,3 @@ liblixutil = declare_dependency( ], link_with : libutil ) - -meson.override_dependency('lix-util', liblixutil) diff --git a/lix/lix.pc.in b/lix/lix.pc.in new file mode 100644 index 000000000..be89d6dc7 --- /dev/null +++ b/lix/lix.pc.in @@ -0,0 +1,12 @@ +prefix=@prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: Lix libraries +Description: Lix Package Manager (libraries) +Version: @PACKAGE_VERSION@ +# dependencies on boost, libarchive, nlohmann_json are omitted since they are optional (only required by some headers) +Requires: lix-base kj-async @BOEHM_IF_FOUND@ +Requires.private: @AWS_SDK_IF_FOUND@ @BOEHM_IF_FOUND@ libeditline lowdown ncurses libbrotlidec libbrotlienc libcpuid libarchive libcrypto capnp-rpc libcurl libseccomp sqlite3 +Cflags: -I${includedir} +Libs: -L${libdir} -lrust_monocrate -llixutil -llixstore -llixfetchers -llixexpr -llixmain -llixcmd diff --git a/lix/meson.build b/lix/meson.build index 81f502f1d..9db97b414 100644 --- a/lix/meson.build +++ b/lix/meson.build @@ -147,6 +147,35 @@ subdir('libmain') # libcmd depends on everything subdir('libcmd') +# FIXME: not using the pkg-config module because it creates way too many deps +# while meson migration is in progress, and we want to not include boost here +foreach lib : [ 'util', 'store', 'fetchers', 'expr', 'main', 'cmd' ] + configure_file( + input : f'lib@lib@/lix-@lib@.pc.in', + output : f'lix-@lib@.pc', + install_dir : libdir / 'pkgconfig', + configuration : { + 'prefix' : prefix, + 'libdir' : libdir, + 'includedir' : includedir, + 'PACKAGE_VERSION' : meson.project_version(), + }, + ) +endforeach + +liblix = declare_dependency( + dependencies : [ + liblixutil, + liblixstore, + liblixfetchers, + liblixexpr, + liblixmain, + liblixcmd, + ], +) + +meson.override_dependency('lix', liblix) + # The rest of the subdirectories aren't separate components, # just source files in another directory, so we process them here. diff --git a/meson.build b/meson.build index 523bcd542..34ff02349 100644 --- a/meson.build +++ b/meson.build @@ -591,17 +591,21 @@ endforeach # FIXME: not using the pkg-config module because it creates way too many deps # while meson migration is in progress, and we want to not include boost here -configure_file( - input : 'lix/lix-base.pc.in', - output : 'lix-base.pc', - install_dir : libdir / 'pkgconfig', - configuration : { - 'prefix' : prefix, - 'libdir' : libdir, - 'includedir' : includedir, - 'PACKAGE_VERSION' : meson.project_version(), - }, -) +foreach pkgconf : [ 'lix-base.pc', 'lix.pc' ] + configure_file( + input : f'lix/@pkgconf@.in', + output : pkgconf, + install_dir : libdir / 'pkgconfig', + configuration : { + 'prefix' : prefix, + 'libdir' : libdir, + 'includedir' : includedir, + 'PACKAGE_VERSION' : meson.project_version(), + 'AWS_SDK_IF_FOUND' : aws_sdk.found() ? 'aws-cpp-sdk-core aws-cpp-sdk-s3 aws-cpp-sdk-transfer' : '', + 'BOEHM_IF_FOUND' : boehm.found() ? 'bdw-gc' : '', + }, + ) +endforeach add_project_arguments( # TODO(Qyriad): Yes this is how the autoconf+Make system did it. diff --git a/subprojects/nix-eval-jobs/meson.build b/subprojects/nix-eval-jobs/meson.build index 873279dc1..1ce51df21 100644 --- a/subprojects/nix-eval-jobs/meson.build +++ b/subprojects/nix-eval-jobs/meson.build @@ -8,11 +8,7 @@ project('nix-eval-jobs', 'cpp', ], ) -nix_main_dep = dependency('lix-main', required: true) -nix_store_dep = dependency('lix-store', required: true) -nix_expr_dep = dependency('lix-expr', required: true) -nix_cmd_dep = dependency('lix-cmd', required: true) -nix_util_dep = dependency('lix-util', required: true) +lix_dep = dependency('lix', required: true) threads_dep = dependency('threads', required: true) nlohmann_json_dep = dependency('nlohmann_json', required: true) boost_dep = dependency('boost', required: true) diff --git a/subprojects/nix-eval-jobs/src/meson.build b/subprojects/nix-eval-jobs/src/meson.build index 773d0a7e1..72f7ee8bd 100644 --- a/subprojects/nix-eval-jobs/src/meson.build +++ b/subprojects/nix-eval-jobs/src/meson.build @@ -37,11 +37,7 @@ configure_file( executable('nix-eval-jobs', src, dependencies : [ - nix_util_dep, - nix_main_dep, - nix_store_dep, - nix_expr_dep, - nix_cmd_dep, + lix_dep, boost_dep, nlohmann_json_dep, threads_dep,