at 15.09-beta 49 lines 1.4 kB view raw
1source $stdenv/setup 2 3PERL5LIB="$PERL5LIB${PERL5LIB:+:}$out/lib/perl5/site_perl" 4 5perlFlags= 6for i in $(IFS=:; echo $PERL5LIB); do 7 perlFlags="$perlFlags -I$i" 8done 9 10oldPreConfigure="$preConfigure" 11preConfigure() { 12 13 eval "$oldPreConfigure" 14 15 find . | while read fn; do 16 if test -f "$fn"; then 17 first=$(dd if="$fn" count=2 bs=1 2> /dev/null) 18 if test "$first" = "#!"; then 19 echo "patching $fn..." 20 sed < "$fn" > "$fn".tmp \ 21 -e "s|^#\!\(.*/perl.*\)$|#\! \1$perlFlags|" 22 if test -x "$fn"; then chmod +x "$fn".tmp; fi 23 mv "$fn".tmp "$fn" 24 fi 25 fi 26 done 27 28 perl Makefile.PL PREFIX=$out INSTALLDIRS=site $makeMakerFlags 29} 30 31postFixup() { 32 # If a user installs a Perl package, she probably also wants its 33 # dependencies in the user environment (since Perl modules don't 34 # have something like an RPATH, so the only way to find the 35 # dependencies is to have them in the PERL5LIB variable). 36 if test -e $out/nix-support/propagated-native-build-inputs; then 37 ln -s $out/nix-support/propagated-native-build-inputs $out/nix-support/propagated-user-env-packages 38 fi 39} 40 41if test -n "$perlPreHook"; then 42 eval "$perlPreHook" 43fi 44 45genericBuild 46 47if test -n "$perlPostHook"; then 48 eval "$perlPostHook" 49fi