Windows 10 target guess workaround (mapping unknown target to known one)
authorpatrik.svestka@gmail.com
Mon, 20 Aug 2018 15:22:44 +0200
changeset 251 492082f2f11d
parent 248 a13b0f9ba9e9
child 252 135a52fc8891
Windows 10 target guess workaround (mapping unknown target to known one)
rakelib/setup.rake
--- a/rakelib/setup.rake	Wed Jun 27 21:21:19 2018 +0100
+++ b/rakelib/setup.rake	Mon Aug 20 15:22:44 2018 +0200
@@ -14,11 +14,21 @@
 # Guess the value of BUILD_TARGET for system on which we're currently 
 # running in form of GNU target triplet, such as `x86_64-pc-linux-gnu`.
 # Essentially a wrapper for config.guess used with autotools. 
-def build_target_guess()
-  return `./config.guess`.chop()
+def build_target_guess
+  target = `sh config.guess`.chop
+  # Workaround for MSYS2 / MINGW environment. When using MSYS2 environment to build 
+  # Smalltalk/X, GNU config.guess reports `x86_64-pc-msys` rather than `i686-pc-mingw32`
+  # or `x86_64-w64-mingw32` which are the values used by CI and/or third-party libraries. 
+  # Therefore we unify the value here (at least for now).
+  case target
+    when 'x86_64-pc-msys'
+      target = 'x86_64-w64-mingw32'
+  end  
+  # /Workaround
+  return target
 end
 
-unless defined? BUILD_TARGET; BUILD_TARGET = ENV['BUILD_TARGET'] || build_target_guess(); end
+unless defined? BUILD_TARGET; BUILD_TARGET = ENV['BUILD_TARGET'] || build_target_guess; end
 
 unless defined? TOOLCHAIN
   if ENV.has_key? 'TOOLCHAIN'