12 |
12 |
13 |
13 |
14 # Guess the value of BUILD_TARGET for system on which we're currently |
14 # Guess the value of BUILD_TARGET for system on which we're currently |
15 # running in form of GNU target triplet, such as `x86_64-pc-linux-gnu`. |
15 # running in form of GNU target triplet, such as `x86_64-pc-linux-gnu`. |
16 # Essentially a wrapper for config.guess used with autotools. |
16 # Essentially a wrapper for config.guess used with autotools. |
17 def build_target_guess() |
17 def build_target_guess |
18 return `./config.guess`.chop() |
18 target = `sh config.guess`.chop |
19 end |
19 # Workaround for MSYS2 / MINGW environment. When using MSYS2 environment to build |
20 |
20 # Smalltalk/X, GNU config.guess reports `x86_64-pc-msys` rather than `i686-pc-mingw32` |
21 unless defined? BUILD_TARGET; BUILD_TARGET = ENV['BUILD_TARGET'] || build_target_guess(); end |
21 # or `x86_64-w64-mingw32` which are the values used by CI and/or third-party libraries. |
|
22 # Therefore we unify the value here (at least for now). |
|
23 case target |
|
24 when 'x86_64-pc-msys' |
|
25 target = 'x86_64-w64-mingw32' |
|
26 end |
|
27 # /Workaround |
|
28 return target |
|
29 end |
|
30 |
|
31 unless defined? BUILD_TARGET; BUILD_TARGET = ENV['BUILD_TARGET'] || build_target_guess; end |
22 |
32 |
23 # "Guess" the current "branch". |
33 # "Guess" the current "branch". |
24 def build_branch_guess() |
34 def build_branch_guess() |
25 repo = HG::Repository.new('.') |
35 repo = HG::Repository.new('.') |
26 return repo.bookmark() || repo.branch() |
36 return repo.bookmark() || repo.branch() |