summary refs log tree commit diff
path: root/pkgs/development/tools/misc/automake/builder.sh
blob: 0f5e955f8806694efeb6348b8048d85bb3dede57 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
source $stdenv/setup


postInstall() {

    # Create a wrapper around `aclocal' that converts every element in
    # `ACLOCAL_PATH' into a `-I dir' option.  This way `aclocal'
    # becomes modular; M4 macros do not need to be stored in a single
    # global directory, while callers of `aclocal' do not need to pass
    # `-I' options explicitly.

    mv $out/bin/aclocal $out/bin/_tmp

    for i in $out/bin/aclocal*; do
        rm $i
        ln -s aclocal $i
    done

    cat > $out/bin/aclocal <<EOF
#! $SHELL -e

oldIFS=\$IFS
IFS=:
extra=
for i in \$ACLOCAL_PATH; do
    if test -n "\$i"; then
        extra="\$extra -I \$i"
    fi
done
IFS=\$oldIFS

exec $out/bin/aclocal-orig \${extra[@]} "\$@"
EOF
    chmod +x $out/bin/aclocal
    mv $out/bin/_tmp $out/bin/aclocal-orig


    # Automatically let `ACLOCAL_PATH' include all build inputs that
    # have a `.../share/aclocal' directory.
    test -x $out/nix-support || mkdir $out/nix-support
    cp -p $setupHook $out/nix-support/setup-hook

}
postInstall=postInstall


genericBuild