ffi-libarchive-binary 0.5.0-arm64-mingw-ucrt
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 +7 -0
- data/.gitignore +19 -0
- data/.rspec +1 -0
- data/.rubocop.yml +18 -0
- data/Gemfile +5 -0
- data/README.adoc +255 -0
- data/Rakefile +79 -0
- data/ext/Makefile +4 -0
- data/ext/configuration.yml +49 -0
- data/ext/extconf.rb +6 -0
- data/ffi-libarchive-binary.gemspec +51 -0
- data/lib/ffi-libarchive-binary/base_recipe.rb +104 -0
- data/lib/ffi-libarchive-binary/configuration.rb +36 -0
- data/lib/ffi-libarchive-binary/libarchive.dll +0 -0
- data/lib/ffi-libarchive-binary/libarchive_recipe.rb +194 -0
- data/lib/ffi-libarchive-binary/libexpat_recipe.rb +42 -0
- data/lib/ffi-libarchive-binary/libxml2_recipe.rb +55 -0
- data/lib/ffi-libarchive-binary/openssl_recipe.rb +83 -0
- data/lib/ffi-libarchive-binary/version.rb +5 -0
- data/lib/ffi-libarchive-binary/xz_recipe.rb +42 -0
- data/lib/ffi-libarchive-binary/zlib_recipe.rb +84 -0
- data/lib/ffi-libarchive-binary.rb +43 -0
- data/toolchain/aarch64-linux-gnu.cmake +12 -0
- metadata +149 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: e4e18d3ce61f70325fcbc464d6933c59955492081dbbcd91be27358406db3e05
|
|
4
|
+
data.tar.gz: 9af0094e1b31fa6449fcc29782dad03cb89514baa8e3bea7b7fdc08bf4c7d2e0
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 5d007132685ef42c35f06015447d8cdb77b79cab1be4a81707328354f318b3be00343a55b889fd85421ed2068f55f15c012f6a77931fff02a2f850b35881b9e3
|
|
7
|
+
data.tar.gz: 7897dc767d5374367589bb00f8c098bcb537a08dff61864931ff57409b77e0a36de45a36e45cd26969241e5a66495b7fefea2500dd0bea7c63c03f67fb68f519
|
data/.gitignore
ADDED
data/.rspec
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
--require spec_helper
|
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
inherit_from:
|
|
2
|
+
- 'https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml'
|
|
3
|
+
|
|
4
|
+
AllCops:
|
|
5
|
+
TargetRubyVersion: 2.7
|
|
6
|
+
SuggestExtensions: false
|
|
7
|
+
NewCops: enable
|
|
8
|
+
Exclude:
|
|
9
|
+
- 'ffi-libarchive-binary.gemspec'
|
|
10
|
+
- 'tmp/**/*'
|
|
11
|
+
- 'pkg/**/*'
|
|
12
|
+
- 'ports/**/*'
|
|
13
|
+
|
|
14
|
+
Gemspec/RequireMFA:
|
|
15
|
+
Enabled: false
|
|
16
|
+
|
|
17
|
+
Layout/LineLength:
|
|
18
|
+
Max: 160
|
data/Gemfile
ADDED
data/README.adoc
ADDED
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
= Binaries for ffi-libarchive
|
|
2
|
+
|
|
3
|
+
image:https://img.shields.io/gem/v/ffi-libarchive-binary.svg["Gem Version", link="https://rubygems.org/gems/ffi-libarchive-binary"]
|
|
4
|
+
image:https://github.com/fontist/ffi-libarchive-binary/actions/workflows/test-and-release.yml/badge.svg["Build Status", link="https://github.com/fontist/ffi-libarchive-binary/actions/workflows/test-and-release.yml"]
|
|
5
|
+
|
|
6
|
+
== Purpose
|
|
7
|
+
|
|
8
|
+
Contains pre-compiled and install-time-compiled binaries for ffi-libarchive.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
== Installation
|
|
12
|
+
|
|
13
|
+
Add this line to your application's Gemfile:
|
|
14
|
+
|
|
15
|
+
[source,ruby]
|
|
16
|
+
----
|
|
17
|
+
gem "ffi-libarchive-binary"
|
|
18
|
+
----
|
|
19
|
+
|
|
20
|
+
And then execute:
|
|
21
|
+
|
|
22
|
+
[source,sh]
|
|
23
|
+
----
|
|
24
|
+
$ bundle install
|
|
25
|
+
----
|
|
26
|
+
|
|
27
|
+
Or install it yourself as:
|
|
28
|
+
|
|
29
|
+
[source,sh]
|
|
30
|
+
----
|
|
31
|
+
$ gem install ffi-libarchive-binary
|
|
32
|
+
----
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
== Usage
|
|
36
|
+
|
|
37
|
+
Require the gem and use calls from https://github.com/chef/ffi-libarchive[ffi-libarchive].
|
|
38
|
+
|
|
39
|
+
[source,ruby]
|
|
40
|
+
----
|
|
41
|
+
require "ffi-libarchive-binary"
|
|
42
|
+
|
|
43
|
+
path = File.expand_path('file.pkg', __dir__)
|
|
44
|
+
flags = Archive::EXTRACT_PERM
|
|
45
|
+
reader = Archive::Reader.open_filename(path)
|
|
46
|
+
|
|
47
|
+
reader.each_entry do |entry|
|
|
48
|
+
reader.extract(entry, flags.to_i)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
reader.close
|
|
52
|
+
----
|
|
53
|
+
|
|
54
|
+
== Development
|
|
55
|
+
|
|
56
|
+
We are following Sandi Metz's Rules for this gem, you can read the
|
|
57
|
+
http://robots.thoughtbot.com/post/50655960596/sandi-metz-rules-for-developers[description of the rules here].
|
|
58
|
+
All new code should follow these
|
|
59
|
+
rules. If you make changes in a pre-existing file that violates these rules you
|
|
60
|
+
should fix the violations as part of your contribution.
|
|
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
|
+
|
|
173
|
+
== Contributing
|
|
174
|
+
|
|
175
|
+
First, thank you for contributing! We love pull requests from everyone. By
|
|
176
|
+
participating in this project, you hereby grant https://www.ribose.com[Ribose Inc.] the
|
|
177
|
+
right to grant or transfer an unlimited number of non exclusive licenses or
|
|
178
|
+
sub-licenses to third parties, under the copyright covering the contribution
|
|
179
|
+
to use the contribution by all means.
|
|
180
|
+
|
|
181
|
+
Here are a few technical guidelines to follow:
|
|
182
|
+
|
|
183
|
+
1. Open an https://github.com/fontist/ffi-libarchive-binary/issues[issue] to discuss a new feature.
|
|
184
|
+
1. Write tests to support your new feature.
|
|
185
|
+
1. Make sure the entire test suite passes locally and on CI.
|
|
186
|
+
1. Open a Pull Request.
|
|
187
|
+
1. https://github.com/thoughtbot/guides/tree/master/protocol/git#write-a-feature[Squash your commits]
|
|
188
|
+
after receiving feedback.
|
|
189
|
+
1. Party!
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
== License
|
|
193
|
+
|
|
194
|
+
This gem is distributed with a BSD 3-Clause license.
|
|
195
|
+
|
|
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
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "rbconfig"
|
|
4
|
+
require "rake/clean"
|
|
5
|
+
require "rubygems/package_task"
|
|
6
|
+
require_relative "lib/ffi-libarchive-binary/libarchive_recipe"
|
|
7
|
+
|
|
8
|
+
require "rspec/core/rake_task"
|
|
9
|
+
require "rubocop/rake_task"
|
|
10
|
+
|
|
11
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
12
|
+
RuboCop::RakeTask.new
|
|
13
|
+
|
|
14
|
+
task default: %i[spec rubocop]
|
|
15
|
+
task spec: :compile
|
|
16
|
+
|
|
17
|
+
desc "Build install-compilation gem"
|
|
18
|
+
task "gem:native:any" do
|
|
19
|
+
sh "rake platform:any gem"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
desc "Define the gem task to build on any platform (compile on install)"
|
|
23
|
+
task "platform:any" do
|
|
24
|
+
spec = Gem::Specification::load("ffi-libarchive-binary.gemspec").dup
|
|
25
|
+
task = Gem::PackageTask.new(spec)
|
|
26
|
+
task.define
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
platforms = [
|
|
30
|
+
["x64-mingw32", "x86_64-w64-mingw32"],
|
|
31
|
+
["x64-mingw-ucrt", "x86_64-w64-mingw32"],
|
|
32
|
+
["arm64-mingw-ucrt", "aarch64-w64-mingw32"],
|
|
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"],
|
|
36
|
+
["aarch64-linux", "aarch64-linux-gnu"],
|
|
37
|
+
["aarch64-linux-gnu", "aarch64-linux-gnu"],
|
|
38
|
+
["aarch64-linux-musl", "aarch64-linux-musl"],
|
|
39
|
+
["x86_64-darwin", "x86_64-apple-darwin"],
|
|
40
|
+
["arm64-darwin", "arm64-apple-darwin"],
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
platforms.each do |platform, host|
|
|
44
|
+
desc "Build pre-compiled gem for the #{platform} platform"
|
|
45
|
+
task "gem:native:#{platform}" do
|
|
46
|
+
sh "rake compile[#{host}] platform:#{platform} gem"
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
desc "Define the gem task to build on the #{platform} platform (binary gem)"
|
|
50
|
+
task "platform:#{platform}" do
|
|
51
|
+
spec = Gem::Specification::load("ffi-libarchive-binary.gemspec").dup
|
|
52
|
+
spec.platform = Gem::Platform.new(platform)
|
|
53
|
+
spec.files += Dir.glob("lib/ffi-libarchive-binary/*.{dll,so,dylib}")
|
|
54
|
+
spec.extensions = []
|
|
55
|
+
spec.dependencies.reject! { |d| d.name == "mini_portile2" }
|
|
56
|
+
|
|
57
|
+
task = Gem::PackageTask.new(spec)
|
|
58
|
+
task.define
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
desc "Compile binary for the target host"
|
|
63
|
+
task :compile, [:host] do |_t, args|
|
|
64
|
+
recipe = LibarchiveBinary::LibarchiveRecipe.new
|
|
65
|
+
if args[:host]
|
|
66
|
+
recipe.host = args[:host]
|
|
67
|
+
else
|
|
68
|
+
recipe.host = "x86_64-apple-darwin" if /x86_64-apple-darwin*/.match?(recipe.host)
|
|
69
|
+
recipe.host = "arm64-apple-darwin" if /arm64-apple-darwin*/.match?(recipe.host)
|
|
70
|
+
end
|
|
71
|
+
recipe.cook_if_not
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
CLOBBER.include("pkg")
|
|
75
|
+
CLEAN.include("ports",
|
|
76
|
+
"tmp",
|
|
77
|
+
"lib/ffi-libarchive-binary/libarchive-13.dll",
|
|
78
|
+
"lib/ffi-libarchive-binary/libarchive.dylib",
|
|
79
|
+
"lib/ffi-libarchive-binary/libarchive.so")
|
data/ext/Makefile
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
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'
|
|
7
|
+
zlib:
|
|
8
|
+
all:
|
|
9
|
+
version: "1.3.1"
|
|
10
|
+
url: "https://zlib.net/zlib-1.3.1.tar.gz"
|
|
11
|
+
sha256: "9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23"
|
|
12
|
+
libexpat:
|
|
13
|
+
all:
|
|
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"
|
|
17
|
+
# openssl:
|
|
18
|
+
# version 3.x.y requires pod2man, that is not easily available on Windows x64
|
|
19
|
+
openssl:
|
|
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"
|
|
28
|
+
all:
|
|
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"
|
|
32
|
+
# xz:
|
|
33
|
+
# versions > 5.2.4 get crazy on MinGW
|
|
34
|
+
# versions <= 5.2.5 do not support arm64-apple-darwin target
|
|
35
|
+
# version 5.2.7 could not be linked statically to libarchive
|
|
36
|
+
xz:
|
|
37
|
+
windows:
|
|
38
|
+
version: "5.2.4"
|
|
39
|
+
url: "https://tukaani.org/xz/xz-5.2.4.tar.gz"
|
|
40
|
+
sha256: "b512f3b726d3b37b6dc4c8570e137b9311e7552e8ccbab4d39d47ce5f4177145"
|
|
41
|
+
all:
|
|
42
|
+
version: "5.2.6"
|
|
43
|
+
url: "https://tukaani.org/xz/xz-5.2.6.tar.gz"
|
|
44
|
+
sha256: "a2105abee17bcd2ebd15ced31b4f5eda6e17efd6b10f921a01cda4a44c91b3a0"
|
|
45
|
+
libarchive:
|
|
46
|
+
all:
|
|
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"
|
data/ext/extconf.rb
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
$: << File.expand_path("lib", __dir__)
|
|
4
|
+
require "ffi-libarchive-binary/version"
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "ffi-libarchive-binary"
|
|
8
|
+
spec.version = LibarchiveBinary::VERSION
|
|
9
|
+
spec.authors = ["Ribose Inc."]
|
|
10
|
+
spec.email = ["open.source@ribose.com"]
|
|
11
|
+
|
|
12
|
+
spec.summary = "Binaries for ffi-libarchive"
|
|
13
|
+
spec.description = "Contains pre-compiled and install-time-compiled binaries for ffi-libarchive" # rubocop:disable Layout/LineLength
|
|
14
|
+
spec.homepage = "https://github.com/fontist/ffi-libarchive-binary"
|
|
15
|
+
spec.license = "BSD-3-Clause"
|
|
16
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0")
|
|
17
|
+
|
|
18
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
19
|
+
spec.metadata["source_code_uri"] = "https://github.com/fontist/ffi-libarchive-binary"
|
|
20
|
+
spec.metadata["changelog_uri"] = "https://github.com/fontist/ffi-libarchive-binary"
|
|
21
|
+
|
|
22
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
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__)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
spec.bindir = "exe"
|
|
39
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
|
40
|
+
spec.require_paths = ["lib"]
|
|
41
|
+
spec.extensions = ["ext/extconf.rb"]
|
|
42
|
+
|
|
43
|
+
spec.add_runtime_dependency "ffi", "~> 1.0"
|
|
44
|
+
spec.add_runtime_dependency "ffi-libarchive", "~> 1.0"
|
|
45
|
+
spec.add_runtime_dependency "mini_portile2", "~> 2.7"
|
|
46
|
+
spec.add_runtime_dependency "rake", "~> 13.0"
|
|
47
|
+
|
|
48
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
|
49
|
+
spec.add_development_dependency "rubocop", "~> 1.7"
|
|
50
|
+
spec.add_development_dependency "rubocop-performance", "~> 1.15"
|
|
51
|
+
end
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "mini_portile2"
|
|
4
|
+
require_relative "configuration"
|
|
5
|
+
|
|
6
|
+
module LibarchiveBinary
|
|
7
|
+
FORMATS = {
|
|
8
|
+
"arm64-apple-darwin" => "Mach-O 64-bit dynamically linked shared library arm64",
|
|
9
|
+
"x86_64-apple-darwin" => "Mach-O 64-bit dynamically linked shared library x86_64",
|
|
10
|
+
"aarch64-linux-gnu" => "ELF 64-bit LSB shared object, ARM aarch64",
|
|
11
|
+
"x86_64-linux-gnu" => "ELF 64-bit LSB shared object, x86-64",
|
|
12
|
+
"x86_64-w64-mingw32" => "PE32+ executable",
|
|
13
|
+
"aarch64-w64-mingw32" => "PE32+ executable",
|
|
14
|
+
}.freeze
|
|
15
|
+
|
|
16
|
+
ARCHS = {
|
|
17
|
+
"arm64-apple-darwin" => "arm64",
|
|
18
|
+
"x86_64-apple-darwin" => "x86_64",
|
|
19
|
+
}.freeze
|
|
20
|
+
|
|
21
|
+
LIBNAMES = {
|
|
22
|
+
"x86_64-w64-mingw32" => "libarchive.dll",
|
|
23
|
+
"aarch64-w64-mingw32" => "libarchive.dll",
|
|
24
|
+
"x86_64-linux-gnu" => "libarchive.so",
|
|
25
|
+
"aarch64-linux-gnu" => "libarchive.so",
|
|
26
|
+
"x86_64-apple-darwin" => "libarchive.dylib",
|
|
27
|
+
"arm64-apple-darwin" => "libarchive.dylib",
|
|
28
|
+
}.freeze
|
|
29
|
+
|
|
30
|
+
ROOT = Pathname.new(File.expand_path("../..", __dir__))
|
|
31
|
+
|
|
32
|
+
class BaseRecipe < MiniPortile
|
|
33
|
+
def initialize(name)
|
|
34
|
+
library = LibarchiveBinary.library_for(name)
|
|
35
|
+
version = library["version"]
|
|
36
|
+
super(name, version)
|
|
37
|
+
@target = ROOT.join(@target).to_s
|
|
38
|
+
@files << {
|
|
39
|
+
url: library["url"],
|
|
40
|
+
sha256: library["sha256"],
|
|
41
|
+
}
|
|
42
|
+
@printed = {}
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def apple_arch_flag(host)
|
|
46
|
+
fl = ARCHS[host]
|
|
47
|
+
fl.nil? ? "" : " -arch #{fl}"
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def cflags(host)
|
|
51
|
+
"CFLAGS=-fPIC#{apple_arch_flag(host)}"
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def ldflags(host)
|
|
55
|
+
"LDFLAGS=-fPIC#{apple_arch_flag(host)}"
|
|
56
|
+
end
|
|
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
|
+
|
|
93
|
+
def message(text)
|
|
94
|
+
return super unless text.start_with?("\rDownloading")
|
|
95
|
+
|
|
96
|
+
match = text.match(/(\rDownloading .*)\((\s*)(\d+)%\)/)
|
|
97
|
+
pattern = match ? match[1] : text
|
|
98
|
+
return if @printed[pattern] && match[3].to_i != 100
|
|
99
|
+
|
|
100
|
+
@printed[pattern] = true
|
|
101
|
+
super
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "psych"
|
|
4
|
+
require "yaml"
|
|
5
|
+
|
|
6
|
+
module LibarchiveBinary
|
|
7
|
+
def self.libraries
|
|
8
|
+
configuration_file = File.join(File.dirname(__FILE__), "..", "..", "ext", "configuration.yml")
|
|
9
|
+
@@libraries ||= ::YAML.load_file(configuration_file)["libraries"] || {}
|
|
10
|
+
rescue Psych::SyntaxError => e
|
|
11
|
+
puts "Warning: The configuration file '#{configuration_file}' contains invalid YAML syntax."
|
|
12
|
+
puts e.message
|
|
13
|
+
exit 1
|
|
14
|
+
rescue StandardError => e
|
|
15
|
+
puts "An unexpected error occurred while loading the configuration file '#{configuration_file}'."
|
|
16
|
+
puts e.message
|
|
17
|
+
exit 1
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def self.library_for(libname)
|
|
21
|
+
if MiniPortile::windows?
|
|
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
|
|
28
|
+
else
|
|
29
|
+
libraries[libname]["all"]
|
|
30
|
+
end
|
|
31
|
+
rescue StandardError => e
|
|
32
|
+
puts "Failed to load library configuration for '#{libname}'."
|
|
33
|
+
puts e.message
|
|
34
|
+
exit 1
|
|
35
|
+
end
|
|
36
|
+
end
|
|
Binary file
|