diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2018-04-05 21:32:17 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2018-04-05 21:32:17 -0700 |
commit | e2e6e16e16ecdbd4eb41177bae2d2297527b5c78 (patch) | |
tree | eae05dcef677afc6a2b304f5a38364af23652b5e | |
parent | e69a99cc4c183a98dd380fdaf47a5a1dcb5d68a0 (diff) | |
download | txr-e2e6e16e16ecdbd4eb41177bae2d2297527b5c78.tar.gz txr-e2e6e16e16ecdbd4eb41177bae2d2297527b5c78.tar.bz2 txr-e2e6e16e16ecdbd4eb41177bae2d2297527b5c78.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-x | configure | 37 |
1 files changed, 36 insertions, 1 deletions
@@ -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 |