Merge pull request #47400 from obsidiansystems/paxctl-darwin-no-mass-rebuild

paxctl: Fix darwin and cross without mass-rebuild
This commit is contained in:
John Ericson 2018-09-26 15:52:31 -04:00 committed by GitHub
commit e59a2ef7eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 3 deletions

View File

@ -1,4 +1,4 @@
{ fetchurl, stdenv }:
{ fetchurl, stdenv, elf-header }:
stdenv.mkDerivation rec {
name = "paxctl-${version}";
@ -9,7 +9,17 @@ stdenv.mkDerivation rec {
sha256 = "0biw882fp1lmgs6kpxznp1v6758r7dg9x8iv5a06k0b82bcdsc53";
};
preBuild = ''
# TODO Always do first way next mass rebuild.
buildInputs = stdenv.lib.optional
(!stdenv.hostPlatform.isLinux || !stdenv.buildPlatform.isLinux)
elf-header;
# TODO Always do first way next mass rebuild.
preBuild = if !stdenv.hostPlatform.isLinux || !stdenv.buildPlatform.isLinux then ''
sed -i Makefile \
-e 's|--owner 0 --group 0||g' \
-e '/CC:=gcc/d'
'' else ''
sed "s|--owner 0 --group 0||g" -i Makefile
'';
@ -24,7 +34,7 @@ stdenv.mkDerivation rec {
description = "A tool for controlling PaX flags on a per binary basis";
homepage = "https://pax.grsecurity.net";
license = licenses.gpl2;
platforms = platforms.linux;
platforms = platforms.all;
maintainers = with maintainers; [ thoughtpolice ];
};
}

View File

@ -53,6 +53,9 @@ in lib.init bootStages ++ [
else buildPackages.gcc;
extraNativeBuildInputs = old.extraNativeBuildInputs
++ lib.optionals
(hostPlatform.isLinux && !buildPlatform.isLinux)
[ buildPackages.patchelf buildPackages.paxctl ]
++ lib.optional
(let f = p: !p.isx86 || p.libc == "musl"; in f hostPlatform && !(f buildPlatform))
buildPackages.updateAutotoolsGnuConfigScriptsHook