[MLton-commit] r4668

Stephen Weeks MLton@mlton.org
Sun, 25 Jun 2006 17:32:58 -0700


Added the new build/lib/$crossTarget/include directory when using gcc
to compile cross-built C files.

Fixed bug introduced in bin/regression in r4515.  The relevant comment
in the commit was:

> 4. Potentially modified the behaviour of bin/regression
> 	A comment previously stated:
>                 #   Must use $f.[0-9].[cS], not $f.*.[cS], because the
>                 #   latter will include other files, e.g. for finalize,
>                 #   it will also include finalize.2.
> 	My testing shows this to be false. Furthermore, the work-around:
>                 files="$f.[0-9].[cS]"
>                 if [ 0 -ne `ls $f.[0-9][0-9].[cS] 2>/dev/null | wc -l` ]; then 
>                         files="$files $f.[0-9][0-9].[cS]"
>                 fi
> 	will break on a filename with spaces or shell specials.

In fact, the problem does happen, but only when cross compiling the
regressions.  I went back to the old workaround, which as the above
notes, is wrong for filenames with spaces or specials.  I'd be happy
to see that fixed.


----------------------------------------------------------------------

U   mlton/branches/on-20050822-x86_64-branch/bin/regression

----------------------------------------------------------------------

Modified: mlton/branches/on-20050822-x86_64-branch/bin/regression
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/bin/regression	2006-06-26 00:24:47 UTC (rev 4667)
+++ mlton/branches/on-20050822-x86_64-branch/bin/regression	2006-06-26 00:32:57 UTC (rev 4668)
@@ -115,7 +115,7 @@
 ;;
 esac
 
-for f in *.sml; do
+for f in finalize.2.sml; do
         f=`basename "$f" .sml`
         if [ "$skipTo" != "" ]; then
                 if [ "$skipTo" != "$f" ]; then
@@ -185,18 +185,22 @@
                 ;;
                 esac
                 libs="-lmlton -lgmp $libs -lgdtoa -lm"
-		# OLD COMMENT:
-                #   Must use $f.[0-9].[cS], not $f.*.[cS], because the
-                #   latter will include other files, e.g. for finalize,
-                #   it will also include finalize.2.
-		# I think this is untrue, and have dropped it as the work-
-		# around used was unsafe for special characters.
+                # Must use $f.[0-9].[cS], not $f.*.[cS], because the
+                # latter will include other files, e.g. for finalize,
+                # it will also include finalize.2. This happens only 
+		# when running cross regressions, which builds all the
+		# C files and saves them in this directory.
+		files="$f.[0-9].[cS]"
+		if [ 0 -ne `ls $f.[0-9][0-9].[cS] 2>/dev/null | wc -l` ]; then 
+			files="$files $f.[0-9][0-9].[cS]"
+		fi
                 gcc -o "$f" -w -O1                              \
                         -I "../build/lib/include"               \
+			-I "../build/lib/$crossTarget/include"  \
                         -L"../build/lib/$crossTarget"           \
                         -L/usr/pkg/lib                          \
                         -L/usr/local/lib                        \
-                        "$f".*.[cS] $libs
+                        $files $libs
 	fi
         if [ ! -r "$f".nonterm -a $cross = 'false' -a -x "$f" ]; then
                 nonZeroMsg='Nonzero exit status.'