| 1 |
#!/bin/sh |
| 2 |
# This script is called when building Gauche in a different directory |
| 3 |
# than srcdir. The first argument is srcdir, and the second is the |
| 4 |
# value of LN_S set by AC_PROG_LN_S. |
| 5 |
|
| 6 |
set -e |
| 7 |
|
| 8 |
if [ $# -ne 2 ]; then |
| 9 |
echo 'Usage: wirebuildlibs "$top_srcdir" "$LN_S"' |
| 10 |
echo 'Run this script in top_builddir to create links necessary to run' |
| 11 |
echo 'gosh in place. (e.g. cd src; ./gosh -ftest).' |
| 12 |
exit 1 |
| 13 |
fi |
| 14 |
|
| 15 |
top_srcdir=$1 |
| 16 |
LN_S=$2 |
| 17 |
|
| 18 |
# Sanity check |
| 19 |
if [ -z "$top_srcdir" ]; then |
| 20 |
echo 'wirebuildlibs: $top_srcdir cannot be empty.' |
| 21 |
exit 1 |
| 22 |
fi |
| 23 |
if [ -z "$LN_S" ]; then |
| 24 |
echo 'wirebuildlibs: $LN_S cannot be empty.' |
| 25 |
exit 1 |
| 26 |
fi |
| 27 |
|
| 28 |
echo "Wiring necessary library files..." |
| 29 |
|
| 30 |
# We want top_srcdir be an absolute path to avoid complications of |
| 31 |
# making links to deep directories. |
| 32 |
echo $top_srcdir | grep '^/' > /dev/null || top_srcdir=`pwd`/$top_srcdir |
| 33 |
|
| 34 |
# Older autoconf sets LN_S to "cp -p" when "ln -s" isn't available, |
| 35 |
# but that doesn't handle directories. |
| 36 |
if [ "$LN_S" = "cp -p" ]; then |
| 37 |
LN_S="cp -pR" |
| 38 |
fi |
| 39 |
|
| 40 |
rm -rf libsrc |
| 41 |
$LN_S $top_srcdir/libsrc libsrc |
| 42 |
for f in `(cd $top_srcdir; find lib \( -name '*.scm' -o -name '*.sld' -o -name 'dump' -o -name 'restore' -o -path 'lib/tools/*' \) -print)`; do |
| 43 |
if [ $f != "lib/gauche/config.scm" -a $f != "slib.scm" ]; then |
| 44 |
mkdir -p `dirname $f` |
| 45 |
rm -rf $f |
| 46 |
$LN_S $top_srcdir/$f $f |
| 47 |
fi |
| 48 |
done |
| 49 |
rm -rf test |
| 50 |
$LN_S $top_srcdir/test test |