rb_sys 0.9.3 → 0.9.6
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/cargo_builder.rb +8 -16
- data/lib/rb_sys/mkmf.rb +6 -4
- data/lib/rb_sys/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -2
- 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: a832bee97ea5d680aa3ce6f48b1a09d32014a977c2b4645986ebb6ba429b1037
|
|
4
|
+
data.tar.gz: df5a2605db7395caf6110efdfb034aac1fec1d0bf40924f967905bb33b789061
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 47f4c252dec7a7cc6c625ad6688b85fc93b07df508b5141211b6a82cbaa02a4a11669c5888b44fa80e0f2cfab3a99d71c2ac34ea543479c30b22271fc50a668a
|
|
7
|
+
data.tar.gz: 2941a00f603431fca4d954c63c0a05bb7b0cd354cb49ea938b92183062f38ac52cbe945dbe414117f33852285709324d9f28f91823d198e7d1f81e81c663d749
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/lib/rb_sys/cargo_builder.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module RbSys
|
|
2
2
|
class CargoBuilder < Gem::Ext::Builder
|
|
3
|
-
attr_accessor :spec, :runner, :profile, :env, :features, :target, :extra_rustc_args, :dry_run
|
|
3
|
+
attr_accessor :spec, :runner, :profile, :env, :features, :target, :extra_rustc_args, :dry_run, :ext_dir
|
|
4
4
|
|
|
5
5
|
def initialize(spec)
|
|
6
6
|
require "rubygems/command"
|
|
@@ -8,12 +8,13 @@ module RbSys
|
|
|
8
8
|
|
|
9
9
|
@spec = spec
|
|
10
10
|
@runner = self.class.method(:run)
|
|
11
|
-
@profile = ENV.fetch("
|
|
11
|
+
@profile = ENV.fetch("RB_SYS_CARGO_BUILD_PROFILE", :release).to_sym
|
|
12
12
|
@env = {}
|
|
13
13
|
@features = []
|
|
14
14
|
@target = ENV["CARGO_BUILD_TARGET"]
|
|
15
15
|
@extra_rustc_args = []
|
|
16
16
|
@dry_run = true
|
|
17
|
+
@ext_dir = nil
|
|
17
18
|
end
|
|
18
19
|
|
|
19
20
|
def build(_extension, dest_path, results, args = [], lib_dir = nil, cargo_dir = Dir.pwd)
|
|
@@ -29,7 +30,7 @@ module RbSys
|
|
|
29
30
|
|
|
30
31
|
def build_crate(dest_path, results, args, cargo_dir)
|
|
31
32
|
env = build_env
|
|
32
|
-
cmd = cargo_command(
|
|
33
|
+
cmd = cargo_command(dest_path, args)
|
|
33
34
|
runner.call cmd, results, "cargo", cargo_dir, env
|
|
34
35
|
|
|
35
36
|
results
|
|
@@ -41,8 +42,8 @@ module RbSys
|
|
|
41
42
|
build_env.merge(env)
|
|
42
43
|
end
|
|
43
44
|
|
|
44
|
-
def cargo_command(
|
|
45
|
-
manifest = File.join(
|
|
45
|
+
def cargo_command(dest_path, args = [])
|
|
46
|
+
manifest = File.join(ext_dir, "Cargo.toml")
|
|
46
47
|
cargo = ENV.fetch("CARGO", "cargo")
|
|
47
48
|
|
|
48
49
|
cmd = []
|
|
@@ -53,7 +54,6 @@ module RbSys
|
|
|
53
54
|
cmd += ["--manifest-path", manifest]
|
|
54
55
|
cmd += ["--lib"]
|
|
55
56
|
cmd += ["--profile", profile.to_s]
|
|
56
|
-
cmd += ["--locked"] if profile.to_s == "release"
|
|
57
57
|
cmd += Gem::Command.build_args
|
|
58
58
|
cmd += args
|
|
59
59
|
cmd += ["--"]
|
|
@@ -84,8 +84,7 @@ module RbSys
|
|
|
84
84
|
*mkmf_libpath,
|
|
85
85
|
*rustc_dynamic_linker_flags(dest_dir),
|
|
86
86
|
*rustc_lib_flags(dest_dir),
|
|
87
|
-
*platform_specific_rustc_args(dest_dir)
|
|
88
|
-
*debug_flags
|
|
87
|
+
*platform_specific_rustc_args(dest_dir)
|
|
89
88
|
]
|
|
90
89
|
end
|
|
91
90
|
|
|
@@ -257,13 +256,6 @@ module RbSys
|
|
|
257
256
|
RbConfig.expand(val.dup)
|
|
258
257
|
end
|
|
259
258
|
|
|
260
|
-
# Good balance between binary size and debugability
|
|
261
|
-
def debug_flags
|
|
262
|
-
return [] if profile == :dev
|
|
263
|
-
|
|
264
|
-
["-C", "debuginfo=1"]
|
|
265
|
-
end
|
|
266
|
-
|
|
267
259
|
# Copied from ExtConfBuilder
|
|
268
260
|
def finalize_directory(dest_path, lib_dir, extension_dir)
|
|
269
261
|
require "fileutils"
|
|
@@ -310,7 +302,7 @@ module RbSys
|
|
|
310
302
|
end
|
|
311
303
|
|
|
312
304
|
def profile_target_directory
|
|
313
|
-
case profile
|
|
305
|
+
case profile.to_sym
|
|
314
306
|
when :release then "release"
|
|
315
307
|
when :dev then "debug"
|
|
316
308
|
else raise "unknown target directory for profile: #{profile}"
|
data/lib/rb_sys/mkmf.rb
CHANGED
|
@@ -28,7 +28,7 @@ module RbSys
|
|
|
28
28
|
# . r.profile = ENV.fetch('RB_SYS_CARGO_PROFILE', :dev).to_sym
|
|
29
29
|
# . r.features = %w[some_cargo_feature]
|
|
30
30
|
# . end
|
|
31
|
-
def create_rust_makefile(target,
|
|
31
|
+
def create_rust_makefile(target, &blk)
|
|
32
32
|
if target.include?("/")
|
|
33
33
|
target_prefix, target = File.split(target)
|
|
34
34
|
target_prefix[0, 0] = "/"
|
|
@@ -41,7 +41,7 @@ module RbSys
|
|
|
41
41
|
|
|
42
42
|
yield builder if blk
|
|
43
43
|
|
|
44
|
-
srcprefix
|
|
44
|
+
srcprefix = "$(srcdir)/#{builder.ext_dir}".chomp("/")
|
|
45
45
|
RbConfig.expand(srcdir = srcprefix.dup)
|
|
46
46
|
|
|
47
47
|
full_cargo_command = cargo_command(srcdir, builder)
|
|
@@ -112,9 +112,11 @@ module RbSys
|
|
|
112
112
|
end
|
|
113
113
|
|
|
114
114
|
def cargo_command(cargo_dir, builder)
|
|
115
|
+
builder.ext_dir = cargo_dir
|
|
115
116
|
dest_path = File.join(Dir.pwd, "target")
|
|
116
|
-
args =
|
|
117
|
-
|
|
117
|
+
args = ARGV.dup
|
|
118
|
+
args.shift if args.first == "--"
|
|
119
|
+
cargo_cmd = builder.cargo_command(dest_path, args)
|
|
118
120
|
Shellwords.join(cargo_cmd).gsub("\\=", "=").gsub(/\Acargo/, "$(CARGO)")
|
|
119
121
|
end
|
|
120
122
|
|
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.6
|
|
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-06-
|
|
33
|
+
date: 2022-06-22 00:00:00.000000000 Z
|
|
34
34
|
dependencies: []
|
|
35
35
|
description:
|
|
36
36
|
email:
|
metadata.gz.sig
CHANGED
|
Binary file
|