Replace the MSYS2/UCRT64 toolchain with the portable w64devkit kit: bootstrap a pinned kit, build with its sh/make/gcc, and keep the compiler's temporary files inside work/. Update upstream to 6.1.0 and add a portable-prefix patch: when the configured prefix is gone, csc, csi, chicken, and the chicken-* tools derive include, library, and repository paths from the running executable. A released zip now works wherever it is unpacked, which it did not before. Signed-off-by: Pavel Kulyov <kulyov.pavel@gmail.com>
112 lines
4.5 KiB
Diff
112 lines
4.5 KiB
Diff
--- a/library.scm
|
|
+++ b/library.scm
|
|
@@ -7896,8 +7896,41 @@
|
|
;;; Installation locations
|
|
|
|
(define-foreign-variable binary-version int "C_BINARY_VERSION")
|
|
-(define-foreign-variable installation-home c-string "C_INSTALL_SHARE_HOME")
|
|
-(define-foreign-variable install-egg-home c-string "C_INSTALL_EGG_HOME")
|
|
+
|
|
+;; A prefix that has been unpacked somewhere else no longer has the
|
|
+;; directories naming it was configured with. When they are gone, use
|
|
+;; the tree the running executable lives in.
|
|
+(define (##sys#executable-prefix)
|
|
+ (let ((dir (foreign-value "C_executable_dirname()" c-string)))
|
|
+ (and dir
|
|
+ (let loop ((i (fx- (string-length dir) 1)))
|
|
+ (cond ((fx< i 0) #f)
|
|
+ ((or (char=? (string-ref dir i) #\/)
|
|
+ (char=? (string-ref dir i) #\\))
|
|
+ (and (fx> i 0) (substring dir 0 i)))
|
|
+ (else (loop (fx- i 1))))))))
|
|
+
|
|
+(define (##sys#existing-directory dir)
|
|
+ (and dir (##sys#file-exists? dir #f #t 'installation-home) dir))
|
|
+
|
|
+(define installation-home
|
|
+ (let ((configured (foreign-value "C_INSTALL_SHARE_HOME" c-string)))
|
|
+ (or (##sys#existing-directory configured)
|
|
+ (let ((prefix (##sys#executable-prefix)))
|
|
+ (and prefix
|
|
+ (##sys#existing-directory
|
|
+ (string-append prefix "/share/chicken"))))
|
|
+ configured)))
|
|
+
|
|
+(define install-egg-home
|
|
+ (let ((configured (foreign-value "C_INSTALL_EGG_HOME" c-string)))
|
|
+ (or (##sys#existing-directory configured)
|
|
+ (let ((prefix (##sys#executable-prefix)))
|
|
+ (and prefix
|
|
+ (##sys#existing-directory
|
|
+ (string-append prefix "/lib/chicken/"
|
|
+ (number->string binary-version)))))
|
|
+ configured)))
|
|
|
|
(define (include-path #!optional new)
|
|
(when new
|
|
--- a/egg-environment.scm
|
|
+++ b/egg-environment.scm
|
|
@@ -65,9 +65,36 @@
|
|
(foreign-value "C_WINDOWS_SHELL" bool)
|
|
'unix))
|
|
|
|
-(define default-prefix (foreign-value "C_INSTALL_PREFIX" c-string))
|
|
-(define default-bindir (foreign-value "C_INSTALL_BIN_HOME" c-string))
|
|
+;; A prefix unpacked somewhere else no longer has the directories it was
|
|
+;; configured with. When they are gone, use the tree the running
|
|
+;; executable lives in.
|
|
+(define (existing-directory path)
|
|
+ (and path (directory-exists? path) path))
|
|
|
|
+(define (executable-bindir)
|
|
+ (foreign-value "C_executable_dirname()" c-string))
|
|
+
|
|
+(define (executable-prefix)
|
|
+ (let ((bindir (executable-bindir)))
|
|
+ (and bindir (pathname-directory bindir))))
|
|
+
|
|
+(define (install-path configured relative)
|
|
+ (or (existing-directory configured)
|
|
+ (let ((prefix (executable-prefix)))
|
|
+ (and prefix
|
|
+ (existing-directory (string-append prefix relative))))
|
|
+ configured))
|
|
+
|
|
+(define default-prefix
|
|
+ (or (existing-directory (foreign-value "C_INSTALL_PREFIX" c-string))
|
|
+ (executable-prefix)
|
|
+ (foreign-value "C_INSTALL_PREFIX" c-string)))
|
|
+
|
|
+(define default-bindir
|
|
+ (or (existing-directory (foreign-value "C_INSTALL_BIN_HOME" c-string))
|
|
+ (executable-bindir)
|
|
+ (foreign-value "C_INSTALL_BIN_HOME" c-string)))
|
|
+
|
|
(define default-csc
|
|
(string-append default-bindir "/" (foreign-value "C_CSC_PROGRAM" c-string)))
|
|
|
|
@@ -80,12 +107,17 @@
|
|
(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))
|
|
-(define host-incdir (foreign-value "C_INSTALL_INCLUDE_HOME" c-string))
|
|
-(define host-sharedir (foreign-value "C_INSTALL_SHARE_HOME" c-string))
|
|
+(define host-prefix default-prefix)
|
|
+(define host-repo
|
|
+ (install-path (foreign-value "C_INSTALL_EGG_HOME" c-string)
|
|
+ (string-append "/lib/chicken/" (number->string binary-version))))
|
|
+(define host-libdir
|
|
+ (install-path (foreign-value "C_INSTALL_LIB_HOME" c-string) "/lib"))
|
|
+(define host-bindir default-bindir)
|
|
+(define host-incdir
|
|
+ (install-path (foreign-value "C_INSTALL_INCLUDE_HOME" c-string) "/include/chicken"))
|
|
+(define host-sharedir
|
|
+ (install-path (foreign-value "C_INSTALL_SHARE_HOME" c-string) "/share/chicken"))
|
|
(define host-libs (foreign-value "C_INSTALL_MORE_LIBS" c-string))
|
|
(define host-cflags (foreign-value "C_INSTALL_CFLAGS" c-string))
|
|
(define host-ldflags (foreign-value "C_INSTALL_LDFLAGS" c-string))
|