-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild_config.rb
71 lines (55 loc) · 1.56 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
def gem_config(conf)
conf.gembox 'default'
# be sure to include this gem (the cli app)
conf.gem(File.expand_path(File.dirname(__FILE__)))
libressl_dir = ENV["LIBRESSL_DIR"]
libressl_dir ||=
if RUBY_PLATFORM =~ /darwin/i
"#{ENV["HOMEBREW_PREFIX"] || "/usr/local" }/opt/libressl"
else
# Our docker image default
"/home/mruby/opt/libressl"
end
# C compiler settings
conf.cc do |cc|
cc.include_paths << ["#{libressl_dir}/include"]
linker.library_paths << ["#{libressl_dir}/lib"]
linker.flags_before_libraries << [
"#{libressl_dir}/lib/libtls.a",
"#{libressl_dir}/lib/libssl.a",
"#{libressl_dir}/lib/libcrypto.a"
]
if RUBY_PLATFORM =~ /darwin/i
cc.include_paths << %w(/usr/local/include)
linker.library_paths << %w(/usr/local/lib)
else
cc.flags << [ENV['CFLAGS'] || %w(-fPIC -DHAVE_ARPA_INET_H)]
end
end
end
build_targets = ENV.fetch("BUILD_TARGET", "").split(",")
MRuby::Build.new do |conf|
toolchain :clang
conf.enable_bintest
conf.enable_debug
conf.enable_test
gem_config(conf)
end
if build_targets.include?("Linux-x86_64")
MRuby::Build.new("Linux-x86_64") do |conf|
toolchain :gcc
conf.disable_lock
gem_config(conf)
conf.cc do |cc|
linker.libraries << %w(readline ncurses tls ssl crypto tinfo pthread)
linker.flags_before_libraries.unshift("-static")
end
end
end
if build_targets.include?("Darwin-x86_64")
MRuby::Build.new("Darwin-x86_64") do |conf|
toolchain :gcc
conf.disable_lock
gem_config(conf)
end
end