build: Support $DESTDIR.
authorJan Nieuwenhuizen <janneke@gnu.org>
Fri, 29 Jun 2018 18:38:11 +0000 (20:38 +0200)
committerJan Nieuwenhuizen <janneke@gnu.org>
Thu, 12 Jul 2018 20:29:59 +0000 (22:29 +0200)
* build-aux/export.make: export DESTDIR.
* install.sh: Support $DESTDIR.

build-aux/export.make
install.sh

index 065819f4d9073360246685e206815ec64504c188..b0c93c697338fd4d50e8141618e55aee8860c841 100644 (file)
@@ -1,3 +1,7 @@
+ifdef DESTDIR
+export DESTDIR
+endif
+
 ifdef PREFIX
 export PREFIX
 endif
index c34c7f84d36d551fd04f6516eb9bbbbb1239020c..224d35632bff3b7dcf9ef529760cefb6a6623218 100755 (executable)
@@ -13,15 +13,15 @@ MES_PREFIX=${MES_PREFIX-$PREFIX/share/mes}
 MES_SEED=${MES_SEED-../mes-seed}
 TINYCC_SEED=${TINYCC_SEED-../tinycc-seed}
 
-mkdir -p $PREFIX/bin
-cp src/mes $PREFIX/bin/mes
+mkdir -p $DESTDIR$PREFIX/bin
+cp src/mes $DESTDIR$PREFIX/bin/mes
 
-mkdir -p $PREFIX/lib
-mkdir -p $MES_PREFIX/lib
-cp scripts/mescc $PREFIX/bin/mescc
+mkdir -p $DESTDIR$PREFIX/lib
+mkdir -p $DESTDIR$MES_PREFIX/lib
+cp scripts/mescc $DESTDIR$PREFIX/bin/mescc
 
-mkdir -p $MES_PREFIX
-tar -cf- doc guile include lib module scaffold | tar -xf- -C $MES_PREFIX
+mkdir -p $DESTDIR$MES_PREFIX
+tar -cf- doc guile include lib module scaffold | tar -xf- -C $DESTDIR$MES_PREFIX
 
 GUILE_EFFECTIVE_VERSION=${GUILE_EFFECTIVE_VERSION-2.2}
 DATADIR=${MODULEDIR-$PREFIX/share/mes}
@@ -31,7 +31,7 @@ GUILEDIR=${MODULEDIR-$PREFIX/share/guile/site/$GUILE_EFFECTIVE_VERSION}
 GODIR=${GODIR-$PREFIX/lib/guile/$GUILE_EFFECTIVE_VERSION/site-ccache}
 DOCDIR=${MODULEDIR-$PREFIX/share/doc/mes}
 
-chmod +w $PREFIX/bin/mescc
+chmod +w $DESTDIR$PREFIX/bin/mescc
 sed \
     -e "s,^#! /bin/sh,#! $SHELL," \
     -e "s,module/,$MODULEDIR/," \
@@ -42,8 +42,8 @@ sed \
     -e "s,@MODULEDIR@,$MODULEDIR,g" \
     -e "s,@PREFIX@,$PREFIX,g" \
     -e "s,@VERSION@,$VERSION,g" \
-    scripts/mescc > $PREFIX/bin/mescc
-chmod +w $MODULEDIR/mes/boot-0.scm
+    scripts/mescc > $DESTDIR$PREFIX/bin/mescc
+chmod +w $DESTDIR$MODULEDIR/mes/boot-0.scm
 sed \
     -e "s,^#! /bin/sh,#! $SHELL," \
     -e "s,module/,$MODULEDIR/," \
@@ -54,25 +54,25 @@ sed \
     -e "s,@MODULEDIR@,$MODULEDIR,g" \
     -e "s,@PREFIX@,$PREFIX,g" \
     -e "s,@VERSION@,$VERSION,g" \
-    module/mes/boot-0.scm > $MODULEDIR/mes/boot-0.scm
+    module/mes/boot-0.scm > $DESTDIR$MODULEDIR/mes/boot-0.scm
 
 sed \
     -e "s,^#! /bin/sh,#! $SHELL," \
-    scripts/diff.scm > $PREFIX/bin/diff.scm
-chmod -w+x $PREFIX/bin/diff.scm
+    scripts/diff.scm > $DESTDIR$PREFIX/bin/diff.scm
+chmod -w+x $DESTDIR$PREFIX/bin/diff.scm
 
 if [ -f doc/mes.info ]; then
-    mkdir -p $PREFIX/share/info
-    install-info --info-dir=$PREFIX/share/info doc/mes.info
-    tar -cf- doc/mes.info* | tar -xf- --strip-components=1 -C $PREFIX/share/info
+    mkdir -p $DESTDIR$PREFIX/share/info
+    install-info --info-dir=$DESTDIR$PREFIX/share/info doc/mes.info
+    tar -cf- doc/mes.info* | tar -xf- --strip-components=1 -C $DESTDIR$PREFIX/share/info
 fi
 
 if [ -f doc/mes.1 ]; then
-    mkdir -p $PREFIX/man/man1
-    cp doc/mes.1 $PREFIX/man/man1/
+    mkdir -p $DESTDIR$PREFIX/man/man1
+    cp doc/mes.1 $DESTDIR$PREFIX/man/man1/
 fi
 
 if [ -f doc/mescc.1 ]; then
-    mkdir -p $PREFIX/man/man1
-    cp doc/mescc.1 $PREFIX/man/man1/
+    mkdir -p $DESTDIR$PREFIX/man/man1
+    cp doc/mescc.1 $DESTDIR$PREFIX/man/man1/
 fi