-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild_config.rb
126 lines (93 loc) · 3.3 KB
/
build_config.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# Apache 2.0 License
#
# Copyright (c) 2018 Sebastian Katzer, appPlant GmbH
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
require 'mruby_utils/build_helpers'
MRuby::Lockfile.disable
def gem_config(conf, glibc_version: '2.19')
conf.enable_optimizations
conf.glibc_version = glibc_version
[conf.cc, conf.cxx].each do |cc|
cc.defines << 'MRB_WITHOUT_FLOAT'
end
conf.gem __dir__
end
MRuby::Build.new do |conf|
toolchain ENV.fetch('TOOLCHAIN', :clang)
conf.enable_bintest
conf.enable_debug
conf.enable_test
conf.build_mrbc_exec
gem_config(conf)
end
MRuby::Build.new('x86_64-pc-linux-gnu') do |conf|
toolchain :clang
gem_config(conf)
end
MRuby::Build.new('x86_64-pc-linux-gnu-glibc-2.9') do |conf|
toolchain :clang
gem_config(conf, glibc_version: '2.9')
end
MRuby::CrossBuild.new('x86_64-alpine-linux-musl') do |conf|
toolchain :gcc
[conf.cc, conf.linker].each do |cc|
cc.command = 'musl-gcc'
end
gem_config(conf)
end
MRuby::CrossBuild.new('x86_64-apple-darwin19') do |conf|
toolchain :clang
[conf.cc, conf.linker].each do |cc|
cc.command = 'x86_64-apple-darwin20.4-clang'
cc.flags << '-mmacosx-version-min=10.15'
end
conf.cxx.command = 'x86_64-apple-darwin20.4-clang++'
conf.archiver.command = 'x86_64-apple-darwin20.4-ar'
conf.build_target = 'x86_64-pc-linux-gnu'
conf.host_target = 'x86_64-apple-darwin19'
gem_config(conf)
end
MRuby::CrossBuild.new('arm64-apple-darwin19') do |conf|
toolchain :clang
[conf.cc, conf.linker].each do |cc|
cc.command = 'arm64-apple-darwin20.4-clang'
cc.flags << '-mmacosx-version-min=10.15'
end
conf.cxx.command = 'arm64-apple-darwin20.4-clang++'
conf.archiver.command = 'arm64-apple-darwin20.4-ar'
conf.build_target = 'arm64-pc-linux-gnu'
conf.host_target = 'arm64-apple-darwin19'
gem_config(conf)
end
MRuby::CrossBuild.new('x86_64-w64-mingw32') do |conf|
toolchain :gcc
[conf.cc, conf.linker].each do |cc|
cc.command = 'x86_64-w64-mingw32-gcc'
end
[conf.cc, conf.cxx].each do |cc|
cc.defines << 'PCRE_STATIC'
end
conf.cxx.command = 'x86_64-w64-mingw32-cpp'
conf.archiver.command = 'x86_64-w64-mingw32-gcc-ar'
conf.exts.executable = '.exe'
conf.build_target = 'x86_64-pc-linux-gnu'
conf.host_target = 'x86_64-w64-mingw32'
gem_config(conf)
end