summary refs log tree commit diff
path: root/pkgs/development/tools/misc/automake
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2011-07-07 15:10:40 +0000
committerLudovic Courtès <ludo@gnu.org>2011-07-07 15:10:40 +0000
commit4d7d10da6b196c43aaa4eb0e79202560395a4c12 (patch)
tree881bda286e4cde9edcd417d6b57b8e896fcf2ed4 /pkgs/development/tools/misc/automake
parent9cbb1dbec69fe0995fd1dcd32994e1dfdc153e65 (diff)
downloadnixpkgs-4d7d10da6b196c43aaa4eb0e79202560395a4c12.tar
nixpkgs-4d7d10da6b196c43aaa4eb0e79202560395a4c12.tar.gz
nixpkgs-4d7d10da6b196c43aaa4eb0e79202560395a4c12.tar.bz2
nixpkgs-4d7d10da6b196c43aaa4eb0e79202560395a4c12.tar.lz
nixpkgs-4d7d10da6b196c43aaa4eb0e79202560395a4c12.tar.xz
nixpkgs-4d7d10da6b196c43aaa4eb0e79202560395a4c12.tar.zst
nixpkgs-4d7d10da6b196c43aaa4eb0e79202560395a4c12.zip
GNU Automake: Append `-I' flags stemming from $ACLOCAL_PATH instead of prepending them.
See <http://lists.gnu.org/archive/html/bug-gnulib/2011-07/msg00100.html>
for an illustration of the bug.

svn path=/nixpkgs/trunk/; revision=27622
Diffstat (limited to 'pkgs/development/tools/misc/automake')
-rw-r--r--pkgs/development/tools/misc/automake/builder.sh39
1 files changed, 29 insertions, 10 deletions
diff --git a/pkgs/development/tools/misc/automake/builder.sh b/pkgs/development/tools/misc/automake/builder.sh
index 6b0cd7e4fa2..7f9e9219de3 100644
--- a/pkgs/development/tools/misc/automake/builder.sh
+++ b/pkgs/development/tools/misc/automake/builder.sh
@@ -1,5 +1,33 @@
 source $stdenv/setup
 
+# Wrap the given `aclocal' program, appending extra `-I' flags
+# corresponding to the directories listed in $ACLOCAL_PATH.  (Note
+# that `wrapProgram' can't be used for that purpose since it can only
+# prepend flags, not append them.)
+wrapAclocal() {
+    local program="$1"
+    local wrapped="$(dirname $program)/.$(basename $program)-wrapped"
+
+    mv "$program" "$wrapped"
+    cat > "$program"<<EOF
+#! $SHELL -e
+
+unset extraFlagsArray
+declare -a extraFlagsArray
+
+oldIFS=\$IFS
+IFS=:
+for dir in \$ACLOCAL_PATH; do
+    if test -n "\$dir" -a -d "\$dir"; then
+        extraFlagsArray=("\${extraFlagsArray[@]}" "-I" "\$dir")
+    fi
+done
+IFS=\$oldIFS
+
+exec "$wrapped" "\$@" "\${extraFlagsArray[@]}"
+EOF
+    chmod +x "$program"
+}
 
 postInstall() {
     # Create a wrapper around `aclocal' that converts every element in
@@ -9,16 +37,7 @@ postInstall() {
     # `-I' options explicitly.
 
     for prog in $out/bin/aclocal*; do 
-        wrapProgram $prog --run \
-            '
-oldIFS=$IFS
-IFS=:
-for dir in $ACLOCAL_PATH; do
-    if test -n "$dir" -a -d "$dir"; then
-        extraFlagsArray=("${extraFlagsArray[@]}" "-I" "$dir")
-    fi
-done
-IFS=$oldIFS'
+        wrapAclocal "$prog"
     done
 }