diff --git a/doc/manual/rl-next/static-linking.md b/doc/manual/rl-next/static-linking.md new file mode 100644 index 000000000..cec6dde67 --- /dev/null +++ b/doc/manual/rl-next/static-linking.md @@ -0,0 +1,10 @@ +--- +synopsis: "Lix libraries can now be linked statically" +issues: [fj#789] +cls: [3775, 3778] +category: Fixes +credits: [alois31] +--- +Previously the pkg-config files distributed with Lix were only suitable for dynamic linkage, causing "undefined reference to…" linker errors when trying to link statically. +Private dependency information has now been added to make static linkage work as expected without user intervention. +In addition, relevant static libraries are now prelinked to avoid strange failures due to missing static initializers. diff --git a/lix/libcmd/lix-cmd.pc.in b/lix/libcmd/lix-cmd.pc.in index 6b197d4d2..262a5c9d0 100644 --- a/lix/libcmd/lix-cmd.pc.in +++ b/lix/libcmd/lix-cmd.pc.in @@ -5,5 +5,6 @@ includedir=@includedir@ Name: Lix (libcmd) Description: Lix Package Manager (libcmd) Version: @PACKAGE_VERSION@ -Requires: lix-base lix-util -Libs: -L${libdir} -llixcmd +Requires: lix-base lix-util lix-store +Requires.private: lix-fetchers lix-expr lix-main @BOEHM_IF_FOUND@ libeditline lowdown ncurses +Libs: -L${libdir} @LIBLIX_DOC_IF_STATIC@ -llixcmd diff --git a/lix/libcmd/meson.build b/lix/libcmd/meson.build index 1ce9783a4..e76faed89 100644 --- a/lix/libcmd/meson.build +++ b/lix/libcmd/meson.build @@ -93,5 +93,7 @@ configure_file( 'libdir' : libdir, 'includedir' : includedir, 'PACKAGE_VERSION' : meson.project_version(), + 'BOEHM_IF_FOUND' : boehm.found() ? 'bdw-gc' : '', + 'LIBLIX_DOC_IF_STATIC' : is_static ? '-llix_doc' : '', }, ) diff --git a/lix/libexpr/lix-expr.pc.in b/lix/libexpr/lix-expr.pc.in index d4c2911e9..ea71ea43d 100644 --- a/lix/libexpr/lix-expr.pc.in +++ b/lix/libexpr/lix-expr.pc.in @@ -5,5 +5,6 @@ includedir=@includedir@ Name: Lix libexpr Description: Lix Package Manager (libexpr) Version: @PACKAGE_VERSION@ -Requires: lix-base lix-util lix-fetchers lix-store bdw-gc +# 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 diff --git a/lix/libexpr/meson.build b/lix/libexpr/meson.build index 85624abb8..8a5cde12b 100644 --- a/lix/libexpr/meson.build +++ b/lix/libexpr/meson.build @@ -357,5 +357,6 @@ configure_file( '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 a0631bb11..513b1c0d5 100644 --- a/lix/libfetchers/lix-fetchers.pc.in +++ b/lix/libfetchers/lix-fetchers.pc.in @@ -5,5 +5,5 @@ includedir=@includedir@ Name: Lix libfetchers Description: Lix Package Manager (libfetchers) Version: @PACKAGE_VERSION@ -Requires: lix-base lix-util +Requires: lix-base lix-util lix-store Libs: -L${libdir} -llixfetchers diff --git a/lix/libmain/lix-main.pc.in b/lix/libmain/lix-main.pc.in index fb733985e..3478263a3 100644 --- a/lix/libmain/lix-main.pc.in +++ b/lix/libmain/lix-main.pc.in @@ -6,4 +6,5 @@ Name: Lix libmain Description: Lix Package Manager (libmain) Version: @PACKAGE_VERSION@ Requires: lix-base lix-util +Requires.private: lix-store Libs: -L${libdir} -llixmain diff --git a/lix/libstore/lix-store.pc.in b/lix/libstore/lix-store.pc.in index a8c86a230..179c90c7f 100644 --- a/lix/libstore/lix-store.pc.in +++ b/lix/libstore/lix-store.pc.in @@ -6,4 +6,5 @@ Name: Lix libstore Description: Lix Package Manager (libstore) Version: @PACKAGE_VERSION@ Requires: lix-base lix-util -Libs: -L${libdir} -llixstore -llixutil +Requires.private: @AWS_SDK_IF_FOUND@ capnp-rpc libcurl libarchive libseccomp libsodium sqlite3 +Libs: -L${libdir} -llixstore diff --git a/lix/libstore/meson.build b/lix/libstore/meson.build index b092c27ba..e4e65254f 100644 --- a/lix/libstore/meson.build +++ b/lix/libstore/meson.build @@ -469,5 +469,6 @@ configure_file( '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-std-transfer' : '', }, ) diff --git a/lix/libutil/lix-util.pc.in b/lix/libutil/lix-util.pc.in index 9847b7ee5..4b392f47d 100644 --- a/lix/libutil/lix-util.pc.in +++ b/lix/libutil/lix-util.pc.in @@ -5,5 +5,7 @@ includedir=@includedir@ Name: Lix libutil Description: Lix Package Manager (libutil) Version: @PACKAGE_VERSION@ -Requires: lix-base lix-util +# 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