>From 6834c22e77cb8cf923debc896092c89481fbab41 Mon Sep 17 00:00:00 2001 From: Mario Domenech Goulart Date: Tue, 15 May 2012 17:11:54 -0300 Subject: [PATCH] When referencing libchicken, take PROGRAM_PREFIX into account The build system names libchicken taking PROGRAM_PREFIX into account, but the chicken tools don't. `libchicken' is hardcoded in chicken tools and tests. This patch makes tools load libchicken according to the name generated by the build system. It also tries to keep tests working on windows, in cases that libchicken has to be copied to the tests dir (this is a bit hacky, since the actual lib name is not known from scripts, so lib*chicken.dll is copied). --- csc.scm | 12 ++++++++---- defaults.make | 3 +++ eval.scm | 4 +++- tests/runbench.sh | 2 +- tests/runtests.bat | 2 +- tests/runtests.sh | 2 +- 6 files changed, 17 insertions(+), 8 deletions(-) diff --git a/csc.scm b/csc.scm index 68834ea..d6b99a6 100644 --- a/csc.scm +++ b/csc.scm @@ -61,6 +61,7 @@ (define-foreign-variable CSC_PROGRAM c-string "C_CSC_PROGRAM") (define-foreign-variable WINDOWS_SHELL bool "C_WINDOWS_SHELL") (define-foreign-variable BINARY_VERSION int "C_BINARY_VERSION") +(define-foreign-variable PROGRAM_PREFIX c-string "C_PROGRAM_PREFIX") ;;; Parameters: @@ -119,8 +120,11 @@ (define windows-shell WINDOWS_SHELL) (define generate-manifest #f) +(define libchicken + (string-append "lib" PROGRAM_PREFIX "chicken")) + (define default-library - (string-append "libchicken." library-extension)) + (string-append libchicken "." library-extension)) (define default-compilation-optimization-options (string-split (if host-mode INSTALL_CFLAGS TARGET_CFLAGS))) (define best-compilation-optimization-options default-compilation-optimization-options) @@ -912,9 +916,9 @@ EOF (when (and osx (or (not cross-chicken) host-mode)) (command (string-append - "install_name_tool -change libchicken.dylib " + "install_name_tool -change " libchicken ".dylib " (quotewrap - (let ((lib "libchicken.dylib")) + (let ((lib (string-append libchicken ".dylib"))) (if deployed (make-pathname "@executable_path" lib) (make-pathname @@ -955,7 +959,7 @@ EOF (define (copy-libraries targetdir) (let ((lib (make-pathname (target-lib-path) - "libchicken" + libchicken (cond (osx "dylib") (win "dll") (else (string-append diff --git a/defaults.make b/defaults.make index a16e5a5..87b6ef1 100644 --- a/defaults.make +++ b/defaults.make @@ -479,6 +479,9 @@ endif echo "#ifndef C_BINARY_VERSION" >>$@ echo "# define C_BINARY_VERSION $(BINARYVERSION)" >>$@ echo "#endif" >>$@ + echo "#ifndef C_PROGRAM_PREFIX" >>$@ + echo "# define C_PROGRAM_PREFIX \"$(PROGRAM_PREFIX)\"" >>$@ + echo "#endif" >>$@ echo "/* END OF FILE */" >>$@ endif diff --git a/eval.scm b/eval.scm index 863e0c4..849c6f9 100644 --- a/eval.scm +++ b/eval.scm @@ -57,6 +57,7 @@ (define-foreign-variable install-egg-home c-string "C_INSTALL_EGG_HOME") (define-foreign-variable installation-home c-string "C_INSTALL_SHARE_HOME") (define-foreign-variable binary-version int "C_BINARY_VERSION") +(define-foreign-variable program-prefix c-string "C_PROGRAM_PREFIX") (define ##sys#core-library-modules '(extras lolevel utils files tcp irregex posix srfi-1 srfi-4 srfi-13 @@ -67,7 +68,8 @@ (define ##sys#explicit-library-modules '()) -(define-constant default-dynamic-load-libraries '("libchicken")) +(define default-dynamic-load-libraries + `(,(string-append "lib" program-prefix "chicken"))) (define-constant cygwin-default-dynamic-load-libraries '("cygchicken-0")) (define-constant macosx-load-library-extension ".dylib") (define-constant windows-load-library-extension ".dll") diff --git a/tests/runbench.sh b/tests/runbench.sh index 77a4e92..58587d6 100644 --- a/tests/runbench.sh +++ b/tests/runbench.sh @@ -17,7 +17,7 @@ COMPILE_OPTIONS="-O5 -d0 -disable-interrupts -b" if test -n "$MSYSTEM"; then CHICKEN="..\\chicken.exe" # make compiled tests use proper library on Windows - cp ../libchicken.dll . + cp ../lib*chicken.dll . fi case `uname -s` in diff --git a/tests/runtests.bat b/tests/runtests.bat index be16134..27ae889 100644 --- a/tests/runtests.bat +++ b/tests/runtests.bat @@ -12,7 +12,7 @@ set FAST_OPTIONS=-O5 -d0 -b -disable-interrupts set TYPESDB=..\types.db -copy ..\libchicken.dll . +copy ..\lib*chicken.dll . set compile=..\csc -compiler %CHICKEN% -v -I.. -L.. -include-path .. -o a.out set compile2=..\csc -compiler %CHICKEN% -v -I.. -L.. -include-path .. diff --git a/tests/runtests.sh b/tests/runtests.sh index 1ec59cd..4508e15 100644 --- a/tests/runtests.sh +++ b/tests/runtests.sh @@ -43,7 +43,7 @@ if test -n "$MSYSTEM"; then ASMFLAGS=-Wa,-w TIME=time # make compiled tests use proper library on Windows - cp ../libchicken.dll . + cp ../lib*chicken.dll . else TIME=/usr/bin/time fi -- 1.7.2.5