leptris 1.9.221.0 → 1.9.221.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1dd22d3fd01dc9a0199f453734f1c0eb6b8825dc0e942edcb9a5b0a354efd776
4
- data.tar.gz: 0e4078ce4fc95daccd043c090abbc8807705685bd8d914293440fcacfde77f22
3
+ metadata.gz: abec97f5dc76127e52554fe9254f7b9a93676c0583dde964e474a7e662884878
4
+ data.tar.gz: d2d30b60d8ad656c6ed3564e63e9ea7ecc006ebe17cdb026075dfd8407311dd8
5
5
  SHA512:
6
- metadata.gz: 2653ad914dc2f4255433d698d706c7ccb89e1eda06115370739ebeb9a12e372a8ea3eb73780670143e267b5f1f2ce7ccabaf7b2bcf4ca496f3deca9bb9e4a539
7
- data.tar.gz: c7f9c594e7567bfbceb42dc4a1ed13bc64719465c588a149fe03c7af82449973c55d08746a7875ed5c021014f0d1de7c2f4c01b5b48470f0b001b5f64ba13250
6
+ metadata.gz: fe37f35a8359f66544471ea70405b3895ce07acc64d9e92067fd26d9945b1c6ec2f2b82ca7a4b18628f59ca012c8347adbea24a173a8fc52bf725dacdd761e36
7
+ data.tar.gz: d2531467d1c319ff967ab0eb7b6cafc54beead04048d3d788300e8bc042cd1ce20784caf98d9e1646944d6db346cec66368bece7f1e1ace2adbf05d779039906
@@ -22,8 +22,15 @@ root = File.expand_path("..", __dir__)
22
22
  ext_dir = File.join(root, "ext", "leptris", "native")
23
23
  minor = RUBY_VERSION[/\A\d+\.\d+/]
24
24
  minor_us = minor.tr(".", "_")
25
+ INIT_PREFIX = "Init_native_"
25
26
 
26
27
  Dir.chdir(ext_dir) do
28
+ # aarch64-ucrt 1.9.221.0 shipped a DLL exporting only Init_native
29
+ # because make reused a stale native.obj from a failed earlier
30
+ # attempt (the log shows "creating Makefile -> linking" with no
31
+ # compile). Force a clean compile on every invocation.
32
+ FileUtils.rm_f(Dir.glob("#{ext_dir}/native.{o,obj,so,dll}"))
33
+ FileUtils.rm_f("#{ext_dir}/leptris/xml/native.so")
27
34
  system(RbConfig.ruby, "extconf.rb") or abort "extconf failed under #{RUBY_VERSION}"
28
35
  # mkmf's link binds the CURRENT Ruby's runtime DLL — exactly
29
36
  # what the versioned naming is for.
@@ -31,6 +38,18 @@ Dir.chdir(ext_dir) do
31
38
  abort "make failed under #{RUBY_VERSION}" unless success
32
39
  so = Dir.glob("native.{so,dll}").first
33
40
  abort "native bundle not produced under #{RUBY_VERSION}" unless so
41
+ # Functional export gate: dlopen the built DLL and resolve the
42
+ # MINOR-SUFFIXED init symbol. A PE DLL can carry the symbol in its
43
+ # string table while exporting only mkmf's Init_native (the arm64
44
+ # toolchain ignores our .def when its own wins the link) — only a
45
+ # real lookup proves native_<minor>.so will load.
46
+ require "fiddle"
47
+ begin
48
+ Fiddle.dlopen(File.expand_path(so))[INIT_PREFIX + minor_us]
49
+ rescue Fiddle::DLError => e
50
+ abort "#{so} does not export #{INIT_PREFIX + minor_us} — refusing to " \
51
+ "install a DLL that would 127 at require (#{e.message})"
52
+ end
34
53
  dest = File.join(root, "lib", "leptris", "xml", "native_#{minor_us}.so")
35
54
  # The artifact must reference only this minor's Ruby DLL.
36
55
  imported = `strings #{so} 2>/dev/null`[/[a-z0-9-]*ruby\d{3,}\.dll/i]
@@ -2524,7 +2524,23 @@ static VALUE leptris_native_resolve_rb(VALUE self, VALUE lib_path)
2524
2524
  return Qnil;
2525
2525
  }
2526
2526
 
2527
- void Init_native(void)
2527
+ /*
2528
+ * Windows export discipline: a PE DLL exports only what a .def file or
2529
+ * __declspec(dllexport) names. native_layer requires the MINOR-SUFFIXED
2530
+ * symbol (native_3_4.so -> Init_native_3_4), but mkmf generates its own
2531
+ * .def listing just Init_native, and depending on toolchain that def
2532
+ * can win over ours (aarch64-ucrt ld does not auto-export the rest, so
2533
+ * the lookup 127s and the platform silently degrades to the FFI
2534
+ * surface). dllexport pins all four entry points into the export table
2535
+ * on every Windows toolchain; it is a no-op elsewhere.
2536
+ */
2537
+ #if defined(_WIN32)
2538
+ # define LEPTRIS_INIT_EXPORT __declspec(dllexport)
2539
+ #else
2540
+ # define LEPTRIS_INIT_EXPORT
2541
+ #endif
2542
+
2543
+ LEPTRIS_INIT_EXPORT void Init_native(void)
2528
2544
  {
2529
2545
  VALUE m_leptris, m_xml, m_native;
2530
2546
 
@@ -2683,7 +2699,7 @@ void Init_native(void)
2683
2699
  * each needs its exact init name exported. All are defined here
2684
2700
  * unconditionally: a DLL only ever loads under the Ruby minor it
2685
2701
  * was built against (PE binds its build Ruby's runtime DLL). */
2686
- void Init_native_3_3(void) { Init_native(); }
2687
- void Init_native_3_4(void) { Init_native(); }
2688
- void Init_native_4_0(void) { Init_native(); }
2702
+ LEPTRIS_INIT_EXPORT void Init_native_3_3(void) { Init_native(); }
2703
+ LEPTRIS_INIT_EXPORT void Init_native_3_4(void) { Init_native(); }
2704
+ LEPTRIS_INIT_EXPORT void Init_native_4_0(void) { Init_native(); }
2689
2705
  #endif
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Leptris
4
- VERSION = "1.9.221.0"
4
+ VERSION = "1.9.221.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leptris
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.221.0
4
+ version: 1.9.221.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.