2012-02-29 13:30:10 +00:00
|
|
|
{ stdenv, fetchurl
|
|
|
|
, autoconf, automake, libtool, makeWrapper
|
2015-08-26 19:33:29 +01:00
|
|
|
, perl, bison, flex, glibc, gettext, which, rpm, LocaleGettext
|
2013-05-11 19:13:53 +01:00
|
|
|
, bash, pam, TermReadKey, RpcXML, swig, python}:
|
2012-02-29 13:30:10 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
|
|
|
|
name = "apparmor-${version}";
|
2014-11-15 20:19:32 +00:00
|
|
|
version = "2.8.4";
|
2012-02-29 13:30:10 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2013-05-10 06:54:21 +01:00
|
|
|
url = "http://launchpad.net/apparmor/2.8/${version}/+download/${name}.tar.gz";
|
2014-11-15 20:19:32 +00:00
|
|
|
sha256 = "1mki4c44ljmr7dpn55grzn33929kdjx149jx00s80yp1war83jwq";
|
2012-02-29 13:30:10 +00:00
|
|
|
};
|
|
|
|
|
2013-05-10 06:54:21 +01:00
|
|
|
buildInputs = [
|
2015-08-26 19:33:29 +01:00
|
|
|
autoconf automake libtool perl bison flex gettext which rpm
|
2013-05-11 19:13:53 +01:00
|
|
|
LocaleGettext pam TermReadKey RpcXML swig makeWrapper python ];
|
2012-02-29 13:30:10 +00:00
|
|
|
|
|
|
|
prePatch = ''
|
|
|
|
substituteInPlace libraries/libapparmor/src/Makefile.in --replace "/usr/include" "${glibc}/include"
|
|
|
|
substituteInPlace libraries/libapparmor/src/Makefile.am --replace "/usr/include" "${glibc}/include"
|
|
|
|
substituteInPlace common/Make.rules --replace "/usr/bin/pod2man" "${perl}/bin/pod2man"
|
|
|
|
substituteInPlace common/Make.rules --replace "/usr/bin/pod2html" "${perl}/bin/pod2html"
|
2013-05-11 06:43:25 +01:00
|
|
|
substituteInPlace common/Make.rules --replace "cpp -dM" "cpp -dM -I${glibc}/include"
|
2012-02-29 13:30:10 +00:00
|
|
|
|
|
|
|
substituteInPlace parser/Makefile --replace "/usr/bin/bison" "${bison}/bin/bison"
|
|
|
|
substituteInPlace parser/Makefile --replace "/usr/bin/flex" "${flex}/bin/flex"
|
|
|
|
substituteInPlace parser/Makefile --replace "/usr/include/bits/socket.h" "${glibc}/include/bits/socket.h"
|
|
|
|
substituteInPlace parser/Makefile --replace "/usr/include/linux/capability.h" "${glibc}/include/linux/capability.h"
|
2013-05-11 06:43:25 +01:00
|
|
|
#substituteInPlace parser/utils/vim/Makefile --replace "/usr/include/linux/capability.h" "${glibc}/include/linux/capability.h"
|
2012-02-29 13:30:10 +00:00
|
|
|
|
2013-05-10 06:54:21 +01:00
|
|
|
# for some reason pdf documentation doesn't build
|
|
|
|
substituteInPlace parser/Makefile --replace "manpages htmlmanpages pdf" "manpages htmlmanpages"
|
|
|
|
|
2012-02-29 13:30:10 +00:00
|
|
|
substituteInPlace parser/tst/gen-xtrans.pl --replace "/usr/bin/perl" "${perl}/bin/perl"
|
|
|
|
substituteInPlace parser/tst/Makefile --replace "/usr/bin/prove" "${perl}/bin/prove"
|
|
|
|
substituteInPlace parser/tst/Makefile --replace "./caching.sh" "${bash}/bin/bash ./caching.sh"
|
|
|
|
'';
|
|
|
|
|
2013-05-10 06:54:21 +01:00
|
|
|
patches = ./capability.patch;
|
|
|
|
|
2012-02-29 13:30:10 +00:00
|
|
|
buildPhase =''
|
|
|
|
PERL5LIB=$PERL5LIB:$out/lib/perl5/site_perl:$out/lib
|
|
|
|
|
|
|
|
cd libraries/libapparmor
|
|
|
|
./autogen.sh
|
|
|
|
./configure --prefix=$out --with-perl # see below
|
|
|
|
make
|
|
|
|
make check
|
|
|
|
make install
|
2014-06-30 13:56:10 +01:00
|
|
|
mkdir -p $out/lib/perl5/site_perl/
|
2012-02-29 13:30:10 +00:00
|
|
|
cp swig/perl/LibAppArmor.pm $out/lib/perl5/site_perl/
|
|
|
|
cp swig/perl/LibAppArmor.bs $out/lib/perl5/site_perl/
|
2013-05-11 19:13:53 +01:00
|
|
|
# this is automatically copied elsewhere....
|
2012-02-29 13:30:10 +00:00
|
|
|
|
|
|
|
cd ../../utils
|
|
|
|
make
|
|
|
|
make install DESTDIR=$out BINDIR=$out/bin VENDOR_PERL=/lib/perl5/site_perl
|
|
|
|
|
|
|
|
cd ../parser
|
|
|
|
make
|
|
|
|
make install DESTDIR=$out DISTRO=unknown
|
|
|
|
|
|
|
|
# cd ../changehat/mod_apparmor
|
|
|
|
# make # depends on libapparmor having been built first
|
|
|
|
# make install
|
|
|
|
|
|
|
|
cd ../changehat/pam_apparmor
|
|
|
|
make # depends on libapparmor having been built first
|
|
|
|
make install DESTDIR=$out
|
|
|
|
|
|
|
|
cd ../../profiles
|
2013-05-11 19:13:53 +01:00
|
|
|
LD_LIBRARY_PATH=$out/lib make
|
|
|
|
#LD_LIBRARY_PATH=$out/lib make check # depends on the parser having been built first
|
2012-02-29 13:30:10 +00:00
|
|
|
make install DESTDIR=$out
|
|
|
|
|
2013-05-11 06:43:25 +01:00
|
|
|
cd ..
|
|
|
|
cp -r kernel-patches $out
|
2012-02-29 13:30:10 +00:00
|
|
|
'';
|
2014-12-10 15:08:48 +00:00
|
|
|
|
|
|
|
installPhase = let
|
|
|
|
perlVersion = (builtins.parseDrvName perl.name).version;
|
|
|
|
in ''
|
2012-02-29 13:30:10 +00:00
|
|
|
for i in $out/bin/*; do
|
2014-12-10 15:08:48 +00:00
|
|
|
wrapProgram $i --prefix PERL5LIB : \
|
|
|
|
"$PERL5LIB:$out/lib/perl5/${perlVersion}/${stdenv.system}-thread-multi/"
|
2012-02-29 13:30:10 +00:00
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
homepage = http://apparmor.net/;
|
2013-10-05 15:22:46 +01:00
|
|
|
description = "Linux application security system";
|
2012-02-29 13:30:10 +00:00
|
|
|
license = licenses.gpl2;
|
2014-05-07 23:36:44 +01:00
|
|
|
maintainers = [ maintainers.phreedom maintainers.thoughtpolice ];
|
2012-02-29 13:30:10 +00:00
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|