[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/1] Add support for `destination' specification in egg files
From: |
Evan Hanson |
Subject: |
[PATCH 1/1] Add support for `destination' specification in egg files |
Date: |
Wed, 26 Aug 2020 21:56:39 +1200 |
---
chicken-install.scm | 1 +
egg-compile.scm | 25 +++++++++++++++++++------
egg-environment.scm | 1 +
manual/Egg specification format | 13 +++++++------
4 files changed, 28 insertions(+), 12 deletions(-)
diff --git a/chicken-install.scm b/chicken-install.scm
index 6d976048..a3429610 100644
--- a/chicken-install.scm
+++ b/chicken-install.scm
@@ -183,6 +183,7 @@
(custom-build #f #f #f)
(linkage #f #f #f)
(objects #f #f #f)
+ (destination #f #f #f ,list?)
(install-name #f #f #f ,nameprop?)
(target #f #t #f)
(host #f #t #f)
diff --git a/egg-compile.scm b/egg-compile.scm
index f6de778c..8612c747 100644
--- a/egg-compile.scm
+++ b/egg-compile.scm
@@ -128,6 +128,19 @@
(list (implib rtarget))))
+;;; normalize target path for "random files" (data, c-include, scheme-include)
+
+(define (normalize-destination dest mode)
+ (let ((dest* (normalize-pathname dest)))
+ (if (irregex-search '(: bos ".." ("\\/")) dest*)
+ (error "destination must be relative to CHICKEN install prefix" dest)
+ (normalize-pathname
+ (make-pathname (if (eq? mode 'target)
+ default-prefix ; XXX wrong!
+ (override-prefix "/" host-prefix))
+ dest*)))))
+
+
;;; check condition in conditional clause
(define (check-condition tst mode link)
@@ -264,7 +277,7 @@
(dest #f)
(files '()))
(for-each compile-data/include (cddr info))
- (let* ((dest (or dest
+ (let* ((dest (or (and dest (normalize-destination dest mode))
(if (eq? mode 'target)
default-sharedir ; XXX wrong!
(override-prefix "/share" host-sharedir))))
@@ -293,8 +306,8 @@
(dest #f)
(files '()))
(for-each compile-data/include (cddr info))
- (let* ((dest (or dest
- (if (eq? mode 'target)
+ (let* ((dest (or (and dest (normalize-destination dest mode))
+ (if (eq? mode 'target)
default-incdir ; XXX wrong!
(override-prefix "/include" host-incdir))))
(dest (normalize-pathname (conc dest "/"))))
@@ -308,8 +321,8 @@
(dest #f)
(files '()))
(for-each compile-data/include (cddr info))
- (let* ((dest (or dest
- (if (eq? mode 'target)
+ (let* ((dest (or (and dest (normalize-destination dest mode))
+ (if (eq? mode 'target)
default-sharedir ; XXX wrong!
(override-prefix "/share" host-sharedir))))
(dest (normalize-pathname (conc dest "/"))))
@@ -1022,7 +1035,7 @@
(root (string-append srcdir "/"))
(mkdir (mkdir-command platform))
(sfiles (map (cut prefix srcdir <>) files))
- (dfile (qs* dest platform #t))
+ (dfile (qs* (normalize-destination dest mode) platform #t))
(ddir (shell-variable "DESTDIR" platform)))
(print "\n" mkdir " " ddir dfile)
(let-values (((ds fs) (partition directory? sfiles)))
diff --git a/egg-environment.scm b/egg-environment.scm
index 50ea972a..470d6894 100644
--- a/egg-environment.scm
+++ b/egg-environment.scm
@@ -79,6 +79,7 @@ EOF
(define target-librarian (foreign-value "C_TARGET_LIBRARIAN" c-string))
(define target-librarian-options (foreign-value "C_TARGET_LIBRARIAN_FLAGS"
c-string))
+(define host-prefix (foreign-value "C_INSTALL_PREFIX" c-string))
(define host-repo (foreign-value "C_INSTALL_EGG_HOME" c-string))
(define host-libdir (foreign-value "C_INSTALL_LIB_HOME" c-string))
(define host-bindir (foreign-value "C_INSTALL_BIN_HOME" c-string))
diff --git a/manual/Egg specification format b/manual/Egg specification format
index 9eabfd2c..73da8566 100644
--- a/manual/Egg specification format
+++ b/manual/Egg specification format
@@ -375,12 +375,13 @@ to this component and that the object components are
dependencies.
[egg property] (destination NAME)
-Specifies an alternative installation destination for the
-built component and only applies
-to components of type {{data}}, {{c-include}} and {{scheme-include}}.
-This property should only be used in extreme
-cases, as it is recommended to use the default installation
-locations, which are:
+Specifies an alternative installation destination for the built
+component and only applies to components of type {{data}}, {{c-include}}
+and {{scheme-include}}. {{NAME}} must be a relative path and is
+considered relative to CHICKEN's installation prefix.
+
+This property should only be used in extreme cases, as it is recommended
+to use the default installation locations, which are:
* for C include files: {{<PREFIX>/include/chicken/}}
--
2.28.0