build: Support $DESTDIR.

* build-aux/export.make: export DESTDIR.
* install.sh: Support $DESTDIR.
This commit is contained in:
Jan Nieuwenhuizen 2018-06-29 20:38:11 +02:00
parent 72e147f53f
commit b4fa5609fe
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273
2 changed files with 24 additions and 20 deletions

View file

@ -1,3 +1,7 @@
ifdef DESTDIR
export DESTDIR
endif
ifdef PREFIX
export PREFIX
endif

View file

@ -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