From ce6139ca5d867700c3e4b391236a3489b01c7d3d Mon Sep 17 00:00:00 2001 From: Evan Hanson Date: Tue, 27 Feb 2018 22:19:26 +1300 Subject: [PATCH] Adjust `build-platform' and `software-version' values for Cygwin and MinGW This changes the platform reporting for Cygwin and MinGW as follows: (build-platform) ; => clang, gnu, or unknown (was cygwin/mingw32) (software-version) ; => cygwin or mingw32 (was unknown on both) These differences are intended to reflect the fact that Cygwin can build software with either the GNU compiler toolchain or Clang (and Mingw presumably too), and that the runtime platform is known to be Cygwin or Mingw. Signed-off-by: Peter Bex --- NEWS | 5 +++++ chicken-install.scm | 2 +- chicken.h | 10 +++++----- csc.scm | 4 ++-- eval.scm | 2 +- library.scm | 2 +- pathname.scm | 2 +- posix.scm | 2 +- scripts/makedist.scm | 13 +++++-------- 9 files changed, 22 insertions(+), 20 deletions(-) diff --git a/NEWS b/NEWS index e7486888..8ef3d185 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,11 @@ - Removed the deprecated C_locative_ref and C_mutate2 C functions. - The trace buffer no longer holds on to thread objects, allowing them to be garbage collected sooner (#1356, thanks to Kristian Lein-Mathisen) + - On Cygwin and MinGW, the "build-platform" now corresponds to the + tool chain used (gnu, clang, unknown) like on *nix, while the + software-version is now "cygwin" or "mingw32" instead of "unknown". + This also means the features list will now contain the tool chain + on all platforms. - Compiler - Fixed an off by one allocation problem in generated C code for (list ...). diff --git a/chicken-install.scm b/chicken-install.scm index 7e9ddd1f..2e32b8e6 100644 --- a/chicken-install.scm +++ b/chicken-install.scm @@ -99,7 +99,7 @@ (define no-deps #f) (define platform - (if (eq? 'mingw32 (build-platform)) + (if (eq? 'mingw32 (software-version)) 'windows 'unix)) diff --git a/chicken.h b/chicken.h index 150736c4..3ab186ab 100644 --- a/chicken.h +++ b/chicken.h @@ -680,12 +680,8 @@ void *alloca (); # define C_SOFTWARE_TYPE "unknown" #endif -#if defined(__CYGWIN__) -# define C_BUILD_PLATFORM "cygwin" -#elif defined(__SUNPRO_C) +#if defined(__SUNPRO_C) # define C_BUILD_PLATFORM "sun" -#elif defined(__MINGW32__) -# define C_BUILD_PLATFORM "mingw32" #elif defined(__clang__) # define C_BUILD_PLATFORM "clang" #elif defined(_AIX) @@ -724,6 +720,10 @@ void *alloca (); # define C_SOFTWARE_VERSION "aix" #elif defined(__GNU__) # define C_SOFTWARE_VERSION "hurd" +#elif defined(__CYGWIN__) +# define C_SOFTWARE_VERSION "cygwin" +#elif defined(__MINGW32__) +# define C_SOFTWARE_VERSION "mingw32" #else # define C_SOFTWARE_VERSION "unknown" #endif diff --git a/csc.scm b/csc.scm index 333efcd5..25694f4a 100644 --- a/csc.scm +++ b/csc.scm @@ -63,9 +63,9 @@ ;;; Parameters: -(define mingw (eq? (build-platform) 'mingw32)) +(define mingw (eq? (software-version) 'mingw32)) (define osx (eq? (software-version) 'macosx)) -(define cygwin (eq? (build-platform) 'cygwin)) +(define cygwin (eq? (software-version) 'cygwin)) (define aix (eq? (build-platform) 'aix)) (define elf diff --git a/eval.scm b/eval.scm index 8df126ef..1a8c056b 100644 --- a/eval.scm +++ b/eval.scm @@ -953,7 +953,7 @@ srfi-16 srfi-17 srfi-26 srfi-31 srfi-55 srfi-88)) ; syntax cont (define default-dynamic-load-libraries - (case (build-platform) + (case (software-version) ((cygwin) cygwin-default-dynamic-load-libraries) (else `(,(string-append "lib" install-lib-name))))) diff --git a/library.scm b/library.scm index cd71a216..47fb56ec 100644 --- a/library.scm +++ b/library.scm @@ -6434,7 +6434,7 @@ static C_word C_fcall C_setenv(C_word x, C_word y) { (define ##sys#windows-platform (and (eq? 'windows (software-type)) ;; Still windows even if 'Linux-like' - (not (eq? 'cygwin (build-platform))))) + (not (eq? 'cygwin (software-version))))) (define (chicken-version #!optional full) (define (get-config) diff --git a/pathname.scm b/pathname.scm index 8f42a5da..f01aa92e 100644 --- a/pathname.scm +++ b/pathname.scm @@ -230,7 +230,7 @@ ;;; normalize pathname for a particular platform (define normalize-pathname - (let ((bldplt (if (eq? (build-platform) 'mingw32) 'windows 'unix))) + (let ((bldplt (if (eq? (software-version) 'mingw32) 'windows 'unix))) (define (addpart part parts) (cond ((string=? "." part) parts) ((string=? ".." part) diff --git a/posix.scm b/posix.scm index 0129dbd3..480273e1 100644 --- a/posix.scm +++ b/posix.scm @@ -202,7 +202,7 @@ ;;; Quote string for shell: -(define (qs str #!optional (platform (build-platform))) +(define (qs str #!optional (platform (software-version))) (let* ((delim (if (eq? platform 'mingw32) #\" #\')) (escaped (if (eq? platform 'mingw32) "\"\"" "'\\''")) (escaped-parts diff --git a/scripts/makedist.scm b/scripts/makedist.scm index 5c804690..bc601ada 100644 --- a/scripts/makedist.scm +++ b/scripts/makedist.scm @@ -22,14 +22,11 @@ (define *platform* (let ((sv (symbol->string (software-version)))) (cond ((irregex-match ".*bsd" sv) "bsd") - (else - (case (build-platform) - ((mingw32) - (if (equal? (get-environment-variable "MSYSTEM") "MINGW32") - "mingw-msys" - "mingw32")) - ((msvc) "msvc") - (else sv)))))) + ((string=? sv "mingw32") + (if (equal? (get-environment-variable "MSYSTEM") "MINGW32") + "mingw-msys" + "mingw32")) + (else sv)))) (define *make* (cond ((string=? "bsd" *platform*) "gmake") -- 2.11.0