apparmor: make apparmor cross-compile

This commit is contained in:
Ding Xiang Fei 2019-06-29 19:17:21 +08:00
parent d3157cbede
commit 63fcc2a0a9
2 changed files with 23 additions and 2 deletions

View file

@ -0,0 +1,19 @@
--- a/parser/libapparmor_re/Makefile 2018-10-14 07:38:06.000000000 +0800
+++ b/parser/libapparmor_re/Makefile 2019-06-28 16:16:33.741916660 +0800
@@ -10,6 +10,7 @@
TARGET=libapparmor_re.a
+AR ?= ar
CFLAGS ?= -g -Wall -O2 ${EXTRA_CFLAGS} -std=gnu++0x
CXXFLAGS := ${CFLAGS} ${INCLUDE_APPARMOR}
@@ -22,7 +23,7 @@
UNITTESTS = tst_parse
libapparmor_re.a: parse.o expr-tree.o hfa.o chfa.o aare_rules.o
- ar ${ARFLAGS} $@ $^
+ ${AR} ${ARFLAGS} $@ $^
expr-tree.o: expr-tree.cc expr-tree.h

View file

@ -49,7 +49,9 @@ let
sha256 = "1m4dx901biqgnr4w4wz8a2z9r9dxyw7wv6m6mqglqwf2lxinqmp4";
})
# (alpine patches {1,4,5,6,8} are needed for apparmor 2.11, but not 2.12)
];
] ++ [
./cross.patch
];
# Set to `true` after the next FIXME gets fixed or this gets some
# common derivation infra. Too much copy-paste to fix one by one.
@ -185,7 +187,7 @@ let
'';
inherit patches;
postPatch = "cd ./parser";
makeFlags = ''LANGS= USE_SYSTEM=1 INCLUDEDIR=${libapparmor}/include'';
makeFlags = ''LANGS= USE_SYSTEM=1 INCLUDEDIR=${libapparmor}/include AR=${stdenv.cc.bintools.targetPrefix}ar'';
installFlags = ''DESTDIR=$(out) DISTRO=unknown'';
inherit doCheck;