Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at netboot-syslinux-multiplatform 48 lines 1.3 kB view raw
1if [ -e .attrs.sh ]; then source .attrs.sh; fi 2source $stdenv/setup 3 4# Wrap the given `aclocal' program, appending extra `-I' flags 5# corresponding to the directories listed in $ACLOCAL_PATH. (Note 6# that `wrapProgram' can't be used for that purpose since it can only 7# prepend flags, not append them.) 8wrapAclocal() { 9 local program="$1" 10 local wrapped="$(dirname $program)/.$(basename $program)-wrapped" 11 12 mv "$program" "$wrapped" 13 cat > "$program"<<EOF 14#! $SHELL -e 15 16unset extraFlagsArray 17declare -a extraFlagsArray 18 19oldIFS=\$IFS 20IFS=: 21for dir in \$ACLOCAL_PATH; do 22 if test -n "\$dir" -a -d "\$dir"; then 23 extraFlagsArray=("\${extraFlagsArray[@]}" "-I" "\$dir") 24 fi 25done 26IFS=\$oldIFS 27 28exec "$wrapped" "\$@" "\${extraFlagsArray[@]}" 29EOF 30 chmod +x "$program" 31} 32 33postInstall() { 34 # Create a wrapper around `aclocal' that converts every element in 35 # `ACLOCAL_PATH' into a `-I dir' option. This way `aclocal' 36 # becomes modular; M4 macros do not need to be stored in a single 37 # global directory, while callers of `aclocal' do not need to pass 38 # `-I' options explicitly. 39 40 for prog in $out/bin/aclocal*; do 41 wrapAclocal "$prog" 42 done 43 44 ln -s aclocal-1.11 $out/share/aclocal 45 ln -s automake-1.11 $out/share/automake 46} 47 48genericBuild