package: fix derivation correctness when static

Change-Id: I394bb72d9f378cd78acc6cf67a9bb15e342d57c4
This commit is contained in:
Qyriad 2024-05-29 20:11:12 -06:00 committed by jade
parent eac3546d50
commit 2760818f06

View file

@ -201,7 +201,7 @@ stdenv.mkDerivation (finalAttrs: {
# so we must explicitly enable or disable features that we are not passing
# dependencies for.
(lib.mesonEnable "internal-api-docs" internalApiDocs)
(lib.mesonBool "enable-tests" finalAttrs.doCheck)
(lib.mesonBool "enable-tests" finalAttrs.finalPackage.doCheck)
(lib.mesonBool "enable-docs" canRunInstalled)
]
++ lib.optional (hostPlatform != buildPlatform) "--cross-file=${mesonCrossFile}";
@ -286,7 +286,7 @@ stdenv.mkDerivation (finalAttrs: {
cp -pd ${boost}/lib/{libboost_context*,libboost_thread*,libboost_system*} $out/lib
rm -f $out/lib/*.a
''
+ lib.optionalString (!finalAttrs.dontBuild && hostPlatform.isLinux) ''
+ lib.optionalString (!finalAttrs.dontBuild && hostPlatform.isLinux && !hostPlatform.isStatic) ''
chmod u+w $out/lib/*.so.*
patchelf --set-rpath $out/lib:${stdenv.cc.cc.lib}/lib $out/lib/libboost_thread.so.*
''
@ -417,11 +417,17 @@ stdenv.mkDerivation (finalAttrs: {
name = "lix-shell-env";
inputsFrom = [ finalAttrs ];
# finalPackage is necessary to propagate stuff that is set by mkDerivation itself,
# like doCheck.
inputsFrom = [ finalAttrs.finalPackage ];
# For Meson to find Boost.
env = finalAttrs.env;
# I guess this is necessary because mesonFlags to mkDerivation doesn't propagate in inputsFrom,
# which only propagates stuff set in hooks? idk.
inherit (finalAttrs) mesonFlags;
packages =
lib.optional (stdenv.cc.isClang && hostPlatform == buildPlatform) clang-tools_llvm
++ [