rb_sys 0.9.42 → 0.9.43

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eb891270e825b41d12d8ef69ebf94c9eac8862d6cf1649d23af775bc84f394d2
4
- data.tar.gz: 3cf455c0df0e6498c4117d3c063bd4ccaa05cb6f566fe51d36b7898b552f8aec
3
+ metadata.gz: abede1c651510cc3d4995a424e634a9ce4afcccf1a83f85151c737ad7b578463
4
+ data.tar.gz: 17d3ea227ca871ae8fb1fc19a6964d57101747a8de0564b95caeda4b042ee8df
5
5
  SHA512:
6
- metadata.gz: f84a703e4194b91120cbeb0968680d8bacd8d4eeabb0f770f94ed00d3056d765b621d46cd89134b1077e72e54bb360594f9df62bab7a2bc676efb07f4931eaa4
7
- data.tar.gz: 5cf5177fd5833d9eba38fc53529b0321d9109b772f59daa84a7d38dc447468c3aade4d8a919488a1a345164ed9589801287a0e4e02513ee9967f219f44bc0457
6
+ metadata.gz: fbbc55012efc13e0eb0ba2c3c578a96e1cca965cc8a8691e8c3e48b008c5603df73d80fbe493b6653582a0461fb7d9b3fbeb4fa8bcbe711c33468714631883de
7
+ data.tar.gz: e12945fed0147192dfdc4c8cbbaa01a34a734c358c3766970e285b563bf4b866216bb489a3075e89ab4f3860d5dce078db0ab291df126006de7718c156a7a280
checksums.yaml.gz.sig CHANGED
@@ -1,2 +1 @@
1
- 99��
2
- �Jќ9a��,��*��t�E����
1
+ �9��㼫:
@@ -1,7 +1,8 @@
1
1
  module RbSys
2
2
  # A class to build a Ruby gem Cargo. Extracted from `rubygems` gem, with some modifications.
3
3
  class CargoBuilder < Gem::Ext::Builder
4
- attr_accessor :spec, :runner, :profile, :env, :features, :target, :extra_rustc_args, :dry_run, :ext_dir, :extra_rustflags
4
+ attr_accessor :spec, :runner, :env, :features, :target, :extra_rustc_args, :dry_run, :ext_dir, :extra_rustflags
5
+ attr_writer :profile
5
6
 
6
7
  def initialize(spec)
7
8
  require "rubygems/command"
@@ -19,6 +20,12 @@ module RbSys
19
20
  @extra_rustflags = []
20
21
  end
21
22
 
23
+ def profile
24
+ return :release if rubygems_invoked?
25
+
26
+ @profile
27
+ end
28
+
22
29
  def build(_extension, dest_path, results, args = [], lib_dir = nil, cargo_dir = Dir.pwd)
23
30
  require "fileutils"
24
31
  require "shellwords"
@@ -324,6 +331,10 @@ module RbSys
324
331
  end
325
332
  end
326
333
 
334
+ def rubygems_invoked?
335
+ ENV.key?("SOURCE_DATE_EPOCH")
336
+ end
337
+
327
338
  # Error raised when no cdylib artifact was created
328
339
  class DylibNotFoundError < StandardError
329
340
  def initialize(dir)
data/lib/rb_sys/mkmf.rb CHANGED
@@ -64,7 +64,7 @@ module RbSys
64
64
  #{conditional_assign("SOEXT_PREFIX", "lib", indent: 1)}
65
65
  #{endif_stmt}
66
66
 
67
- #{conditional_assign("RB_SYS_CARGO_PROFILE", builder.profile)}
67
+ #{set_cargo_profile(builder)}
68
68
  #{conditional_assign("RB_SYS_CARGO_FEATURES", builder.features.join(","))}
69
69
  #{conditional_assign("RB_SYS_GLOBAL_RUSTFLAGS", GLOBAL_RUSTFLAGS.join(" "))}
70
70
  #{conditional_assign("RB_SYS_EXTRA_RUSTFLAGS", builder.extra_rustflags.join(" "))}
@@ -84,28 +84,30 @@ module RbSys
84
84
  #{endif_stmt}
85
85
 
86
86
  # Account for sub-directories when using `--target` argument with Cargo
87
+ #{conditional_assign("RB_SYS_CARGO_TARGET_DIR", "target")}
87
88
  #{if_neq_stmt("$(CARGO_BUILD_TARGET)", "")}
88
- #{assign_stmt("RB_SYS_CARGO_BUILD_TARGET_DIR", "target/$(CARGO_BUILD_TARGET)", indent: 1)}
89
+ #{assign_stmt("RB_SYS_FULL_TARGET_DIR", "$(RB_SYS_CARGO_TARGET_DIR)/$(CARGO_BUILD_TARGET)", indent: 1)}
89
90
  #{else_stmt}
90
- #{assign_stmt("RB_SYS_CARGO_BUILD_TARGET_DIR", "target", indent: 1)}
91
+ #{assign_stmt("RB_SYS_FULL_TARGET_DIR", "$(RB_SYS_CARGO_TARGET_DIR)", indent: 1)}
91
92
  #{endif_stmt}
92
93
 
93
94
  target_prefix = #{target_prefix}
94
95
  TARGET_NAME = #{target[/\A\w+/]}
95
96
  TARGET_ENTRY = #{RbConfig::CONFIG["EXPORT_PREFIX"]}Init_$(TARGET_NAME)
96
- RUBYARCHDIR = $(sitearchdir)$(target_prefix)
97
+ RUBYARCHDIR = $(sitearchdir)$(target_prefix)
97
98
  TARGET = #{target}
98
99
  DLLIB = $(TARGET).#{RbConfig::CONFIG["DLEXT"]}
99
- #{conditional_assign("TARGET_DIR", "$(RB_SYS_CARGO_BUILD_TARGET_DIR)")}
100
- RUSTLIBDIR = $(TARGET_DIR)/$(RB_SYS_CARGO_PROFILE_DIR)
100
+ RUSTLIBDIR = $(RB_SYS_FULL_TARGET_DIR)/$(RB_SYS_CARGO_PROFILE_DIR)
101
101
  RUSTLIB = $(RUSTLIBDIR)/$(SOEXT_PREFIX)$(TARGET_NAME).$(SOEXT)
102
102
 
103
- CLEANOBJS = $(RUSTLIBDIR)/.fingerprint $(RUSTLIBDIR)/incremental $(RUSTLIBDIR)/examples $(RUSTLIBDIR)/deps $(RUSTLIBDIR)/build $(RUSTLIBDIR)/.cargo-lock $(RUSTLIBDIR)/*.d $(RUSTLIBDIR)/*.rlib $(RB_SYS_BUILD_DIR)
103
+ CLEANOBJS = $(RUSTLIBDIR) $(RB_SYS_BUILD_DIR)
104
104
  DEFFILE = $(RUSTLIBDIR)/$(TARGET)-$(arch).def
105
105
  CLEANLIBS = $(DLLIB) $(RUSTLIB) $(DEFFILE)
106
106
 
107
107
  #{base_makefile(srcdir)}
108
108
 
109
+ .PHONY: gemclean
110
+
109
111
  #{if_neq_stmt("$(RB_SYS_VERBOSE)", "")}
110
112
  #{assign_stmt("Q", "$(0=@)", indent: 1)}
111
113
  #{endif_stmt}
@@ -135,7 +137,10 @@ module RbSys
135
137
  \t$(Q) $(MAKEDIRS) $(RUBYARCHDIR)
136
138
  \t$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
137
139
 
138
- install: #{builder.clean_after_install ? "install-so realclean" : "install-so"}
140
+ gemclean:
141
+ \t-$(Q)$(RM_RF) $(CLEANOBJS) $(CLEANFILES) 2> /dev/null || true
142
+
143
+ install: #{builder.clean_after_install ? "install-so gemclean" : "install-so"}
139
144
 
140
145
  all: #{$extout ? "install" : "$(DLLIB)"}
141
146
  MAKE
@@ -184,7 +189,7 @@ module RbSys
184
189
  cargo_command.gsub!(/--profile \w+/, "$(RB_SYS_CARGO_PROFILE_FLAG)")
185
190
  cargo_command.gsub!(%r{--features \S+}, "--features $(RB_SYS_CARGO_FEATURES)")
186
191
  cargo_command.gsub!(%r{--target \S+}, "--target $(CARGO_BUILD_TARGET)")
187
- cargo_command.gsub!(/--target-dir (?:(?!--).)+/, "--target-dir $(TARGET_DIR) ")
192
+ cargo_command.gsub!(/--target-dir (?:(?!--).)+/, "--target-dir $(RB_SYS_CARGO_TARGET_DIR) ")
188
193
  cargo_command
189
194
  end
190
195
 
@@ -238,9 +243,10 @@ module RbSys
238
243
 
239
244
  $(CARGO):
240
245
  \t$(Q) $(MAKEDIRS) $(CARGO_HOME) $(RUSTUP_HOME)
241
- \tcurl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL "https://sh.rustup.rs" | sh -s -- --no-modify-path --profile $(RB_SYS_RUSTUP_PROFILE) --default-toolchain none -y
242
- \trustup toolchain install $(RB_SYS_DEFAULT_TOOLCHAIN) --profile $(RB_SYS_RUSTUP_PROFILE)
243
- \trustup default $(RB_SYS_DEFAULT_TOOLCHAIN)
246
+ \t$(Q) curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL "https://sh.rustup.rs" | sh -s -- --no-modify-path --profile $(RB_SYS_RUSTUP_PROFILE) --default-toolchain none -y
247
+ \t$(Q) rustup toolchain install $(RB_SYS_DEFAULT_TOOLCHAIN) --profile $(RB_SYS_RUSTUP_PROFILE)
248
+ \t$(Q) rustup default $(RB_SYS_DEFAULT_TOOLCHAIN)
249
+ \t$(Q) rustup component add rustfmt
244
250
 
245
251
  $(RUSTLIB): $(CARGO)
246
252
  #{endif_stmt}
@@ -311,6 +317,12 @@ module RbSys
311
317
  "export #{k} := #{v}"
312
318
  end
313
319
  end
320
+
321
+ def set_cargo_profile(builder)
322
+ return assign_stmt("RB_SYS_CARGO_PROFILE", "release") if builder.rubygems_invoked?
323
+
324
+ conditional_assign("RB_SYS_CARGO_PROFILE", builder.profile)
325
+ end
314
326
  end
315
327
  end
316
328
  # rubocop:enable Style/GlobalVars
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RbSys
4
- VERSION = "0.9.42"
4
+ VERSION = "0.9.43"
5
5
  end
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.42
4
+ version: 0.9.43
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Ker-Seymer
metadata.gz.sig CHANGED
@@ -1,3 +1,2 @@
1
- k9zs�|+���HΞ����Ƙf��!9�� ��BA�A�NM(�{���հ�2�H�TȞq �o��
2
- j��Wd�����Crn�����]�*�^sA �`����lFE��<
3
- �Ue9:�4���H[6��<i�)d��Nm���`6O_Efc�q�V��t���+yƏ�r�� �Ö@�Z,,�C��op?�X�����ǨM��1�5O�ޥ��t}��"�o�G����
1
+ aIA�H������]A����𲂷��e��׏���:Q��߮�jU�&��R�cb���6e��г&��������\^��Y�s�����Ĝó����G�/*���ơ|u8T
2
+ �\�|o p��]F MѶ�y2DDK(-Xyz�\��劗_