ffi-libarchive-binary 0.2.6 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -0
- data/.rubocop.yml +17 -0
- data/Gemfile +0 -6
- data/README.adoc +0 -30
- data/Rakefile +24 -16
- data/ffi-libarchive-binary.gemspec +15 -5
- data/lib/ffi-libarchive-binary/base_recipe.rb +57 -0
- data/lib/ffi-libarchive-binary/libarchive_recipe.rb +101 -60
- data/lib/ffi-libarchive-binary/libexpat_recipe.rb +12 -11
- data/lib/ffi-libarchive-binary/openssl_recipe.rb +57 -0
- data/lib/ffi-libarchive-binary/version.rb +1 -1
- data/lib/ffi-libarchive-binary/xz_recipe.rb +69 -0
- data/lib/ffi-libarchive-binary/zlib_recipe.rb +27 -25
- data/lib/ffi-libarchive-binary.rb +1 -1
- data/toolchain/aarch64-linux-gnu.cmake +25 -0
- metadata +100 -7
- data/updates/config.guess +0 -1700
- data/updates/config.sub +0 -1860
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 763e2d18ae12d500bb88f28d06ae8ceaaf9132603e39110f9745147b3b82512b
|
4
|
+
data.tar.gz: 80118001b5009982438372c556eb0ce9216e692b6d4eb2b9ee4398b169878c38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00e0cd38bf50be09921ed600c1b52a22e5ee3c08176bce316af80692ed00ace10ba81ca8b6c532cfd05f8232b31ff7053cc1d7c5f8bd4617e9d453b4cf46907f
|
7
|
+
data.tar.gz: 46c377899d77464f35a65ee622f157e00b6c83235c9ca0d74173bb25036ef1681b172bdb010dd08787177c3d1c31ee506da97bf53bc575ebf0a8c1dc8698a221
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
@@ -0,0 +1,17 @@
|
|
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
|
+
Exclude:
|
8
|
+
- 'ffi-libarchive-binary.gemspec'
|
9
|
+
- 'tmp/**/*'
|
10
|
+
- 'pkg/**/*'
|
11
|
+
- 'ports/**/*'
|
12
|
+
|
13
|
+
Gemspec/RequireMFA:
|
14
|
+
Enabled: false
|
15
|
+
|
16
|
+
Layout/LineLength:
|
17
|
+
Max: 160
|
data/Gemfile
CHANGED
data/README.adoc
CHANGED
@@ -51,16 +51,6 @@ end
|
|
51
51
|
reader.close
|
52
52
|
----
|
53
53
|
|
54
|
-
|
55
|
-
== Dependencies
|
56
|
-
|
57
|
-
* zlib
|
58
|
-
* Expat
|
59
|
-
* OpenSSL (for Linux only)
|
60
|
-
|
61
|
-
These dependencies are generally present on all systems.
|
62
|
-
|
63
|
-
|
64
54
|
== Development
|
65
55
|
|
66
56
|
We are following Sandi Metz's Rules for this gem, you can read the
|
@@ -69,26 +59,6 @@ All new code should follow these
|
|
69
59
|
rules. If you make changes in a pre-existing file that violates these rules you
|
70
60
|
should fix the violations as part of your contribution.
|
71
61
|
|
72
|
-
|
73
|
-
== Releasing
|
74
|
-
|
75
|
-
Releasing is done automatically with GitHub Action. Just bump and tag with `gem-release`.
|
76
|
-
|
77
|
-
For a patch release (0.0.x) use:
|
78
|
-
|
79
|
-
[source,ruby]
|
80
|
-
----
|
81
|
-
gem bump --version patch --tag --push
|
82
|
-
----
|
83
|
-
|
84
|
-
For a minor release (0.x.0) use:
|
85
|
-
|
86
|
-
[source,ruby]
|
87
|
-
----
|
88
|
-
gem bump --version minor --tag --push
|
89
|
-
----
|
90
|
-
|
91
|
-
|
92
62
|
== Contributing
|
93
63
|
|
94
64
|
First, thank you for contributing! We love pull requests from everyone. By
|
data/Rakefile
CHANGED
@@ -1,9 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "rbconfig"
|
3
4
|
require "rake/clean"
|
4
5
|
require "rubygems/package_task"
|
5
6
|
require_relative "lib/ffi-libarchive-binary/libarchive_recipe"
|
6
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
|
+
|
7
17
|
desc "Build install-compilation gem"
|
8
18
|
task "gem:native:any" do
|
9
19
|
sh "rake platform:any gem"
|
@@ -17,16 +27,15 @@ task "platform:any" do
|
|
17
27
|
end
|
18
28
|
|
19
29
|
platforms = [
|
20
|
-
["
|
21
|
-
["x64-
|
22
|
-
["
|
23
|
-
["
|
24
|
-
["x86_64-
|
25
|
-
["
|
26
|
-
["arm64-darwin", "arm64-darwin", "libarchive.dylib"],
|
30
|
+
["x64-mingw32", "x86_64-w64-mingw32"],
|
31
|
+
["x64-mingw-ucrt", "x86_64-w64-mingw32"],
|
32
|
+
["x86_64-linux", "x86_64-linux-gnu"],
|
33
|
+
["aarch64-linux", "aarch64-linux-gnu"],
|
34
|
+
["x86_64-darwin", "x86_64-apple-darwin"],
|
35
|
+
["arm64-darwin", "arm64-apple-darwin"],
|
27
36
|
]
|
28
37
|
|
29
|
-
platforms.each do |platform, host
|
38
|
+
platforms.each do |platform, host|
|
30
39
|
desc "Build pre-compiled gem for the #{platform} platform"
|
31
40
|
task "gem:native:#{platform}" do
|
32
41
|
sh "rake compile[#{host}] platform:#{platform} gem"
|
@@ -36,7 +45,7 @@ platforms.each do |platform, host, lib|
|
|
36
45
|
task "platform:#{platform}" do
|
37
46
|
spec = Gem::Specification::load("ffi-libarchive-binary.gemspec").dup
|
38
47
|
spec.platform = Gem::Platform.new(platform)
|
39
|
-
spec.files +=
|
48
|
+
spec.files += Dir.glob("lib/ffi-libarchive-binary/*.{dll,so,dylib}")
|
40
49
|
spec.extensions = []
|
41
50
|
spec.dependencies.reject! { |d| d.name == "mini_portile2" }
|
42
51
|
|
@@ -48,16 +57,15 @@ end
|
|
48
57
|
desc "Compile binary for the target host"
|
49
58
|
task :compile, [:host] do |_t, args|
|
50
59
|
recipe = LibarchiveBinary::LibarchiveRecipe.new
|
51
|
-
|
60
|
+
if args[:host]
|
61
|
+
recipe.host = args[:host]
|
62
|
+
else
|
63
|
+
recipe.host = "x86_64-apple-darwin" if /x86_64-apple-darwin*/.match?(recipe.host)
|
64
|
+
recipe.host = "arm64-apple-darwin" if /arm64-apple-darwin*/.match?(recipe.host)
|
65
|
+
end
|
52
66
|
recipe.cook_if_not
|
53
67
|
end
|
54
68
|
|
55
|
-
desc "Recompile binary"
|
56
|
-
task :recompile do
|
57
|
-
recipe = LibarchiveBinary::LibarchiveRecipe.new
|
58
|
-
recipe.cook
|
59
|
-
end
|
60
|
-
|
61
69
|
CLOBBER.include("pkg")
|
62
70
|
CLEAN.include("ports",
|
63
71
|
"tmp",
|
@@ -10,23 +10,33 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["open.source@ribose.com"]
|
11
11
|
|
12
12
|
spec.summary = "Binaries for ffi-libarchive"
|
13
|
-
spec.description = "Contains pre-compiled and install-time-compiled binaries for ffi-libarchive"
|
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.
|
16
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.7.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
|
23
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
24
|
+
f.match(%r{\A(?:test|spec|features|bin|.github)/})
|
25
|
+
end
|
24
26
|
end
|
27
|
+
|
25
28
|
spec.bindir = "exe"
|
26
29
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
27
30
|
spec.require_paths = ["lib"]
|
28
|
-
spec.extensions = [
|
31
|
+
spec.extensions = ["ext/extconf.rb"]
|
29
32
|
|
33
|
+
spec.add_runtime_dependency "bundler", "~> 2.3", ">= 2.3.22"
|
34
|
+
spec.add_runtime_dependency "ffi", "~> 1.0"
|
30
35
|
spec.add_runtime_dependency "ffi-libarchive", "~> 1.0"
|
31
|
-
spec.add_runtime_dependency "mini_portile2", "~> 2.
|
36
|
+
spec.add_runtime_dependency "mini_portile2", "~> 2.7"
|
37
|
+
spec.add_runtime_dependency "rake", "~> 13.0"
|
38
|
+
|
39
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
40
|
+
spec.add_development_dependency "rubocop", "~> 1.7"
|
41
|
+
spec.add_development_dependency "rubocop-performance", "~> 1.15"
|
32
42
|
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "mini_portile2"
|
4
|
+
|
5
|
+
module LibarchiveBinary
|
6
|
+
FORMATS = {
|
7
|
+
"arm64-apple-darwin" => "Mach-O 64-bit dynamically linked shared library arm64",
|
8
|
+
"x86_64-apple-darwin" => "Mach-O 64-bit dynamically linked shared library x86_64",
|
9
|
+
"aarch64-linux-gnu" => "ELF 64-bit LSB shared object, ARM aarch64",
|
10
|
+
"x86_64-linux-gnu" => "ELF 64-bit LSB shared object, x86-64",
|
11
|
+
"x86_64-w64-mingw32" => "PE32+ executable (DLL) (console) x86-64, for MS Windows",
|
12
|
+
}.freeze
|
13
|
+
|
14
|
+
ARCHS = {
|
15
|
+
"arm64-apple-darwin" => "arm64",
|
16
|
+
"x86_64-apple-darwin" => "x86_64",
|
17
|
+
}.freeze
|
18
|
+
|
19
|
+
LIBNAMES = {
|
20
|
+
"x86_64-w64-mingw32" => "libarchive.dll",
|
21
|
+
"x86_64-linux-gnu" => "libarchive.so",
|
22
|
+
"aarch64-linux-gnu" => "libarchive.so",
|
23
|
+
"x86_64-apple-darwin" => "libarchive.dylib",
|
24
|
+
"arm64-apple-darwin" => "libarchive.dylib",
|
25
|
+
}.freeze
|
26
|
+
|
27
|
+
class BaseRecipe < MiniPortile
|
28
|
+
def initialize(name, version)
|
29
|
+
super
|
30
|
+
@printed = {}
|
31
|
+
end
|
32
|
+
|
33
|
+
def apple_arch_flag(host)
|
34
|
+
fl = ARCHS[host]
|
35
|
+
fl.nil? ? "" : " -arch #{fl}"
|
36
|
+
end
|
37
|
+
|
38
|
+
def cflags(host)
|
39
|
+
"CFLAGS=-fPIC#{apple_arch_flag(host)}"
|
40
|
+
end
|
41
|
+
|
42
|
+
def ldflags(host)
|
43
|
+
"LDFLAGS=-fPIC#{apple_arch_flag(host)}"
|
44
|
+
end
|
45
|
+
|
46
|
+
def message(text)
|
47
|
+
return super unless text.start_with?("\rDownloading")
|
48
|
+
|
49
|
+
match = text.match(/(\rDownloading .*)\((\s*)(\d+)%\)/)
|
50
|
+
pattern = match ? match[1] : text
|
51
|
+
return if @printed[pattern] && match[3].to_i != 100
|
52
|
+
|
53
|
+
@printed[pattern] = true
|
54
|
+
super
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -1,85 +1,81 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require "pathname"
|
4
|
+
require "open3"
|
3
5
|
|
6
|
+
require_relative "base_recipe"
|
4
7
|
require_relative "zlib_recipe"
|
5
8
|
require_relative "libexpat_recipe"
|
9
|
+
require_relative "openssl_recipe"
|
10
|
+
require_relative "xz_recipe"
|
6
11
|
|
7
12
|
module LibarchiveBinary
|
8
|
-
class LibarchiveRecipe <
|
13
|
+
class LibarchiveRecipe < MiniPortileCMake
|
9
14
|
ROOT = Pathname.new(File.expand_path("../..", __dir__))
|
10
15
|
|
11
16
|
def initialize
|
12
|
-
super("libarchive", "3.
|
17
|
+
super("libarchive", "3.6.1")
|
18
|
+
@printed = {}
|
13
19
|
|
14
20
|
@files << {
|
15
|
-
url: "https://www.libarchive.org/downloads/libarchive-3.
|
16
|
-
sha256: "
|
21
|
+
url: "https://www.libarchive.org/downloads/libarchive-3.6.1.tar.gz",
|
22
|
+
sha256: "c676146577d989189940f1959d9e3980d28513d74eedfbc6b7f15ea45fe54ee2",
|
17
23
|
}
|
18
24
|
|
25
|
+
@target = ROOT.join(@target).to_s
|
26
|
+
|
27
|
+
create_dependencies
|
28
|
+
end
|
29
|
+
|
30
|
+
def create_dependencies
|
19
31
|
@zlib_recipe = ZLibRecipe.new
|
20
32
|
@expat_recipe = LibexpatRecipe.new
|
33
|
+
@openssl_recipe = OpensslRecipe.new
|
34
|
+
@xz_recipe = XZRecipe.new
|
35
|
+
end
|
21
36
|
|
22
|
-
|
37
|
+
def generator_flags
|
38
|
+
MiniPortile::mingw? ? ["-G", "MSYS Makefiles"] : []
|
23
39
|
end
|
24
40
|
|
25
|
-
def
|
41
|
+
def default_flags
|
26
42
|
[
|
27
|
-
"
|
28
|
-
"
|
29
|
-
"
|
30
|
-
"
|
31
|
-
"
|
32
|
-
"
|
33
|
-
"
|
34
|
-
"
|
35
|
-
"--without-zstd",
|
36
|
-
"--without-lzma",
|
37
|
-
"--without-cng",
|
38
|
-
"--without-xml2",
|
39
|
-
"--with-expat",
|
40
|
-
"--with-openssl",
|
41
|
-
"--disable-acl",
|
43
|
+
"-DENABLE_OPENSSL:BOOL=ON", "-DENABLE_LIBB2:BOOL=OFF", "-DENABLE_LZ4:BOOL=OFF",
|
44
|
+
"-DENABLE_LZO::BOOL=OFF", "-DENABLE_LZMA:BOOL=ON", "-DENABLE_ZSTD:BOOL=OFF",
|
45
|
+
"-DENABLE_ZLIB::BOOL=ON", "-DENABLE_BZip2:BOOL=OFF", "-DENABLE_LIBXML2:BOOL=OFF",
|
46
|
+
"-DENABLE_EXPAT::BOOL=ON", "-DENABLE_TAR:BOOL=OFF", "-DENABLE_ICONV::BOOL=OFF",
|
47
|
+
"-DENABLE_CPIO::BOOL=OFF", "-DENABLE_CAT:BOOL=OFF", "-DENABLE_ACL:BOOL=OFF",
|
48
|
+
"-DENABLE_TEST:BOOL=OFF",
|
49
|
+
"-DCMAKE_INCLUDE_PATH=#{include_path}",
|
50
|
+
"-DCMAKE_LIBRARY_PATH=#{library_path}"
|
42
51
|
]
|
43
52
|
end
|
44
53
|
|
45
|
-
def
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
# drop default libexpat and zlib
|
53
|
-
libz = File.join(@zlib_recipe.path, "lib", "libz.a")
|
54
|
-
libexpat = File.join(@expat_recipe.path, "lib", "libexpat.a")
|
55
|
-
|
56
|
-
if LibarchiveBinary::windows?
|
57
|
-
# https://stackoverflow.com/a/14112368/902217
|
58
|
-
static_link_pref = "-Wl,-Bstatic,"
|
59
|
-
libz = libz.prepend(static_link_pref)
|
60
|
-
libexpat = libexpat.prepend(static_link_pref)
|
54
|
+
def configure_defaults
|
55
|
+
df = generator_flags + default_flags
|
56
|
+
ar = ARCHS[host]
|
57
|
+
if ar.nil?
|
58
|
+
df
|
59
|
+
else
|
60
|
+
df + ["-DCMAKE_OSX_ARCHITECTURES=#{ar}"]
|
61
61
|
end
|
62
|
-
|
63
|
-
makefile = File.join(work_path, "Makefile")
|
64
|
-
replace_in_file(" -lz ", " #{libz} ", makefile)
|
65
|
-
replace_in_file(" -lexpat ", " #{libexpat} ", makefile)
|
66
62
|
end
|
67
63
|
|
68
|
-
def
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
content = f.read
|
73
|
-
f.close
|
74
|
-
|
75
|
-
content.gsub!(search_str, replace_str)
|
64
|
+
def include_path
|
65
|
+
paths = [@zlib_recipe.path, @expat_recipe.path, @openssl_recipe.path, @xz_recipe.path]
|
66
|
+
paths.map { |k| "#{k}/include" }.join(";")
|
67
|
+
end
|
76
68
|
|
77
|
-
|
69
|
+
def library_path
|
70
|
+
paths = [@zlib_recipe.path, @expat_recipe.path, @openssl_recipe.path, @xz_recipe.path]
|
71
|
+
paths.map { |k| "#{k}/lib" }.join(";")
|
78
72
|
end
|
79
73
|
|
80
74
|
def activate
|
81
75
|
@zlib_recipe.activate
|
82
76
|
@expat_recipe.activate
|
77
|
+
@openssl_recipe.activate
|
78
|
+
@xz_recipe.activate
|
83
79
|
|
84
80
|
super
|
85
81
|
end
|
@@ -89,23 +85,25 @@ module LibarchiveBinary
|
|
89
85
|
end
|
90
86
|
|
91
87
|
def cook
|
88
|
+
@zlib_recipe.host = @host if @host
|
92
89
|
@zlib_recipe.cook_if_not
|
90
|
+
|
91
|
+
@expat_recipe.host = @host if @host
|
93
92
|
@expat_recipe.cook_if_not
|
94
93
|
|
94
|
+
@openssl_recipe.host = @host if @host
|
95
|
+
@openssl_recipe.cook_if_not
|
96
|
+
|
97
|
+
@xz_recipe.host = @host if @host
|
98
|
+
@xz_recipe.cook_if_not
|
99
|
+
|
95
100
|
super
|
96
101
|
|
97
102
|
FileUtils.touch(checkpoint)
|
98
103
|
end
|
99
104
|
|
100
105
|
def checkpoint
|
101
|
-
File.join(@target, "#{
|
102
|
-
end
|
103
|
-
|
104
|
-
def patch
|
105
|
-
super
|
106
|
-
|
107
|
-
FileUtils.cp(Dir.glob(ROOT.join("updates", "config.*").to_s),
|
108
|
-
File.join(work_path, "build", "autoconf"))
|
106
|
+
File.join(@target, "#{name}-#{version}-#{host}.installed")
|
109
107
|
end
|
110
108
|
|
111
109
|
def install
|
@@ -113,7 +111,50 @@ module LibarchiveBinary
|
|
113
111
|
|
114
112
|
libs = Dir.glob(File.join(port_path, "{lib,bin}", "*"))
|
115
113
|
.grep(/\/(?:lib)?[a-zA-Z0-9\-]+\.(?:so|dylib|dll)$/)
|
116
|
-
FileUtils.cp_r(libs,
|
114
|
+
FileUtils.cp_r(libs, lib_workpath, verbose: true)
|
115
|
+
if lib_fullpath.nil?
|
116
|
+
message("Cannot guess libarchive library name, skipping format verification")
|
117
|
+
else
|
118
|
+
verify_lib
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
def lib_workpath
|
123
|
+
@lib_workpath ||= ROOT.join("lib", "ffi-libarchive-binary")
|
124
|
+
end
|
125
|
+
|
126
|
+
def lib_fullpath
|
127
|
+
lib_filename = LIBNAMES[@host]
|
128
|
+
@lib_fullpath ||= lib_filename.nil? ? nil : File.join(lib_workpath, lib_filename)
|
129
|
+
end
|
130
|
+
|
131
|
+
def verify_lib
|
132
|
+
begin
|
133
|
+
out, = Open3.capture2("file #{lib_fullpath}")
|
134
|
+
rescue StandardError
|
135
|
+
message("failed to call file, library verification skipped.\n")
|
136
|
+
return
|
137
|
+
end
|
138
|
+
unless out.include?(target_format)
|
139
|
+
raise "Invalid file format '#{out.strip}', '#{target_format}' expected"
|
140
|
+
end
|
141
|
+
|
142
|
+
message("#{lib_fullpath} format has been verified (#{target_format})\n")
|
143
|
+
end
|
144
|
+
|
145
|
+
def target_format
|
146
|
+
@target_format ||= FORMATS[@host].nil? ? "skip" : FORMATS[@host]
|
147
|
+
end
|
148
|
+
|
149
|
+
def message(text)
|
150
|
+
return super unless text.start_with?("\rDownloading")
|
151
|
+
|
152
|
+
match = text.match(/(\rDownloading .*)\((\s*)(\d+)%\)/)
|
153
|
+
pattern = match ? match[1] : text
|
154
|
+
return if @printed[pattern] && match[3].to_i != 100
|
155
|
+
|
156
|
+
@printed[pattern] = true
|
157
|
+
super
|
117
158
|
end
|
118
159
|
end
|
119
160
|
end
|
@@ -1,16 +1,17 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "base_recipe"
|
2
4
|
|
3
5
|
module LibarchiveBinary
|
4
|
-
|
5
|
-
class LibexpatRecipe < MiniPortile
|
6
|
+
class LibexpatRecipe < BaseRecipe
|
6
7
|
ROOT = Pathname.new(File.expand_path("../..", __dir__))
|
7
8
|
|
8
9
|
def initialize
|
9
|
-
super("libexpat", "2.4.
|
10
|
+
super("libexpat", "2.4.9")
|
10
11
|
|
11
12
|
@files << {
|
12
|
-
url: "https://github.com/libexpat/libexpat/releases/download/
|
13
|
-
sha256: "
|
13
|
+
url: "https://github.com/libexpat/libexpat/releases/download/R_2_4_9/expat-2.4.9.tar.gz",
|
14
|
+
sha256: "4415710268555b32c4e5ab06a583bea9fec8ff89333b218b70b43d4ca10e38fa",
|
14
15
|
}
|
15
16
|
|
16
17
|
@target = ROOT.join(@target).to_s
|
@@ -18,19 +19,19 @@ module LibarchiveBinary
|
|
18
19
|
|
19
20
|
def configure_defaults
|
20
21
|
[
|
21
|
-
"--host=#{@host}",
|
22
|
-
"--
|
23
|
-
"--enable-static",
|
22
|
+
"--host=#{@host}", "--disable-shared", "--enable-static",
|
23
|
+
"--without-tests", "--without-examples"
|
24
24
|
]
|
25
25
|
end
|
26
26
|
|
27
27
|
def configure
|
28
|
-
cmd = ["env",
|
28
|
+
cmd = ["env", cflags(host), ldflags(host),
|
29
|
+
"./configure"] + computed_options
|
29
30
|
execute("configure", cmd)
|
30
31
|
end
|
31
32
|
|
32
33
|
def checkpoint
|
33
|
-
File.join(@target, "#{
|
34
|
+
File.join(@target, "#{name}-#{version}-#{host}.installed")
|
34
35
|
end
|
35
36
|
|
36
37
|
def cook_if_not
|
@@ -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" => nil,
|
10
|
+
"x86_64-linux-gnu" => nil,
|
11
|
+
"x86_64-w64-mingw32" => "mingw64",
|
12
|
+
}.freeze
|
13
|
+
|
14
|
+
ENV_CMD = ["env", "CFLAGS=-fPIC", "LDFLAGS=-fPIC"].freeze
|
15
|
+
|
16
|
+
class OpensslRecipe < BaseRecipe
|
17
|
+
ROOT = Pathname.new(File.expand_path("../..", __dir__))
|
18
|
+
|
19
|
+
def initialize
|
20
|
+
super("openssl", "1.1.1n")
|
21
|
+
|
22
|
+
@files << {
|
23
|
+
url: "https://www.openssl.org/source/openssl-1.1.1n.tar.gz",
|
24
|
+
sha256: "40dceb51a4f6a5275bde0e6bf20ef4b91bfc32ed57c0552e2e8e15463372b17a",
|
25
|
+
}
|
26
|
+
|
27
|
+
@target = ROOT.join(@target).to_s
|
28
|
+
end
|
29
|
+
|
30
|
+
def configure
|
31
|
+
os_compiler = OS_COMPILERS[@host]
|
32
|
+
common_opts = ["--openssldir=#{ROOT}/ports/SSL", "no-tests", "no-shared"] +
|
33
|
+
computed_options.grep(/--prefix/)
|
34
|
+
cmd = if os_compiler.nil?
|
35
|
+
message("OpensslRecipe: guessing with 'config' for '#{@host}'\n")
|
36
|
+
ENV_CMD + ["./config"] + common_opts
|
37
|
+
else
|
38
|
+
ENV_CMD + ["./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,69 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "base_recipe"
|
4
|
+
|
5
|
+
module LibarchiveBinary
|
6
|
+
class XZRecipe < BaseRecipe
|
7
|
+
ROOT = Pathname.new(File.expand_path("../..", __dir__))
|
8
|
+
|
9
|
+
# As of 19.10.2022
|
10
|
+
# versions > 5.2.4 get crazy on MinGW
|
11
|
+
# versions <= 5.2.5 do not support arm64-apple-darwin target
|
12
|
+
# version 5.2.7 could not be linked statically to libarchive
|
13
|
+
|
14
|
+
def initialize
|
15
|
+
if MiniPortile::windows?
|
16
|
+
super("xz", "5.2.4")
|
17
|
+
windows_files
|
18
|
+
else
|
19
|
+
super("xz", "5.2.6")
|
20
|
+
not_windows_files
|
21
|
+
end
|
22
|
+
|
23
|
+
@target = ROOT.join(@target).to_s
|
24
|
+
end
|
25
|
+
|
26
|
+
def windows_files
|
27
|
+
@files << {
|
28
|
+
url: "https://tukaani.org/xz/xz-5.2.4.tar.gz",
|
29
|
+
sha256: "b512f3b726d3b37b6dc4c8570e137b9311e7552e8ccbab4d39d47ce5f4177145",
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
def not_windows_files
|
34
|
+
@files << {
|
35
|
+
url: "https://tukaani.org/xz/xz-5.2.6.tar.gz",
|
36
|
+
sha256: "a2105abee17bcd2ebd15ced31b4f5eda6e17efd6b10f921a01cda4a44c91b3a0",
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
def configure_defaults
|
41
|
+
[
|
42
|
+
"--host=#{@host}",
|
43
|
+
"--disable-doc", "--disable-xz", "--with-pic",
|
44
|
+
"--disable-xzdec", "--disable-lzmadec", "--disable-lzmainfo",
|
45
|
+
"--disable-scripts", "--disable-shared", "--enable-static"
|
46
|
+
]
|
47
|
+
end
|
48
|
+
|
49
|
+
def configure
|
50
|
+
cmd = ["env", cflags(host), ldflags(host),
|
51
|
+
"./configure"] + computed_options
|
52
|
+
execute("configure", cmd)
|
53
|
+
end
|
54
|
+
|
55
|
+
def checkpoint
|
56
|
+
File.join(@target, "#{name}-#{version}-#{host}.installed")
|
57
|
+
end
|
58
|
+
|
59
|
+
def cook_if_not
|
60
|
+
cook unless File.exist?(checkpoint)
|
61
|
+
end
|
62
|
+
|
63
|
+
def cook
|
64
|
+
super
|
65
|
+
|
66
|
+
FileUtils.touch(checkpoint)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|