author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Sat, 22 Sep 2018 00:00:27 +0100 | |
changeset 257 | c6a3ceed613c |
parent 254 | 70c9861ad62f |
child 298 | 4e3234986e01 |
permissions | -rw-r--r-- |
138 | 1 |
unless defined? BUILD_DIR; BUILD_DIR = 'build'; end |
2 |
unless defined? BUILD_ID; BUILD_ID = (ENV['BUILD_NUMBER'] ? "build#{ENV['BUILD_NUMBER']}" : "#{Time.now.strftime('%Y%m%d')}"); end |
|
3 |
unless defined? ARTIFACTS_DIR; ARTIFACTS_DIR = 'artifacts'; end |
|
4 |
unless defined? REPORT_DIR; REPORT_DIR = 'reports'; end |
|
5 |
unless defined? TMP_DIR; TMP_DIR = 'tmp'; end |
|
6 |
unless defined? DEBUG; DEBUG = nil; end |
|
0
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
7 |
|
144
30d9a0025ae7
Rakefiles: renamed (generated) `config.rb` to `stx-config.rb`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
139
diff
changeset
|
8 |
load BUILD_DIR / 'stx-config.rake' if File.exist?(BUILD_DIR / 'stx-config.rake') |
3
18c56730fabf
Renamed `amd64?` to `x86_64?` for consistency
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
9 |
|
138 | 10 |
unless defined? PROJECT; PROJECT = 'stx:jv-branch'; end |
7
b6fe3a90f6e0
Added `zip()` & `unzip()` extensions to easily create / extract archives from build scripts.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4
diff
changeset
|
11 |
|
169
f9f519bb10b6
Use GNU target triplets to specify build targets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
12 |
|
f9f519bb10b6
Use GNU target triplets to specify build targets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
13 |
|
245
b02b6cf48a23
Rakefiles: use `config.guess` from autotools for aut-detect `BUILD_TARGET`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
238
diff
changeset
|
14 |
# Guess the value of BUILD_TARGET for system on which we're currently |
b02b6cf48a23
Rakefiles: use `config.guess` from autotools for aut-detect `BUILD_TARGET`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
238
diff
changeset
|
15 |
# running in form of GNU target triplet, such as `x86_64-pc-linux-gnu`. |
b02b6cf48a23
Rakefiles: use `config.guess` from autotools for aut-detect `BUILD_TARGET`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
238
diff
changeset
|
16 |
# Essentially a wrapper for config.guess used with autotools. |
251
492082f2f11d
Windows 10 target guess workaround (mapping unknown target to known one)
patrik.svestka@gmail.com
parents:
245
diff
changeset
|
17 |
def build_target_guess |
492082f2f11d
Windows 10 target guess workaround (mapping unknown target to known one)
patrik.svestka@gmail.com
parents:
245
diff
changeset
|
18 |
target = `sh config.guess`.chop |
492082f2f11d
Windows 10 target guess workaround (mapping unknown target to known one)
patrik.svestka@gmail.com
parents:
245
diff
changeset
|
19 |
# Workaround for MSYS2 / MINGW environment. When using MSYS2 environment to build |
492082f2f11d
Windows 10 target guess workaround (mapping unknown target to known one)
patrik.svestka@gmail.com
parents:
245
diff
changeset
|
20 |
# Smalltalk/X, GNU config.guess reports `x86_64-pc-msys` rather than `i686-pc-mingw32` |
492082f2f11d
Windows 10 target guess workaround (mapping unknown target to known one)
patrik.svestka@gmail.com
parents:
245
diff
changeset
|
21 |
# or `x86_64-w64-mingw32` which are the values used by CI and/or third-party libraries. |
492082f2f11d
Windows 10 target guess workaround (mapping unknown target to known one)
patrik.svestka@gmail.com
parents:
245
diff
changeset
|
22 |
# Therefore we unify the value here (at least for now). |
492082f2f11d
Windows 10 target guess workaround (mapping unknown target to known one)
patrik.svestka@gmail.com
parents:
245
diff
changeset
|
23 |
case target |
492082f2f11d
Windows 10 target guess workaround (mapping unknown target to known one)
patrik.svestka@gmail.com
parents:
245
diff
changeset
|
24 |
when 'x86_64-pc-msys' |
492082f2f11d
Windows 10 target guess workaround (mapping unknown target to known one)
patrik.svestka@gmail.com
parents:
245
diff
changeset
|
25 |
target = 'x86_64-w64-mingw32' |
492082f2f11d
Windows 10 target guess workaround (mapping unknown target to known one)
patrik.svestka@gmail.com
parents:
245
diff
changeset
|
26 |
end |
492082f2f11d
Windows 10 target guess workaround (mapping unknown target to known one)
patrik.svestka@gmail.com
parents:
245
diff
changeset
|
27 |
# /Workaround |
492082f2f11d
Windows 10 target guess workaround (mapping unknown target to known one)
patrik.svestka@gmail.com
parents:
245
diff
changeset
|
28 |
return target |
3
18c56730fabf
Renamed `amd64?` to `x86_64?` for consistency
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
29 |
end |
18c56730fabf
Renamed `amd64?` to `x86_64?` for consistency
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
30 |
|
251
492082f2f11d
Windows 10 target guess workaround (mapping unknown target to known one)
patrik.svestka@gmail.com
parents:
245
diff
changeset
|
31 |
unless defined? BUILD_TARGET; BUILD_TARGET = ENV['BUILD_TARGET'] || build_target_guess; end |
169
f9f519bb10b6
Use GNU target triplets to specify build targets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
32 |
|
249
20b718d60bba
Rakefiles: automagically checkout revisions for given branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
245
diff
changeset
|
33 |
# "Guess" the current "branch". |
20b718d60bba
Rakefiles: automagically checkout revisions for given branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
245
diff
changeset
|
34 |
def build_branch_guess() |
20b718d60bba
Rakefiles: automagically checkout revisions for given branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
245
diff
changeset
|
35 |
repo = HG::Repository.new('.') |
20b718d60bba
Rakefiles: automagically checkout revisions for given branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
245
diff
changeset
|
36 |
return repo.bookmark() || repo.branch() |
20b718d60bba
Rakefiles: automagically checkout revisions for given branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
245
diff
changeset
|
37 |
end |
20b718d60bba
Rakefiles: automagically checkout revisions for given branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
245
diff
changeset
|
38 |
|
20b718d60bba
Rakefiles: automagically checkout revisions for given branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
245
diff
changeset
|
39 |
BUILD_BRANCH = build_branch_guess() |
20b718d60bba
Rakefiles: automagically checkout revisions for given branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
245
diff
changeset
|
40 |
|
137
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
41 |
unless defined? TOOLCHAIN |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
42 |
if ENV.has_key? 'TOOLCHAIN' |
3
18c56730fabf
Renamed `amd64?` to `x86_64?` for consistency
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
43 |
TOOLCHAIN = ENV['TOOLCHAIN'] |
18c56730fabf
Renamed `amd64?` to `x86_64?` for consistency
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
44 |
else |
137
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
45 |
if unix? |
3
18c56730fabf
Renamed `amd64?` to `x86_64?` for consistency
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
46 |
TOOLCHAIN='gcc' |
169
f9f519bb10b6
Use GNU target triplets to specify build targets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
47 |
elsif win32? |
f9f519bb10b6
Use GNU target triplets to specify build targets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
144
diff
changeset
|
48 |
if /x86_64/ =~ BUILD_TARGET |
3
18c56730fabf
Renamed `amd64?` to `x86_64?` for consistency
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
49 |
TOOLCHAIN='mingw64' |
137
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
50 |
else |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
51 |
TOOLCHAIN='mingw32' |
3
18c56730fabf
Renamed `amd64?` to `x86_64?` for consistency
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
52 |
end |
18c56730fabf
Renamed `amd64?` to `x86_64?` for consistency
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
53 |
else |
139
9ba260bbbdf0
Fixed slip in commit 2507036dfee8 causing runtime error when building 32bit Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
138
diff
changeset
|
54 |
raise Exception.new('Unsupported operating system') |
3
18c56730fabf
Renamed `amd64?` to `x86_64?` for consistency
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
55 |
end |
18c56730fabf
Renamed `amd64?` to `x86_64?` for consistency
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
56 |
end |
18c56730fabf
Renamed `amd64?` to `x86_64?` for consistency
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
57 |
end |
18c56730fabf
Renamed `amd64?` to `x86_64?` for consistency
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
58 |
|
144
30d9a0025ae7
Rakefiles: renamed (generated) `config.rb` to `stx-config.rb`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
139
diff
changeset
|
59 |
unless File.exist? BUILD_DIR / 'stx-config.rake' |
0
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
60 |
if defined? PROJECT |
144
30d9a0025ae7
Rakefiles: renamed (generated) `config.rb` to `stx-config.rb`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
139
diff
changeset
|
61 |
mkdir_p BUILD_DIR |
30d9a0025ae7
Rakefiles: renamed (generated) `config.rb` to `stx-config.rb`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
139
diff
changeset
|
62 |
File.open(BUILD_DIR / 'stx-config.rake', 'w') do | f | |
18
647bee28090f
Write default configuration to `config.rb` rather than to `.config.rake`.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
9
diff
changeset
|
63 |
f.puts <<COMMENT |
647bee28090f
Write default configuration to `config.rb` rather than to `.config.rake`.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
9
diff
changeset
|
64 |
# This file contans a default build configuration. It is created automatically |
647bee28090f
Write default configuration to `config.rb` rather than to `.config.rake`.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
9
diff
changeset
|
65 |
# when `rake` is called for the very first time. You may still override values |
647bee28090f
Write default configuration to `config.rb` rather than to `.config.rake`.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
9
diff
changeset
|
66 |
# on command line, i.e., |
647bee28090f
Write default configuration to `config.rb` rather than to `.config.rake`.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
9
diff
changeset
|
67 |
# |
647bee28090f
Write default configuration to `config.rb` rather than to `.config.rake`.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
9
diff
changeset
|
68 |
# rake PROJECT=some-other-project |
647bee28090f
Write default configuration to `config.rb` rather than to `.config.rake`.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
9
diff
changeset
|
69 |
# |
647bee28090f
Write default configuration to `config.rb` rather than to `.config.rake`.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
9
diff
changeset
|
70 |
# This file SHOULD NOT be checked in a repository. |
647bee28090f
Write default configuration to `config.rb` rather than to `.config.rake`.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
9
diff
changeset
|
71 |
# |
647bee28090f
Write default configuration to `config.rb` rather than to `.config.rake`.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
9
diff
changeset
|
72 |
COMMENT |
138 | 73 |
f.puts "unless defined? PROJECT; PROJECT='#{PROJECT}'; end" |
238
8d6be42520be
Rakefiles: cleanup - removed `REPOSITORYSET` variable
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
234
diff
changeset
|
74 |
f.puts "unless defined? BUILD_TARGET; BUILD_TARGET = '#{BUILD_TARGET}'; end" |
0
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
75 |
if defined? PROJECT_DIRS |
138 | 76 |
f.puts "unless defined? PROJECT_DIRS; PROJECT_DIRS='#{PROJECT_DIRS}'; end" |
0
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
77 |
end |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
78 |
end |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
79 |
end |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
80 |
end |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
81 |
|
138 | 82 |
unless defined? PROJECT_DIRS; PROJECT_DIRS = ''; end |
137
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
83 |
|
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
84 |
case TOOLCHAIN |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
85 |
when 'gcc' |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
86 |
OBJ_DIR = '.' |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
87 |
OBJ_SUFFIX = 'o' |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
88 |
MAKE='make' |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
89 |
|
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
90 |
when 'bcc' |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
91 |
OBJ_DIR = 'objbc' |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
92 |
OBJ_SUFFIX = 'obj' |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
93 |
MAKE='bmake.bat -DUSEBC' |
0
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
94 |
|
137
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
95 |
when 'mingw64' |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
96 |
if File.exist? 'C:\mingw64\bin' |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
97 |
ENV['MINGW_DIR'] ='C:\MINGW64' |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
98 |
ENV['USEMINGW_ARG'] = '-DUSEMINGW64' |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
99 |
elsif File.exist? 'C:\MSYS64\MINGW64\bin\gcc.exe' |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
100 |
ENV['MINGW_DIR'] ='C:\MSYS64\MINGW64' |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
101 |
ENV['USEMINGW_ARG'] = '-DUSEMINGW64' |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
102 |
else |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
103 |
raise Exception.new(%q{MINGW64 nor MSYS2 found in C:\MinGW64 nor C:\MSYS64!}) |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
104 |
end |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
105 |
ENV['MINGW'] = '__MINGW64__' |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
106 |
OBJ_DIR = 'objmingw' |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
107 |
OBJ_SUFFIX = 'obj' |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
108 |
MAKE='mingwmake.bat' |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
109 |
ENV['PATH'] = "#{ENV['PATH']};#{ENV['MINGW_DIR']}\\bin" |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
110 |
|
139
9ba260bbbdf0
Fixed slip in commit 2507036dfee8 causing runtime error when building 32bit Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
138
diff
changeset
|
111 |
when 'mingw32' |
137
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
112 |
if File.exist? 'C:\mingw\bin' |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
113 |
ENV['MINGW_DIR'] ='C:\MINGW' |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
114 |
ENV['USEMINGW_ARG'] = '-DUSEMINGW32' |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
115 |
elsif File.exist? 'C:\MSYS64\MINGW32\bin\gcc.exe' |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
116 |
ENV['MINGW_DIR'] ='C:\MSYS64\MINGW32' |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
117 |
ENV['USEMINGW_ARG'] = '-DUSEMINGW32' |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
118 |
system 'set' |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
119 |
elsif File.exist? 'C:\MSYS\MINGW32\bin\gcc.exe' |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
120 |
ENV['MINGW_DIR'] ='C:\MSYS\MINGW32' |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
121 |
ENV['USEMINGW_ARG'] = '-DUSEMINGW32' |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
122 |
else |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
123 |
raise Exception.new(%q{MINGW32 nor MSYS2 found in C:\MinGW nor C:\MSYS64 nor C:\MSYS!}) |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
124 |
end |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
125 |
ENV['MINGW'] = '__MINGW32__' |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
126 |
OBJ_DIR = 'objmingw' |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
127 |
OBJ_SUFFIX = 'obj' |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
128 |
MAKE='mingwmake.bat' |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
129 |
ENV['PATH'] = "#{ENV['PATH']};#{ENV['MINGW_DIR']}\\bin" |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
130 |
|
23
7dad21b22558
Added support to build under MSYS2 environment
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18
diff
changeset
|
131 |
else |
139
9ba260bbbdf0
Fixed slip in commit 2507036dfee8 causing runtime error when building 32bit Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
138
diff
changeset
|
132 |
raise Exception.new("Unsupported toolchain: #{TOOLCHAIN}") |
0
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
133 |
end |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
134 |
|
137
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
135 |
task :setup => %i(setup:pre |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
136 |
setup:main |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
137 |
setup:post) |
0
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
138 |
|
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
139 |
task :'setup:pre' |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
140 |
task :'setup:post' |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
141 |
|
137
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
142 |
task :'setup:main' => %i(setup:projects setup:project setup:tasks) |
0
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
143 |
|
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
144 |
task :'setup:projects' do |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
145 |
Rake::Stx::Configuration.read_specs(PROJECT_DIRS) |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
146 |
end |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
147 |
|
137
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
148 |
task :'setup:project' => :'setup:projects' do |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
149 |
unless defined? PROJECT; error('PROJECT variable not defined!') end |
0
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
150 |
project! PROJECT.to_sym |
137
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
151 |
project.apply_imports |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
152 |
app_name = project.app_name || 'smalltalkx' |
234
05943c900d5e
Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
216
diff
changeset
|
153 |
app_version = project.app_version || '8.0.0' |
0
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
154 |
|
234
05943c900d5e
Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
216
diff
changeset
|
155 |
if not defined? BUILD_NAME; |
05943c900d5e
Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
216
diff
changeset
|
156 |
BUILD_NAME = "#{app_name}-#{app_version}_#{BUILD_TARGET}" |
05943c900d5e
Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
216
diff
changeset
|
157 |
end |
93
650412e81596
Automatically extract package dependencies from project definition file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
85
diff
changeset
|
158 |
end |
650412e81596
Automatically extract package dependencies from project definition file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
85
diff
changeset
|
159 |
|
137
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
160 |
task :'setup:dependencies' => :checkout do |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
161 |
project.packages.each do |pkg| |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
162 |
if pkg.name == 'stx:stc' or pkg.name == 'stx:librun' or File.exist? (BUILD_DIR / pkg.directory / pkg.project_definition_file_name) |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
163 |
unless pkg.test_package? |
93
650412e81596
Automatically extract package dependencies from project definition file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
85
diff
changeset
|
164 |
task "#{project.application.name}:dependencies" => pkg.name |
650412e81596
Automatically extract package dependencies from project definition file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
85
diff
changeset
|
165 |
task "#{pkg.name}:dependencies" => pkg.prereqs(mandatory: true) |
650412e81596
Automatically extract package dependencies from project definition file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
85
diff
changeset
|
166 |
end |
650412e81596
Automatically extract package dependencies from project definition file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
85
diff
changeset
|
167 |
end |
650412e81596
Automatically extract package dependencies from project definition file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
85
diff
changeset
|
168 |
end |
0
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
169 |
end |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
170 |
|
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
171 |
task :'setup:tasks' => :'setup:tasks:internal' |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
172 |
|
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
173 |
task :'setup:tasks:internal' => :'setup:project' do |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
174 |
|
137
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
175 |
project.tasks.each {|t| t.define!} |
0
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
176 |
|
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
177 |
# compile task |
137
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
178 |
project.application ? (task :'compile:application' => project.application.name) : (task :'compile:application') |
0
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
179 |
|
137
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
180 |
info 'Defining tasks for packages...' |
0
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
181 |
|
137
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
182 |
project.packages_and_application.each do |pkg| |
0
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
183 |
|
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
184 |
info "Defining task for package #{pkg.name}" |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
185 |
|
93
650412e81596
Automatically extract package dependencies from project definition file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
85
diff
changeset
|
186 |
if unix? #and not File.exist? BUILD_DIR / pkg.directory / 'makefile' |
137
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
187 |
task pkg.name => [BUILD_DIR / pkg.directory / 'makefile'] |
0
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
188 |
file BUILD_DIR / pkg.directory / 'makefile' do |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
189 |
chdir BUILD_DIR / pkg.directory do |
138 | 190 |
raise Exception.new("Cannot run stmkmf for #{pkg.directory}") unless system "#{pkg.top / 'stx' / 'rules' / 'stmkmf'}" |
0
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
191 |
end |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
192 |
end |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
193 |
end |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
194 |
|
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
195 |
#require 'find' |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
196 |
#[ 'bitmaps', 'resources' ].each do | dir | |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
197 |
# path = BUILD_DIR / pkg.directory() / dir |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
198 |
# if File.exist?(path) |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
199 |
# Find.find(File.expand_path(path)) do | file | |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
200 |
# if FileTest.directory?(file) |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
201 |
# if (File.basename(file) == '..') || (File.basename(file) == '.') |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
202 |
# Find.prune # Don't look any further into this directory. |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
203 |
# else |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
204 |
# if File.exists?(File.join(file, '.svn')) |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
205 |
# rm_rf File.join(file, '.svn') |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
206 |
# #Find.prune |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
207 |
# end |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
208 |
# end |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
209 |
# end |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
210 |
# end |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
211 |
# end |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
212 |
#end |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
213 |
|
131
edaf0258b9c2
Rakefiles: make per-package compilation task to setup its dependencies
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
113
diff
changeset
|
214 |
task "#{pkg.name}" => [ :'setup:dependencies' , "#{pkg.name}:dependencies", "#{pkg.name}:pre", "#{pkg.name}:main", "#{pkg.name}:post" ] |
137
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
215 |
|
133
8229af6e81df
Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
216 |
# For Smalltalk class libraries, we have to update VM symbol database |
8229af6e81df
Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
217 |
# if changed... |
138 | 218 |
if pkg.name != 'stx:stc' && pkg.name != 'stx:librun' |
219 |
task "#{pkg.name}" => %w(stx:librun:symbols) |
|
133
8229af6e81df
Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
132
diff
changeset
|
220 |
end |
0
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
221 |
|
131
edaf0258b9c2
Rakefiles: make per-package compilation task to setup its dependencies
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
113
diff
changeset
|
222 |
task "#{pkg.name}:dependencies" |
0
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
223 |
task "#{pkg.name}:pre" |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
224 |
task "#{pkg.name}:post" |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
225 |
|
137
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
226 |
task "#{pkg.name}:main" do |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
227 |
make_vars = '' |
0
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
228 |
d = win32? ? '-D' : '' |
137
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
229 |
q = win32? ? '"' : "'" |
0
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
230 |
|
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
231 |
|
138 | 232 |
(make_vars += "STC=#{STC}") if unix? |
137
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
233 |
|
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
234 |
if pkg.application? and !win32? |
0
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
235 |
liblist='' |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
236 |
libobjs='' |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
237 |
link_libobjs='' |
137
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
238 |
project.packages.each do |p| |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
239 |
if File.exist? (BUILD_DIR / p.directory / p.project_definition_file_name) |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
240 |
if !p.application? and p.link and !p.test_package? |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
241 |
liblist += "#{p.dll_name_without_suffix} " |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
242 |
libobjs += "#{File.join(pkg.top, p.directory, p.dll_name)} " |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
243 |
link_libobjs += "#{p.dll_name} " |
93
650412e81596
Automatically extract package dependencies from project definition file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
85
diff
changeset
|
244 |
end |
0
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
245 |
end |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
246 |
end |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
247 |
make_vars += " #{q}#{d}LIBLIST=#{liblist}#{q}" |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
248 |
make_vars += " #{q}#{d}LIBOBJS=#{libobjs}#{q}" |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
249 |
make_vars += " #{q}#{d}LINK_LIBOBJS=#{link_libobjs}#{q}" |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
250 |
end |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
251 |
|
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
252 |
# Update stc flags, |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
253 |
stc_flags = pkg.stc_flags |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
254 |
|
138 | 255 |
(make_vars += " #{q}#{d}STC_CMD_OPT=#{stc_flags}#{q}") if stc_flags |
0
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
256 |
|
137
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
257 |
(rm BUILD_DIR / pkg.directory / 'GNUmakefile') if File.exist? BUILD_DIR / pkg.directory / 'GNUmakefile' |
0
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
258 |
|
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
259 |
info "Compiling #{pkg.name}..." |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
260 |
make_vars = "#{make_vars} #{DEBUG}" |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
261 |
chdir BUILD_DIR / pkg.directory do |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
262 |
if pkg.application? and win32? |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
263 |
make 'exe' |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
264 |
make 'RESOURCEFILES' |
137
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
265 |
else |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
266 |
if pkg.name == 'stx:stc' |
102
fc572bd895f2
Cleanup: treat stx:stc & stx:librun as normal packages
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
101
diff
changeset
|
267 |
# Sigh, on UNIX makefile is generated. So if we're using |
fc572bd895f2
Cleanup: treat stx:stc & stx:librun as normal packages
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
101
diff
changeset
|
268 |
# binary stc, we have to recreate it first. |
137
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
269 |
if unix? |
138 | 270 |
(sh "'#{STX_TOP_DIR / 'rules' / 'stmkmf'}'") unless File.exist?('makefile') |
102
fc572bd895f2
Cleanup: treat stx:stc & stx:librun as normal packages
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
101
diff
changeset
|
271 |
end |
fc572bd895f2
Cleanup: treat stx:stc & stx:librun as normal packages
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
101
diff
changeset
|
272 |
make |
fc572bd895f2
Cleanup: treat stx:stc & stx:librun as normal packages
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
101
diff
changeset
|
273 |
elsif pkg.name == 'stx:librun' |
138 | 274 |
# A workaround for Windows 10 & ancient Borland make which |
111
767f2ace9b82
Win32: A nasty workaround to avoid Borland make to crash under Windows 10
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
102
diff
changeset
|
275 |
# tend to crash there when trying to recompile already compiled |
767f2ace9b82
Win32: A nasty workaround to avoid Borland make to crash under Windows 10
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
102
diff
changeset
|
276 |
# librun. Sigh, we have to move away from it as soon as possible! |
138 | 277 |
(touch 'stxmain.c') if win32? and File.exist?('stxmain.c') |
102
fc572bd895f2
Cleanup: treat stx:stc & stx:librun as normal packages
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
101
diff
changeset
|
278 |
make |
138 | 279 |
if !pkg.application? and win32? |
132
076776f79023
Rakefiles: copy built `.dll to application directory after package is compiled.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
131
diff
changeset
|
280 |
cp 'objmingw' / 'librun.dll', |
076776f79023
Rakefiles: copy built `.dll to application directory after package is compiled.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
131
diff
changeset
|
281 |
pkg.top / project.application.directory |
076776f79023
Rakefiles: copy built `.dll to application directory after package is compiled.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
131
diff
changeset
|
282 |
end |
0
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
283 |
else |
102
fc572bd895f2
Cleanup: treat stx:stc & stx:librun as normal packages
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
101
diff
changeset
|
284 |
# Somewhat stupid detection whether we run recent St/X or not |
fc572bd895f2
Cleanup: treat stx:stc & stx:librun as normal packages
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
101
diff
changeset
|
285 |
# ('recent' mean more recent than 3 years or so) |
fc572bd895f2
Cleanup: treat stx:stc & stx:librun as normal packages
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
101
diff
changeset
|
286 |
# TODO: Remove this hack |
fc572bd895f2
Cleanup: treat stx:stc & stx:librun as normal packages
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
101
diff
changeset
|
287 |
if File.exist? BUILD_DIR / 'stx' / 'libbasic2' / 'Makefile.init' |
fc572bd895f2
Cleanup: treat stx:stc & stx:librun as normal packages
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
101
diff
changeset
|
288 |
make "#{make_vars} full" |
fc572bd895f2
Cleanup: treat stx:stc & stx:librun as normal packages
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
101
diff
changeset
|
289 |
else |
fc572bd895f2
Cleanup: treat stx:stc & stx:librun as normal packages
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
101
diff
changeset
|
290 |
make "#{make_vars}" |
fc572bd895f2
Cleanup: treat stx:stc & stx:librun as normal packages
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
101
diff
changeset
|
291 |
end |
132
076776f79023
Rakefiles: copy built `.dll to application directory after package is compiled.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
131
diff
changeset
|
292 |
# On Windows, copy the DLL application directory |
138 | 293 |
if !pkg.application? and win32? |
294 |
if !uptodate? pkg.top / project.application.directory, [ OBJ_DIR / pkg.dll_name ] |
|
216
ca243e8d46c8
Rakefiles: on Windows also copy debug info files (`.dll.debug`)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
169
diff
changeset
|
295 |
cp OBJ_DIR / pkg.dll_name, pkg.top / project.application.directory |
ca243e8d46c8
Rakefiles: on Windows also copy debug info files (`.dll.debug`)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
169
diff
changeset
|
296 |
end |
ca243e8d46c8
Rakefiles: on Windows also copy debug info files (`.dll.debug`)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
169
diff
changeset
|
297 |
if !uptodate? pkg.top / project.application.directory, [ OBJ_DIR / "#{pkg.dll_name}.debug" ] |
ca243e8d46c8
Rakefiles: on Windows also copy debug info files (`.dll.debug`)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
169
diff
changeset
|
298 |
cp OBJ_DIR / "#{pkg.dll_name}.debug", pkg.top / project.application.directory |
132
076776f79023
Rakefiles: copy built `.dll to application directory after package is compiled.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
131
diff
changeset
|
299 |
end |
076776f79023
Rakefiles: copy built `.dll to application directory after package is compiled.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
131
diff
changeset
|
300 |
end |
0
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
301 |
end |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
302 |
end |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
303 |
end |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
304 |
|
137
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
305 |
if pkg.application? and unix? |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
306 |
chdir BUILD_DIR / 'stx' / 'librun' do; make; end |
0
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
307 |
end |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
308 |
|
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
309 |
|
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
310 |
end |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
311 |
|
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
312 |
if pkg.application? |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
313 |
if win32? |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
314 |
task pkg.name => BUILD_DIR / pkg.directory / 'modules.stx' |
137
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
315 |
|
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
316 |
task BUILD_DIR / pkg.directory / 'modules.stx' do |t| |
0
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
317 |
rm t.name if File.exist? t.name |
137
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
318 |
File.open(t.name, 'w') do |f| |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
319 |
project.packages.each do |p| |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
320 |
if !p.application? and p.link and !p.test_package? and p.name != 'stx:stc' and p.name != 'stx:librun' and File.exist? BUILD_DIR / p.directory / OBJ_DIR / p.dll_name |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
321 |
f.puts p.dll_name_without_suffix |
0
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
322 |
end |
137
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
323 |
end |
0
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
324 |
end |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
325 |
end |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
326 |
|
137
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
327 |
project.packages.each do |p| |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
328 |
if !p.application? and !p.test_package? |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
329 |
task pkg.name => BUILD_DIR / pkg.directory / p.dll_name |
0
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
330 |
|
137
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
331 |
file BUILD_DIR / pkg.directory / p.dll_name do |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
332 |
if !p.application? and p.link and !p.test_package? and File.exist? BUILD_DIR / p.directory / OBJ_DIR / p.dll_name |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
333 |
cp BUILD_DIR / p.directory / OBJ_DIR / p.dll_name, |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
334 |
BUILD_DIR / pkg.directory / p.dll_name |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
335 |
end |
0
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
336 |
end |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
337 |
end |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
338 |
|
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
339 |
if win32_wine? |
137
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
340 |
file BUILD_DIR / pkg.directory / p.dll_name do |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
341 |
cp BUILD_DIR / p.directory / OBJ_DIR / p.dll_name, |
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
342 |
BUILD_DIR / pkg.directory / p.dll_name |
0
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
343 |
end |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
344 |
end |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
345 |
|
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
346 |
end |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
347 |
else # UNIX |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
348 |
task "#{pkg.name}:main" => BUILD_DIR / pkg.directory / 'modulList.stc' |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
349 |
|
137
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
350 |
task BUILD_DIR / pkg.directory / 'modulList.stc' do |t| |
0
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
351 |
rm t.name if File.exist? t.name |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
352 |
end |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
353 |
|
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
354 |
task "#{pkg.name}:main" => BUILD_DIR / pkg.directory / 'modulList.c' |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
355 |
|
137
e665031cade7
Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents:
113
diff
changeset
|
356 |
task BUILD_DIR / pkg.directory / 'modulList.c' do |t| |
0
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
357 |
rm t.name if File.exist? t.name |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
358 |
end |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
359 |
end |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
360 |
end |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
361 |
end |
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
362 |
|
f46260ba26b1
Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
363 |
end |