mundler 0.6.1 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/mundle +2 -0
- data/lib/mundler/build_config.rb +124 -10
- data/lib/mundler/clean_environment.rb +11 -0
- data/lib/mundler/cli.rb +4 -2
- data/lib/mundler/config.rb +22 -0
- data/lib/mundler/dsl.rb +42 -6
- data/lib/mundler/libraries/example.rb +13 -0
- data/lib/mundler/mruby.rb +36 -26
- data/lib/mundler/platforms/android.rb +21 -1
- data/lib/mundler/platforms/host.rb +23 -0
- data/lib/mundler/platforms/ios.rb +13 -6
- data/lib/mundler/platforms/ios_simulator.rb +12 -6
- data/lib/mundler/platforms/wasm.rb +33 -0
- data/lib/mundler/version.rb +1 -1
- data/lib/mundler.rb +2 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a1e212a7e64550513e7b9581af1cddf8e4b9162bfa68cb44c0e1723cc1530ed
|
4
|
+
data.tar.gz: b426f4f7f1b4b7da2dfc2a252a48cf232cd18f6709306d35c50060867b317f03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd5a38523ad21a2ca981eb1cb996c0ccb14e78e1d6fb56e3fa20750b5ad3c57839ab48da45c539517542f471927e250e038dcab222f4299cac70368e6a92b665
|
7
|
+
data.tar.gz: 9535ee1e6dea408f0887a97a8320ec0d1a42f1cb18603cf4dd3ed761a91a12d5258fbe6a0ea8c7cf31d1ce47bb1bff1e0e56e4c2aa32d746e68ceee637f2ca01
|
data/exe/mundle
CHANGED
data/lib/mundler/build_config.rb
CHANGED
@@ -16,8 +16,12 @@ module Mundler
|
|
16
16
|
end.join("\n")
|
17
17
|
end
|
18
18
|
|
19
|
-
def gems
|
19
|
+
def gems(platform_name)
|
20
20
|
@config.gems.map do |gem|
|
21
|
+
if !gem[:platforms].empty? && !gem[:platforms].include?(platform_name.to_sym)
|
22
|
+
next
|
23
|
+
end
|
24
|
+
|
21
25
|
# e.g. gem = {:name=>"mruby-regexp-pcre", :path=>nil, :github=>nil, :core=>nil}
|
22
26
|
args = ":mgem => #{gem[:name].inspect}"
|
23
27
|
|
@@ -47,29 +51,139 @@ module Mundler
|
|
47
51
|
|
48
52
|
private
|
49
53
|
|
50
|
-
def
|
51
|
-
@config.platforms
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
54
|
+
def host_platform
|
55
|
+
@config.platforms
|
56
|
+
.select { |attributes| attributes[:name].to_s == "host" }
|
57
|
+
.map { |attributes| platform(attributes) }
|
58
|
+
.join("\n")
|
59
|
+
end
|
60
|
+
|
61
|
+
def non_host_platforms
|
62
|
+
@config.platforms
|
63
|
+
.select { |attributes| attributes[:name].to_s != "host" }
|
64
|
+
.map { |attributes| platform(attributes) }
|
65
|
+
.join("\n")
|
66
|
+
end
|
67
|
+
|
68
|
+
def platform(platform_attrs)
|
69
|
+
platform_name = platform_attrs[:name].to_s
|
70
|
+
type = @config.platform_types[platform_name]
|
71
|
+
raise "Can't find platform: #{platform_name}" unless type
|
72
|
+
|
73
|
+
options = {}
|
74
|
+
@config.libraries.each do |library_name, library_options|
|
75
|
+
library_type = @config.library_types[library_name]
|
76
|
+
|
77
|
+
raise "Unknown library: #{library_name}" unless library_type
|
78
|
+
|
79
|
+
library_builder = library_type.new
|
80
|
+
|
81
|
+
puts "Using #{library_name} library (#{platform_name})"
|
82
|
+
library_builder.build(platform_name, library_options)
|
83
|
+
library_attrs = library_builder.platform_configuration(platform_name, library_options)
|
84
|
+
raise "Library #{library_name} for platform #{platform_name} returned expected result" unless library_attrs.is_a?(Hash)
|
85
|
+
merge_platform_attributes!(options, library_attrs)
|
86
|
+
end
|
87
|
+
|
88
|
+
merge_platform_attributes!(options, platform_attrs[:options])
|
89
|
+
|
90
|
+
type.config(options, self)
|
91
|
+
end
|
92
|
+
|
93
|
+
# Merge with a bit of specific logic to make sure build settings
|
94
|
+
#
|
95
|
+
# E.g. if lhs was something like
|
96
|
+
#
|
97
|
+
# ```
|
98
|
+
# {
|
99
|
+
# cc: { flags: "-I#{sdl_install}/include/SDL2" },
|
100
|
+
# linker: { flags: "-L#{sdl_install}/lib -lSDL2 -lSDL2_image -lSDL2_ttf" }
|
101
|
+
# }
|
102
|
+
# ```
|
103
|
+
#
|
104
|
+
# and rhs was like
|
105
|
+
#
|
106
|
+
# ```
|
107
|
+
# {
|
108
|
+
# cc: { flags: "abc" },
|
109
|
+
# linker: { flags: "def" },
|
110
|
+
# more_options: true
|
111
|
+
# }
|
112
|
+
# ```
|
113
|
+
#
|
114
|
+
# result would be
|
115
|
+
# ```
|
116
|
+
# {
|
117
|
+
# cc: { flags: ["-I#{sdl_install}/include/SDL2", "abc"] },
|
118
|
+
# linker: { flags: ["-L#{sdl_install}/lib -lSDL2 -lSDL2_image -lSDL2_ttf", "def"] }
|
119
|
+
# more_options: true
|
120
|
+
# }
|
121
|
+
# ```
|
122
|
+
#
|
123
|
+
def merge_platform_attributes!(lhs, rhs)
|
124
|
+
rhs = rhs.dup
|
125
|
+
|
126
|
+
[:cc, :linker].each do |cc_or_linker|
|
127
|
+
[:command, :flags].each do |command_or_flags|
|
128
|
+
lhs_flags = lhs.dig(cc_or_linker, command_or_flags)
|
129
|
+
rhs_flags = rhs.dig(cc_or_linker, command_or_flags)
|
130
|
+
|
131
|
+
if rhs_flags
|
132
|
+
lhs[cc_or_linker] ||= {}
|
133
|
+
lhs[cc_or_linker][command_or_flags] ||= []
|
134
|
+
lhs_flags = lhs.dig(cc_or_linker, command_or_flags)
|
135
|
+
|
136
|
+
if lhs_flags.is_a?(String)
|
137
|
+
lhs[cc_or_linker][command_or_flags] = [lhs_flags]
|
138
|
+
end
|
139
|
+
|
140
|
+
if rhs_flags.is_a?(String)
|
141
|
+
rhs[cc_or_linker][command_or_flags] = [rhs_flags]
|
142
|
+
end
|
143
|
+
|
144
|
+
lhs[cc_or_linker][command_or_flags] = lhs[cc_or_linker][command_or_flags] + rhs[cc_or_linker][command_or_flags]
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
rhs.delete(cc_or_linker)
|
149
|
+
end
|
150
|
+
|
151
|
+
lhs.merge!(rhs)
|
152
|
+
end
|
153
|
+
|
154
|
+
def env_vars
|
155
|
+
str = ""
|
156
|
+
@config.env.each do |key, value|
|
157
|
+
str = str + "\nENV[\"#{key}\"] = \"#{value}\""
|
158
|
+
end
|
159
|
+
str
|
56
160
|
end
|
57
161
|
|
58
162
|
def contents
|
59
163
|
contents = <<~CONTENTS
|
60
164
|
# #{mruby_version}
|
165
|
+
#{env_vars}
|
61
166
|
|
62
167
|
MRuby::Build.new do |conf|
|
63
168
|
toolchain :clang
|
64
169
|
|
170
|
+
#{host_platform}
|
65
171
|
#{gemboxes}
|
66
|
-
#{gems}
|
172
|
+
#{gems(:host)}
|
67
173
|
end
|
68
174
|
|
69
|
-
#{
|
175
|
+
#{non_host_platforms}
|
70
176
|
CONTENTS
|
71
177
|
|
72
|
-
contents.strip + "\n"
|
178
|
+
contents = contents.strip + "\n"
|
179
|
+
|
180
|
+
3.times do
|
181
|
+
contents.gsub!("\n \n", "\n\n")
|
182
|
+
contents.gsub!("\n\n\n", "\n\n")
|
183
|
+
contents.gsub!("\n\nend", "\nend")
|
184
|
+
end
|
185
|
+
|
186
|
+
contents
|
73
187
|
end
|
74
188
|
end
|
75
189
|
end
|
data/lib/mundler/cli.rb
CHANGED
@@ -11,11 +11,12 @@ module Mundler
|
|
11
11
|
desc "install", "Download and compile mruby"
|
12
12
|
def install
|
13
13
|
Mundler::Project.new(Dir.pwd).install
|
14
|
+
puts("\e[32mMundle complete!\e[0m")
|
14
15
|
rescue Mundler::CompilationError
|
15
|
-
$stderr.puts("\e[
|
16
|
+
$stderr.puts("\e[31mMundle failed\e[0m")
|
16
17
|
exit 1
|
17
18
|
rescue Interrupt
|
18
|
-
$stderr.puts("\e[
|
19
|
+
$stderr.puts("\e[31mMundle failed (user cancelled)\e[0m")
|
19
20
|
exit 1
|
20
21
|
rescue MundlefileNotFound
|
21
22
|
$stderr.puts("\e[31mMundlefile not found in the current directory\e[0m")
|
@@ -27,6 +28,7 @@ module Mundler
|
|
27
28
|
project = Mundler::Project.new(Dir.pwd)
|
28
29
|
project.clean
|
29
30
|
project.install
|
31
|
+
puts("\e[32mMundle complete!\e[0m")
|
30
32
|
rescue Mundler::CompilationError
|
31
33
|
$stderr.puts("\e[31mFailed to install\e[0m")
|
32
34
|
exit 1
|
data/lib/mundler/config.rb
CHANGED
@@ -10,10 +10,16 @@ module Mundler
|
|
10
10
|
@gemboxes = []
|
11
11
|
@gems = []
|
12
12
|
@platform_types = {}
|
13
|
+
@library_types = {}
|
14
|
+
@env = {}
|
15
|
+
@libraries = {}
|
13
16
|
end
|
14
17
|
|
15
18
|
attr_reader :mruby
|
16
19
|
attr_reader :platform_types
|
20
|
+
attr_reader :library_types
|
21
|
+
attr_reader :libraries
|
22
|
+
attr_reader :env
|
17
23
|
|
18
24
|
def hex
|
19
25
|
Digest::MD5.hexdigest(to_s)
|
@@ -36,9 +42,25 @@ module Mundler
|
|
36
42
|
#{mruby.inspect}
|
37
43
|
#{platforms.inspect}
|
38
44
|
#{platform_types.keys.sort.inspect}
|
45
|
+
#{library_types.keys.sort.inspect}
|
46
|
+
#{hashable_string_for_hash(env)}
|
39
47
|
#{gemboxes.inspect}
|
40
48
|
#{gems.inspect}
|
49
|
+
#{hashable_string_for_hash(libraries)}
|
41
50
|
HASHABLE
|
42
51
|
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def hashable_string_for_hash(hash)
|
56
|
+
str = "{"
|
57
|
+
sorted_keys = hash.keys.sort
|
58
|
+
|
59
|
+
sorted_keys.map do |key|
|
60
|
+
str = str + "#{key}=>#{hash[key]}"
|
61
|
+
end.join(", ")
|
62
|
+
|
63
|
+
str + "}"
|
64
|
+
end
|
43
65
|
end
|
44
66
|
end
|
data/lib/mundler/dsl.rb
CHANGED
@@ -3,13 +3,12 @@ module Mundler
|
|
3
3
|
def initialize(path)
|
4
4
|
@config = Config.new
|
5
5
|
@path = path
|
6
|
+
|
7
|
+
load_libraries
|
8
|
+
load_platforms
|
6
9
|
end
|
7
10
|
|
8
11
|
def evaluate!
|
9
|
-
platforms = Dir.glob(File.join(__dir__, "platforms", "*.rb"))
|
10
|
-
platforms.each do |platform|
|
11
|
-
instance_eval(File.read(platform))
|
12
|
-
end
|
13
12
|
begin
|
14
13
|
instance_eval(File.read(@path), @path)
|
15
14
|
rescue Errno::ENOENT
|
@@ -19,6 +18,20 @@ module Mundler
|
|
19
18
|
|
20
19
|
attr_reader :config
|
21
20
|
|
21
|
+
def load_libraries
|
22
|
+
libraries = Dir.glob(File.join(__dir__, "libraries", "*.rb"))
|
23
|
+
libraries.each do |library|
|
24
|
+
instance_eval(File.read(library))
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def load_platforms
|
29
|
+
platforms = Dir.glob(File.join(__dir__, "platforms", "*.rb"))
|
30
|
+
platforms.each do |platform|
|
31
|
+
instance_eval(File.read(platform))
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
22
35
|
private
|
23
36
|
|
24
37
|
def mruby(url: nil, tag: nil, branch: nil)
|
@@ -40,8 +53,31 @@ module Mundler
|
|
40
53
|
config.platforms << { name: name.to_s, options: options }
|
41
54
|
end
|
42
55
|
|
43
|
-
def gem(name, core: nil, path: nil, github: nil)
|
44
|
-
|
56
|
+
def gem(name, core: nil, path: nil, github: nil, platforms: [])
|
57
|
+
if path && !path.start_with?("/")
|
58
|
+
app_path = Pathname.new(@path).dirname.to_s
|
59
|
+
path = File.expand_path(File.join(app_path, path))
|
60
|
+
end
|
61
|
+
|
62
|
+
config.gems << {
|
63
|
+
name: name,
|
64
|
+
path: path,
|
65
|
+
github: github,
|
66
|
+
core: core,
|
67
|
+
platforms: Array(platforms)
|
68
|
+
}
|
69
|
+
end
|
70
|
+
|
71
|
+
def env(name, value)
|
72
|
+
config.env[name] = value
|
73
|
+
end
|
74
|
+
|
75
|
+
def library(name, options = {})
|
76
|
+
config.libraries[name.to_s] = options
|
77
|
+
end
|
78
|
+
|
79
|
+
def define_library(name, library_class)
|
80
|
+
config.library_types[name.to_s] = library_class
|
45
81
|
end
|
46
82
|
end
|
47
83
|
end
|
data/lib/mundler/mruby.rb
CHANGED
@@ -29,7 +29,8 @@ module Mundler
|
|
29
29
|
FileUtils.rm_rf(@path)
|
30
30
|
FileUtils.mkdir_p(@path)
|
31
31
|
FileUtils.cd(@path)
|
32
|
-
|
32
|
+
|
33
|
+
Mundler.with_clean_env do
|
33
34
|
system(
|
34
35
|
{
|
35
36
|
# The {mundler gem path}/cached_git directory contains a binary called
|
@@ -38,20 +39,13 @@ module Mundler
|
|
38
39
|
"PATH" => ([cached_git_dir] + ENV["PATH"].split(":")).join(":")
|
39
40
|
},
|
40
41
|
"git clone #{mruby_url} . >/dev/null 2>&1"
|
41
|
-
) ||
|
42
|
-
end
|
43
|
-
|
44
|
-
if defined?(Bundler) && Bundler.respond_to?(:with_unbundled_env)
|
45
|
-
Bundler.with_unbundled_env(&git_clone)
|
46
|
-
elsif defined?(Bundler)
|
47
|
-
Bundler.with_clean_env(&git_clone)
|
48
|
-
else
|
49
|
-
git_clone.call
|
42
|
+
) || raise(Mundler::CloneError, "Failed to clone #{mruby_url}")
|
50
43
|
end
|
51
44
|
|
52
45
|
if version
|
53
46
|
system("git reset --hard #{version} >/dev/null 2>&1") ||
|
54
|
-
|
47
|
+
system("git reset --hard origin/#{version} >/dev/null 2>&1") ||
|
48
|
+
exit_out("Failed to set mruby version to \"#{version}\".")
|
55
49
|
end
|
56
50
|
|
57
51
|
FileUtils.touch(success_indicator)
|
@@ -70,6 +64,26 @@ module Mundler
|
|
70
64
|
def compile(build_config)
|
71
65
|
logfile = Tempfile.new(['mundler_build', '.log'])
|
72
66
|
|
67
|
+
version = (
|
68
|
+
@config.mruby[:tag] ||
|
69
|
+
@config.mruby[:branch] ||
|
70
|
+
@config.mruby[:version]
|
71
|
+
)
|
72
|
+
|
73
|
+
@config.gemboxes.each do |gembox|
|
74
|
+
puts "Using #{gembox} gembox"
|
75
|
+
end
|
76
|
+
@config.gems.each do |gem|
|
77
|
+
if gem[:platforms].empty?
|
78
|
+
puts "Using #{gem[:name]} gem"
|
79
|
+
else
|
80
|
+
puts "Using #{gem[:name]} gem for platforms: #{gem[:platforms]}"
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
puts "Using mruby (#{version})"
|
85
|
+
|
86
|
+
|
73
87
|
success_indicator = File.join(@path, ".mundler_built_successfully")
|
74
88
|
if File.file?(success_indicator)
|
75
89
|
return
|
@@ -87,14 +101,14 @@ module Mundler
|
|
87
101
|
directory = pathname.directory? ? pathname.to_s : Pathname.new(file).dirname.to_s
|
88
102
|
next if covered.include?(directory)
|
89
103
|
covered << directory
|
90
|
-
print "\e[
|
104
|
+
print "\e[34m.\e[0m"
|
91
105
|
end
|
92
106
|
end
|
93
107
|
sleep(0.3)
|
94
108
|
end
|
95
109
|
end
|
96
110
|
|
97
|
-
|
111
|
+
Mundler.with_clean_env do
|
98
112
|
rake = `which rake`.chomp
|
99
113
|
system(
|
100
114
|
{
|
@@ -108,15 +122,14 @@ module Mundler
|
|
108
122
|
) || begin
|
109
123
|
$stderr.print "\e[31mF\e[0m"
|
110
124
|
$stderr.puts "\n\n"
|
125
|
+
$stderr.puts File.read(build_config)
|
111
126
|
$stderr.puts File.read(logfile)
|
112
127
|
|
113
128
|
raise Mundler::CompilationError
|
114
129
|
end
|
115
130
|
|
116
131
|
cleaned = true
|
117
|
-
end
|
118
132
|
|
119
|
-
compile = Proc.new do
|
120
133
|
rake = `which rake`.chomp
|
121
134
|
system(
|
122
135
|
{
|
@@ -130,26 +143,18 @@ module Mundler
|
|
130
143
|
) || begin
|
131
144
|
$stderr.print "\e[31mF\e[0m"
|
132
145
|
$stderr.puts "\n\n"
|
146
|
+
$stderr.puts File.read(build_config)
|
133
147
|
$stderr.puts File.read(logfile)
|
134
148
|
|
135
149
|
raise Mundler::CompilationError
|
136
150
|
end
|
137
151
|
end
|
138
152
|
|
139
|
-
|
140
|
-
Bundler.with_unbundled_env(&clean)
|
141
|
-
Bundler.with_unbundled_env(&compile)
|
142
|
-
elsif defined?(Bundler)
|
143
|
-
Bundler.with_clean_env(&clean)
|
144
|
-
Bundler.with_clean_env(&compile)
|
145
|
-
else
|
146
|
-
clean.call
|
147
|
-
compile.call
|
148
|
-
end
|
153
|
+
puts "\n\n"
|
149
154
|
|
150
|
-
output_thread.kill
|
151
155
|
FileUtils.touch(success_indicator)
|
152
156
|
ensure
|
157
|
+
output_thread.kill if output_thread
|
153
158
|
logfile.close
|
154
159
|
logfile.delete
|
155
160
|
end
|
@@ -169,6 +174,11 @@ module Mundler
|
|
169
174
|
|
170
175
|
private
|
171
176
|
|
177
|
+
def exit_out(msg)
|
178
|
+
STDERR.puts("\e[31m#{msg}\e[0m")
|
179
|
+
exit(1)
|
180
|
+
end
|
181
|
+
|
172
182
|
def installed?
|
173
183
|
success_indicator = File.join(@path, ".mundler_built_successfully")
|
174
184
|
File.file?(success_indicator)
|
@@ -23,12 +23,32 @@ module AndroidPlatform
|
|
23
23
|
|
24
24
|
toolchain :android, params
|
25
25
|
|
26
|
+
#{cc_and_linker(options[:options])}
|
26
27
|
#{build_config.gemboxes}
|
27
|
-
#{build_config.gems}
|
28
|
+
#{build_config.gems(:android)}
|
28
29
|
end
|
29
30
|
BUILD
|
30
31
|
end.join("\n")
|
31
32
|
end
|
33
|
+
|
34
|
+
def self.cc_and_linker(options)
|
35
|
+
build = ""
|
36
|
+
if options[:cc]
|
37
|
+
build += " conf.cc do |cc|\n"
|
38
|
+
build += " cc.command = #{options[:cc][:command].inspect}\n" if options[:cc][:command]
|
39
|
+
build += " cc.flags << #{options[:cc][:flags].inspect}\n" if options[:cc][:flags]
|
40
|
+
build += " end\n\n"
|
41
|
+
end
|
42
|
+
|
43
|
+
if options[:linker]
|
44
|
+
build += " conf.linker do |linker|\n"
|
45
|
+
build += " linker.command = #{options[:linker][:command].inspect}\n" if options[:linker][:command]
|
46
|
+
build += " linker.flags << #{options[:linker][:flags].inspect}\n" if options[:linker][:flags]
|
47
|
+
build += " end\n\n"
|
48
|
+
end
|
49
|
+
|
50
|
+
build
|
51
|
+
end
|
32
52
|
end
|
33
53
|
|
34
54
|
define_platform "android", AndroidPlatform
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module HostPlatform
|
2
|
+
def self.config(options, build_config)
|
3
|
+
build = ""
|
4
|
+
|
5
|
+
if options[:cc]
|
6
|
+
build += " conf.cc do |cc|\n"
|
7
|
+
build += " cc.command = #{options[:cc][:command].inspect}\n" if options[:cc][:command]
|
8
|
+
build += " cc.flags << #{options[:cc][:flags].inspect}\n" if options[:cc][:flags]
|
9
|
+
build += " end\n\n"
|
10
|
+
end
|
11
|
+
|
12
|
+
if options[:linker]
|
13
|
+
build += " conf.linker do |linker|\n"
|
14
|
+
build += " linker.command = #{options[:linker][:command].inspect}\n" if options[:linker][:command]
|
15
|
+
build += " linker.flags << #{options[:linker][:flags].inspect}\n" if options[:linker][:flags]
|
16
|
+
build += " end\n\n"
|
17
|
+
end
|
18
|
+
|
19
|
+
build
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
define_platform "host", HostPlatform
|
@@ -1,7 +1,8 @@
|
|
1
1
|
module IOSPlatform
|
2
2
|
def self.config(options, build_config)
|
3
3
|
valid_archs = [:armv7, :arm64]
|
4
|
-
|
4
|
+
default_archs = [:arm64]
|
5
|
+
options[:archs] ||= default_archs
|
5
6
|
|
6
7
|
options[:archs].map do |arch|
|
7
8
|
unless valid_archs.include?(arch)
|
@@ -19,19 +20,25 @@ module IOSPlatform
|
|
19
20
|
-isysroot #{ios_sdk}
|
20
21
|
)
|
21
22
|
|
23
|
+
cc_command = options.dig(:cc, :command) || clang
|
24
|
+
linker_command = options.dig(:linker, :command) || clang
|
25
|
+
|
26
|
+
cc_flags = flags + Array(options.dig(:cc, :flags) || [])
|
27
|
+
linker_flags = flags + Array(options.dig(:linker, :flags) || [])
|
28
|
+
|
22
29
|
<<~BUILD
|
23
30
|
MRuby::CrossBuild.new("ios__#{arch}") do |conf|
|
24
31
|
#{build_config.gemboxes}
|
25
|
-
#{build_config.gems}
|
32
|
+
#{build_config.gems(:ios)}
|
26
33
|
|
27
34
|
conf.cc do |cc|
|
28
|
-
cc.command = #{
|
29
|
-
cc.flags = #{
|
35
|
+
cc.command = #{cc_command.inspect}
|
36
|
+
cc.flags = #{cc_flags.inspect}
|
30
37
|
end
|
31
38
|
|
32
39
|
conf.linker do |l|
|
33
|
-
l.command = #{
|
34
|
-
l.flags = #{
|
40
|
+
l.command = #{linker_command.inspect}
|
41
|
+
l.flags = #{linker_flags.inspect}
|
35
42
|
end
|
36
43
|
end
|
37
44
|
BUILD
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module IOSSimulatorPlatform
|
2
2
|
def self.config(options, build_config)
|
3
|
-
valid_archs = [:i386, :x86_64]
|
3
|
+
valid_archs = [:i386, :x86_64, :arm64]
|
4
4
|
options[:archs] ||= valid_archs
|
5
5
|
|
6
6
|
options[:archs].map do |arch|
|
@@ -19,19 +19,25 @@ module IOSSimulatorPlatform
|
|
19
19
|
-isysroot #{ios_simulator_sdk}
|
20
20
|
)
|
21
21
|
|
22
|
+
cc_command = options.dig(:cc, :command) || clang
|
23
|
+
linker_command = options.dig(:linker, :command) || clang
|
24
|
+
|
25
|
+
cc_flags = flags + Array(options.dig(:cc, :flags) || [])
|
26
|
+
linker_flags = flags + Array(options.dig(:linker, :flags) || [])
|
27
|
+
|
22
28
|
<<~BUILD
|
23
29
|
MRuby::CrossBuild.new("ios_simulator__#{arch}") do |conf|
|
24
30
|
#{build_config.gemboxes}
|
25
|
-
#{build_config.gems}
|
31
|
+
#{build_config.gems(:ios_simulator)}
|
26
32
|
|
27
33
|
conf.cc do |cc|
|
28
|
-
cc.command = #{
|
29
|
-
cc.flags = #{
|
34
|
+
cc.command = #{cc_command.inspect}
|
35
|
+
cc.flags = #{cc_flags.inspect}
|
30
36
|
end
|
31
37
|
|
32
38
|
conf.linker do |l|
|
33
|
-
l.command = #{
|
34
|
-
l.flags = #{
|
39
|
+
l.command = #{linker_command.inspect}
|
40
|
+
l.flags = #{linker_flags.inspect}
|
35
41
|
end
|
36
42
|
end
|
37
43
|
BUILD
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module WASMPlatform
|
2
|
+
def self.config(options, build_config)
|
3
|
+
cc_command = "emcc"
|
4
|
+
linker_command = "emcc"
|
5
|
+
archiver_command = "emar"
|
6
|
+
|
7
|
+
cc_flags = ["-Os"]
|
8
|
+
|
9
|
+
<<~BUILD
|
10
|
+
MRuby::CrossBuild.new("wasm") do |conf|
|
11
|
+
toolchain :clang
|
12
|
+
|
13
|
+
#{build_config.gemboxes}
|
14
|
+
#{build_config.gems(:wasm)}
|
15
|
+
|
16
|
+
conf.cc do |cc|
|
17
|
+
cc.command = #{cc_command.inspect}
|
18
|
+
cc.flags = #{cc_flags.inspect}
|
19
|
+
end
|
20
|
+
|
21
|
+
conf.linker do |l|
|
22
|
+
l.command = #{linker_command.inspect}
|
23
|
+
end
|
24
|
+
|
25
|
+
conf.archiver do |a|
|
26
|
+
a.command = #{archiver_command.inspect}
|
27
|
+
end
|
28
|
+
end
|
29
|
+
BUILD
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
define_platform "wasm", WASMPlatform
|
data/lib/mundler/version.rb
CHANGED
data/lib/mundler.rb
CHANGED
@@ -8,9 +8,11 @@ require "mundler/build_config"
|
|
8
8
|
require "mundler/dsl"
|
9
9
|
require "mundler/mruby"
|
10
10
|
require "mundler/project"
|
11
|
+
require "mundler/clean_environment"
|
11
12
|
|
12
13
|
module Mundler
|
13
14
|
class CompilationError < StandardError; end
|
15
|
+
class CloneError < CompilationError; end
|
14
16
|
class NotInstalledError < StandardError; end
|
15
17
|
class MundlefileNotFound < StandardError; end
|
16
18
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mundler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Inkpen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -65,13 +65,17 @@ files:
|
|
65
65
|
- lib/mundler/build_config.rb
|
66
66
|
- lib/mundler/cached_git/cached_git
|
67
67
|
- lib/mundler/cached_git/git
|
68
|
+
- lib/mundler/clean_environment.rb
|
68
69
|
- lib/mundler/cli.rb
|
69
70
|
- lib/mundler/config.rb
|
70
71
|
- lib/mundler/dsl.rb
|
72
|
+
- lib/mundler/libraries/example.rb
|
71
73
|
- lib/mundler/mruby.rb
|
72
74
|
- lib/mundler/platforms/android.rb
|
75
|
+
- lib/mundler/platforms/host.rb
|
73
76
|
- lib/mundler/platforms/ios.rb
|
74
77
|
- lib/mundler/platforms/ios_simulator.rb
|
78
|
+
- lib/mundler/platforms/wasm.rb
|
75
79
|
- lib/mundler/project.rb
|
76
80
|
- lib/mundler/version.rb
|
77
81
|
homepage: https://github.com/Dan2552/mundler
|