janneke pushed a commit to branch wip-mingw
in repository guile.
commit d11d9a92d2d2c5e2e97958a1ab31ca86fb4808fd
Author: Jan (janneke) Nieuwenhuizen <[email protected]>
AuthorDate: Thu Mar 18 07:46:49 2021 +0100
Fix 'absolute-file-name?' and others for cross-build to MinGW.
* module/ice-9/boot-9.scm (compile-time-file-name-convention): New
procedure, defined only when loading.
(compile-time-case): Use it to correctly determine system file name
convention while compiling.
---
module/ice-9/boot-9.scm | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm
index 9440617..b7833a6 100644
--- a/module/ice-9/boot-9.scm
+++ b/module/ice-9/boot-9.scm
@@ -2060,6 +2060,16 @@ non-locally, that exit determines the continuation."
;;; {Load Paths}
;;;
+(eval-when (load)
+ (define (compile-time-file-name-convention)
+ (let ((target (fluid-ref (@@ (system base target) %target-type))))
+ (cond ((equal? target %host-type)
+ (system-file-name-convention))
+ ((string-contains-ci target "mingw")
+ 'windows)
+ (else
+ 'posix)))))
+
(let-syntax ((compile-time-case
(lambda (stx)
(syntax-case stx ()
@@ -2077,7 +2087,9 @@ non-locally, that exit determines the continuation."
#'(begin form ...)
(next-clause #'(clauses ...))))))))))))
;; emacs: (put 'compile-time-case 'scheme-indent-function 1)
- (compile-time-case (system-file-name-convention)
+ (compile-time-case (or (and (defined? 'compile-time-file-name-convention)
+ (compile-time-file-name-convention))
+ 'posix)
((posix)
(define (file-name-separator? c)
(char=? c #\/))