rb_sys 0.9.86 → 0.9.94
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/exe/rb-sys-dock +1 -1
- data/lib/rb_sys/cargo_builder.rb +20 -6
- data/lib/rb_sys/mkmf/config.rb +6 -1
- data/lib/rb_sys/mkmf.rb +9 -6
- data/lib/rb_sys/toolchain_info/data.rb +1 -1
- data/lib/rb_sys/toolchain_info.rb +7 -0
- 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: ad789ca85cc714cf54fbe4a319c848abf886923c6452d3468cff39f1b053e2d3
|
|
4
|
+
data.tar.gz: 91c11f5b89aed8b9d7bd9227b4a389325b620ee6081db5aa4730de608f93551d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 696b43646b4a8c82267ec837c394bf303ff0f7f1c0a2518dd6b099103aa825b6809a4e3fb27b6e595a832a1d47f7d6331e86c3cf95d7240be51909f23246e318
|
|
7
|
+
data.tar.gz: bc0bfadb3b46add5ea371c12da0b6da2ef75836688dd1a656da54c5823666297fd575da55f406c8c3c908f026ca10a5658202f38e72e8d127b5f43f8192e1278
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/exe/rb-sys-dock
CHANGED
|
@@ -359,7 +359,7 @@ def rcd(input_args)
|
|
|
359
359
|
cmd = <<~SH
|
|
360
360
|
#{default_docker_command} run \
|
|
361
361
|
--platform #{OPTIONS.fetch(:docker_platform)} \
|
|
362
|
-
-v
|
|
362
|
+
-v $(pwd):$(pwd) \
|
|
363
363
|
#{mount_tmp_dir} \
|
|
364
364
|
#{mount_target_dir} \
|
|
365
365
|
#{mount_cargo_registry} \
|
data/lib/rb_sys/cargo_builder.rb
CHANGED
|
@@ -9,7 +9,7 @@ module RbSys
|
|
|
9
9
|
WELL_KNOWN_WRAPPERS = %w[sccache cachepot].freeze
|
|
10
10
|
|
|
11
11
|
attr_accessor :spec, :runner, :env, :features, :target, :extra_rustc_args, :dry_run, :ext_dir, :extra_rustflags,
|
|
12
|
-
:extra_cargo_args
|
|
12
|
+
:extra_cargo_args, :config
|
|
13
13
|
attr_writer :profile
|
|
14
14
|
|
|
15
15
|
def initialize(spec)
|
|
@@ -66,7 +66,11 @@ module RbSys
|
|
|
66
66
|
|
|
67
67
|
def cargo_command(dest_path, args = [])
|
|
68
68
|
cmd = []
|
|
69
|
-
cmd +=
|
|
69
|
+
cmd += if config.use_cargo_build
|
|
70
|
+
["cargo", "build"]
|
|
71
|
+
else
|
|
72
|
+
["cargo", "rustc"]
|
|
73
|
+
end
|
|
70
74
|
cmd += ["--target", target] if target
|
|
71
75
|
cmd += ["--target-dir", dest_path]
|
|
72
76
|
cmd += ["--features", features.join(",")] unless features.empty?
|
|
@@ -74,9 +78,11 @@ module RbSys
|
|
|
74
78
|
cmd += ["--profile", profile.to_s]
|
|
75
79
|
cmd += Gem::Command.build_args
|
|
76
80
|
cmd += args
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
81
|
+
if !config.use_cargo_build
|
|
82
|
+
cmd += ["--"]
|
|
83
|
+
cmd += [*rustc_args(dest_path)]
|
|
84
|
+
cmd += extra_rustc_args
|
|
85
|
+
end
|
|
80
86
|
cmd
|
|
81
87
|
end
|
|
82
88
|
|
|
@@ -142,6 +148,10 @@ module RbSys
|
|
|
142
148
|
flags += ["-C", "link-arg=#{dl_flag}"] unless makefile_config("DLDFLAGS")&.include?(dl_flag)
|
|
143
149
|
end
|
|
144
150
|
|
|
151
|
+
if musl?
|
|
152
|
+
flags += ["-C", "target-feature=-crt-static"]
|
|
153
|
+
end
|
|
154
|
+
|
|
145
155
|
flags
|
|
146
156
|
end
|
|
147
157
|
|
|
@@ -328,7 +338,11 @@ module RbSys
|
|
|
328
338
|
end
|
|
329
339
|
|
|
330
340
|
def rubygems_invoked?
|
|
331
|
-
ENV.key?("SOURCE_DATE_EPOCH")
|
|
341
|
+
ENV.key?("SOURCE_DATE_EPOCH") && ENV["RB_SYS_TEST"] != "1"
|
|
342
|
+
end
|
|
343
|
+
|
|
344
|
+
def musl?
|
|
345
|
+
RbConfig::CONFIG["target_os"] == "linux-musl" || RbConfig::CONFIG["CC"]&.include?("musl-gcc")
|
|
332
346
|
end
|
|
333
347
|
|
|
334
348
|
# Error raised when no cdylib artifact was created
|
data/lib/rb_sys/mkmf/config.rb
CHANGED
|
@@ -25,8 +25,13 @@ module RbSys
|
|
|
25
25
|
# Use compiled C code fallback for stable API for ruby-head (default: false)
|
|
26
26
|
attr_accessor :use_stable_api_compiled_fallback
|
|
27
27
|
|
|
28
|
+
# Instead of the default `cargo rustc` behaviour, just call `cargo build`.
|
|
29
|
+
# Requires manually setting relevant rb-sys environment (default: false)
|
|
30
|
+
attr_accessor :use_cargo_build
|
|
31
|
+
|
|
28
32
|
def initialize(builder)
|
|
29
33
|
@builder = builder
|
|
34
|
+
@builder.config = self
|
|
30
35
|
@force_install_rust_toolchain = false
|
|
31
36
|
@auto_install_rust_toolchain = true
|
|
32
37
|
@use_stable_api_compiled_fallback = false
|
|
@@ -55,7 +60,7 @@ module RbSys
|
|
|
55
60
|
# install, to remove bloat.
|
|
56
61
|
# @api private
|
|
57
62
|
def rubygems_invoked?
|
|
58
|
-
ENV.key?("SOURCE_DATE_EPOCH")
|
|
63
|
+
ENV.key?("SOURCE_DATE_EPOCH") && ENV["RB_SYS_TEST"] != "1"
|
|
59
64
|
end
|
|
60
65
|
|
|
61
66
|
def use_stable_api_compiled_fallback?
|
data/lib/rb_sys/mkmf.rb
CHANGED
|
@@ -10,9 +10,6 @@ require_relative "mkmf/config"
|
|
|
10
10
|
module RbSys
|
|
11
11
|
# Helper class for creating Rust Makefiles
|
|
12
12
|
module Mkmf
|
|
13
|
-
# @api private
|
|
14
|
-
GLOBAL_RUSTFLAGS = ["--cfg=rb_sys_gem"]
|
|
15
|
-
|
|
16
13
|
# Helper for building Rust extensions by creating a Ruby compatible makefile
|
|
17
14
|
# for Rust. By using this class, your rust extension will be 100% compatible
|
|
18
15
|
# with the rake-compiler gem, which allows for easy cross compilation.
|
|
@@ -32,7 +29,7 @@ module RbSys
|
|
|
32
29
|
# r.env = { 'FOO' => 'bar' }
|
|
33
30
|
# r.profile = ENV.fetch('RB_SYS_CARGO_PROFILE', :dev).to_sym
|
|
34
31
|
# r.features = %w[some_cargo_feature]
|
|
35
|
-
# r.
|
|
32
|
+
# r.extra_rustflags = %w[--cfg=foo]
|
|
36
33
|
# r.target_dir = "some/target/dir"
|
|
37
34
|
# end
|
|
38
35
|
def create_rust_makefile(target, &blk)
|
|
@@ -53,7 +50,9 @@ module RbSys
|
|
|
53
50
|
RbConfig.expand(srcdir = srcprefix.dup)
|
|
54
51
|
|
|
55
52
|
full_cargo_command = cargo_command(srcdir, builder)
|
|
56
|
-
|
|
53
|
+
|
|
54
|
+
global_rustflags = []
|
|
55
|
+
global_rustflags << "--cfg=rb_sys_gem" unless builder.use_cargo_build
|
|
57
56
|
global_rustflags << "--cfg=rb_sys_use_stable_api_compiled_fallback" if builder.use_stable_api_compiled_fallback?
|
|
58
57
|
|
|
59
58
|
make_install = +<<~MAKE
|
|
@@ -169,7 +168,11 @@ module RbSys
|
|
|
169
168
|
cargo_cmd = builder.cargo_command(dest_path, args)
|
|
170
169
|
cmd = Shellwords.join(cargo_cmd)
|
|
171
170
|
cmd.gsub!("\\=", "=")
|
|
172
|
-
|
|
171
|
+
if builder.use_cargo_build
|
|
172
|
+
cmd.gsub!(/\Acargo rustc/, "$(CARGO) build $(RB_SYS_EXTRA_CARGO_ARGS) --manifest-path $(RB_SYS_CARGO_MANIFEST_DIR)/Cargo.toml")
|
|
173
|
+
else
|
|
174
|
+
cmd.gsub!(/\Acargo rustc/, "$(CARGO) rustc $(RB_SYS_EXTRA_CARGO_ARGS) --manifest-path $(RB_SYS_CARGO_MANIFEST_DIR)/Cargo.toml")
|
|
175
|
+
end
|
|
173
176
|
cmd.gsub!(/-v=\d/, "")
|
|
174
177
|
cmd
|
|
175
178
|
end
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
module RbSys
|
|
6
6
|
class ToolchainInfo
|
|
7
7
|
# @private
|
|
8
|
-
DATA = {"arm-linux" => {"rust-target" => "arm-unknown-linux-gnueabihf", "rake-compiler-dock" => {"cc" => "arm-linux-gnueabihf-gcc"}, "docker-platform" => "linux/arm/v7", "supported" => true}, "aarch64-linux" => {"rust-target" => "aarch64-unknown-linux-gnu", "rake-compiler-dock" => {"cc" => "aarch64-linux-gnu-gcc"}, "docker-platform" => "linux/arm64/v8", "supported" => true}, "arm64-darwin" => {"rust-target" => "aarch64-apple-darwin", "rake-compiler-dock" => {"cc" => "aarch64-apple-darwin-clang"}, "docker-platform" => "linux/arm64/v8", "supported" => true}, "x64-mingw-ucrt" => {"rust-target" => "x86_64-pc-windows-gnu", "rake-compiler-dock" => {"cc" => "x86_64-windows-gnu-gcc"}, "docker-platform" => "linux/amd64", "supported" => true}, "x64-mingw32" => {"rust-target" => "x86_64-pc-windows-gnu", "rake-compiler-dock" => {"cc" => "x86_64-windows-gnu-gcc"}, "docker-platform" => "linux/amd64", "supported" => true}, "x86-linux" => {"rust-target" => "i686-unknown-linux-gnu", "rake-compiler-dock" => {"cc" => "i686-redhat-linux-gcc"}, "docker-platform" => "linux/i386", "supported" => false}, "x86-mingw32" => {"rust-target" => "i686-pc-windows-gnu", "rake-compiler-dock" => {"cc" => "i686-w64-mingw32-gcc"}, "docker-platform" => "linux/i386", "supported" => false}, "x86_64-darwin" => {"rust-target" => "x86_64-apple-darwin", "rake-compiler-dock" => {"cc" => "x86_64-apple-darwin-clang"}, "docker-platform" => "linux/amd64", "supported" => true}, "x86_64-linux" => {"rust-target" => "x86_64-unknown-linux-gnu", "rake-compiler-dock" => {"cc" => "x86_64-redhat-linux-gcc"}, "docker-platform" => "linux/amd64", "supported" => true}, "x86_64-linux-musl" => {"rust-target" => "x86_64-unknown-linux-musl", "rake-compiler-dock" => {"cc" => "x86_64-unknown-linux-musl-gcc"}, "docker-platform" => "linux/amd64", "supported" => true}}
|
|
8
|
+
DATA = {"arm-linux" => {"rust-target" => "arm-unknown-linux-gnueabihf", "rake-compiler-dock" => {"cc" => "arm-linux-gnueabihf-gcc"}, "docker-platform" => "linux/arm/v7", "supported" => true}, "aarch64-linux" => {"rust-target" => "aarch64-unknown-linux-gnu", "rake-compiler-dock" => {"cc" => "aarch64-linux-gnu-gcc"}, "docker-platform" => "linux/arm64/v8", "supported" => true}, "aarch64-linux-musl" => {"rust-target" => "aarch64-unknown-linux-musl", "rake-compiler-dock" => {"cc" => "aarch64-linux-musl-gcc"}, "docker-platform" => "linux/arm64/v8", "supported" => true}, "arm64-darwin" => {"rust-target" => "aarch64-apple-darwin", "rake-compiler-dock" => {"cc" => "aarch64-apple-darwin-clang"}, "docker-platform" => "linux/arm64/v8", "supported" => true}, "x64-mingw-ucrt" => {"rust-target" => "x86_64-pc-windows-gnu", "rake-compiler-dock" => {"cc" => "x86_64-windows-gnu-gcc"}, "docker-platform" => "linux/amd64", "supported" => true}, "x64-mingw32" => {"rust-target" => "x86_64-pc-windows-gnu", "rake-compiler-dock" => {"cc" => "x86_64-windows-gnu-gcc"}, "docker-platform" => "linux/amd64", "supported" => true}, "x86-linux" => {"rust-target" => "i686-unknown-linux-gnu", "rake-compiler-dock" => {"cc" => "i686-redhat-linux-gcc"}, "docker-platform" => "linux/i386", "supported" => false}, "x86-mingw32" => {"rust-target" => "i686-pc-windows-gnu", "rake-compiler-dock" => {"cc" => "i686-w64-mingw32-gcc"}, "docker-platform" => "linux/i386", "supported" => false}, "x86_64-darwin" => {"rust-target" => "x86_64-apple-darwin", "rake-compiler-dock" => {"cc" => "x86_64-apple-darwin-clang"}, "docker-platform" => "linux/amd64", "supported" => true}, "x86_64-linux" => {"rust-target" => "x86_64-unknown-linux-gnu", "rake-compiler-dock" => {"cc" => "x86_64-redhat-linux-gcc"}, "docker-platform" => "linux/amd64", "supported" => true}, "x86_64-linux-musl" => {"rust-target" => "x86_64-unknown-linux-musl", "rake-compiler-dock" => {"cc" => "x86_64-unknown-linux-musl-gcc"}, "docker-platform" => "linux/amd64", "supported" => true}}
|
|
9
9
|
end
|
|
10
10
|
end
|
|
@@ -28,6 +28,13 @@ module RbSys
|
|
|
28
28
|
@supported ||= all.select(&:supported?)
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
+
# Get all supported toolchain names, as strings.
|
|
32
|
+
#
|
|
33
|
+
# @return [Array<String>]
|
|
34
|
+
def supported_ruby_platforms
|
|
35
|
+
supported.map(&:platform)
|
|
36
|
+
end
|
|
37
|
+
|
|
31
38
|
# Get the toolchain for the current platform.
|
|
32
39
|
#
|
|
33
40
|
# @return [RbSys::ToolchainInfo]
|
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.94
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ian Ker-Seymer
|
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
|
30
30
|
DIZ6NVmpBvohJVCCCDxQQxFKLXZp1ivoxjN+m7eJSW7yzIz062pH4u8pPNQsiVSb
|
|
31
31
|
I5rgRPbDr2rAFGXKoQ0+u6CLkRxqrVsITl/OPfZhBQI=
|
|
32
32
|
-----END CERTIFICATE-----
|
|
33
|
-
date: 2024-
|
|
33
|
+
date: 2024-04-12 00:00:00.000000000 Z
|
|
34
34
|
dependencies: []
|
|
35
35
|
description:
|
|
36
36
|
email:
|
|
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
82
82
|
- !ruby/object:Gem::Version
|
|
83
83
|
version: '0'
|
|
84
84
|
requirements: []
|
|
85
|
-
rubygems_version: 3.
|
|
85
|
+
rubygems_version: 3.5.3
|
|
86
86
|
signing_key:
|
|
87
87
|
specification_version: 4
|
|
88
88
|
summary: Helpers for compiling Rust extensions for ruby
|
metadata.gz.sig
CHANGED
|
Binary file
|