Hi! This patch adds the -libdir option to csc to override the default library location. This is needed for running the tests without prior installation and may also be helpful in obscure build situations where linking with a custom libchicken is intended. This should fix #1429.
Please note that I haven't tested this on Windows, yet. felix
From 185515075ac3bccedeaf976702bf2a535368b603 Mon Sep 17 00:00:00 2001 From: felix <fe...@call-with-current-continuation.org> Date: Wed, 6 Dec 2017 23:49:07 +0100 Subject: [PATCH] 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. --- NEWS | 1 + csc.mdoc | 2 ++ csc.scm | 5 +++++ tests/csc-tests.scm | 2 +- tests/runtests.bat | 11 ++++++----- tests/runtests.sh | 11 ++++++----- 6 files changed, 21 insertions(+), 11 deletions(-) diff --git a/NEWS b/NEWS index f3b00b4..3e2c294 100644 --- a/NEWS +++ b/NEWS @@ -31,6 +31,7 @@ - The new "-link" option to csc allows linking with objects from extensions. - The ambiguous "-l<libname>" option for csc has been removed (#1193). - Removed deprecated "-n" shorthand for "-emit-inline-file" from csc. + - The option "-libdir" to csc allows overriding the runtime library directory. - Core libraries - Removed support for memory-mapped files (posix), queues diff --git a/csc.mdoc b/csc.mdoc index 9383290..6c749ab 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 196aa4d..9b8fd53 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 b97e835..01381ac 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 b6af433..882e022 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 f512bdb..6d23f53 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 ..." -- 1.7.9.5
_______________________________________________ Chicken-hackers mailing list Chicken-hackers@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-hackers