summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-04-05 21:32:17 -0700
committerKaz Kylheku <kaz@kylheku.com>2018-04-05 21:32:17 -0700
commitecd42d81af251ba063cddff3616a40b5ce09938c (patch)
treeeae05dcef677afc6a2b304f5a38364af23652b5e
parentd39cada9bf4d450148b5dc689d1c82e2437a9d2b (diff)
downloadtxr-ecd42d81af251ba063cddff3616a40b5ce09938c.tar.gz
txr-ecd42d81af251ba063cddff3616a40b5ce09938c.tar.bz2
txr-ecd42d81af251ba063cddff3616a40b5ce09938c.zip
configure: link files rather than dirs.
* configure (lndir): New function; imitation of same-named utility from the X11 distribution. Using lndir, instead of creating, in the build directory, symlinks for the tests and shared directories pointing back to the source tree, we mirror the directory structure of these directories and populate it with individual file symlinks. Motivation: this will allow us to build .tlo object files in these directories side by side with .tl files, without touching the source tree.
-rwxr-xr-xconfigure37
1 files changed, 36 insertions, 1 deletions
diff --git a/configure b/configure
index bb6b9169..f05f2969 100755
--- a/configure
+++ b/configure
@@ -587,6 +587,37 @@ fi
printf "Checking source directory \"%s\" ..." "$top_srcdir"
+lndir()
+{
+ fromdir=$1
+ todir=$2
+ abs=${fromdir%${fromdir#/}}
+
+ find "$fromdir" \( -type f -o -type d \) | while read frompath ; do
+ topath=${frompath#$fromdir}
+ topath=${topath#/}
+ [ -n "$topath" ] || topath="."
+ if [ -f "$frompath" ] ; then
+ if [ $abs ] ; then
+ ln -sf "$frompath" "$todir/$topath"
+ else
+ old_IFS=$IFS
+ IFS=/
+ set -- $todir/$topath
+ IFS=$old_IFS
+ dots=""
+ while [ $# -gt 0 ] ; do
+ [ $1 = "." ] || dots="$dots../"
+ shift
+ done
+ ln -sf "$dots$frompath" "$todir/$topath"
+ fi
+ else
+ mkdir -p "$todir/$topath"
+ fi
+ done
+}
+
case "$top_srcdir" in
" "* | *" "* | *" " )
printf " bad (contains spaces)\n"
@@ -598,10 +629,14 @@ case "$top_srcdir" in
esac
if [ "$source_dir" != "." ] ; then
- for x in Makefile share tests; do
+ for x in Makefile ; do
printf "Symlinking %s -> $source_dir/%s\n" $x $x
ln -sf "$source_dir/$x" .
done
+ for x in share tests; do
+ printf "Tree symlinking %s -> $source_dir/%s\n" $x $x
+ lndir $source_dir/$x $x
+ done
else
printf "** Note: it's recommended to build in a separate directory\n"
fi