rb_sys 0.9.1 → 0.9.2
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 +7 -4
- data/lib/rb_sys/mkmf.rb +33 -11
- data/lib/rb_sys/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6cfe436aa013c63da8e6f04fb3e74cc73749d331b787e463b0bcf083a9e3779a
|
|
4
|
+
data.tar.gz: bd8cfba875dcb57d55bf56d686b4bfd4edaf7d61985f4d001e7bee26f58e8493
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 97375efc789f2f7d24fccbc7cc7ecf7d47ad43a6604e516cea4448b44c10003772b40ada47795d879bfffa006a71f40fc63b0497aeadfe6d8e11bb9387f19f00
|
|
7
|
+
data.tar.gz: c3fa144af515113f774ad7b1390a81780f364c5c11806db402b481b4cca82d6b3ffdbdddf8d8626421c67e7be28192849742e5de1973e799ea2b0cb608c1fff5
|
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
|
|
3
|
+
attr_accessor :spec, :runner, :profile, :env, :features, :target, :extra_rustc_args, :dry_run
|
|
4
4
|
|
|
5
5
|
def initialize(spec)
|
|
6
6
|
require "rubygems/command"
|
|
@@ -13,6 +13,7 @@ module RbSys
|
|
|
13
13
|
@features = []
|
|
14
14
|
@target = ENV["CARGO_BUILD_TARGET"]
|
|
15
15
|
@extra_rustc_args = []
|
|
16
|
+
@dry_run = true
|
|
16
17
|
end
|
|
17
18
|
|
|
18
19
|
def build(_extension, dest_path, results, args = [], lib_dir = nil, cargo_dir = Dir.pwd)
|
|
@@ -217,9 +218,11 @@ module RbSys
|
|
|
217
218
|
deffile_path = File.join(dest_dir, "#{spec.name}-#{RbConfig::CONFIG["arch"]}.def")
|
|
218
219
|
export_prefix = makefile_config("EXPORT_PREFIX") || ""
|
|
219
220
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
221
|
+
unless dry_run
|
|
222
|
+
File.open(deffile_path, "w") do |f|
|
|
223
|
+
f.puts "EXPORTS"
|
|
224
|
+
f.puts "#{export_prefix.strip}Init_#{spec.name}"
|
|
225
|
+
end
|
|
223
226
|
end
|
|
224
227
|
|
|
225
228
|
deffile_path
|
data/lib/rb_sys/mkmf.rb
CHANGED
|
@@ -25,7 +25,7 @@ module RbSys
|
|
|
25
25
|
# . create_rust_makefile("my_extension") do |r|
|
|
26
26
|
# . # All of these are optional
|
|
27
27
|
# . r.env = { 'FOO' => 'bar' }
|
|
28
|
-
# . r.profile = ENV.fetch('
|
|
28
|
+
# . r.profile = ENV.fetch('RB_SYS_CARGO_PROFILE', :dev).to_sym
|
|
29
29
|
# . r.features = %w[some_cargo_feature]
|
|
30
30
|
# . end
|
|
31
31
|
def create_rust_makefile(target, srcprefix = nil, &blk)
|
|
@@ -45,36 +45,57 @@ module RbSys
|
|
|
45
45
|
RbConfig.expand(srcdir = srcprefix.dup)
|
|
46
46
|
|
|
47
47
|
full_cargo_command = cargo_command(srcdir, builder)
|
|
48
|
-
gsub_cargo_command!(full_cargo_command, builder: builder)
|
|
49
48
|
|
|
50
49
|
# rubocop:disable Style/GlobalVars
|
|
51
|
-
make_install =
|
|
50
|
+
make_install = +<<~MAKE
|
|
52
51
|
RB_SYS_CARGO_PROFILE ?= #{builder.profile}
|
|
53
52
|
RB_SYS_CARGO_FEATURES ?= #{builder.features.join(",")}
|
|
53
|
+
CARGO ?= cargo
|
|
54
|
+
|
|
55
|
+
ifeq ($(RB_SYS_CARGO_PROFILE),dev)
|
|
56
|
+
RB_SYS_TARGET_DIR ?= debug
|
|
57
|
+
else
|
|
58
|
+
RB_SYS_TARGET_DIR ?= $(RB_SYS_CARGO_PROFILE)
|
|
59
|
+
endif
|
|
60
|
+
|
|
54
61
|
target_prefix = #{target_prefix}
|
|
55
|
-
|
|
62
|
+
TARGET_NAME = #{target[/\A\w+/]}
|
|
63
|
+
TARGET_ENTRY = #{RbConfig::CONFIG["EXPORT_PREFIX"]}Init_$(TARGET_NAME)
|
|
64
|
+
CLEANLIBS = $(RUSTLIB) $(DLLIB) $(DEFFILE)
|
|
56
65
|
DISTCLEANDIRS = target/
|
|
57
66
|
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
|
|
58
67
|
RUSTLIB = #{dllib_path(builder)}
|
|
59
68
|
TARGET = #{target}
|
|
60
69
|
DLLIB = $(TARGET).#{RbConfig::CONFIG["DLEXT"]}
|
|
61
|
-
|
|
70
|
+
TARGET_DIR = #{Dir.pwd}/target/$(RB_SYS_TARGET_DIR)
|
|
71
|
+
DEFFILE = $(TARGET_DIR)/$(TARGET)-$(arch).def
|
|
62
72
|
#{base_makefile(srcdir)}
|
|
63
|
-
|
|
64
73
|
#{env_vars(builder)}
|
|
65
74
|
|
|
66
75
|
FORCE: ;
|
|
67
76
|
|
|
68
|
-
$(
|
|
69
|
-
\t
|
|
70
|
-
\t$(
|
|
77
|
+
$(TARGET_DIR):
|
|
78
|
+
\t$(ECHO) creating target directory \\($(@)\\)
|
|
79
|
+
\t$(Q) $(MAKEDIRS) $(TARGET_DIR)
|
|
80
|
+
|
|
81
|
+
$(DEFFILE): $(TARGET_DIR)
|
|
82
|
+
\t$(ECHO) generating $(@)
|
|
83
|
+
\t$(Q) ($(COPY) $(srcdir)/$(TARGET).def $@ 2> /dev/null) || (echo EXPORTS && echo $(TARGET_ENTRY)) > $@
|
|
84
|
+
|
|
85
|
+
$(DLLIB): $(DEFFILE) FORCE
|
|
86
|
+
\t$(ECHO) generating $(@) \\("$(RB_SYS_CARGO_PROFILE)"\\)
|
|
87
|
+
\t$(Q) #{full_cargo_command}
|
|
88
|
+
\t$(Q) $(COPY) "$(RUSTLIB)" $@
|
|
71
89
|
|
|
72
90
|
install: $(DLLIB) Makefile
|
|
73
|
-
\t$(
|
|
91
|
+
\t$(ECHO) installing $(DLLIB)
|
|
92
|
+
\t$(Q) $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
|
|
74
93
|
|
|
75
94
|
all: #{$extout ? "install" : "$(DLLIB)"}
|
|
76
95
|
MAKE
|
|
77
96
|
|
|
97
|
+
gsub_cargo_command!(make_install, builder: builder)
|
|
98
|
+
|
|
78
99
|
File.write("Makefile", make_install)
|
|
79
100
|
end
|
|
80
101
|
# rubocop:enable Style/GlobalVars
|
|
@@ -93,7 +114,7 @@ module RbSys
|
|
|
93
114
|
dest_path = File.join(Dir.pwd, "target")
|
|
94
115
|
args = []
|
|
95
116
|
cargo_cmd = builder.cargo_command(cargo_dir, dest_path, args)
|
|
96
|
-
Shellwords.join(cargo_cmd).gsub("\\=", "=")
|
|
117
|
+
Shellwords.join(cargo_cmd).gsub("\\=", "=").gsub(/\Acargo/, "$(CARGO)")
|
|
97
118
|
end
|
|
98
119
|
|
|
99
120
|
def env_vars(builder)
|
|
@@ -119,6 +140,7 @@ module RbSys
|
|
|
119
140
|
def gsub_cargo_command!(cargo_command, builder:)
|
|
120
141
|
cargo_command.gsub!("--profile #{builder.profile}", "--profile $(RB_SYS_CARGO_PROFILE)")
|
|
121
142
|
cargo_command.gsub!(%r{--features \S+}, "--features $(RB_SYS_CARGO_FEATURES)")
|
|
143
|
+
cargo_command.gsub!(%r{/target/\w+/}, "/target/$(RB_SYS_TARGET_DIR)/")
|
|
122
144
|
cargo_command
|
|
123
145
|
end
|
|
124
146
|
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.2
|
|
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-02 00:00:00.000000000 Z
|
|
34
34
|
dependencies: []
|
|
35
35
|
description:
|
|
36
36
|
email:
|
metadata.gz.sig
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
�
|
|
1
|
+
7Μ4�빯��"Nm����ގ-��Ɣ�ᦼ-�U�{��oU��
|