ffi-libarchive-binary 0.4.1-aarch64-linux → 0.5.0-aarch64-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: ab8faa5dc94a48e00eb46776e6c5bca00069e0e5d647a41fa75171a9f026b1c4
4
- data.tar.gz: dd5923e00ac4f448e2b04e57218ca4ac41acc1b34c7aad881f3894de04dd580e
3
+ metadata.gz: cca4dcc9edc688f26b3990de61106f08a8ffe6bcc9b3572f3a598b150357a808
4
+ data.tar.gz: dca26bc329a6f1718f6289cc1e676a0b846fc4d5d0e000bddab45f1cc4f2b31e
5
5
  SHA512:
6
- metadata.gz: e2a0b5837a8ba698478a6ef896fba98b40c554422f52b99ce6bbd6b7d5c1e2b1378542b7a6d268ffb6c25af359f90a22f874b3056b5c8e643e363af5f3544fdf
7
- data.tar.gz: d7f3921d058b20d21d1754242306b25c8e9011b19044fc39454f953837da779d8ec1ff1514a8e6cc22d7029d6ab4c78b8494860b2ff9acce6c7e51e8bf6a2f72
6
+ metadata.gz: 0777161d21b9a7df4dd0eb4fe7de215fb826abbffac197d801f916ed65a6e4cc8be43c25f3d5671107c65fccccf1b0a4ef3ec22b2e628db00003c264afcfbe85
7
+ data.tar.gz: 406527b5f0b21da8e5f6befdae9c5cd887fd5133cb9f08f3a2874925823169200f53aed26622f6a2b8491e4a132be302ddaf35634119f0629af7635db742e699
data/README.adoc CHANGED
@@ -59,6 +59,117 @@ All new code should follow these
59
59
  rules. If you make changes in a pre-existing file that violates these rules you
60
60
  should fix the violations as part of your contribution.
61
61
 
62
+ == Releasing
63
+
64
+ The gem uses an automated release workflow that handles version bumping and
65
+ publishing to RubyGems using the `gem-release` gem.
66
+
67
+ === Release workflow
68
+
69
+ The release process is managed through GitHub Actions workflow dispatch:
70
+
71
+ . Navigate to the Actions tab in the GitHub repository
72
+ . Select the "release" workflow
73
+ . Click "Run workflow"
74
+ . Choose the version bump type:
75
+ - `x.y.z` - Set a specific version (e.g., `1.2.3`)
76
+ - `major` - Bump major version (e.g., `0.4.2` → `1.0.0`)
77
+ - `minor` - Bump minor version (e.g., `0.4.2` → `0.5.0`)
78
+ - `patch` - Bump patch version (e.g., `0.4.2` → `0.4.3`)
79
+ - `skip` - Publish current version without bumping (useful for republishing)
80
+
81
+ The workflow will:
82
+
83
+ . Install the `gem-release` gem
84
+ . Bump the version in [`lib/ffi-libarchive-binary/version.rb`](lib/ffi-libarchive-binary/version.rb:4) (if not skip)
85
+ . Create a git commit with the version change
86
+ . Create a git tag (`vX.Y.Z`)
87
+ . Push changes to the repository
88
+ . Build platform-specific gems for all supported platforms
89
+ . Publish all gems to RubyGems
90
+
91
+ NOTE: The workflow uses the `gem-release` gem which provides a reliable and
92
+ well-tested version bumping mechanism used across many Ruby projects.
93
+
94
+ === Manual release
95
+
96
+ For manual releases, you can use the `gem-release` gem directly:
97
+
98
+ [source,shell]
99
+ ----
100
+ # Install gem-release if not already installed
101
+ gem install gem-release
102
+
103
+ # Bump patch version (0.4.2 -> 0.4.3) and create tag
104
+ gem bump --version patch --tag --push
105
+
106
+ # Bump minor version (0.4.2 -> 0.5.0) and create tag
107
+ gem bump --version minor --tag --push
108
+
109
+ # Bump major version (0.4.2 -> 1.0.0) and create tag
110
+ gem bump --version major --tag --push
111
+
112
+ # Set specific version and create tag
113
+ gem bump --version 1.2.3 --tag --push
114
+ ----
115
+
116
+ Once the tag is pushed, the release workflow will automatically trigger and build
117
+ the gems for all platforms.
118
+
119
+ == Platform configuration
120
+
121
+ The gem uses centralized platform configuration in [`.github/platforms.json`](.github/platforms.json:1)
122
+ as the single source of truth for all platform-specific settings.
123
+
124
+ === Platform metadata
125
+
126
+ Each platform entry includes:
127
+
128
+ * `platform` - Platform identifier for gem naming (e.g., `x86_64-linux`)
129
+ * `os` - GitHub Actions runner to use for building
130
+ * `ruby` - Ruby version to use
131
+ * `description` - Human-readable description
132
+ * `build` - Whether to build a gem for this platform
133
+ * `test` - Whether to test this platform
134
+ * `test_os` - Array of OS runners to test on (if applicable)
135
+ * `cross_compile` - Whether this requires cross-compilation
136
+ * `notes` - Additional information
137
+
138
+ === Listing platforms
139
+
140
+ Use the provided script to list all configured platforms:
141
+
142
+ [source,shell]
143
+ ----
144
+ # List all platforms
145
+ bin/list-platforms
146
+
147
+ # List only build platforms
148
+ bin/list-platforms --build
149
+
150
+ # List only test platforms
151
+ bin/list-platforms --test
152
+ ----
153
+
154
+ === Adding or removing platforms
155
+
156
+ To add or modify platform support:
157
+
158
+ . Edit [`.github/platforms.json`](.github/platforms.json:1)
159
+ . Update the platform entry with appropriate settings
160
+ . Set `"build": true` to enable building for that platform
161
+ . Set `"test": true` to enable testing for that platform
162
+ . Update the platform arrays (`build_platforms` and `test_platforms`) at the bottom of the file
163
+
164
+ NOTE: When adding a new platform, ensure the GitHub Actions runner is available
165
+ and the build toolchain is properly configured.
166
+
167
+ === Windows ARM64 support
168
+
169
+ Windows ARM64 (`arm64-mingw-ucrt`) builds pre-compiled gems for Windows on ARM64
170
+ devices (e.g., Surface Pro X, Windows 11 ARM). This platform uses the GitHub
171
+ Actions `windows-11-arm` runner.
172
+
62
173
  == Contributing
63
174
 
64
175
  First, thank you for contributing! We love pull requests from everyone. By
@@ -83,3 +194,62 @@ Here are a few technical guidelines to follow:
83
194
  This gem is distributed with a BSD 3-Clause license.
84
195
 
85
196
  This gem is developed, maintained and funded by https://www.ribose.com/[Ribose Inc.]
197
+
198
+ === Supported platforms
199
+
200
+ The following platforms are officially tested and supported:
201
+
202
+ [cols="1,1,1,1",options="header"]
203
+ |===
204
+ | Platform | Architecture | Ruby Versions | Status
205
+
206
+ | Windows 2022 | x86_64 | 3.1+ | ✅ Supported
207
+ | Windows 2025 | x86_64 | 3.1+ | ✅ Supported
208
+ | Windows 11 ARM | ARM64 | 3.4+ | ✅ Supported
209
+ | macOS 15 | ARM64 (Apple Silicon) | 3.1+ | ✅ Supported
210
+ | macOS 15 Large | x86_64 (Intel) | 3.1+ | ✅ Supported
211
+ | macOS 26 | ARM64 (Apple Silicon) | 3.1+ | ✅ Supported
212
+ | Ubuntu 24.04 | x86_64 (glibc) | 3.1+ | ✅ Supported
213
+ | Ubuntu 22.04 | x86_64 (glibc) | 3.1+ | ✅ Supported
214
+ | Alpine Linux | x86_64 (musl) | 3.1+ | ✅ Supported
215
+ | Ubuntu 24.04 | ARM64 (glibc) | 3.1+ | ✅ Supported
216
+ | Ubuntu 22.04 | ARM64 (glibc) | 3.1+ | ✅ Supported
217
+ | Alpine Linux | ARM64 (musl) | 3.1+ | ✅ Supported
218
+ |===
219
+
220
+ NOTE: The gem provides pre-compiled binaries for 11 platforms. Separate binaries
221
+ are provided for glibc-based (gnu) and musl-based Linux distributions to ensure
222
+ compatibility.
223
+
224
+ === OpenSSL compiler target strategy
225
+
226
+ The gem explicitly sets OpenSSL compiler targets to ensure correct assembly
227
+ code generation:
228
+
229
+ [cols="1,1,1",options="header"]
230
+ |===
231
+ | Platform | Compiler Target | Reason
232
+
233
+ | Windows x64 | `mingw64` | Explicit x86_64 assembly selection
234
+ | Linux x86_64 (gnu/musl) | Auto-detect | Native toolchain works correctly
235
+ | Linux ARM64 (gnu/musl) | Auto-detect | Native toolchain works correctly
236
+ | macOS ARM64 | Auto-detect | Native toolchain works correctly
237
+ | macOS x64 | Auto-detect | Native toolchain works correctly
238
+ |===
239
+
240
+ NOTE: Windows platforms require explicit compiler targets because OpenSSL's
241
+ auto-detection does not reliably select the correct target on Windows.
242
+ Linux musl and glibc variants use the same OpenSSL configuration with
243
+ auto-detection, as the toolchain correctly identifies the target.
244
+
245
+ == Build requirements
246
+
247
+ === Windows
248
+
249
+ ==== Windows x64
250
+
251
+ For building from source on Windows x64, you need:
252
+
253
+ * Ruby 2.7 or higher with DevKit
254
+ * MinGW-w64 x86_64 toolchain
255
+ * MSYS2 (recommended) or equivalent Unix-like environment
data/Rakefile CHANGED
@@ -29,8 +29,13 @@ end
29
29
  platforms = [
30
30
  ["x64-mingw32", "x86_64-w64-mingw32"],
31
31
  ["x64-mingw-ucrt", "x86_64-w64-mingw32"],
32
+ ["arm64-mingw-ucrt", "aarch64-w64-mingw32"],
32
33
  ["x86_64-linux", "x86_64-linux-gnu"],
34
+ ["x86_64-linux-gnu", "x86_64-linux-gnu"],
35
+ ["x86_64-linux-musl", "x86_64-linux-musl"],
33
36
  ["aarch64-linux", "aarch64-linux-gnu"],
37
+ ["aarch64-linux-gnu", "aarch64-linux-gnu"],
38
+ ["aarch64-linux-musl", "aarch64-linux-musl"],
34
39
  ["x86_64-darwin", "x86_64-apple-darwin"],
35
40
  ["arm64-darwin", "arm64-apple-darwin"],
36
41
  ]
@@ -1,25 +1,34 @@
1
1
  libraries:
2
+ # Windows ARM64 support is enabled via platform-specific configurations below:
3
+ # - OpenSSL uses version 3.3.2 for Windows ARM64 (required for ARM64 compatibility)
4
+ # - OpenSSL uses version 1.1.1w for Windows x64 (more stable for x86_64)
5
+ # - xz uses version 5.2.4 for all Windows platforms (MinGW compatibility)
6
+ # - Other libraries use cross-platform versions under 'all'
2
7
  zlib:
3
8
  all:
4
9
  version: "1.3.1"
5
- url: "http://zlib.net/fossils/zlib-1.3.1.tar.gz"
10
+ url: "https://zlib.net/zlib-1.3.1.tar.gz"
6
11
  sha256: "9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23"
7
12
  libexpat:
8
13
  all:
9
- version: "2.6.4"
10
- url: "https://github.com/libexpat/libexpat/releases/download/R_2_6_4/expat-2.6.4.tar.gz"
11
- sha256: "fd03b7172b3bd7427a3e7a812063f74754f24542429b634e0db6511b53fb2278"
14
+ version: "2.7.4"
15
+ url: "https://github.com/libexpat/libexpat/releases/download/R_2_7_4/expat-2.7.4.tar.gz"
16
+ sha256: "461ecc8aa98ab1a68c2db788175665d1a4db640dc05bf0e289b6ea17122144ec"
12
17
  # openssl:
13
- # version 3.x.y requires pod2man, that is not easily available on Windows
18
+ # version 3.x.y requires pod2man, that is not easily available on Windows x64
14
19
  openssl:
15
- windows:
16
- version: "1.1.1w"
17
- url: "https://github.com/openssl/openssl/releases/download/OpenSSL_1_1_1w/openssl-1.1.1w.tar.gz"
18
- sha256: "cf3098950cb4d853ad95c0841f1f9c6d3dc102dccfcacd521d93925208b76ac8"
20
+ windows-x64:
21
+ version: "3.6.1"
22
+ url: "https://github.com/openssl/openssl/releases/download/openssl-3.6.1/openssl-3.6.1.tar.gz"
23
+ sha256: "b1bfedcd5b289ff22aee87c9d600f515767ebf45f77168cb6d64f231f518a82e"
24
+ windows-arm64:
25
+ version: "3.6.1"
26
+ url: "https://github.com/openssl/openssl/releases/download/openssl-3.6.1/openssl-3.6.1.tar.gz"
27
+ sha256: "b1bfedcd5b289ff22aee87c9d600f515767ebf45f77168cb6d64f231f518a82e"
19
28
  all:
20
- version: "3.3.2"
21
- url: "https://github.com/openssl/openssl/releases/download/openssl-3.3.2/openssl-3.3.2.tar.gz"
22
- sha256: "2e8a40b01979afe8be0bbfb3de5dc1c6709fedb46d6c89c10da114ab5fc3d281"
29
+ version: "3.6.1"
30
+ url: "https://github.com/openssl/openssl/releases/download/openssl-3.6.1/openssl-3.6.1.tar.gz"
31
+ sha256: "b1bfedcd5b289ff22aee87c9d600f515767ebf45f77168cb6d64f231f518a82e"
23
32
  # xz:
24
33
  # versions > 5.2.4 get crazy on MinGW
25
34
  # versions <= 5.2.5 do not support arm64-apple-darwin target
@@ -35,6 +44,6 @@ libraries:
35
44
  sha256: "a2105abee17bcd2ebd15ced31b4f5eda6e17efd6b10f921a01cda4a44c91b3a0"
36
45
  libarchive:
37
46
  all:
38
- version: "3.7.9"
39
- url: "https://www.libarchive.org/downloads/libarchive-3.7.9.tar.gz"
40
- sha256: "aa90732c5a6bdda52fda2ad468ac98d75be981c15dde263d7b5cf6af66fd009f"
47
+ version: "3.8.5"
48
+ url: "https://github.com/libarchive/libarchive/releases/download/v3.8.5/libarchive-3.8.5.tar.gz"
49
+ sha256: "8a60f3a7bfd59c54ce82ae805a93dba65defd04148c3333b7eaa2102f03b7ffd"
@@ -13,16 +13,26 @@ Gem::Specification.new do |spec|
13
13
  spec.description = "Contains pre-compiled and install-time-compiled binaries for ffi-libarchive" # rubocop:disable Layout/LineLength
14
14
  spec.homepage = "https://github.com/fontist/ffi-libarchive-binary"
15
15
  spec.license = "BSD-3-Clause"
16
- spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
16
+ spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0")
17
17
 
18
18
  spec.metadata["homepage_uri"] = spec.homepage
19
19
  spec.metadata["source_code_uri"] = "https://github.com/fontist/ffi-libarchive-binary"
20
20
  spec.metadata["changelog_uri"] = "https://github.com/fontist/ffi-libarchive-binary"
21
21
 
22
22
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
23
- `git ls-files -z`.split("\x0").reject do |f|
24
- f.match(%r{\A(?:test|spec|features|bin|.github)/})
25
- end
23
+ Dir.glob([
24
+ "lib/**/*.rb",
25
+ "lib/**/*.{so,dylib,dll}",
26
+ "ext/**/*",
27
+ "toolchain/**/*",
28
+ "ffi-libarchive-binary.gemspec",
29
+ "Gemfile",
30
+ "Rakefile",
31
+ "README.adoc",
32
+ ".gitignore",
33
+ ".rspec",
34
+ ".rubocop.yml"
35
+ ], base: __dir__)
26
36
  end
27
37
 
28
38
  spec.bindir = "exe"
@@ -30,7 +40,6 @@ Gem::Specification.new do |spec|
30
40
  spec.require_paths = ["lib"]
31
41
  spec.extensions = ["ext/extconf.rb"]
32
42
 
33
- spec.add_runtime_dependency "bundler", "~> 2.3", ">= 2.3.22"
34
43
  spec.add_runtime_dependency "ffi", "~> 1.0"
35
44
  spec.add_runtime_dependency "ffi-libarchive", "~> 1.0"
36
45
  spec.add_runtime_dependency "mini_portile2", "~> 2.7"
@@ -10,6 +10,7 @@ module LibarchiveBinary
10
10
  "aarch64-linux-gnu" => "ELF 64-bit LSB shared object, ARM aarch64",
11
11
  "x86_64-linux-gnu" => "ELF 64-bit LSB shared object, x86-64",
12
12
  "x86_64-w64-mingw32" => "PE32+ executable",
13
+ "aarch64-w64-mingw32" => "PE32+ executable",
13
14
  }.freeze
14
15
 
15
16
  ARCHS = {
@@ -19,6 +20,7 @@ module LibarchiveBinary
19
20
 
20
21
  LIBNAMES = {
21
22
  "x86_64-w64-mingw32" => "libarchive.dll",
23
+ "aarch64-w64-mingw32" => "libarchive.dll",
22
24
  "x86_64-linux-gnu" => "libarchive.so",
23
25
  "aarch64-linux-gnu" => "libarchive.so",
24
26
  "x86_64-apple-darwin" => "libarchive.dylib",
@@ -53,6 +55,41 @@ module LibarchiveBinary
53
55
  "LDFLAGS=-fPIC#{apple_arch_flag(host)}"
54
56
  end
55
57
 
58
+ def cross_compiler_env(host)
59
+ # For aarch64 cross-compilation, set the compiler
60
+ return {} unless host&.start_with?("aarch64")
61
+
62
+ if host == "aarch64-linux-gnu" || host == "aarch64-linux-musl"
63
+ # Note: We use aarch64-linux-gnu-gcc for both glibc and musl targets because:
64
+ # 1. We build static libraries (.a files) which are libc-agnostic
65
+ # 2. The compiler generates aarch64 machine code (architecture-specific)
66
+ # 3. glibc vs musl only matters for dynamic linking at runtime
67
+ # 4. Our static libs link into libarchive.so which links to the target libc
68
+ {
69
+ "CC" => "aarch64-linux-gnu-gcc",
70
+ "CXX" => "aarch64-linux-gnu-g++",
71
+ "AR" => "aarch64-linux-gnu-ar",
72
+ "RANLIB" => "aarch64-linux-gnu-ranlib",
73
+ "STRIP" => "aarch64-linux-gnu-strip",
74
+ }
75
+ elsif host == "aarch64-w64-mingw32"
76
+ # For Windows ARM64 cross-compilation, use regular clang with explicit target
77
+ # Not clang-cl because configure scripts don't recognize it as a C99 compiler
78
+ {
79
+ "CC" => "clang -target aarch64-w64-mingw32",
80
+ "CXX" => "clang++ -target aarch64-w64-mingw32",
81
+ "AR" => "ar",
82
+ "RANLIB" => "ranlib",
83
+ "NM" => "nm",
84
+ # Put all windres flags in RC to prevent OpenSSL from appending --target=pe-x86-64
85
+ # OpenSSL's mingw64 target adds --target=pe-x86-64 which must be the LAST flag
86
+ "RC" => "windres",
87
+ }
88
+ else
89
+ {}
90
+ end
91
+ end
92
+
56
93
  def message(text)
57
94
  return super unless text.start_with?("\rDownloading")
58
95
 
@@ -19,7 +19,12 @@ module LibarchiveBinary
19
19
 
20
20
  def self.library_for(libname)
21
21
  if MiniPortile::windows?
22
- libraries[libname]["windows"] || libraries[libname]["all"]
22
+ # Detect Windows ARM64
23
+ if RUBY_PLATFORM =~ /aarch64|arm64/i
24
+ libraries[libname]["windows-arm64"] || libraries[libname]["windows"] || libraries[libname]["all"]
25
+ else
26
+ libraries[libname]["windows-x64"] || libraries[libname]["windows"] || libraries[libname]["all"]
27
+ end
23
28
  else
24
29
  libraries[libname]["all"]
25
30
  end
@@ -45,9 +45,17 @@ module LibarchiveBinary
45
45
  "-DENABLE_OPENSSL:BOOL=ON", "-DENABLE_LIBB2:BOOL=OFF", "-DENABLE_LZ4:BOOL=OFF",
46
46
  "-DENABLE_LZO::BOOL=OFF", "-DENABLE_LZMA:BOOL=ON", "-DENABLE_ZSTD:BOOL=OFF",
47
47
  "-DENABLE_ZLIB::BOOL=ON", "-DENABLE_BZip2:BOOL=OFF", "-DENABLE_LIBXML2:BOOL=OFF",
48
- "-DENABLE_EXPAT::BOOL=ON", "-DENABLE_TAR:BOOL=OFF", "-DENABLE_ICONV::BOOL=OFF",
49
- "-DENABLE_CPIO::BOOL=OFF", "-DENABLE_CAT:BOOL=OFF", "-DENABLE_ACL:BOOL=OFF",
50
- "-DENABLE_TEST:BOOL=OFF", "-DENABLE_UNZIP:BOOL=OFF", "-DOPENSSL_USE_STATIC_LIBS=ON",
48
+ "-DENABLE_EXPAT::BOOL=ON", "-DENABLE_TAR:BOOL=OFF", "-DENABLE_CPIO::BOOL=OFF",
49
+ "-DENABLE_CAT:BOOL=OFF", "-DENABLE_ACL:BOOL=OFF", "-DENABLE_TEST:BOOL=OFF",
50
+ "-DENABLE_UNZIP:BOOL=OFF", "-DOPENSSL_USE_STATIC_LIBS=ON", "-DENABLE_XAR:BOOL=ON",
51
+
52
+ # Provide root directories - let CMake find libraries in lib or lib64
53
+ "-DOPENSSL_ROOT_DIR:PATH=#{@openssl_recipe.path}",
54
+
55
+ # Add include paths to C flags so CMake's header detection can find them
56
+ "-DCMAKE_C_FLAGS=-I#{@expat_recipe.path}/include -I#{@openssl_recipe.path}/include -I#{@xz_recipe.path}/include -I#{@zlib_recipe.path}/include",
57
+
58
+ # Provide search paths for CMake to find libraries
51
59
  "-DCMAKE_INCLUDE_PATH:STRING=#{include_path}",
52
60
  "-DCMAKE_LIBRARY_PATH:STRING=#{library_path}"
53
61
  ]
@@ -55,12 +63,11 @@ module LibarchiveBinary
55
63
 
56
64
  def configure_defaults
57
65
  df = generator_flags + default_flags
66
+
58
67
  ar = ARCHS[host]
59
- if ar.nil?
60
- df
61
- else
62
- df + ["-DCMAKE_OSX_ARCHITECTURES=#{ar}"]
63
- end
68
+ df += ["-DCMAKE_OSX_ARCHITECTURES=#{ar}"] if ar
69
+
70
+ df
64
71
  end
65
72
 
66
73
  def include_path
@@ -99,6 +106,10 @@ module LibarchiveBinary
99
106
  @xz_recipe.host = @host if @host
100
107
  @xz_recipe.cook_if_not
101
108
 
109
+ # Set explicit LZMA environment variables for libarchive configure
110
+ ENV['LIBLZMA_CFLAGS'] = "-I#{@xz_recipe.path}/include"
111
+ ENV['LIBLZMA_LIBS'] = "-L#{@xz_recipe.path}/lib -llzma"
112
+
102
113
  super
103
114
 
104
115
  FileUtils.touch(checkpoint)
@@ -18,8 +18,10 @@ module LibarchiveBinary
18
18
  end
19
19
 
20
20
  def configure
21
- cmd = ["env", cflags(host), ldflags(host),
22
- "./configure"] + computed_options
21
+ # Set cross-compiler environment variables for aarch64
22
+ env_vars = cross_compiler_env(host)
23
+ cmd = ["env"] + env_vars.map { |k, v| "#{k}=#{v}" } +
24
+ [cflags(host), ldflags(host), "./configure"] + computed_options
23
25
  execute("configure", cmd)
24
26
  end
25
27
 
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "base_recipe"
4
+
5
+ module LibarchiveBinary
6
+ class Libxml2Recipe < BaseRecipe
7
+ def initialize
8
+ super("libxml2")
9
+
10
+ @target = ROOT.join(@target).to_s
11
+ end
12
+
13
+ def configure_defaults
14
+ [
15
+ "--host=#{@host}",
16
+ "--disable-dependency-tracking",
17
+ "--without-python",
18
+ "--without-lzma",
19
+ "--without-zlib",
20
+ "--without-iconv",
21
+ "--without-icu",
22
+ "--without-debug",
23
+ "--without-threads",
24
+ "--without-modules",
25
+ "--without-catalog",
26
+ "--without-docbook",
27
+ "--without-legacy",
28
+ "--without-http",
29
+ "--without-ftp",
30
+ "--enable-static",
31
+ "--disable-shared"
32
+ ]
33
+ end
34
+
35
+ def configure
36
+ cmd = ["env", cflags(host), ldflags(host),
37
+ "./configure"] + computed_options
38
+ execute("configure", cmd)
39
+ end
40
+
41
+ def checkpoint
42
+ File.join(@target, "#{name}-#{version}-#{host}.installed")
43
+ end
44
+
45
+ def cook_if_not
46
+ cook unless File.exist?(checkpoint)
47
+ end
48
+
49
+ def cook
50
+ super
51
+
52
+ FileUtils.touch(checkpoint)
53
+ end
54
+ end
55
+ end
@@ -6,9 +6,14 @@ module LibarchiveBinary
6
6
  OS_COMPILERS = {
7
7
  "arm64-apple-darwin" => "darwin64-arm64-cc",
8
8
  "x86_64-apple-darwin" => "darwin64-x86_64-cc",
9
- "aarch64-linux-gnu" => nil,
9
+ "aarch64-linux-gnu" => "linux-aarch64",
10
+ "aarch64-linux-musl" => "linux-aarch64",
10
11
  "x86_64-linux-gnu" => nil,
12
+ "x86_64-linux-musl" => nil,
11
13
  "x86_64-w64-mingw32" => "mingw64",
14
+ # Use mingw64 target for Windows ARM64 with clang and explicit CFLAGS
15
+ # This prevents OpenSSL from adding -m64 flag which would create x86_64 objects
16
+ "aarch64-w64-mingw32" => "mingw64",
12
17
  }.freeze
13
18
 
14
19
  ENV_CMD = ["env", "CFLAGS=-fPIC", "LDFLAGS=-fPIC"].freeze
@@ -20,15 +25,45 @@ module LibarchiveBinary
20
25
 
21
26
  def configure
22
27
  os_compiler = OS_COMPILERS[@host]
23
- common_opts = ["--openssldir=#{ROOT}/ports/SSL", "no-tests", "no-shared"] +
28
+ common_opts = ["--openssldir=#{ROOT}/ports/SSL", "--libdir=lib", "no-tests", "no-shared", "no-docs"] +
24
29
  computed_options.grep(/--prefix/)
30
+
31
+ # For Windows ARM64, set CFLAGS=-fPIC first to prevent OpenSSL from adding -m64
32
+ # The mingw64 target unconditionally adds -m64 which breaks ARM64 cross-compilation
33
+ common_opts.unshift("CFLAGS=-fPIC") if @host == "aarch64-w64-mingw32"
34
+
35
+ # Disable assembly for ARM64 as x86_64-specific instructions (AVX512, etc.) won't work
36
+ common_opts << "no-asm" if @host == "aarch64-w64-mingw32"
37
+
38
+ # Disable module loading for Windows ARM64 to avoid resource file compilation
39
+ # The resource compiler (llvm-rc) can't find Windows SDK headers like winver.h
40
+ common_opts << "no-module" if @host == "aarch64-w64-mingw32"
41
+
42
+ # Disable command-line apps for Windows ARM64 to avoid resource file compilation
43
+ # The apps/openssl.rc also requires Windows SDK headers which llvm-rc can't find
44
+ common_opts << "no-apps" if @host == "aarch64-w64-mingw32"
45
+
46
+ # Set cross-compiler environment variables for aarch64
47
+ env_vars = cross_compiler_env(@host)
48
+ env_prefix = env_vars.empty? ? ENV_CMD : ENV_CMD + env_vars.map { |k, v| "#{k}=#{v}" }
49
+
25
50
  cmd = if os_compiler.nil?
26
51
  message("OpensslRecipe: guessing with 'config' for '#{@host}'\n")
27
- ENV_CMD + ["./config"] + common_opts
52
+ env_prefix + ["./config"] + common_opts
28
53
  else
29
- ENV_CMD + ["./Configure"] + common_opts + [os_compiler]
54
+ env_prefix + ["./Configure"] + common_opts + [os_compiler]
30
55
  end
31
56
  execute("configure", cmd)
57
+
58
+ # For Windows ARM64, fix the Makefile to use pe-arm64 instead of pe-x86-64 for windres
59
+ # OpenSSL's mingw64 target hardcodes --target=pe-x86-64 which creates x86_64 resource files
60
+ if @host == "aarch64-w64-mingw32"
61
+ makefile = File.join(work_path, "Makefile")
62
+ content = File.read(makefile)
63
+ content.gsub!("pe-x86-64", "pe-arm64")
64
+ File.write(makefile, content)
65
+ message("OpensslRecipe: fixed Makefile to use pe-arm64 for windres\n")
66
+ end
32
67
  end
33
68
 
34
69
  def checkpoint
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LibarchiveBinary
4
- VERSION = "0.4.1"
4
+ VERSION = "0.5.0"
5
5
  end
@@ -18,8 +18,10 @@ module LibarchiveBinary
18
18
  end
19
19
 
20
20
  def configure
21
- cmd = ["env", cflags(host), ldflags(host),
22
- "./configure"] + computed_options
21
+ # Set cross-compiler environment variables for aarch64
22
+ env_vars = cross_compiler_env(host)
23
+ cmd = ["env"] + env_vars.map { |k, v| "#{k}=#{v}" } +
24
+ [cflags(host), ldflags(host), "./configure"] + computed_options
23
25
  execute("configure", cmd)
24
26
  end
25
27
 
@@ -33,8 +33,10 @@ module LibarchiveBinary
33
33
  configure_windows
34
34
  end
35
35
  else
36
- cmd = ["env", cflags(host), ldflags(host),
37
- "./configure"] + computed_options
36
+ # Set cross-compiler environment variables for aarch64
37
+ env_vars = cross_compiler_env(host)
38
+ cmd = ["env"] + env_vars.map { |k, v| "#{k}=#{v}" } +
39
+ [cflags(host), ldflags(host), "./configure"] + computed_options
38
40
  execute("configure", cmd)
39
41
  end
40
42
  end
@@ -1,25 +1,12 @@
1
- #
2
- # CMake Toolchain file for crosscompiling for aarch64-linux-gnu.
3
- #
4
1
  set(CMAKE_SYSTEM_NAME Linux)
5
2
  set(CMAKE_SYSTEM_PROCESSOR aarch64)
6
3
 
7
- set(TOOLCHAIN_PREFIX aarch64-linux-gnu-)
8
- execute_process(
9
- COMMAND which ${TOOLCHAIN_PREFIX}gcc
10
- OUTPUT_VARIABLE BINUTILS_PATH
11
- OUTPUT_STRIP_TRAILING_WHITESPACE
12
- )
4
+ # Specify the cross compiler
5
+ set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc)
6
+ set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++)
13
7
 
14
- get_filename_component(AARCH64_TOOLCHAIN_DIR ${BINUTILS_PATH} DIRECTORY)
15
-
16
- set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}gcc)
17
- set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER})
18
- set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}g++)
19
- set(CMAKE_C_COMPILER_WORKS 1)
20
- set(CMAKE_CXX_COMPILER_WORKS 1)
21
-
22
- set(CMAKE_FIND_ROOT_PATH ${BINUTILS_PATH})
8
+ # Where to look for the target environment
23
9
  set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
24
10
  set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
25
11
  set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
12
+ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
metadata CHANGED
@@ -1,35 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffi-libarchive-binary
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: aarch64-linux
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2025-04-09 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '2.3'
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: 2.3.22
23
- type: :runtime
24
- prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- requirements:
27
- - - "~>"
28
- - !ruby/object:Gem::Version
29
- version: '2.3'
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: 2.3.22
33
12
  - !ruby/object:Gem::Dependency
34
13
  name: ffi
35
14
  requirement: !ruby/object:Gem::Requirement
@@ -137,6 +116,7 @@ files:
137
116
  - lib/ffi-libarchive-binary/libarchive.so
138
117
  - lib/ffi-libarchive-binary/libarchive_recipe.rb
139
118
  - lib/ffi-libarchive-binary/libexpat_recipe.rb
119
+ - lib/ffi-libarchive-binary/libxml2_recipe.rb
140
120
  - lib/ffi-libarchive-binary/openssl_recipe.rb
141
121
  - lib/ffi-libarchive-binary/version.rb
142
122
  - lib/ffi-libarchive-binary/xz_recipe.rb
@@ -149,7 +129,6 @@ metadata:
149
129
  homepage_uri: https://github.com/fontist/ffi-libarchive-binary
150
130
  source_code_uri: https://github.com/fontist/ffi-libarchive-binary
151
131
  changelog_uri: https://github.com/fontist/ffi-libarchive-binary
152
- post_install_message:
153
132
  rdoc_options: []
154
133
  require_paths:
155
134
  - lib
@@ -157,15 +136,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
157
136
  requirements:
158
137
  - - ">="
159
138
  - !ruby/object:Gem::Version
160
- version: 2.7.0
139
+ version: 3.1.0
161
140
  required_rubygems_version: !ruby/object:Gem::Requirement
162
141
  requirements:
163
142
  - - ">="
164
143
  - !ruby/object:Gem::Version
165
144
  version: '0'
166
145
  requirements: []
167
- rubygems_version: 3.1.6
168
- signing_key:
146
+ rubygems_version: 3.6.9
169
147
  specification_version: 4
170
148
  summary: Binaries for ffi-libarchive
171
149
  test_files: []