pkgsStatic.libselinux: fix build

+26 -3
+26 -3
pkgs/os-specific/linux/libselinux/default.nix
··· 1 - { lib, stdenv, fetchurl, pcre, pkg-config, libsepol 2 - , enablePython ? true, swig ? null, python3 ? null 3 , fts 4 }: 5 ··· 19 sha256 = "0mvh793g7fg6wb6zqhkdyrv80x6k84ypqwi8ii89c91xcckyxzdc"; 20 }; 21 22 - nativeBuildInputs = [ pkg-config ] ++ optionals enablePython [ swig python3 ]; 23 buildInputs = [ libsepol pcre fts ] ++ optionals enablePython [ python3 ]; 24 25 # drop fortify here since package uses it by default, leading to compile error: ··· 40 41 "LIBSEPOLA=${lib.getLib libsepol}/lib/libsepol.a" 42 "ARCH=${stdenv.hostPlatform.linuxArch}" 43 ] ++ optionals enablePython [ 44 "PYTHON=${python3.pythonForBuild.interpreter}" 45 "PYTHONLIBDIR=$(py)/${python3.sitePackages}"
··· 1 + { lib, stdenv, fetchurl, fetchpatch, buildPackages, pcre, pkg-config, libsepol 2 + , enablePython ? !stdenv.hostPlatform.isStatic, swig ? null, python3 ? null 3 , fts 4 }: 5 ··· 19 sha256 = "0mvh793g7fg6wb6zqhkdyrv80x6k84ypqwi8ii89c91xcckyxzdc"; 20 }; 21 22 + patches = [ 23 + # Make it possible to disable shared builds (for pkgsStatic). 24 + # 25 + # We can't use fetchpatch because it processes includes/excludes 26 + # /after/ stripping the prefix, which wouldn't work here because 27 + # there would be no way to distinguish between 28 + # e.g. libselinux/src/Makefile and libsepol/src/Makefile. 29 + # 30 + # This is a static email, so we shouldn't have to worry about 31 + # normalizing the patch. 32 + (fetchurl { 33 + url = "https://lore.kernel.org/selinux/20211113141616.361640-1-hi@alyssa.is/raw"; 34 + sha256 = "16a2s2ji9049892i15yyqgp4r20hi1hij4c1s4s8law9jsx65b3n"; 35 + postFetch = '' 36 + mv "$out" $TMPDIR/patch 37 + ${buildPackages.patchutils_0_3_3}/bin/filterdiff \ 38 + -i 'a/libselinux/*' --strip 1 <$TMPDIR/patch >"$out" 39 + ''; 40 + }) 41 + ]; 42 + 43 + nativeBuildInputs = [ pkg-config python3 ] ++ optionals enablePython [ swig ]; 44 buildInputs = [ libsepol pcre fts ] ++ optionals enablePython [ python3 ]; 45 46 # drop fortify here since package uses it by default, leading to compile error: ··· 61 62 "LIBSEPOLA=${lib.getLib libsepol}/lib/libsepol.a" 63 "ARCH=${stdenv.hostPlatform.linuxArch}" 64 + ] ++ optionals stdenv.hostPlatform.isStatic [ 65 + "DISABLE_SHARED=y" 66 ] ++ optionals enablePython [ 67 "PYTHON=${python3.pythonForBuild.interpreter}" 68 "PYTHONLIBDIR=$(py)/${python3.sitePackages}"