1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 02:21:16 +02:00

packaging: Add mkMeson{Library,Executable}

and:
- move pkg-config out of mkMesonDerivation, for components that don't
  produce any executable code
This commit is contained in:
Robert Hensing 2024-10-13 23:17:54 +02:00
parent e10ff893e5
commit 15e3e1543b
23 changed files with 73 additions and 151 deletions

View file

@ -69,10 +69,23 @@ let
nativeBuildInputs = [
pkgs.buildPackages.meson
pkgs.buildPackages.ninja
pkgs.buildPackages.pkg-config
] ++ prevAttrs.nativeBuildInputs or [];
};
mesonBuildLayer = finalAttrs: prevAttrs:
{
nativeBuildInputs = prevAttrs.nativeBuildInputs or [] ++ [
pkgs.buildPackages.pkg-config
];
separateDebugInfo = !stdenv.hostPlatform.isStatic;
hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie";
};
mesonLibraryLayer = finalAttrs: prevAttrs:
{
outputs = prevAttrs.outputs or [ "out" ] ++ [ "dev" ];
};
# Work around weird `--as-needed` linker behavior with BSD, see
# https://github.com/mesonbuild/meson/issues/3593
bsdNoLinkAsNeeded = finalAttrs: prevAttrs:
@ -188,8 +201,24 @@ scope: {
mkMesonDerivation =
mkPackageBuilder [
miscGoodPractice
bsdNoLinkAsNeeded
localSourceLayer
mesonLayer
];
mkMesonExecutable =
mkPackageBuilder [
miscGoodPractice
bsdNoLinkAsNeeded
localSourceLayer
mesonLayer
mesonBuildLayer
];
mkMesonLibrary =
mkPackageBuilder [
miscGoodPractice
bsdNoLinkAsNeeded
localSourceLayer
mesonLayer
mesonBuildLayer
mesonLibraryLayer
];
}