ffi-libarchive-binary 0.4.2-x86_64-linux-gnu
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 +146 -0
- data/Rakefile +80 -0
- data/ext/Makefile +4 -0
- data/ext/configuration.yml +45 -0
- data/ext/extconf.rb +6 -0
- data/ffi-libarchive-binary.gemspec +51 -0
- data/lib/ffi-libarchive-binary/base_recipe.rb +87 -0
- data/lib/ffi-libarchive-binary/configuration.rb +36 -0
- data/lib/ffi-libarchive-binary/libarchive.so +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 +57 -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: 5990258abeba90b4e908b041751af3d46c0af82009cf8509025380b6faaae21f
|
|
4
|
+
data.tar.gz: 4524387e450631e7813034ffa1863ba5ed1aedcd7b91071f53808521ff845d00
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: e7fdfe5ce5a0929945bb452450abc9c63ce8a95b51357542c5b6fb50ae6da8da26d20a1c669be388a7ac628e4c847aeb2572d508c1b3c6ddf57b530a8f615e83
|
|
7
|
+
data.tar.gz: d49c2f358413fa127c2678e44b3b378c1a7650fefcccd616f4196ca6a77ed9dc115ff30fccdf71ee9a5f7a36652688c99fb7a498fefe0fae2dc3154de91e66e2
|
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,146 @@
|
|
|
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
|
+
== Contributing
|
|
63
|
+
|
|
64
|
+
First, thank you for contributing! We love pull requests from everyone. By
|
|
65
|
+
participating in this project, you hereby grant https://www.ribose.com[Ribose Inc.] the
|
|
66
|
+
right to grant or transfer an unlimited number of non exclusive licenses or
|
|
67
|
+
sub-licenses to third parties, under the copyright covering the contribution
|
|
68
|
+
to use the contribution by all means.
|
|
69
|
+
|
|
70
|
+
Here are a few technical guidelines to follow:
|
|
71
|
+
|
|
72
|
+
1. Open an https://github.com/fontist/ffi-libarchive-binary/issues[issue] to discuss a new feature.
|
|
73
|
+
1. Write tests to support your new feature.
|
|
74
|
+
1. Make sure the entire test suite passes locally and on CI.
|
|
75
|
+
1. Open a Pull Request.
|
|
76
|
+
1. https://github.com/thoughtbot/guides/tree/master/protocol/git#write-a-feature[Squash your commits]
|
|
77
|
+
after receiving feedback.
|
|
78
|
+
1. Party!
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
== License
|
|
82
|
+
|
|
83
|
+
This gem is distributed with a BSD 3-Clause license.
|
|
84
|
+
|
|
85
|
+
This gem is developed, maintained and funded by https://www.ribose.com/[Ribose Inc.]
|
|
86
|
+
|
|
87
|
+
=== Supported platforms
|
|
88
|
+
|
|
89
|
+
The following platforms are officially tested and supported:
|
|
90
|
+
|
|
91
|
+
[cols="1,1,1,1",options="header"]
|
|
92
|
+
|===
|
|
93
|
+
| Platform | Architecture | Ruby Versions | Status
|
|
94
|
+
|
|
95
|
+
| Windows 2022 | x86_64 | 2.7, 3.0, 3.1, 3.2, 3.3, 3.4 | ✅ Supported
|
|
96
|
+
| Windows 2025 | x86_64 | 2.7, 3.0, 3.1, 3.2, 3.3, 3.4 | ✅ Supported
|
|
97
|
+
| macOS 15 | ARM64 (Apple Silicon) | 2.7, 3.0, 3.1, 3.2, 3.3, 3.4 | ✅ Supported
|
|
98
|
+
| macOS 15 Large | x86_64 (Intel) | 2.7, 3.0, 3.1, 3.2, 3.3, 3.4 | ✅ Supported
|
|
99
|
+
| macOS 26 | ARM64 (Apple Silicon) | 2.7, 3.0, 3.1, 3.2, 3.3, 3.4 | ✅ Supported
|
|
100
|
+
| Ubuntu 24.04 | x86_64 (glibc) | 2.7, 3.0, 3.1, 3.2, 3.3, 3.4 | ✅ Supported
|
|
101
|
+
| Ubuntu 22.04 | x86_64 (glibc) | 2.7, 3.0, 3.1, 3.2, 3.3, 3.4 | ✅ Supported
|
|
102
|
+
| Alpine Linux | x86_64 (musl) | 2.7, 3.0, 3.1, 3.2, 3.3, 3.4 | ✅ Supported
|
|
103
|
+
| Ubuntu 24.04 | ARM64 (glibc) | 2.7, 3.0, 3.1, 3.2, 3.3, 3.4 | ✅ Supported
|
|
104
|
+
| Ubuntu 22.04 | ARM64 (glibc) | 2.7, 3.0, 3.1, 3.2, 3.3, 3.4 | ✅ Supported
|
|
105
|
+
| Alpine Linux | ARM64 (musl) | 2.7, 3.0, 3.1, 3.2, 3.3, 3.4 | ✅ Supported
|
|
106
|
+
|===
|
|
107
|
+
|
|
108
|
+
NOTE: The gem provides pre-compiled binaries for 10 platforms. Separate binaries
|
|
109
|
+
are provided for glibc-based (gnu) and musl-based Linux distributions to ensure
|
|
110
|
+
compatibility. Windows ARM64 support is planned for future releases pending
|
|
111
|
+
resolution of OpenSSL build system compatibility issues with MSYS2 CLANGARM64.
|
|
112
|
+
|
|
113
|
+
=== OpenSSL compiler target strategy
|
|
114
|
+
|
|
115
|
+
The gem explicitly sets OpenSSL compiler targets to ensure correct assembly
|
|
116
|
+
code generation:
|
|
117
|
+
|
|
118
|
+
[cols="1,1,1",options="header"]
|
|
119
|
+
|===
|
|
120
|
+
| Platform | Compiler Target | Reason
|
|
121
|
+
|
|
122
|
+
| Windows x64 | `mingw64` | Explicit x86_64 assembly selection
|
|
123
|
+
| Linux x86_64 (gnu/musl) | Auto-detect | Native toolchain works correctly
|
|
124
|
+
| Linux ARM64 (gnu/musl) | Auto-detect | Native toolchain works correctly
|
|
125
|
+
| macOS ARM64 | Auto-detect | Native toolchain works correctly
|
|
126
|
+
| macOS x64 | Auto-detect | Native toolchain works correctly
|
|
127
|
+
|===
|
|
128
|
+
|
|
129
|
+
NOTE: Windows platforms require explicit compiler targets because OpenSSL's
|
|
130
|
+
auto-detection does not reliably select the correct target on Windows.
|
|
131
|
+
Linux musl and glibc variants use the same OpenSSL configuration with
|
|
132
|
+
auto-detection, as the toolchain correctly identifies the target.
|
|
133
|
+
|
|
134
|
+
== Build requirements
|
|
135
|
+
|
|
136
|
+
=== Windows
|
|
137
|
+
|
|
138
|
+
==== Windows x64
|
|
139
|
+
|
|
140
|
+
For building from source on Windows x64, you need:
|
|
141
|
+
|
|
142
|
+
* Ruby 2.7 or higher with DevKit
|
|
143
|
+
* MinGW-w64 x86_64 toolchain
|
|
144
|
+
* MSYS2 (recommended) or equivalent Unix-like environment
|
|
145
|
+
|
|
146
|
+
=== macOS
|
data/Rakefile
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
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
|
+
# Future: Windows ARM64 support (commented out due to OpenSSL build system incompatibility)
|
|
33
|
+
# ["arm64-mingw-ucrt", "aarch64-w64-mingw32"],
|
|
34
|
+
["x86_64-linux", "x86_64-linux-gnu"],
|
|
35
|
+
["x86_64-linux-gnu", "x86_64-linux-gnu"],
|
|
36
|
+
["x86_64-linux-musl", "x86_64-linux-musl"],
|
|
37
|
+
["aarch64-linux", "aarch64-linux-gnu"],
|
|
38
|
+
["aarch64-linux-gnu", "aarch64-linux-gnu"],
|
|
39
|
+
["aarch64-linux-musl", "aarch64-linux-musl"],
|
|
40
|
+
["x86_64-darwin", "x86_64-apple-darwin"],
|
|
41
|
+
["arm64-darwin", "arm64-apple-darwin"],
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
platforms.each do |platform, host|
|
|
45
|
+
desc "Build pre-compiled gem for the #{platform} platform"
|
|
46
|
+
task "gem:native:#{platform}" do
|
|
47
|
+
sh "rake compile[#{host}] platform:#{platform} gem"
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
desc "Define the gem task to build on the #{platform} platform (binary gem)"
|
|
51
|
+
task "platform:#{platform}" do
|
|
52
|
+
spec = Gem::Specification::load("ffi-libarchive-binary.gemspec").dup
|
|
53
|
+
spec.platform = Gem::Platform.new(platform)
|
|
54
|
+
spec.files += Dir.glob("lib/ffi-libarchive-binary/*.{dll,so,dylib}")
|
|
55
|
+
spec.extensions = []
|
|
56
|
+
spec.dependencies.reject! { |d| d.name == "mini_portile2" }
|
|
57
|
+
|
|
58
|
+
task = Gem::PackageTask.new(spec)
|
|
59
|
+
task.define
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
desc "Compile binary for the target host"
|
|
64
|
+
task :compile, [:host] do |_t, args|
|
|
65
|
+
recipe = LibarchiveBinary::LibarchiveRecipe.new
|
|
66
|
+
if args[:host]
|
|
67
|
+
recipe.host = args[:host]
|
|
68
|
+
else
|
|
69
|
+
recipe.host = "x86_64-apple-darwin" if /x86_64-apple-darwin*/.match?(recipe.host)
|
|
70
|
+
recipe.host = "arm64-apple-darwin" if /arm64-apple-darwin*/.match?(recipe.host)
|
|
71
|
+
end
|
|
72
|
+
recipe.cook_if_not
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
CLOBBER.include("pkg")
|
|
76
|
+
CLEAN.include("ports",
|
|
77
|
+
"tmp",
|
|
78
|
+
"lib/ffi-libarchive-binary/libarchive-13.dll",
|
|
79
|
+
"lib/ffi-libarchive-binary/libarchive.dylib",
|
|
80
|
+
"lib/ffi-libarchive-binary/libarchive.so")
|
data/ext/Makefile
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
libraries:
|
|
2
|
+
zlib:
|
|
3
|
+
all:
|
|
4
|
+
version: "1.3.1"
|
|
5
|
+
url: "https://zlib.net/zlib-1.3.1.tar.gz"
|
|
6
|
+
sha256: "9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23"
|
|
7
|
+
libexpat:
|
|
8
|
+
all:
|
|
9
|
+
version: "2.7.3"
|
|
10
|
+
url: "https://github.com/libexpat/libexpat/releases/download/R_2_7_3/expat-2.7.3.tar.gz"
|
|
11
|
+
sha256: "821ac9710d2c073eaf13e1b1895a9c9aa66c1157a99635c639fbff65cdbdd732"
|
|
12
|
+
# openssl:
|
|
13
|
+
# version 3.x.y requires pod2man, that is not easily available on Windows x64
|
|
14
|
+
# Windows ARM64 requires OpenSSL 3.3.2 (1.1.1w is x86_64 only)
|
|
15
|
+
openssl:
|
|
16
|
+
windows-x64:
|
|
17
|
+
version: "1.1.1w"
|
|
18
|
+
url: "https://github.com/openssl/openssl/releases/download/OpenSSL_1_1_1w/openssl-1.1.1w.tar.gz"
|
|
19
|
+
sha256: "cf3098950cb4d853ad95c0841f1f9c6d3dc102dccfcacd521d93925208b76ac8"
|
|
20
|
+
windows-arm64:
|
|
21
|
+
version: "3.3.2"
|
|
22
|
+
url: "https://github.com/openssl/openssl/releases/download/openssl-3.3.2/openssl-3.3.2.tar.gz"
|
|
23
|
+
sha256: "2e8a40b01979afe8be0bbfb3de5dc1c6709fedb46d6c89c10da114ab5fc3d281"
|
|
24
|
+
all:
|
|
25
|
+
version: "3.3.2"
|
|
26
|
+
url: "https://github.com/openssl/openssl/releases/download/openssl-3.3.2/openssl-3.3.2.tar.gz"
|
|
27
|
+
sha256: "2e8a40b01979afe8be0bbfb3de5dc1c6709fedb46d6c89c10da114ab5fc3d281"
|
|
28
|
+
# xz:
|
|
29
|
+
# versions > 5.2.4 get crazy on MinGW
|
|
30
|
+
# versions <= 5.2.5 do not support arm64-apple-darwin target
|
|
31
|
+
# version 5.2.7 could not be linked statically to libarchive
|
|
32
|
+
xz:
|
|
33
|
+
windows:
|
|
34
|
+
version: "5.2.4"
|
|
35
|
+
url: "https://tukaani.org/xz/xz-5.2.4.tar.gz"
|
|
36
|
+
sha256: "b512f3b726d3b37b6dc4c8570e137b9311e7552e8ccbab4d39d47ce5f4177145"
|
|
37
|
+
all:
|
|
38
|
+
version: "5.2.6"
|
|
39
|
+
url: "https://tukaani.org/xz/xz-5.2.6.tar.gz"
|
|
40
|
+
sha256: "a2105abee17bcd2ebd15ced31b4f5eda6e17efd6b10f921a01cda4a44c91b3a0"
|
|
41
|
+
libarchive:
|
|
42
|
+
all:
|
|
43
|
+
version: "3.8.4"
|
|
44
|
+
url: "https://www.libarchive.org/downloads/libarchive-3.8.4.tar.gz"
|
|
45
|
+
sha256: "b2c75b132a0ec43274d2867221befcb425034cd038e465afbfad09911abb1abb"
|
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(">= 2.7.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,87 @@
|
|
|
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-linux")
|
|
61
|
+
|
|
62
|
+
# Note: We use aarch64-linux-gnu-gcc for both glibc and musl targets because:
|
|
63
|
+
# 1. We build static libraries (.a files) which are libc-agnostic
|
|
64
|
+
# 2. The compiler generates aarch64 machine code (architecture-specific)
|
|
65
|
+
# 3. glibc vs musl only matters for dynamic linking at runtime
|
|
66
|
+
# 4. Our static libs link into libarchive.so which links to the target libc
|
|
67
|
+
{
|
|
68
|
+
"CC" => "aarch64-linux-gnu-gcc",
|
|
69
|
+
"CXX" => "aarch64-linux-gnu-g++",
|
|
70
|
+
"AR" => "aarch64-linux-gnu-ar",
|
|
71
|
+
"RANLIB" => "aarch64-linux-gnu-ranlib",
|
|
72
|
+
"STRIP" => "aarch64-linux-gnu-strip",
|
|
73
|
+
}
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def message(text)
|
|
77
|
+
return super unless text.start_with?("\rDownloading")
|
|
78
|
+
|
|
79
|
+
match = text.match(/(\rDownloading .*)\((\s*)(\d+)%\)/)
|
|
80
|
+
pattern = match ? match[1] : text
|
|
81
|
+
return if @printed[pattern] && match[3].to_i != 100
|
|
82
|
+
|
|
83
|
+
@printed[pattern] = true
|
|
84
|
+
super
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
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
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "pathname"
|
|
4
|
+
require "open3"
|
|
5
|
+
|
|
6
|
+
require_relative "configuration"
|
|
7
|
+
require_relative "base_recipe"
|
|
8
|
+
require_relative "zlib_recipe"
|
|
9
|
+
require_relative "libexpat_recipe"
|
|
10
|
+
require_relative "openssl_recipe"
|
|
11
|
+
require_relative "xz_recipe"
|
|
12
|
+
|
|
13
|
+
module LibarchiveBinary
|
|
14
|
+
class LibarchiveRecipe < MiniPortileCMake
|
|
15
|
+
ROOT = Pathname.new(File.expand_path("../..", __dir__))
|
|
16
|
+
NAME = "libarchive"
|
|
17
|
+
def initialize
|
|
18
|
+
libarchive = LibarchiveBinary.library_for(NAME)
|
|
19
|
+
super(NAME, libarchive["version"])
|
|
20
|
+
@printed = {}
|
|
21
|
+
|
|
22
|
+
@files << {
|
|
23
|
+
url: libarchive["url"],
|
|
24
|
+
sha256: libarchive["sha256"],
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@target = ROOT.join(@target).to_s
|
|
28
|
+
|
|
29
|
+
create_dependencies
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def create_dependencies
|
|
33
|
+
@zlib_recipe = ZLibRecipe.new
|
|
34
|
+
@expat_recipe = LibexpatRecipe.new
|
|
35
|
+
@openssl_recipe = OpensslRecipe.new
|
|
36
|
+
@xz_recipe = XZRecipe.new
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def generator_flags
|
|
40
|
+
MiniPortile::mingw? ? ["-G", "MSYS Makefiles"] : []
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def default_flags
|
|
44
|
+
[
|
|
45
|
+
"-DENABLE_OPENSSL:BOOL=ON", "-DENABLE_LIBB2:BOOL=OFF", "-DENABLE_LZ4:BOOL=OFF",
|
|
46
|
+
"-DENABLE_LZO::BOOL=OFF", "-DENABLE_LZMA:BOOL=ON", "-DENABLE_ZSTD:BOOL=OFF",
|
|
47
|
+
"-DENABLE_ZLIB::BOOL=ON", "-DENABLE_BZip2:BOOL=OFF", "-DENABLE_LIBXML2:BOOL=OFF",
|
|
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
|
|
59
|
+
"-DCMAKE_INCLUDE_PATH:STRING=#{include_path}",
|
|
60
|
+
"-DCMAKE_LIBRARY_PATH:STRING=#{library_path}"
|
|
61
|
+
]
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def configure_defaults
|
|
65
|
+
df = generator_flags + default_flags
|
|
66
|
+
|
|
67
|
+
ar = ARCHS[host]
|
|
68
|
+
df += ["-DCMAKE_OSX_ARCHITECTURES=#{ar}"] if ar
|
|
69
|
+
|
|
70
|
+
df
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def include_path
|
|
74
|
+
paths = [@zlib_recipe.path, @expat_recipe.path, @openssl_recipe.path, @xz_recipe.path]
|
|
75
|
+
paths.map { |k| "#{k}/include" }.join(";")
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def library_path
|
|
79
|
+
paths = [@zlib_recipe.path, @expat_recipe.path, @openssl_recipe.path, @xz_recipe.path]
|
|
80
|
+
paths.map { |k| "#{k}/lib;#{k}/lib64" }.join(";")
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def activate
|
|
84
|
+
@zlib_recipe.activate
|
|
85
|
+
@expat_recipe.activate
|
|
86
|
+
@openssl_recipe.activate
|
|
87
|
+
@xz_recipe.activate
|
|
88
|
+
|
|
89
|
+
super
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def cook_if_not
|
|
93
|
+
cook unless File.exist?(checkpoint)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def cook
|
|
97
|
+
@zlib_recipe.host = @host if @host
|
|
98
|
+
@zlib_recipe.cook_if_not
|
|
99
|
+
|
|
100
|
+
@expat_recipe.host = @host if @host
|
|
101
|
+
@expat_recipe.cook_if_not
|
|
102
|
+
|
|
103
|
+
@openssl_recipe.host = @host if @host
|
|
104
|
+
@openssl_recipe.cook_if_not
|
|
105
|
+
|
|
106
|
+
@xz_recipe.host = @host if @host
|
|
107
|
+
@xz_recipe.cook_if_not
|
|
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
|
+
|
|
113
|
+
super
|
|
114
|
+
|
|
115
|
+
FileUtils.touch(checkpoint)
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def checkpoint
|
|
119
|
+
File.join(@target, "#{name}-#{version}-#{host}.installed")
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def install
|
|
123
|
+
super
|
|
124
|
+
|
|
125
|
+
libs = Dir.glob(File.join(port_path, "{lib,bin}", "*"))
|
|
126
|
+
.grep(/\/(?:lib)?[a-zA-Z0-9\-]+\.(?:so|dylib|dll)$/)
|
|
127
|
+
FileUtils.cp_r(libs, lib_workpath, verbose: true)
|
|
128
|
+
if lib_fullpath.nil?
|
|
129
|
+
message("Cannot guess libarchive library name, skipping format verification")
|
|
130
|
+
else
|
|
131
|
+
verify_lib
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
def lib_workpath
|
|
136
|
+
@lib_workpath ||= ROOT.join("lib", "ffi-libarchive-binary")
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def lib_fullpath
|
|
140
|
+
lib_filename = LIBNAMES[@host]
|
|
141
|
+
@lib_fullpath ||= lib_filename.nil? ? nil : File.join(lib_workpath, lib_filename)
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def libraries
|
|
145
|
+
configuration_file = File.join(File.dirname(__FILE__), "..", "..", "ext", "configuration.yml")
|
|
146
|
+
@libraries ||= ::YAML.load_file(configuration_file)["libraries"] || {}
|
|
147
|
+
rescue Psych::SyntaxError => e
|
|
148
|
+
puts "Warning: The configuration file '#{configuration_file}' contains invalid YAML syntax."
|
|
149
|
+
puts e.message
|
|
150
|
+
exit 1
|
|
151
|
+
rescue StandardError => e
|
|
152
|
+
puts "An unexpected error occurred while loading the configuration file '#{configuration_file}'."
|
|
153
|
+
puts e.message
|
|
154
|
+
exit 1
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
def library_for(libname)
|
|
158
|
+
libraries[libname][MiniPortile::windows? ? "windows" : "all"]
|
|
159
|
+
rescue StandardError => e
|
|
160
|
+
puts "Failed to load library configuration for '#{libname}'."
|
|
161
|
+
puts e.message
|
|
162
|
+
exit 1
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
def verify_lib
|
|
166
|
+
begin
|
|
167
|
+
out, = Open3.capture2("file #{lib_fullpath}")
|
|
168
|
+
rescue StandardError
|
|
169
|
+
message("failed to call file, library verification skipped.\n")
|
|
170
|
+
return
|
|
171
|
+
end
|
|
172
|
+
unless out.include?(target_format)
|
|
173
|
+
raise "Invalid file format '#{out.strip}', '#{target_format}' expected"
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
message("#{lib_fullpath} format has been verified (#{target_format})\n")
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
def target_format
|
|
180
|
+
@target_format ||= FORMATS[@host].nil? ? "skip" : FORMATS[@host]
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
def message(text)
|
|
184
|
+
return super unless text.start_with?("\rDownloading")
|
|
185
|
+
|
|
186
|
+
match = text.match(/(\rDownloading .*)\((\s*)(\d+)%\)/)
|
|
187
|
+
pattern = match ? match[1] : text
|
|
188
|
+
return if @printed[pattern] && match[3].to_i != 100
|
|
189
|
+
|
|
190
|
+
@printed[pattern] = true
|
|
191
|
+
super
|
|
192
|
+
end
|
|
193
|
+
end
|
|
194
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "base_recipe"
|
|
4
|
+
|
|
5
|
+
module LibarchiveBinary
|
|
6
|
+
class LibexpatRecipe < BaseRecipe
|
|
7
|
+
def initialize
|
|
8
|
+
super("libexpat")
|
|
9
|
+
|
|
10
|
+
@target = ROOT.join(@target).to_s
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def configure_defaults
|
|
14
|
+
[
|
|
15
|
+
"--host=#{@host}", "--disable-shared", "--enable-static",
|
|
16
|
+
"--without-tests", "--without-examples"
|
|
17
|
+
]
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def configure
|
|
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
|
|
25
|
+
execute("configure", cmd)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def checkpoint
|
|
29
|
+
File.join(@target, "#{name}-#{version}-#{host}.installed")
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def cook_if_not
|
|
33
|
+
cook unless File.exist?(checkpoint)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def cook
|
|
37
|
+
super
|
|
38
|
+
|
|
39
|
+
FileUtils.touch(checkpoint)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -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
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "base_recipe"
|
|
4
|
+
|
|
5
|
+
module LibarchiveBinary
|
|
6
|
+
OS_COMPILERS = {
|
|
7
|
+
"arm64-apple-darwin" => "darwin64-arm64-cc",
|
|
8
|
+
"x86_64-apple-darwin" => "darwin64-x86_64-cc",
|
|
9
|
+
"aarch64-linux-gnu" => "linux-aarch64",
|
|
10
|
+
"aarch64-linux-musl" => "linux-aarch64",
|
|
11
|
+
"x86_64-linux-gnu" => nil,
|
|
12
|
+
"x86_64-linux-musl" => nil,
|
|
13
|
+
"x86_64-w64-mingw32" => "mingw64",
|
|
14
|
+
# Future: Windows ARM64 support (commented out due to OpenSSL build system incompatibility)
|
|
15
|
+
# "aarch64-w64-mingw32" => "VC-CLANG-WIN64-CLANGASM-ARM",
|
|
16
|
+
}.freeze
|
|
17
|
+
|
|
18
|
+
ENV_CMD = ["env", "CFLAGS=-fPIC", "LDFLAGS=-fPIC"].freeze
|
|
19
|
+
|
|
20
|
+
class OpensslRecipe < BaseRecipe
|
|
21
|
+
def initialize
|
|
22
|
+
super("openssl")
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def configure
|
|
26
|
+
os_compiler = OS_COMPILERS[@host]
|
|
27
|
+
common_opts = ["--openssldir=#{ROOT}/ports/SSL", "--libdir=lib", "no-tests", "no-shared"] +
|
|
28
|
+
computed_options.grep(/--prefix/)
|
|
29
|
+
|
|
30
|
+
# Set cross-compiler environment variables for aarch64
|
|
31
|
+
env_vars = cross_compiler_env(@host)
|
|
32
|
+
env_prefix = env_vars.empty? ? ENV_CMD : ENV_CMD + env_vars.map { |k, v| "#{k}=#{v}" }
|
|
33
|
+
|
|
34
|
+
cmd = if os_compiler.nil?
|
|
35
|
+
message("OpensslRecipe: guessing with 'config' for '#{@host}'\n")
|
|
36
|
+
env_prefix + ["./config"] + common_opts
|
|
37
|
+
else
|
|
38
|
+
env_prefix + ["./Configure"] + common_opts + [os_compiler]
|
|
39
|
+
end
|
|
40
|
+
execute("configure", cmd)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def checkpoint
|
|
44
|
+
File.join(@target, "#{name}-#{version}-#{host}.installed")
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def cook_if_not
|
|
48
|
+
cook unless File.exist?(checkpoint)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def cook
|
|
52
|
+
super
|
|
53
|
+
|
|
54
|
+
FileUtils.touch(checkpoint)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "base_recipe"
|
|
4
|
+
|
|
5
|
+
module LibarchiveBinary
|
|
6
|
+
class XZRecipe < BaseRecipe
|
|
7
|
+
def initialize
|
|
8
|
+
super("xz")
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def configure_defaults
|
|
12
|
+
[
|
|
13
|
+
"--host=#{@host}",
|
|
14
|
+
"--disable-doc", "--disable-xz", "--with-pic",
|
|
15
|
+
"--disable-xzdec", "--disable-lzmadec", "--disable-lzmainfo",
|
|
16
|
+
"--disable-scripts", "--disable-shared", "--enable-static"
|
|
17
|
+
]
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def configure
|
|
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
|
|
25
|
+
execute("configure", cmd)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def checkpoint
|
|
29
|
+
File.join(@target, "#{name}-#{version}-#{host}.installed")
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def cook_if_not
|
|
33
|
+
cook unless File.exist?(checkpoint)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def cook
|
|
37
|
+
super
|
|
38
|
+
|
|
39
|
+
FileUtils.touch(checkpoint)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "pathname"
|
|
4
|
+
require_relative "base_recipe"
|
|
5
|
+
|
|
6
|
+
module LibarchiveBinary
|
|
7
|
+
class ZLibRecipe < BaseRecipe
|
|
8
|
+
def initialize
|
|
9
|
+
super("zlib")
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def configure_defaults
|
|
13
|
+
[
|
|
14
|
+
"--static",
|
|
15
|
+
]
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def configure_windows
|
|
19
|
+
mk = File.read("win32/Makefile.gcc")
|
|
20
|
+
File.open("win32/Makefile.gcc", "wb") do |f|
|
|
21
|
+
f.puts "BINARY_PATH = #{path}/bin"
|
|
22
|
+
f.puts "LIBRARY_PATH = #{path}/lib"
|
|
23
|
+
f.puts "INCLUDE_PATH = #{path}/include"
|
|
24
|
+
f.puts "SHARED_MODE = 0"
|
|
25
|
+
f.puts "LOC = -fPIC"
|
|
26
|
+
f.puts mk
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def configure
|
|
31
|
+
if MiniPortile::windows?
|
|
32
|
+
Dir.chdir(work_path) do
|
|
33
|
+
configure_windows
|
|
34
|
+
end
|
|
35
|
+
else
|
|
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
|
|
40
|
+
execute("configure", cmd)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def configured?
|
|
45
|
+
if MiniPortile::windows?
|
|
46
|
+
Dir.chdir(work_path) do
|
|
47
|
+
!!(File.read("win32/Makefile.gcc") =~ /^BINARY_PATH/)
|
|
48
|
+
end
|
|
49
|
+
else
|
|
50
|
+
super
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def compile
|
|
55
|
+
if MiniPortile::windows?
|
|
56
|
+
execute("compile", "make -f win32/Makefile.gcc libz.a")
|
|
57
|
+
else
|
|
58
|
+
super
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def install
|
|
63
|
+
if MiniPortile::windows?
|
|
64
|
+
execute("install", "make -f win32/Makefile.gcc install")
|
|
65
|
+
else
|
|
66
|
+
super
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def checkpoint
|
|
71
|
+
File.join(@target, "#{name}-#{version}-#{host}.installed")
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def cook_if_not
|
|
75
|
+
cook unless File.exist?(checkpoint)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def cook
|
|
79
|
+
super
|
|
80
|
+
|
|
81
|
+
FileUtils.touch(checkpoint)
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "ffi-libarchive-binary/version"
|
|
4
|
+
require "pathname"
|
|
5
|
+
|
|
6
|
+
module LibarchiveBinary
|
|
7
|
+
class Error < StandardError; end
|
|
8
|
+
|
|
9
|
+
LIBRARY_PATH = Pathname.new(File.join(__dir__, "ffi-libarchive-binary"))
|
|
10
|
+
|
|
11
|
+
def self.lib_path
|
|
12
|
+
LIBRARY_PATH.join(lib_filename).to_s
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.lib_filename
|
|
16
|
+
if FFI::Platform.windows?
|
|
17
|
+
"libarchive.dll"
|
|
18
|
+
elsif FFI::Platform.mac?
|
|
19
|
+
"libarchive.dylib"
|
|
20
|
+
else
|
|
21
|
+
"libarchive.so"
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
module Archive
|
|
27
|
+
module C
|
|
28
|
+
def self.ffi_lib(*args)
|
|
29
|
+
prefixed = args.map do |names|
|
|
30
|
+
paths = names.is_a?(Array) ? names : [names]
|
|
31
|
+
if paths.any? { |f| f.include?("libarchive") }
|
|
32
|
+
[LibarchiveBinary.lib_path] + paths
|
|
33
|
+
else
|
|
34
|
+
names
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
super(*prefixed)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
require "ffi-libarchive"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
set(CMAKE_SYSTEM_NAME Linux)
|
|
2
|
+
set(CMAKE_SYSTEM_PROCESSOR aarch64)
|
|
3
|
+
|
|
4
|
+
# Specify the cross compiler
|
|
5
|
+
set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc)
|
|
6
|
+
set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++)
|
|
7
|
+
|
|
8
|
+
# Where to look for the target environment
|
|
9
|
+
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
|
10
|
+
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
|
11
|
+
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
12
|
+
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
metadata
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: ffi-libarchive-binary
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.4.2
|
|
5
|
+
platform: x86_64-linux-gnu
|
|
6
|
+
authors:
|
|
7
|
+
- Ribose Inc.
|
|
8
|
+
bindir: exe
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: ffi
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '1.0'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "~>"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '1.0'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: ffi-libarchive
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - "~>"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '1.0'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - "~>"
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '1.0'
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: rake
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - "~>"
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '13.0'
|
|
47
|
+
type: :runtime
|
|
48
|
+
prerelease: false
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - "~>"
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '13.0'
|
|
54
|
+
- !ruby/object:Gem::Dependency
|
|
55
|
+
name: rspec
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - "~>"
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '3.0'
|
|
61
|
+
type: :development
|
|
62
|
+
prerelease: false
|
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - "~>"
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '3.0'
|
|
68
|
+
- !ruby/object:Gem::Dependency
|
|
69
|
+
name: rubocop
|
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - "~>"
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '1.7'
|
|
75
|
+
type: :development
|
|
76
|
+
prerelease: false
|
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - "~>"
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '1.7'
|
|
82
|
+
- !ruby/object:Gem::Dependency
|
|
83
|
+
name: rubocop-performance
|
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
|
85
|
+
requirements:
|
|
86
|
+
- - "~>"
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
version: '1.15'
|
|
89
|
+
type: :development
|
|
90
|
+
prerelease: false
|
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
92
|
+
requirements:
|
|
93
|
+
- - "~>"
|
|
94
|
+
- !ruby/object:Gem::Version
|
|
95
|
+
version: '1.15'
|
|
96
|
+
description: Contains pre-compiled and install-time-compiled binaries for ffi-libarchive
|
|
97
|
+
email:
|
|
98
|
+
- open.source@ribose.com
|
|
99
|
+
executables: []
|
|
100
|
+
extensions: []
|
|
101
|
+
extra_rdoc_files: []
|
|
102
|
+
files:
|
|
103
|
+
- ".gitignore"
|
|
104
|
+
- ".rspec"
|
|
105
|
+
- ".rubocop.yml"
|
|
106
|
+
- Gemfile
|
|
107
|
+
- README.adoc
|
|
108
|
+
- Rakefile
|
|
109
|
+
- ext/Makefile
|
|
110
|
+
- ext/configuration.yml
|
|
111
|
+
- ext/extconf.rb
|
|
112
|
+
- ffi-libarchive-binary.gemspec
|
|
113
|
+
- lib/ffi-libarchive-binary.rb
|
|
114
|
+
- lib/ffi-libarchive-binary/base_recipe.rb
|
|
115
|
+
- lib/ffi-libarchive-binary/configuration.rb
|
|
116
|
+
- lib/ffi-libarchive-binary/libarchive.so
|
|
117
|
+
- lib/ffi-libarchive-binary/libarchive_recipe.rb
|
|
118
|
+
- lib/ffi-libarchive-binary/libexpat_recipe.rb
|
|
119
|
+
- lib/ffi-libarchive-binary/libxml2_recipe.rb
|
|
120
|
+
- lib/ffi-libarchive-binary/openssl_recipe.rb
|
|
121
|
+
- lib/ffi-libarchive-binary/version.rb
|
|
122
|
+
- lib/ffi-libarchive-binary/xz_recipe.rb
|
|
123
|
+
- lib/ffi-libarchive-binary/zlib_recipe.rb
|
|
124
|
+
- toolchain/aarch64-linux-gnu.cmake
|
|
125
|
+
homepage: https://github.com/fontist/ffi-libarchive-binary
|
|
126
|
+
licenses:
|
|
127
|
+
- BSD-3-Clause
|
|
128
|
+
metadata:
|
|
129
|
+
homepage_uri: https://github.com/fontist/ffi-libarchive-binary
|
|
130
|
+
source_code_uri: https://github.com/fontist/ffi-libarchive-binary
|
|
131
|
+
changelog_uri: https://github.com/fontist/ffi-libarchive-binary
|
|
132
|
+
rdoc_options: []
|
|
133
|
+
require_paths:
|
|
134
|
+
- lib
|
|
135
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
136
|
+
requirements:
|
|
137
|
+
- - ">="
|
|
138
|
+
- !ruby/object:Gem::Version
|
|
139
|
+
version: 2.7.0
|
|
140
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
|
+
requirements:
|
|
142
|
+
- - ">="
|
|
143
|
+
- !ruby/object:Gem::Version
|
|
144
|
+
version: '0'
|
|
145
|
+
requirements: []
|
|
146
|
+
rubygems_version: 3.6.9
|
|
147
|
+
specification_version: 4
|
|
148
|
+
summary: Binaries for ffi-libarchive
|
|
149
|
+
test_files: []
|