>From 1ecbef5cc4022e04c1ea938e5747387d5d7422d1 Mon Sep 17 00:00:00 2001 From: Mario Domenech Goulart Date: Thu, 17 May 2012 11:39:01 -0300 Subject: [PATCH] When referencing libchicken, take PROGRAM_PREFIX and PROGRAM_SUFFIX into account The build system names libchicken taking PROGRAM_PREFIX and PROGRAM_SUFFIX into account (to assemble INSTALL_LIB_NAME), but the chicken tools don't. `libchicken' is hardcoded in chicken tools and tests. This patch makes cross 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). This patch doesn't handle the case when TARGET_LIB_NAME is used by csc (i.e., when not in host-mode). TARGET_LIB_NAME is hardcoded to `chicken'. --- csc.scm | 11 +++++++---- eval.scm | 4 +++- tests/runbench.sh | 2 +- tests/runtests.bat | 2 +- tests/runtests.sh | 2 +- 5 files changed, 13 insertions(+), 8 deletions(-) mode change 100644 => 100755 tests/runbench.sh mode change 100644 => 100755 tests/runtests.sh diff --git a/csc.scm b/csc.scm index 68834ea..2310bbb 100644 --- a/csc.scm +++ b/csc.scm @@ -119,8 +119,11 @@ (define windows-shell WINDOWS_SHELL) (define generate-manifest #f) +(define libchicken + (string-append "lib" INSTALL_LIB_NAME)) + (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 +915,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 +958,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/eval.scm b/eval.scm index 863e0c4..9f7a9cf 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 install-lib-name c-string "C_INSTALL_LIB_NAME") (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" install-lib-name))) (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 old mode 100644 new mode 100755 index 77a4e92..7841ec1 --- 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..ecd8d05 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 old mode 100644 new mode 100755 index 1ec59cd..9f9f7ee --- 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