at 15.09-beta 98 lines 3.7 kB view raw
1{ stdenv, fetchurl 2, autoconf, automake, libtool, makeWrapper 3, perl, bison, flex, glibc, gettext, which, rpm, LocaleGettext 4, bash, pam, TermReadKey, RpcXML, swig, python}: 5stdenv.mkDerivation rec { 6 7 name = "apparmor-${version}"; 8 version = "2.8.4"; 9 10 src = fetchurl { 11 url = "http://launchpad.net/apparmor/2.8/${version}/+download/${name}.tar.gz"; 12 sha256 = "1mki4c44ljmr7dpn55grzn33929kdjx149jx00s80yp1war83jwq"; 13 }; 14 15 buildInputs = [ 16 autoconf automake libtool perl bison flex gettext which rpm 17 LocaleGettext pam TermReadKey RpcXML swig makeWrapper python ]; 18 19 prePatch = '' 20 substituteInPlace libraries/libapparmor/src/Makefile.in --replace "/usr/include" "${glibc}/include" 21 substituteInPlace libraries/libapparmor/src/Makefile.am --replace "/usr/include" "${glibc}/include" 22 substituteInPlace common/Make.rules --replace "/usr/bin/pod2man" "${perl}/bin/pod2man" 23 substituteInPlace common/Make.rules --replace "/usr/bin/pod2html" "${perl}/bin/pod2html" 24 substituteInPlace common/Make.rules --replace "cpp -dM" "cpp -dM -I${glibc}/include" 25 26 substituteInPlace parser/Makefile --replace "/usr/bin/bison" "${bison}/bin/bison" 27 substituteInPlace parser/Makefile --replace "/usr/bin/flex" "${flex}/bin/flex" 28 substituteInPlace parser/Makefile --replace "/usr/include/bits/socket.h" "${glibc}/include/bits/socket.h" 29 substituteInPlace parser/Makefile --replace "/usr/include/linux/capability.h" "${glibc}/include/linux/capability.h" 30 #substituteInPlace parser/utils/vim/Makefile --replace "/usr/include/linux/capability.h" "${glibc}/include/linux/capability.h" 31 32 # for some reason pdf documentation doesn't build 33 substituteInPlace parser/Makefile --replace "manpages htmlmanpages pdf" "manpages htmlmanpages" 34 35 substituteInPlace parser/tst/gen-xtrans.pl --replace "/usr/bin/perl" "${perl}/bin/perl" 36 substituteInPlace parser/tst/Makefile --replace "/usr/bin/prove" "${perl}/bin/prove" 37 substituteInPlace parser/tst/Makefile --replace "./caching.sh" "${bash}/bin/bash ./caching.sh" 38 ''; 39 40 patches = ./capability.patch; 41 42 buildPhase ='' 43 PERL5LIB=$PERL5LIB:$out/lib/perl5/site_perl:$out/lib 44 45 cd libraries/libapparmor 46 ./autogen.sh 47 ./configure --prefix=$out --with-perl # see below 48 make 49 make check 50 make install 51 mkdir -p $out/lib/perl5/site_perl/ 52 cp swig/perl/LibAppArmor.pm $out/lib/perl5/site_perl/ 53 cp swig/perl/LibAppArmor.bs $out/lib/perl5/site_perl/ 54 # this is automatically copied elsewhere.... 55 56 cd ../../utils 57 make 58 make install DESTDIR=$out BINDIR=$out/bin VENDOR_PERL=/lib/perl5/site_perl 59 60 cd ../parser 61 make 62 make install DESTDIR=$out DISTRO=unknown 63 64# cd ../changehat/mod_apparmor 65# make # depends on libapparmor having been built first 66# make install 67 68 cd ../changehat/pam_apparmor 69 make # depends on libapparmor having been built first 70 make install DESTDIR=$out 71 72 cd ../../profiles 73 LD_LIBRARY_PATH=$out/lib make 74 #LD_LIBRARY_PATH=$out/lib make check # depends on the parser having been built first 75 make install DESTDIR=$out 76 77 cd .. 78 cp -r kernel-patches $out 79 ''; 80 81 installPhase = let 82 perlVersion = (builtins.parseDrvName perl.name).version; 83 in '' 84 for i in $out/bin/*; do 85 wrapProgram $i --prefix PERL5LIB : \ 86 "$PERL5LIB:$out/lib/perl5/${perlVersion}/${stdenv.system}-thread-multi/" 87 done 88 ''; 89 90 meta = with stdenv.lib; { 91 homepage = http://apparmor.net/; 92 description = "Linux application security system"; 93 license = licenses.gpl2; 94 maintainers = [ maintainers.phreedom maintainers.thoughtpolice ]; 95 platforms = platforms.linux; 96 }; 97} 98