rb_sys 0.9.30 → 0.9.32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/rb_sys/cargo_builder.rb +7 -0
- data/lib/rb_sys/mkmf.rb +104 -46
- data/lib/rb_sys/toolchain_info/data.rb +1 -1
- data/lib/rb_sys/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +3 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3646412771a1f14d60e962b3502ae73298f16c1199fa2829e3075ff16ae017f3
|
4
|
+
data.tar.gz: 4a4ca352c575e60c4cd1765b4e6c2f615a447c647098a4a1ec2ba491f55cb98e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eeef73802bf310125d839c795e2ff47e538d3ede95d5d6c0eaa7205b000e53b8586bab68929190684cd807c2af204ab97b646c97e66935670f996bef041f068d
|
7
|
+
data.tar.gz: eb8cf1dc3aaff73016309a5d0c624ac4def94dae4791e5d01b5061bf7c521696d2c4756bc512fea195e32db0d547230dddeaf70663c1e19e93cf3cc64cbc3625
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/rb_sys/cargo_builder.rb
CHANGED
@@ -132,9 +132,16 @@ module RbSys
|
|
132
132
|
linker = cc_flag.shift
|
133
133
|
link_args = cc_flag.flat_map { |a| ["-C", "link-arg=#{a}"] }
|
134
134
|
|
135
|
+
return mswin_link_args if linker == "cl"
|
136
|
+
|
135
137
|
["-C", "linker=#{linker}", *link_args]
|
136
138
|
end
|
137
139
|
|
140
|
+
def mswin_link_args
|
141
|
+
libruby = ruby_static? ? makefile_config("LIBRUBY_A") : makefile_config("LIBRUBY")
|
142
|
+
["-C", "link-arg=#{libruby}"]
|
143
|
+
end
|
144
|
+
|
138
145
|
def libruby_args(dest_dir)
|
139
146
|
libs = makefile_config(ruby_static? ? "LIBRUBYARG_STATIC" : "LIBRUBYARG_SHARED")
|
140
147
|
raw_libs = Shellwords.split(libs)
|
data/lib/rb_sys/mkmf.rb
CHANGED
@@ -5,6 +5,7 @@ require "shellwords"
|
|
5
5
|
require_relative "cargo_builder"
|
6
6
|
require_relative "mkmf/config"
|
7
7
|
|
8
|
+
# rubocop:disable Style/GlobalVars
|
8
9
|
# Root module
|
9
10
|
module RbSys
|
10
11
|
# Helper class for creating Rust Makefiles
|
@@ -48,42 +49,41 @@ module RbSys
|
|
48
49
|
|
49
50
|
full_cargo_command = cargo_command(srcdir, builder)
|
50
51
|
|
51
|
-
# rubocop:disable Style/GlobalVars
|
52
52
|
make_install = +<<~MAKE
|
53
|
-
RB_SYS_BUILD_DIR
|
54
|
-
CARGO
|
55
|
-
CARGO_BUILD_TARGET
|
56
|
-
SOEXT
|
53
|
+
#{conditional_assign("RB_SYS_BUILD_DIR", File.join(Dir.pwd, ".rb-sys"))}
|
54
|
+
#{conditional_assign("CARGO", "cargo")}
|
55
|
+
#{conditional_assign("CARGO_BUILD_TARGET", builder.target)}
|
56
|
+
#{conditional_assign("SOEXT", builder.so_ext)}
|
57
57
|
|
58
58
|
# Determine the prefix Cargo uses for the lib.
|
59
|
-
|
60
|
-
|
61
|
-
|
59
|
+
#{if_neq_stmt("$(SOEXT)", "dll")}
|
60
|
+
#{conditional_assign("SOEXT_PREFIX", "lib", indent: 1)}
|
61
|
+
#{endif_stmt}
|
62
62
|
|
63
|
-
RB_SYS_CARGO_PROFILE
|
64
|
-
RB_SYS_CARGO_FEATURES
|
65
|
-
RB_SYS_EXTRA_RUSTFLAGS
|
63
|
+
#{conditional_assign("RB_SYS_CARGO_PROFILE", builder.profile)}
|
64
|
+
#{conditional_assign("RB_SYS_CARGO_FEATURES", builder.features.join(","))}
|
65
|
+
#{conditional_assign("RB_SYS_EXTRA_RUSTFLAGS", builder.extra_rustflags.join(" "))}
|
66
66
|
|
67
67
|
# Set dirname for the profile, since the profiles do not directly map to target dir (i.e. dev -> debug)
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
68
|
+
#{if_eq_stmt("$(RB_SYS_CARGO_PROFILE)", "dev")}
|
69
|
+
#{conditional_assign("RB_SYS_CARGO_PROFILE_DIR", "debug", indent: 1)}
|
70
|
+
#{else_stmt}
|
71
|
+
#{conditional_assign("RB_SYS_CARGO_PROFILE_DIR", "$(RB_SYS_CARGO_PROFILE)", indent: 1)}
|
72
|
+
#{endif_stmt}
|
73
73
|
|
74
74
|
# Set the build profile (dev, release, etc.) Compat with Rust 1.51.
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
75
|
+
#{if_eq_stmt("$(RB_SYS_CARGO_PROFILE)", "release")}
|
76
|
+
#{assign_stmt("RB_SYS_CARGO_PROFILE_FLAG", "--release", indent: 1)}
|
77
|
+
#{else_stmt}
|
78
|
+
#{assign_stmt("RB_SYS_CARGO_PROFILE_FLAG", "--profile $(RB_SYS_CARGO_PROFILE)", indent: 1)}
|
79
|
+
#{endif_stmt}
|
80
80
|
|
81
81
|
# Account for sub-directories when using `--target` argument with Cargo
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
82
|
+
#{if_neq_stmt("$(CARGO_BUILD_TARGET)", "")}
|
83
|
+
#{assign_stmt("RB_SYS_CARGO_BUILD_TARGET_DIR", "target/$(CARGO_BUILD_TARGET)", indent: 1)}
|
84
|
+
#{else_stmt}
|
85
|
+
#{assign_stmt("RB_SYS_CARGO_BUILD_TARGET_DIR", "target", indent: 1)}
|
86
|
+
#{endif_stmt}
|
87
87
|
|
88
88
|
target_prefix = #{target_prefix}
|
89
89
|
TARGET_NAME = #{target[/\A\w+/]}
|
@@ -100,12 +100,12 @@ module RbSys
|
|
100
100
|
|
101
101
|
#{base_makefile(srcdir)}
|
102
102
|
|
103
|
-
|
104
|
-
|
105
|
-
|
103
|
+
#{if_neq_stmt("$(RB_SYS_VERBOSE)", "")}
|
104
|
+
#{assign_stmt("Q", "$(0=@)", indent: 1)}
|
105
|
+
#{endif_stmt}
|
106
106
|
|
107
107
|
#{env_vars(builder)}
|
108
|
-
|
108
|
+
#{export_env("RUSTFLAGS", "$(RUSTFLAGS) $(RB_SYS_EXTRA_RUSTFLAGS)")}
|
109
109
|
|
110
110
|
FORCE: ;
|
111
111
|
|
@@ -140,7 +140,6 @@ module RbSys
|
|
140
140
|
|
141
141
|
File.write("Makefile", make_install)
|
142
142
|
end
|
143
|
-
# rubocop:enable Style/GlobalVars
|
144
143
|
|
145
144
|
private
|
146
145
|
|
@@ -170,7 +169,7 @@ module RbSys
|
|
170
169
|
|
171
170
|
def env_line(k, v)
|
172
171
|
return unless v
|
173
|
-
|
172
|
+
export_env(k, v.gsub("\n", '\n'))
|
174
173
|
end
|
175
174
|
|
176
175
|
def env_or_makefile_config(key)
|
@@ -188,31 +187,31 @@ module RbSys
|
|
188
187
|
|
189
188
|
def optional_rust_toolchain(builder)
|
190
189
|
<<~MAKE
|
191
|
-
RB_SYS_FORCE_INSTALL_RUST_TOOLCHAIN
|
190
|
+
#{conditional_assign("RB_SYS_FORCE_INSTALL_RUST_TOOLCHAIN", builder.force_install_rust_toolchain)}
|
192
191
|
|
193
192
|
# Only run if the we are told to explicitly install the Rust toolchain
|
194
|
-
|
195
|
-
RB_SYS_RUSTUP_PROFILE
|
193
|
+
#{if_neq_stmt("$(RB_SYS_FORCE_INSTALL_RUST_TOOLCHAIN)", "false")}
|
194
|
+
#{conditional_assign("RB_SYS_RUSTUP_PROFILE", "minimal")}
|
196
195
|
|
197
196
|
# If the user passed true, we assume stable Rust. Otherwise, use what
|
198
197
|
# was specified (i.e. RB_SYS_FORCE_INSTALL_RUST_TOOLCHAIN=beta)
|
199
|
-
|
198
|
+
#{if_eq_stmt("$(RB_SYS_FORCE_INSTALL_RUST_TOOLCHAIN)", "true")}
|
200
199
|
RB_SYS_FORCE_INSTALL_RUST_TOOLCHAIN = stable
|
201
|
-
|
200
|
+
#{endif_stmt}
|
202
201
|
|
203
202
|
# If a $RUST_TARGET is specified (i.e. for rake-compiler-dock), append
|
204
203
|
# that to the profile.
|
205
|
-
|
204
|
+
#{if_eq_stmt("$(RUST_TARGET)", "")}
|
206
205
|
RB_SYS_DEFAULT_TOOLCHAIN = $(RB_SYS_FORCE_INSTALL_RUST_TOOLCHAIN)
|
207
|
-
|
206
|
+
#{else_stmt}
|
208
207
|
RB_SYS_DEFAULT_TOOLCHAIN = $(RB_SYS_FORCE_INSTALL_RUST_TOOLCHAIN)-$(RUST_TARGET)
|
209
|
-
|
208
|
+
#{endif_stmt}
|
210
209
|
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
210
|
+
#{conditional_assign("CARGO_HOME", "$(RB_SYS_BUILD_DIR)/$(RB_SYS_DEFAULT_TOOLCHAIN)/cargo", export: true)}
|
211
|
+
#{conditional_assign("RUSTUP_HOME", "$(RB_SYS_BUILD_DIR)/$(RB_SYS_DEFAULT_TOOLCHAIN)/rustup", export: true)}
|
212
|
+
#{export_env("PATH", "$(CARGO_HOME)/bin:$(RUSTUP_HOME)/bin:$(PATH)")}
|
213
|
+
#{export_env("RUSTUP_TOOLCHAIN", "$(RB_SYS_DEFAULT_TOOLCHAIN)")}
|
214
|
+
#{export_env("CARGO", "$(CARGO_HOME)/bin/cargo")}
|
216
215
|
|
217
216
|
$(CARGO):
|
218
217
|
\t$(Q) $(MAKEDIRS) $(CARGO_HOME) $(RUSTUP_HOME)
|
@@ -221,10 +220,69 @@ module RbSys
|
|
221
220
|
\trustup default $(RB_SYS_DEFAULT_TOOLCHAIN)
|
222
221
|
|
223
222
|
$(RUSTLIB): $(CARGO)
|
224
|
-
|
223
|
+
#{endif_stmt}
|
225
224
|
MAKE
|
226
225
|
end
|
226
|
+
|
227
|
+
def if_eq_stmt(a, b)
|
228
|
+
if $nmake
|
229
|
+
"!IF #{a.inspect} == #{b.inspect}"
|
230
|
+
else
|
231
|
+
"ifeq (#{a},#{b})"
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
def if_neq_stmt(a, b)
|
236
|
+
if $nmake
|
237
|
+
"!IF #{a.inspect} != #{b.inspect}"
|
238
|
+
else
|
239
|
+
"ifneq (#{a},#{b})"
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
def else_stmt
|
244
|
+
if $nmake
|
245
|
+
"!ELSE"
|
246
|
+
else
|
247
|
+
"else"
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
def endif_stmt
|
252
|
+
if $nmake
|
253
|
+
"!ENDIF"
|
254
|
+
else
|
255
|
+
"endif"
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
def conditional_assign(a, b, export: false, indent: 0)
|
260
|
+
if $nmake
|
261
|
+
result = +"!IFNDEF #{a}\n#{a} = #{b}\n!ENDIF\n"
|
262
|
+
result << export_env(a, b) if export
|
263
|
+
result
|
264
|
+
else
|
265
|
+
"#{"\t" * indent}#{export ? "export " : ""}#{a} ?= #{b}"
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
269
|
+
def assign_stmt(a, b, indent: 0)
|
270
|
+
if $nmake
|
271
|
+
"#{a} = #{b}"
|
272
|
+
else
|
273
|
+
"#{"\t" * indent}#{a} = #{b}"
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
277
|
+
def export_env(k, v)
|
278
|
+
if $nmake
|
279
|
+
"!if [set #{k}=#{v}]\n!endif"
|
280
|
+
else
|
281
|
+
"export #{k} := #{v}"
|
282
|
+
end
|
283
|
+
end
|
227
284
|
end
|
228
285
|
end
|
286
|
+
# rubocop:enable Style/GlobalVars
|
229
287
|
|
230
288
|
include RbSys::Mkmf # rubocop:disable Style/MixinUsage
|
@@ -4,6 +4,6 @@
|
|
4
4
|
|
5
5
|
module RbSys
|
6
6
|
class ToolchainInfo
|
7
|
-
DATA = {"arm-linux" => {"rust-target" => "arm-unknown-linux-gnueabihf", "rake-compiler-dock" => {"cc" => "arm-linux-gnueabihf-gcc"}, "supported" => true}, "aarch64-linux" => {"rust-target" => "aarch64-unknown-linux-gnu", "rake-compiler-dock" => {"cc" => "aarch64-linux-gnu-gcc"}, "supported" => true}, "arm64-darwin" => {"rust-target" => "aarch64-unknown-linux-gnu", "rake-compiler-dock" => {"cc" => "aarch64-apple-darwin-clang"}, "supported" => true}, "x64-mingw-ucrt" => {"rust-target" => "x86_64-pc-windows-gnu", "rake-compiler-dock" => {"cc" => "x86_64-windows-gnu-gcc"}, "supported" => true}, "x64-mingw32" => {"rust-target" => "x86_64-pc-windows-gnu", "rake-compiler-dock" => {"cc" => "x86_64-windows-gnu-gcc"}, "supported" => true}, "x86-linux" => {"rust-target" => "i686-unknown-linux-gnu", "rake-compiler-dock" => {"cc" => "i686-redhat-linux-gcc"}, "supported" => false}, "x86-mingw32" => {"rust-target" => "i686-pc-windows-gnu", "rake-compiler-dock" => {"cc" => "i686-w64-mingw32-gcc"}, "supported" => false}, "x86_64-darwin" => {"rust-target" => "x86_64-apple-darwin", "rake-compiler-dock" => {"cc" => "x86_64-apple-darwin-clang"}, "supported" => true}, "x86_64-linux" => {"rust-target" => "x86_64-unknown-linux-gnu", "rake-compiler-dock" => {"cc" => "x86_64-redhat-linux-gcc"}, "supported" => true}}
|
7
|
+
DATA = {"arm-linux" => {"rust-target" => "arm-unknown-linux-gnueabihf", "rake-compiler-dock" => {"cc" => "arm-linux-gnueabihf-gcc"}, "supported" => true}, "aarch64-linux" => {"rust-target" => "aarch64-unknown-linux-gnu", "rake-compiler-dock" => {"cc" => "aarch64-linux-gnu-gcc"}, "supported" => true}, "arm64-darwin" => {"rust-target" => "aarch64-unknown-linux-gnu", "rake-compiler-dock" => {"cc" => "aarch64-apple-darwin-clang"}, "supported" => true}, "x64-mingw-ucrt" => {"rust-target" => "x86_64-pc-windows-gnu", "rake-compiler-dock" => {"cc" => "x86_64-windows-gnu-gcc"}, "supported" => true}, "x64-mingw32" => {"rust-target" => "x86_64-pc-windows-gnu", "rake-compiler-dock" => {"cc" => "x86_64-windows-gnu-gcc"}, "supported" => true}, "x86-linux" => {"rust-target" => "i686-unknown-linux-gnu", "rake-compiler-dock" => {"cc" => "i686-redhat-linux-gcc"}, "supported" => false}, "x86-mingw32" => {"rust-target" => "i686-pc-windows-gnu", "rake-compiler-dock" => {"cc" => "i686-w64-mingw32-gcc"}, "supported" => false}, "x86_64-darwin" => {"rust-target" => "x86_64-apple-darwin", "rake-compiler-dock" => {"cc" => "x86_64-apple-darwin-clang"}, "supported" => true}, "x86_64-linux" => {"rust-target" => "x86_64-unknown-linux-gnu", "rake-compiler-dock" => {"cc" => "x86_64-redhat-linux-gcc"}, "supported" => true}, "x86_64-linux-musl" => {"rust-target" => "x86_64-unknown-linux-musl", "rake-compiler-dock" => {"cc" => "x86_64-unknown-linux-musl-gcc"}, "supported" => true}}
|
8
8
|
end
|
9
9
|
end
|
data/lib/rb_sys/version.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rb_sys
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.32
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian Ker-Seymer
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
Rl+ASkq2/1i07TkBpCf+2hq66+h/hx+/Y/KrUzXfe0jtvil0WESkJT2kqRqHWNhD
|
31
31
|
9GKBxaQlXokNDtWCm1/gl6cD8WRZ0N5S4ZGJT1FLLsA=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2022-
|
33
|
+
date: 2022-10-18 00:00:00.000000000 Z
|
34
34
|
dependencies: []
|
35
35
|
description:
|
36
36
|
email:
|
@@ -72,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
72
|
- !ruby/object:Gem::Version
|
73
73
|
version: '0'
|
74
74
|
requirements: []
|
75
|
-
rubygems_version: 3.3.
|
75
|
+
rubygems_version: 3.3.22
|
76
76
|
signing_key:
|
77
77
|
specification_version: 4
|
78
78
|
summary: Helpers for compiling Rust extensions for ruby
|
metadata.gz.sig
CHANGED
Binary file
|