libapparmor: Fix cross-compilation.

This commit is contained in:
Shea Levy 2018-02-25 09:38:55 -05:00
parent 42c8776571
commit e21300a6ae
No known key found for this signature in database
GPG Key ID: 5C0BD6957D86FE27

View File

@ -8,6 +8,7 @@
, swig , swig
, ncurses , ncurses
, pam , pam
, buildPackages
}: }:
let let
@ -29,8 +30,8 @@ let
}; };
prePatchCommon = '' prePatchCommon = ''
substituteInPlace ./common/Make.rules --replace "/usr/bin/pod2man" "${perl}/bin/pod2man" substituteInPlace ./common/Make.rules --replace "/usr/bin/pod2man" "${buildPackages.perl}/bin/pod2man"
substituteInPlace ./common/Make.rules --replace "/usr/bin/pod2html" "${perl}/bin/pod2html" substituteInPlace ./common/Make.rules --replace "/usr/bin/pod2html" "${buildPackages.perl}/bin/pod2html"
substituteInPlace ./common/Make.rules --replace "/usr/include/linux/capability.h" "${linuxHeaders}/include/linux/capability.h" substituteInPlace ./common/Make.rules --replace "/usr/include/linux/capability.h" "${linuxHeaders}/include/linux/capability.h"
substituteInPlace ./common/Make.rules --replace "/usr/share/man" "share/man" substituteInPlace ./common/Make.rules --replace "/usr/share/man" "share/man"
''; '';
@ -70,9 +71,10 @@ let
swig swig
ncurses ncurses
which which
perl
]; ];
buildInputs = [ buildInputs = stdenv.lib.optionals (!stdenv.isCross) [
perl perl
python python
]; ];
@ -87,11 +89,12 @@ let
inherit patches; inherit patches;
postPatch = "cd ./libraries/libapparmor"; postPatch = "cd ./libraries/libapparmor";
configureFlags = "--with-python --with-perl"; # https://gitlab.com/apparmor/apparmor/issues/1
configureFlags = stdenv.lib.optionalString (!stdenv.isCross) "--with-python --with-perl";
outputs = [ "out" "python" ]; outputs = if stdenv.isCross then [ "out" ] else [ "out" "python" ];
postInstall = '' postInstall = stdenv.lib.optionalString (!stdenv.isCross) ''
mkdir -p $python/lib mkdir -p $python/lib
mv $out/lib/python* $python/lib/ mv $out/lib/python* $python/lib/
''; '';