From e2e6e16e16ecdbd4eb41177bae2d2297527b5c78 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 5 Apr 2018 21:32:17 -0700 Subject: 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. --- configure | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'configure') 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 -- cgit v1.2.3