~ chicken-core (chicken-5) 8eb461a79fe221e0e0669839cf12025acde6d1c1
commit 8eb461a79fe221e0e0669839cf12025acde6d1c1
Author: felix <bunny351@gmail.com>
AuthorDate: Mon Apr 26 12:25:27 2010 +0200
Commit: felix <bunny351@gmail.com>
CommitDate: Mon Apr 26 12:25:27 2010 +0200
added TARGET_DESTDIR which is used by -deploy and as default destination for chicken-install in cross-chickens
diff --git a/Makefile.cygwin b/Makefile.cygwin
index 056bec46..39a9c287 100644
--- a/Makefile.cygwin
+++ b/Makefile.cygwin
@@ -182,6 +182,9 @@ chicken-defaults.h:
echo "#ifndef C_TARGET_MORE_LIBS" >>$@
echo "# define C_TARGET_MORE_LIBS \"$(TARGET_LIBRARIES)\"" >>$@
echo "#endif" >>$@
+ echo "#ifndef C_TARGET_MORE_LIBS" >>$@
+ echo "# define C_TARGET_MORE_LIBS \"$(TARGET_LIBRARIES)\"" >>$@
+ echo "#endif" >>$@
echo "#ifndef C_TARGET_MORE_STATIC_LIBS" >>$@
echo "# define C_TARGET_MORE_STATIC_LIBS \"$(TARGET_LIBRARIES)\"" >>$@
echo "#endif" >>$@
@@ -200,6 +203,12 @@ chicken-defaults.h:
echo "#ifndef C_CROSS_CHICKEN" >>$@
echo "# define C_CROSS_CHICKEN $(CROSS_CHICKEN)" >>$@
echo "#endif" >>$@
+ echo "#ifndef C_TARGET_DESTDIR" >>$@
+ echo "# define C_TARGET_DESTDIR \"$(TARGET_DESTDIR)\"" >>$@
+ echo "#endif" >>$@
+ echo "#ifndef C_TARGET_PREFIX" >>$@
+ echo "# define C_TARGET_PREFIX \"$(TARGET_PREFIX)\"" >>$@
+ echo "#endif" >>$@
echo "#ifndef C_TARGET_BIN_HOME" >>$@
echo "# define C_TARGET_BIN_HOME \"$(TARGET_PREFIX)/bin\"" >>$@
echo "#endif" >>$@
diff --git a/Makefile.mingw b/Makefile.mingw
index b07d9205..53bb5811 100644
--- a/Makefile.mingw
+++ b/Makefile.mingw
@@ -211,6 +211,12 @@ endif
echo #ifndef C_CROSS_CHICKEN >>$@
echo # define C_CROSS_CHICKEN $(CROSS_CHICKEN) >>$@
echo #endif >>$@
+ echo #ifndef C_TARGET_PREFIX >>$@
+ echo # define C_TARGET_PREFIX "$(TARGET_PREFIX)" >>$@
+ echo #endif >>$@
+ echo #ifndef C_TARGET_DESTDIR >>$@
+ echo # define C_TARGET_DESTDIR "$(TARGET_DESTDIR)" >>$@
+ echo #endif >>$@
echo #ifndef C_TARGET_BIN_HOME >>$@
echo # define C_TARGET_BIN_HOME "$(TARGET_PREFIX)/bin" >>$@
echo #endif >>$@
diff --git a/chicken-install.scm b/chicken-install.scm
index 5b2518fb..c9063a67 100644
--- a/chicken-install.scm
+++ b/chicken-install.scm
@@ -69,7 +69,6 @@
(define *keep* #f)
(define *force* #f)
- (define *prefix* #f)
(define *host-extension* #f)
(define *run-tests* #f)
(define *retrieve-only* #f)
@@ -86,6 +85,12 @@
(define *mappings* '())
(define *deploy* #f)
(define *trunk* #f)
+ (define *csc-features* '())
+
+ (define *prefix*
+ (let ((p (foreign-value "C_TARGET_DESTDIR" c-string)))
+ (and (not (string=? p ""))
+ p)))
(define-constant +module-db+ "modules.db")
(define-constant +defaults-file+ "setup.defaults")
@@ -364,6 +369,7 @@
(sprintf " -e \"(destination-prefix \\\"~a\\\")\""
(normalize-pathname *prefix* 'unix))
"")
+ (sprintf " -e \"(extra-features '~s)\"" *csc-features*)
(if *deploy* " -e \"(deployment-mode #t)\"" "")
#\space
(shellpath (make-pathname (cadr e+d+v) (car e+d+v) "setup"))) )
@@ -505,11 +511,12 @@ usage: chicken-install [OPTION | EXTENSION[:VERSION]] ...
-repository print path used for egg installation
-deploy build extensions for deployment
-trunk build trunk instead of tagged version (only local)
+ -D -feature FEATURE features to pass to sub-invocations of `csc'
EOF
);|
(exit code))
- (define *short-options* '(#\h #\k #\l #\t #\s #\p #\r #\n #\v #\i #\u))
+ (define *short-options* '(#\h #\k #\l #\t #\s #\p #\r #\n #\v #\i #\u #\D))
(define (main args)
(let ((defaults (load-defaults))
@@ -599,6 +606,11 @@ EOF
(set! *proxy-host* (cadr args))
(set! *proxy-port* 80)))
(loop (cddr args) eggs))
+ ((or (string=? "-D" arg) (string=? "-feature" arg))
+ (unless (pair? (cdr args)) (usage 1))
+ (set! *csc-features*
+ (cons (string->symbol (cadr args)) *csc-features*))
+ (loop (cddr args) eggs))
((string=? "-test" arg)
(set! *run-tests* #t)
(loop (cdr args) eggs))
diff --git a/config.make b/config.make
index 1d94f4ef..f1ad8fb9 100644
--- a/config.make
+++ b/config.make
@@ -44,6 +44,9 @@
# Specification of target (runtime) system for cross-compiling:
#TARGETSYSTEM=
+# Where the install-location of a cross-build is
+#TARGET_DESTDIR=
+
# Specify that the sources are in a different directory than ".":
#SRCDIR=
diff --git a/csc.scm b/csc.scm
index 63260e1e..94a159e0 100644
--- a/csc.scm
+++ b/csc.scm
@@ -54,6 +54,7 @@
(define-foreign-variable TARGET_INCLUDE_HOME c-string "C_TARGET_INCLUDE_HOME")
(define-foreign-variable TARGET_STATIC_LIB_HOME c-string "C_TARGET_STATIC_LIB_HOME")
(define-foreign-variable TARGET_RUN_LIB_HOME c-string "C_TARGET_RUN_LIB_HOME")
+(define-foreign-variable TARGET_DESTDIR c-string "C_TARGET_DESTDIR")
(define-foreign-variable CHICKEN_PROGRAM c-string "C_CHICKEN_PROGRAM")
(define-foreign-variable CSC_PROGRAM c-string "C_CSC_PROGRAM")
(define-foreign-variable WINDOWS_SHELL bool "C_WINDOWS_SHELL")
@@ -923,9 +924,15 @@ EOF
INSTALL_LIB_HOME
TARGET_RUN_LIB_HOME))))
+(define (target-lib-path)
+ (let ((tdir TARGET_DESTDIR))
+ (if (not (string=? tdir ""))
+ (make-pathname tdir "lib")
+ (lib-path))))
+
(define (copy-libraries targetdir)
(let ((lib (make-pathname
- (lib-path)
+ (target-lib-path)
"libchicken"
(cond (osx "dylib")
(win "dll")
diff --git a/defaults.make b/defaults.make
index 4669a853..264f1ca0 100644
--- a/defaults.make
+++ b/defaults.make
@@ -41,7 +41,7 @@ endif
SEP ?= /
SRCDIR ?= .$(SEP)
-DESTDIR ?=
+DESTDIR ?= $(TARGET_DESTDIR)
PREFIX ?= /usr/local
BRANCHNAME ?= $(shell sh identify-branch.sh $(SRCDIR))
@@ -443,6 +443,12 @@ endif
echo "#ifndef C_CROSS_CHICKEN" >>$@
echo "# define C_CROSS_CHICKEN $(CROSS_CHICKEN)" >>$@
echo "#endif" >>$@
+ echo "#ifndef C_TARGET_PREFIX" >>$@
+ echo "# define C_TARGET_PREFIX \"$(TARGET_PREFIX)\"" >>$@
+ echo "#endif" >>$@
+ echo "#ifndef C_TARGET_DESTDIR" >>$@
+ echo "# define C_TARGET_DESTDIR \"$(TARGET_DESTDIR)\"" >>$@
+ echo "#endif" >>$@
echo "#ifndef C_TARGET_BIN_HOME" >>$@
echo "# define C_TARGET_BIN_HOME \"$(TARGET_PREFIX)/bin\"" >>$@
echo "#endif" >>$@
diff --git a/setup-api.scm b/setup-api.scm
index 5a19ece2..eb056490 100644
--- a/setup-api.scm
+++ b/setup-api.scm
@@ -51,6 +51,7 @@
patch yes-or-no? abort-setup
setup-root-directory create-directory/parents
test-compile try-compile run-verbose
+ extra-features
copy-file move-file ;XXX DEPRECATED
copy-file* move-file*
required-chicken-version required-extension-version cross-chicken
@@ -108,12 +109,19 @@
(define *csc-options* '())
(define *base-directory* (current-directory))
-(define setup-root-directory (make-parameter *base-directory*))
-(define setup-verbose-mode (make-parameter #f))
-(define setup-install-mode (make-parameter #t))
-(define deployment-mode (make-parameter #f))
-(define program-path (make-parameter *chicken-bin-path*))
-(define keep-intermediates (make-parameter #f))
+(define setup-root-directory (make-parameter *base-directory*))
+(define setup-verbose-mode (make-parameter #f))
+(define setup-install-mode (make-parameter #t))
+(define deployment-mode (make-parameter #f))
+(define program-path (make-parameter *chicken-bin-path*))
+(define keep-intermediates (make-parameter #f))
+
+(define extra-features
+ (let ((xfs '()))
+ (lambda (#!optional fs)
+ (cond (fs (apply register-feature! fs)
+ (set! xfs fs))
+ (else xfs)))))
; Setup shell commands
@@ -240,7 +248,11 @@
(if (keep-intermediates) "-k" "")
(if (host-extension) "-host" "")
(if (deployment-mode) "-deployed" "")
- *csc-options*)
+ (append
+ (map (lambda (f)
+ (string-append "-feature "(symbol->string f)))
+ (extra-features))
+ *csc-options*) )
" ")
(find-program prg)))
Trap