diff --git a/build-aux/export.make b/build-aux/export.make index 065819f4..b0c93c69 100644 --- a/build-aux/export.make +++ b/build-aux/export.make @@ -1,3 +1,7 @@ +ifdef DESTDIR +export DESTDIR +endif + ifdef PREFIX export PREFIX endif diff --git a/install.sh b/install.sh index c34c7f84..224d3563 100755 --- a/install.sh +++ b/install.sh @@ -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