~ chicken-core (chicken-5) 7d892447f01de534a54df5f2eb17ef9e0e75819e
commit 7d892447f01de534a54df5f2eb17ef9e0e75819e
Author: felix <felix@call-with-current-continuation.org>
AuthorDate: Wed Dec 6 23:49:07 2017 +0100
Commit: Peter Bex <peter@more-magic.net>
CommitDate: Sun Dec 10 12:43:57 2017 +0100
added -libdir option to csc
Also modifies calls to csc in test scripts to use this option so that running
"make check" is independent of the installation directory.
Signed-off-by: Peter Bex <peter@more-magic.net>
diff --git a/NEWS b/NEWS
index f3e08c78..b7d8aeec 100644
--- a/NEWS
+++ b/NEWS
@@ -29,6 +29,8 @@
- Tools
- The new "-link" option to csc allows linking with objects from extensions.
+ - The new "-libdir" option to csc allows overriding the runtime library
+ directory.
- The ambiguous "-l<libname>" option for csc has been removed (#1193).
- Removed deprecated "-n" shorthand for "-emit-inline-file" from csc.
- Removed "chicken-bug" tool.
diff --git a/csc.mdoc b/csc.mdoc
index 1c027fae..16d2c89a 100644
--- a/csc.mdoc
+++ b/csc.mdoc
@@ -235,6 +235,8 @@ Link extension with compiled executable
Require extension and import in compiled code.
.It Fl dll , Fl library
Compile multiple units into a dynamic library.
+.It Fl libdir Ar DIRECTORY
+Override location of runtime library directory.
.El
.Pp
Options to other passes:
diff --git a/csc.scm b/csc.scm
index 196aa4d5..9b8fd531 100644
--- a/csc.scm
+++ b/csc.scm
@@ -434,6 +434,7 @@ Usage: #{csc} [OPTION ...] [FILENAME ...]
code
-dll -library compile multiple units into a dynamic
library
+ -libdir DIRECTORY override directory for runtime library
Options to other passes:
@@ -643,6 +644,10 @@ EOF
(set! linked-extensions
(append linked-extensions (string-split (car rest) ", ")))
(set! rest (cdr rest))]
+ ((-libdir)
+ (check s rest)
+ (set! library-dir (car rest))
+ (set! rest (cdr rest)))
[(-require-extension -R)
(check s rest)
(t-options "-require-extension" (car rest))
diff --git a/tests/csc-tests.scm b/tests/csc-tests.scm
index b97e8354..01381aca 100644
--- a/tests/csc-tests.scm
+++ b/tests/csc-tests.scm
@@ -7,7 +7,7 @@
(define (abs x) (make-pathname (current-directory) x))
(define (run x . args) (system* (string-intersperse (cons (abs x) args))))
-(define (csc . args) (apply run "../csc" "-v" "-compiler ../chicken" "-I.." args))
+(define (csc . args) (apply run "../csc" "-v" "-compiler ../chicken" "-I.." "-libdir .." args))
(csc "null.scm" "-t")
(assert (file-exists? "null.c"))
diff --git a/tests/runtests.bat b/tests/runtests.bat
index b6af433c..882e0223 100644
--- a/tests/runtests.bat
+++ b/tests/runtests.bat
@@ -15,9 +15,10 @@ set TYPESDB=..\types.db
rem Increase this when tests start failing on "inexplicable" diffs
set FCBUFSIZE=500
-set compile=..\csc -types %TYPESDB% -ignore-repository -compiler %CHICKEN% -v -I%TEST_DIR%/.. -L%TEST_DIR%/.. -include-path %TEST_DIR%/.. -o a.out
-set compile2=..\csc -compiler %CHICKEN% -v -I%TEST_DIR%/.. -L%TEST_DIR%/.. -include-path %TEST_DIR%/..
-set compile_s=..\csc -s -types %TYPESDB% -ignore-repository -compiler %CHICKEN% -v -I%TEST_DIR%/.. -L%TEST_DIR%/.. -include-path %TEST_DIR%/..
+set compile=..\csc -types %TYPESDB% -ignore-repository -compiler %CHICKEN% -v -I%TEST_DIR%/.. -L%TEST_DIR%/.. -include-path %TEST_DIR%/.. -libdir %TEST_DIR%/.. -o a.out
+set compile2=..\csc -compiler %CHICKEN% -v -I%TEST_DIR%/.. -L%TEST_DIR%/.. -include-path %TEST_DIR%/.. -libdir %TEST_DIR%/..
+set compile_s=..\csc -s -types %TYPESDB% -ignore-repository -compiler %CHICKEN% -v -I%TEST_DIR%/.. -L%TEST_DIR%/.. -include-path %TEST_DIR%/.. -libdir %TEST_DIR%/..
+set compile_static=..\csc -static -types %TYPESDB% -ignore-repository -compiler %CHICKEN% -v -I%TEST_DIR%/.. -L%TEST_DIR%/.. -include-path %TEST_DIR%/.. -libdir %TEST_DIR%/..
set interpret=..\csi -n -include-path %TEST_DIR%/..
del /f /q /s *.exe *.so *.o *.import.* ..\foo.import.* %CHICKEN_INSTALL_REPOSITORY%
@@ -585,7 +586,7 @@ echo ======================================== linking tests ...
if errorlevel 1 exit /b 1
a.out
if errorlevel 1 exit /b 1
-%compile2% -link reverser linking-tests.scm -o a.out -static
+%compile_static% -link reverser linking-tests.scm -o a.out
if errorlevel 1 exit /b 1
a.out
if errorlevel 1 exit /b 1
@@ -595,7 +596,7 @@ move reverser.import.scm %CHICKEN_INSTALL_REPOSITORY%
if errorlevel 1 exit /b 1
a.out
if errorlevel 1 exit /b 1
-%compile2% -link reverser linking-tests.scm -o a.out -static
+%compile_static% -link reverser linking-tests.scm -o a.out
if errorlevel 1 exit /b 1
a.out
if errorlevel 1 exit /b 1
diff --git a/tests/runtests.sh b/tests/runtests.sh
index f512bdbe..6d23f533 100755
--- a/tests/runtests.sh
+++ b/tests/runtests.sh
@@ -43,9 +43,10 @@ export CHICKEN_INSTALL_REPOSITORY CHICKEN_REPOSITORY_PATH
TYPESDB=../types.db
-compile="../csc -types ${TYPESDB} -ignore-repository ${COMPILE_OPTIONS} -o a.out"
-compile2="../csc -compiler ${CHICKEN} -v -I${TEST_DIR}/.. -L${TEST_DIR}/.. -include-path ${TEST_DIR}/.."
-compile_s="../csc -s -types ${TYPESDB} -ignore-repository ${COMPILE_OPTIONS}"
+compile="../csc -types ${TYPESDB} -ignore-repository ${COMPILE_OPTIONS} -o a.out -libdir ${TEST_DIR}/.."
+compile2="../csc -compiler ${CHICKEN} -v -I${TEST_DIR}/.. -L${TEST_DIR}/.. -include-path ${TEST_DIR}/.. -libdir ${TEST_DIR}/.."
+compile_s="../csc -s -types ${TYPESDB} -ignore-repository ${COMPILE_OPTIONS} -libdir ${TEST_DIR}/.."
+compile_static="../csc -compiler ${CHICKEN} -v -static -I${TEST_DIR}/.. -include-path ${TEST_DIR}/.. -libdir ${TEST_DIR}/.."
interpret="../csi -n -include-path ${TEST_DIR}/.."
time=time
@@ -456,12 +457,12 @@ echo "======================================== linking tests ..."
$compile2 -unit reverser reverser/tags/1.0/reverser.scm -J -c -o reverser.o
$compile2 -link reverser linking-tests.scm -o a.out
./a.out
-$compile2 -link reverser linking-tests.scm -o a.out -static
+$compile_static -link reverser linking-tests.scm -o a.out
./a.out
mv reverser.o reverser.import.scm "$CHICKEN_INSTALL_REPOSITORY"
$compile2 -link reverser linking-tests.scm -o a.out
./a.out
-$compile2 -link reverser linking-tests.scm -o a.out -static
+$compile_static -link reverser linking-tests.scm -o a.out
./a.out
echo "======================================== private repository test ..."
Trap