rb_sys 0.9.128 → 0.9.130
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/lib/rb_sys/error.rb +1 -1
- data/lib/rb_sys/extensiontask.rb +33 -4
- data/lib/rb_sys/mkmf.rb +27 -4
- 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 +1 -1
- 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: e3e0c8b8dba44b339c68919b055cbaceacd426347771a15e288c0ce30dba4ae4
|
|
4
|
+
data.tar.gz: 87c5f0322d8ca0c6f91b8c4508fc6ee76a3581721d8c2e4299631fcbe9ebdb75
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c513c9b21e6a025b1779a45559f7da443f7d3464e35d8db8c3f664a1757d051c6b1c8688081d4e71f93c5fe9f57592d3815d1194296ad02ea3e862c83c727998
|
|
7
|
+
data.tar.gz: 70a6da32dc974b268459bd767b9073ed1ee2fbe5dc876b710433a31c92b8a449618d0ad69e5d6a7b8b2660d994b24bb09ae581f5c43f679c5b649371f0cc3e0f
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/lib/rb_sys/error.rb
CHANGED
|
@@ -32,7 +32,7 @@ module RbSys
|
|
|
32
32
|
- Make sure `cargo` is installed and in your PATH
|
|
33
33
|
MSG
|
|
34
34
|
|
|
35
|
-
if !stderr.empty?
|
|
35
|
+
if stderr && !stderr.empty?
|
|
36
36
|
indented_stderr = stderr.lines.map { |line| " #{line}" }.join
|
|
37
37
|
msg << "Stderr from `cargo metadata` was:\n#{indented_stderr}"
|
|
38
38
|
end
|
data/lib/rb_sys/extensiontask.rb
CHANGED
|
@@ -29,8 +29,8 @@ module RbSys
|
|
|
29
29
|
def init(name = nil, gem_spec = nil)
|
|
30
30
|
super(name, lint_gem_spec(name, gem_spec))
|
|
31
31
|
|
|
32
|
-
@
|
|
33
|
-
@ext_dir =
|
|
32
|
+
@original_ext_dir = @ext_dir
|
|
33
|
+
@ext_dir = cargo_manifest_directory
|
|
34
34
|
@source_pattern = nil
|
|
35
35
|
@compiled_pattern = "*.{obj,so,bundle,dSYM}"
|
|
36
36
|
@cross_compile = ENV.key?("RUBY_TARGET")
|
|
@@ -61,7 +61,7 @@ module RbSys
|
|
|
61
61
|
end
|
|
62
62
|
|
|
63
63
|
def extconf
|
|
64
|
-
File.join(
|
|
64
|
+
File.join(ext_dir, "extconf.rb")
|
|
65
65
|
end
|
|
66
66
|
|
|
67
67
|
def binary(_platf)
|
|
@@ -86,6 +86,8 @@ module RbSys
|
|
|
86
86
|
end
|
|
87
87
|
|
|
88
88
|
def target_directory
|
|
89
|
+
return fallback_target_directory if @cargo_metadata_unavailable
|
|
90
|
+
|
|
89
91
|
cargo_metadata.target_directory
|
|
90
92
|
end
|
|
91
93
|
|
|
@@ -104,7 +106,7 @@ module RbSys
|
|
|
104
106
|
def define_env_tasks
|
|
105
107
|
task "rb_sys:env:default" do
|
|
106
108
|
ENV["RB_SYS_CARGO_TARGET_DIR"] ||= target_directory
|
|
107
|
-
ENV["RB_SYS_CARGO_MANIFEST_DIR"] ||=
|
|
109
|
+
ENV["RB_SYS_CARGO_MANIFEST_DIR"] ||= File.expand_path(ext_dir)
|
|
108
110
|
ENV["RB_SYS_CARGO_PROFILE"] ||= "release"
|
|
109
111
|
end
|
|
110
112
|
|
|
@@ -129,6 +131,33 @@ module RbSys
|
|
|
129
131
|
|
|
130
132
|
private
|
|
131
133
|
|
|
134
|
+
def cargo_manifest_directory
|
|
135
|
+
cargo_metadata.manifest_directory
|
|
136
|
+
rescue CargoMetadataError
|
|
137
|
+
raise unless force_install_rust_toolchain?
|
|
138
|
+
|
|
139
|
+
# Let the generated Makefile install Cargo before the extension is built.
|
|
140
|
+
@cargo_metadata_unavailable = true
|
|
141
|
+
File.expand_path(configured_extension_directory)
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def configured_extension_directory
|
|
145
|
+
extension = @gem_spec&.extensions&.find do |path|
|
|
146
|
+
%w[Cargo.toml extconf.rb].include?(File.basename(path))
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
extension ? File.dirname(extension) : @original_ext_dir
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
def fallback_target_directory
|
|
153
|
+
File.expand_path(ENV["RB_SYS_CARGO_TARGET_DIR"] || ENV["CARGO_TARGET_DIR"] || "target")
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
def force_install_rust_toolchain?
|
|
157
|
+
value = ENV["RB_SYS_FORCE_INSTALL_RUST_TOOLCHAIN"]
|
|
158
|
+
value && value != "false"
|
|
159
|
+
end
|
|
160
|
+
|
|
132
161
|
def lint_gem_spec(name, gs)
|
|
133
162
|
gem_spec = case gs
|
|
134
163
|
when :undefined
|
data/lib/rb_sys/mkmf.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "rubygems/ext"
|
|
4
|
+
require "open3"
|
|
4
5
|
require "shellwords"
|
|
5
6
|
require_relative "cargo_builder"
|
|
6
7
|
require_relative "mkmf/config"
|
|
@@ -217,7 +218,7 @@ module RbSys
|
|
|
217
218
|
cargo_command.gsub!(/--profile [\w-]+/, "$(RB_SYS_CARGO_PROFILE_FLAG)")
|
|
218
219
|
cargo_command.gsub!(%r{--features \S+}, "--features $(RB_SYS_CARGO_FEATURES)")
|
|
219
220
|
cargo_command.gsub!(%r{--target \S+}, "--target $(CARGO_BUILD_TARGET)")
|
|
220
|
-
cargo_command.gsub!(/--target-dir (
|
|
221
|
+
cargo_command.gsub!(/--target-dir (?:\\.|[^[:space:]])+/, "--target-dir $(RB_SYS_CARGO_TARGET_DIR)")
|
|
221
222
|
cargo_command
|
|
222
223
|
end
|
|
223
224
|
|
|
@@ -297,7 +298,7 @@ module RbSys
|
|
|
297
298
|
return
|
|
298
299
|
end
|
|
299
300
|
|
|
300
|
-
%($(Q) #{tool} -id "" $(DLLIB))
|
|
301
|
+
%($(Q) #{tool} -id "$(notdir $(DLLIB))" $(DLLIB))
|
|
301
302
|
end
|
|
302
303
|
|
|
303
304
|
def if_eq_stmt(a, b)
|
|
@@ -358,14 +359,36 @@ module RbSys
|
|
|
358
359
|
end
|
|
359
360
|
end
|
|
360
361
|
|
|
361
|
-
def try_load_bundled_libclang(
|
|
362
|
+
def try_load_bundled_libclang(builder)
|
|
362
363
|
require "libclang"
|
|
363
364
|
assert_libclang_version_valid!
|
|
364
|
-
|
|
365
|
+
|
|
366
|
+
config = [export_env("LIBCLANG_PATH", Libclang.libdir)]
|
|
367
|
+
if (include_dir = compiler_builtin_include_dir(builder))
|
|
368
|
+
clang_args = Shellwords.join(["-isystem", include_dir])
|
|
369
|
+
config << conditional_assign("BINDGEN_EXTRA_CLANG_ARGS", clang_args, export: true)
|
|
370
|
+
end
|
|
371
|
+
config.join("\n")
|
|
365
372
|
rescue LoadError
|
|
366
373
|
# If we can't load the bundled libclang, just continue
|
|
367
374
|
end
|
|
368
375
|
|
|
376
|
+
def compiler_builtin_include_dir(builder)
|
|
377
|
+
cc = env_or_makefile_config("CC", builder)
|
|
378
|
+
return unless cc
|
|
379
|
+
|
|
380
|
+
stdout, _stderr, status = Open3.capture3(*Shellwords.split(cc), "-print-file-name=include")
|
|
381
|
+
return unless status.success?
|
|
382
|
+
|
|
383
|
+
path = stdout.strip
|
|
384
|
+
return if path.empty? || path == "include"
|
|
385
|
+
|
|
386
|
+
include_dir = File.expand_path(path)
|
|
387
|
+
include_dir if Dir.exist?(include_dir)
|
|
388
|
+
rescue Errno::ENOENT
|
|
389
|
+
nil
|
|
390
|
+
end
|
|
391
|
+
|
|
369
392
|
def assert_libclang_version_valid!
|
|
370
393
|
libclang_version = Gem::Version.new(Libclang.version)
|
|
371
394
|
|
|
@@ -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" => {"aliases" => ["aarch64-linux-gnu", "aarch64-unknown-linux-gnu"], "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}, "aarch64-mingw-ucrt" => {"rust-target" => "aarch64-pc-windows-gnullvm", "rake-compiler-dock" => {"cc" => "aarch64-w64-mingw32-clang"}, "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" => {"aliases" => ["x86_64-linux-gnu", "x86_64-unknown-linux-gnu"], "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}, "arm-linux-musl" => {"rust-target" => "arm-unknown-linux-musleabihf", "rake-compiler-dock" => {"cc" => "arm-linux-musleabihf-gcc"}, "docker-platform" => "linux/arm/v7", "supported" => true}, "aarch64-linux" => {"aliases" => ["aarch64-linux-gnu", "aarch64-unknown-linux-gnu"], "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}, "aarch64-mingw-ucrt" => {"rust-target" => "aarch64-pc-windows-gnullvm", "rake-compiler-dock" => {"cc" => "aarch64-w64-mingw32-clang"}, "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" => {"aliases" => ["x86_64-linux-gnu", "x86_64-unknown-linux-gnu"], "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
|
data/lib/rb_sys/version.rb
CHANGED
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
|
Binary file
|