ocran 1.4.1-x86_64-linux → 1.4.2-x86_64-linux

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: 2910fba5a1d75bad3d5f89609f07f9a203b2b51a6face83b17149403f48768c1
4
- data.tar.gz: ec10f93643d20ed7ac91aec5966d1779d1745d2d6c280911c96a8e8889e67eaf
3
+ metadata.gz: c8ae157a9de1441f400873047957620d2c6f41c47371ba0e0a1c4a00be2399fe
4
+ data.tar.gz: 21dc8dc3b6ef0c91af1d96547c4701b0c16e347e386304cd756f6fd6aeda8985
5
5
  SHA512:
6
- metadata.gz: dc3429ad456ff458145a746e4d582294831cd0fafae24b63b0f53576c0d2a637110c7d1d2250af494746ef3247337ce45cae338dd31ee4f517aadac47ac2df9e
7
- data.tar.gz: 6aab8243d03e471d81127320d51ff274d4a95bc43936c1ea677472f4c4382214d5b3d56b7bffd36b7a2a6308e20fab379ae63736bf9c6ed60d2460946763776b
6
+ metadata.gz: 4063ae4a93a90dc0f1dd9ee4d96cdddceb3a4c28836830e06e4827386fbd79f9ec646b1007d542c7e1653396541356636fdaeaccef42231835ebd5b59f464dfa
7
+ data.tar.gz: '00696824bb66b0144751b042bb152eee43c51e929ae05c4e4bae8e706c698cd945db0be3eba37708ca7290e0b8cca3a053883452242c8520c84ed45d5ce7a7eb'
data/CHANGELOG.txt CHANGED
@@ -1,3 +1,8 @@
1
+ === 1.4.2
2
+ - Auto-bundle OpenSSL and all its transitive dependencies (openssl.rb, digest.so, etc.) when net/http is loaded but no HTTPS request was made during the dependency scan. OpenSSL is now required inside the OCRAN build process so every file it pulls in appears in the bundled executable.
3
+ - Add companion DLL scan on windows: when a native extension (.so) within the Ruby installation is loaded, all DLLs in the same directory are proactively included. This ensures libssl-3-x64.dll, libcrypto-3-x64.dll, libwinpthread-1.dll, and libyaml-0-2.dll are bundled even when no HTTPS connection is made during the build scan.
4
+ - Add `return if defined?(Ocran)` guards to test fixtures that have runtime-only side effects (file writes, Dir.chdir, file existence checks, network requests) to prevent them from running during the dependency scan, so we can check if the dependencies are included correctly.
5
+
1
6
  === 1.4.1
2
7
  - Fix kernel_require.rb packed at wrong path when rubygems-update is installed (e.g. via asdf on Linux/macOS). kernel_require.rb is now located relative to the actually-loaded rubygems.rb from $LOADED_FEATURES, falling back to rubylibdir for standard Ruby installations.
3
8
 
data/README.md CHANGED
@@ -115,10 +115,11 @@ Same as `--output-dir`, but packages the result into a zip file. Requires
115
115
  ### Options:
116
116
 
117
117
  ocran --help
118
+ ocran -h
118
119
 
119
120
  #### General options:
120
121
 
121
- * `--help`: Display available command-line options.
122
+ * `--help`, `-h`: Display available command-line options.
122
123
  * `--quiet`: Suppress all output during the build process.
123
124
  * `--verbose`: Provide detailed output during the build process.
124
125
  * `--version`: Display the OCRAN version number and exit.
@@ -222,6 +223,23 @@ On Windows, run the batch file:
222
223
  * OCRAN-built executables correctly handle multibyte paths (e.g. Japanese, emoji) on Windows 10 1903+.
223
224
  * When using the executable from the console, run `chcp 65001` first to switch to UTF-8 on windows.
224
225
 
226
+ ## Limitations
227
+
228
+ ### No cross-platform building
229
+
230
+ OCRAN is not a cross-compiler. The executable or directory it produces bundles
231
+ the Ruby interpreter from the machine where OCRAN is run, so you must **run
232
+ OCRAN on the same platform (and architecture) as the intended target**:
233
+
234
+ * To produce a Windows `.exe`, run OCRAN on Windows.
235
+ * To produce a Linux binary, run OCRAN on Linux.
236
+ * To produce a macOS app bundle, run OCRAN on macOS.
237
+
238
+ There is no support for building a Windows `.exe` from a Linux or macOS host,
239
+ or vice versa. If you need builds for multiple platforms, run OCRAN in CI on
240
+ each target platform separately (e.g., a Windows runner for `.exe` builds and
241
+ a Linux runner for Linux builds).
242
+
225
243
  ## Requirements
226
244
 
227
245
  * Ruby 3.2+
@@ -144,6 +144,24 @@ module Ocran
144
144
  # Store the currently loaded files
145
145
  features = normalized_features
146
146
 
147
+ # If net/http was loaded but openssl wasn't (it is only required lazily
148
+ # at the point of an actual HTTPS connection), require it now inside the
149
+ # OCRAN build process so that every transitive dependency — openssl.rb,
150
+ # digest.so, and any other files pulled in by the extension — appears in
151
+ # $LOADED_FEATURES and gets bundled alongside the application.
152
+ openssl_so = Pathname(RbConfig::CONFIG["archdir"]) / "openssl.so"
153
+ if openssl_so.exist? &&
154
+ features.any? { |f| f.to_posix.end_with?("/net/http.rb") } &&
155
+ features.none? { |f| f == openssl_so }
156
+ say "Auto-loading openssl (net/http loaded but openssl not yet required)"
157
+ before = $LOADED_FEATURES.dup
158
+ require "openssl"
159
+ ($LOADED_FEATURES - before).each do |f|
160
+ path = Pathname(f).cleanpath
161
+ features << path if path.absolute?
162
+ end
163
+ end
164
+
147
165
  say "Building #{@option.output_executable}"
148
166
  require_relative "build_helper"
149
167
  builder.extend(BuildHelper)
@@ -185,6 +203,22 @@ module Ocran
185
203
  builder.copy_to_bin(dll, dll.basename)
186
204
  end
187
205
  end
206
+
207
+ # Proactively include companion DLLs for loaded native extensions.
208
+ # Native extensions (.so) may depend on DLLs in the same archdir
209
+ # directory (e.g., libssl-3-x64.dll alongside openssl.so) that are
210
+ # loaded lazily on first use. Scanning .so directories ensures those
211
+ # DLLs are bundled even when the extension is required but not
212
+ # exercised during the OCRAN dependency scan.
213
+ features.select { |f| f.extname?(".so") && f.subpath?(exec_prefix) }
214
+ .map(&:dirname).uniq
215
+ .each do |dir|
216
+ dir.each_child do |path|
217
+ next unless path.file? && path.extname?(".dll")
218
+ say "Adding companion DLL #{path}"
219
+ builder.duplicate_to_exec_prefix(path)
220
+ end
221
+ end
188
222
  end
189
223
 
190
224
  # Windows-only: Add external manifest and builtin DLLs
data/lib/ocran/option.rb CHANGED
@@ -46,7 +46,7 @@ ocran [options] script.rb
46
46
 
47
47
  Ocran options:
48
48
 
49
- --help Display this information.
49
+ --help, -h Display this information.
50
50
  --quiet Suppress output while building executable.
51
51
  --verbose Show extra output while building executable.
52
52
  --version Display version number and exit.
@@ -179,7 +179,7 @@ EOF
179
179
  when /\A--(no-)?gem-(\w+)(?:=(.*))?$/
180
180
  negate, group, list = $1, $2, $3
181
181
  @options[:gem_options] << [negate, group.to_sym, list&.split(",")] if group
182
- when "--help", /\A--./
182
+ when "--help", "-h", /\A--./
183
183
  puts usage
184
184
  raise SystemExit
185
185
  else
data/lib/ocran/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ocran
4
- VERSION = "1.4.1"
4
+ VERSION = "1.4.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ocran
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: x86_64-linux
6
6
  authors:
7
7
  - Andi Idogawa