ffi-libarchive-binary 0.3.0-aarch64-linux

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4e37eb17be6b13c4dfb76f195828223b4bf1b6f2d132b20aa4a8142faae3a329
4
+ data.tar.gz: fb3620596d29592bcb49c343e39cb85a42951451af63c31cbe7dcd3ad2ece51e
5
+ SHA512:
6
+ metadata.gz: 9e2ae29929ec1d30b11e06b156dd23b7f686c50cea64dfdfc89e3957bb4db90e9ae174d562b112d559de2ca40688b572a9e20774e7756b51ce85750dad70ab47
7
+ data.tar.gz: 3e5b834f69fbcca20af5dd75dbf3e710ef1de47bc3279197fe64784d954d02da16d568669195ca63965f4e46876a0f5d7a340591f8f439a3c546da2c5bcc6552
data/.gitignore ADDED
@@ -0,0 +1,19 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ Gemfile.lock
10
+ *.installed
11
+ ports/
12
+ vendor/
13
+ *.dll
14
+ *.dylib
15
+ *.so
16
+ /.vscode/
17
+
18
+ # remote file cache
19
+ .rubocop-*
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
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 ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gemspec
data/README.adoc ADDED
@@ -0,0 +1,85 @@
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/rspec.yml/badge.svg["Build Status", link="https://github.com/fontist/ffi-libarchive-binary/actions/workflows/rspec.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.]
data/Rakefile ADDED
@@ -0,0 +1,74 @@
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
+ ["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"],
36
+ ]
37
+
38
+ platforms.each do |platform, host|
39
+ desc "Build pre-compiled gem for the #{platform} platform"
40
+ task "gem:native:#{platform}" do
41
+ sh "rake compile[#{host}] platform:#{platform} gem"
42
+ end
43
+
44
+ desc "Define the gem task to build on the #{platform} platform (binary gem)"
45
+ task "platform:#{platform}" do
46
+ spec = Gem::Specification::load("ffi-libarchive-binary.gemspec").dup
47
+ spec.platform = Gem::Platform.new(platform)
48
+ spec.files += Dir.glob("lib/ffi-libarchive-binary/*.{dll,so,dylib}")
49
+ spec.extensions = []
50
+ spec.dependencies.reject! { |d| d.name == "mini_portile2" }
51
+
52
+ task = Gem::PackageTask.new(spec)
53
+ task.define
54
+ end
55
+ end
56
+
57
+ desc "Compile binary for the target host"
58
+ task :compile, [:host] do |_t, args|
59
+ recipe = LibarchiveBinary::LibarchiveRecipe.new
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
66
+ recipe.cook_if_not
67
+ end
68
+
69
+ CLOBBER.include("pkg")
70
+ CLEAN.include("ports",
71
+ "tmp",
72
+ "lib/ffi-libarchive-binary/libarchive-13.dll",
73
+ "lib/ffi-libarchive-binary/libarchive.dylib",
74
+ "lib/ffi-libarchive-binary/libarchive.so")
data/ext/Makefile ADDED
@@ -0,0 +1,4 @@
1
+ # dummy Makefile, it is required to build an extension
2
+ all:
3
+ clean:
4
+ install:
data/ext/extconf.rb ADDED
@@ -0,0 +1,6 @@
1
+ $: << File.expand_path(File.join(File.dirname(__FILE__), "../lib"))
2
+
3
+ require "ffi-libarchive-binary/libarchive_recipe"
4
+
5
+ recipe = LibarchiveBinary::LibarchiveRecipe.new
6
+ recipe.cook_if_not
@@ -0,0 +1,42 @@
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
+ `git ls-files -z`.split("\x0").reject do |f|
24
+ f.match(%r{\A(?:test|spec|features|bin|.github)/})
25
+ end
26
+ end
27
+
28
+ spec.bindir = "exe"
29
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
30
+ spec.require_paths = ["lib"]
31
+ spec.extensions = ["ext/extconf.rb"]
32
+
33
+ spec.add_runtime_dependency "bundler", "~> 2.3", ">= 2.3.22"
34
+ spec.add_runtime_dependency "ffi", "~> 1.0"
35
+ spec.add_runtime_dependency "ffi-libarchive", "~> 1.0"
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"
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
@@ -0,0 +1,160 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "pathname"
4
+ require "open3"
5
+
6
+ require_relative "base_recipe"
7
+ require_relative "zlib_recipe"
8
+ require_relative "libexpat_recipe"
9
+ require_relative "openssl_recipe"
10
+ require_relative "xz_recipe"
11
+
12
+ module LibarchiveBinary
13
+ class LibarchiveRecipe < MiniPortileCMake
14
+ ROOT = Pathname.new(File.expand_path("../..", __dir__))
15
+
16
+ def initialize
17
+ super("libarchive", "3.6.1")
18
+ @printed = {}
19
+
20
+ @files << {
21
+ url: "https://www.libarchive.org/downloads/libarchive-3.6.1.tar.gz",
22
+ sha256: "c676146577d989189940f1959d9e3980d28513d74eedfbc6b7f15ea45fe54ee2",
23
+ }
24
+
25
+ @target = ROOT.join(@target).to_s
26
+
27
+ create_dependencies
28
+ end
29
+
30
+ def create_dependencies
31
+ @zlib_recipe = ZLibRecipe.new
32
+ @expat_recipe = LibexpatRecipe.new
33
+ @openssl_recipe = OpensslRecipe.new
34
+ @xz_recipe = XZRecipe.new
35
+ end
36
+
37
+ def generator_flags
38
+ MiniPortile::mingw? ? ["-G", "MSYS Makefiles"] : []
39
+ end
40
+
41
+ def default_flags
42
+ [
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}"
51
+ ]
52
+ end
53
+
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
+ end
62
+ end
63
+
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
68
+
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(";")
72
+ end
73
+
74
+ def activate
75
+ @zlib_recipe.activate
76
+ @expat_recipe.activate
77
+ @openssl_recipe.activate
78
+ @xz_recipe.activate
79
+
80
+ super
81
+ end
82
+
83
+ def cook_if_not
84
+ cook unless File.exist?(checkpoint)
85
+ end
86
+
87
+ def cook
88
+ @zlib_recipe.host = @host if @host
89
+ @zlib_recipe.cook_if_not
90
+
91
+ @expat_recipe.host = @host if @host
92
+ @expat_recipe.cook_if_not
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
+
100
+ super
101
+
102
+ FileUtils.touch(checkpoint)
103
+ end
104
+
105
+ def checkpoint
106
+ File.join(@target, "#{name}-#{version}-#{host}.installed")
107
+ end
108
+
109
+ def install
110
+ super
111
+
112
+ libs = Dir.glob(File.join(port_path, "{lib,bin}", "*"))
113
+ .grep(/\/(?:lib)?[a-zA-Z0-9\-]+\.(?:so|dylib|dll)$/)
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
158
+ end
159
+ end
160
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "base_recipe"
4
+
5
+ module LibarchiveBinary
6
+ class LibexpatRecipe < BaseRecipe
7
+ ROOT = Pathname.new(File.expand_path("../..", __dir__))
8
+
9
+ def initialize
10
+ super("libexpat", "2.4.9")
11
+
12
+ @files << {
13
+ url: "https://github.com/libexpat/libexpat/releases/download/R_2_4_9/expat-2.4.9.tar.gz",
14
+ sha256: "4415710268555b32c4e5ab06a583bea9fec8ff89333b218b70b43d4ca10e38fa",
15
+ }
16
+
17
+ @target = ROOT.join(@target).to_s
18
+ end
19
+
20
+ def configure_defaults
21
+ [
22
+ "--host=#{@host}", "--disable-shared", "--enable-static",
23
+ "--without-tests", "--without-examples"
24
+ ]
25
+ end
26
+
27
+ def configure
28
+ cmd = ["env", cflags(host), ldflags(host),
29
+ "./configure"] + computed_options
30
+ execute("configure", cmd)
31
+ end
32
+
33
+ def checkpoint
34
+ File.join(@target, "#{name}-#{version}-#{host}.installed")
35
+ end
36
+
37
+ def cook_if_not
38
+ cook unless File.exist?(checkpoint)
39
+ end
40
+
41
+ def cook
42
+ super
43
+
44
+ FileUtils.touch(checkpoint)
45
+ end
46
+ end
47
+ 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" => 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,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LibarchiveBinary
4
+ VERSION = "0.3.0"
5
+ 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
@@ -0,0 +1,91 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "pathname"
4
+ require_relative "base_recipe"
5
+
6
+ module LibarchiveBinary
7
+ class ZLibRecipe < BaseRecipe
8
+ ROOT = Pathname.new(File.expand_path("../..", __dir__))
9
+
10
+ def initialize
11
+ super("zlib", "1.2.11")
12
+
13
+ @files << {
14
+ url: "http://zlib.net/fossils/zlib-1.2.11.tar.gz",
15
+ sha256: "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1",
16
+ }
17
+
18
+ @target = ROOT.join(@target).to_s
19
+ end
20
+
21
+ def configure_defaults
22
+ [
23
+ "--static",
24
+ ]
25
+ end
26
+
27
+ def configure_windows
28
+ mk = File.read("win32/Makefile.gcc")
29
+ File.open("win32/Makefile.gcc", "wb") do |f|
30
+ f.puts "BINARY_PATH = #{path}/bin"
31
+ f.puts "LIBRARY_PATH = #{path}/lib"
32
+ f.puts "INCLUDE_PATH = #{path}/include"
33
+ f.puts "SHARED_MODE = 0"
34
+ f.puts "LOC = -fPIC"
35
+ f.puts mk
36
+ end
37
+ end
38
+
39
+ def configure
40
+ if MiniPortile::windows?
41
+ Dir.chdir(work_path) do
42
+ configure_windows
43
+ end
44
+ else
45
+ cmd = ["env", cflags(host), ldflags(host),
46
+ "./configure"] + computed_options
47
+ execute("configure", cmd)
48
+ end
49
+ end
50
+
51
+ def configured?
52
+ if MiniPortile::windows?
53
+ Dir.chdir(work_path) do
54
+ !!(File.read("win32/Makefile.gcc") =~ /^BINARY_PATH/)
55
+ end
56
+ else
57
+ super
58
+ end
59
+ end
60
+
61
+ def compile
62
+ if MiniPortile::windows?
63
+ execute("compile", "make -f win32/Makefile.gcc libz.a")
64
+ else
65
+ super
66
+ end
67
+ end
68
+
69
+ def install
70
+ if MiniPortile::windows?
71
+ execute("install", "make -f win32/Makefile.gcc install")
72
+ else
73
+ super
74
+ end
75
+ end
76
+
77
+ def checkpoint
78
+ File.join(@target, "#{name}-#{version}-#{host}.installed")
79
+ end
80
+
81
+ def cook_if_not
82
+ cook unless File.exist?(checkpoint)
83
+ end
84
+
85
+ def cook
86
+ super
87
+
88
+ FileUtils.touch(checkpoint)
89
+ end
90
+ end
91
+ 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,25 @@
1
+ #
2
+ # CMake Toolchain file for crosscompiling for aarch64-linux-gnu.
3
+ #
4
+ set(CMAKE_SYSTEM_NAME Linux)
5
+ set(CMAKE_SYSTEM_PROCESSOR aarch64)
6
+
7
+ set(TOOLCHAIN_PREFIX aarch64-linux-gnu-)
8
+ execute_process(
9
+ COMMAND which ${TOOLCHAIN_PREFIX}gcc
10
+ OUTPUT_VARIABLE BINUTILS_PATH
11
+ OUTPUT_STRIP_TRAILING_WHITESPACE
12
+ )
13
+
14
+ get_filename_component(AARCH64_TOOLCHAIN_DIR ${BINUTILS_PATH} DIRECTORY)
15
+
16
+ set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}gcc)
17
+ set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER})
18
+ set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}g++)
19
+ set(CMAKE_C_COMPILER_WORKS 1)
20
+ set(CMAKE_CXX_COMPILER_WORKS 1)
21
+
22
+ set(CMAKE_FIND_ROOT_PATH ${BINUTILS_PATH})
23
+ set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
24
+ set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
25
+ set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
metadata ADDED
@@ -0,0 +1,169 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ffi-libarchive-binary
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
+ platform: aarch64-linux
6
+ authors:
7
+ - Ribose Inc.
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-10-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.3'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 2.3.22
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '2.3'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 2.3.22
33
+ - !ruby/object:Gem::Dependency
34
+ name: ffi
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.0'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '1.0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: ffi-libarchive
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '1.0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '1.0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: rake
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '13.0'
68
+ type: :runtime
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '13.0'
75
+ - !ruby/object:Gem::Dependency
76
+ name: rspec
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '3.0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '3.0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: rubocop
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '1.7'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '1.7'
103
+ - !ruby/object:Gem::Dependency
104
+ name: rubocop-performance
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '1.15'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '1.15'
117
+ description: Contains pre-compiled and install-time-compiled binaries for ffi-libarchive
118
+ email:
119
+ - open.source@ribose.com
120
+ executables: []
121
+ extensions: []
122
+ extra_rdoc_files: []
123
+ files:
124
+ - ".gitignore"
125
+ - ".rspec"
126
+ - ".rubocop.yml"
127
+ - Gemfile
128
+ - README.adoc
129
+ - Rakefile
130
+ - ext/Makefile
131
+ - ext/extconf.rb
132
+ - ffi-libarchive-binary.gemspec
133
+ - lib/ffi-libarchive-binary.rb
134
+ - lib/ffi-libarchive-binary/base_recipe.rb
135
+ - lib/ffi-libarchive-binary/libarchive.so
136
+ - lib/ffi-libarchive-binary/libarchive_recipe.rb
137
+ - lib/ffi-libarchive-binary/libexpat_recipe.rb
138
+ - lib/ffi-libarchive-binary/openssl_recipe.rb
139
+ - lib/ffi-libarchive-binary/version.rb
140
+ - lib/ffi-libarchive-binary/xz_recipe.rb
141
+ - lib/ffi-libarchive-binary/zlib_recipe.rb
142
+ - toolchain/aarch64-linux-gnu.cmake
143
+ homepage: https://github.com/fontist/ffi-libarchive-binary
144
+ licenses:
145
+ - BSD-3-Clause
146
+ metadata:
147
+ homepage_uri: https://github.com/fontist/ffi-libarchive-binary
148
+ source_code_uri: https://github.com/fontist/ffi-libarchive-binary
149
+ changelog_uri: https://github.com/fontist/ffi-libarchive-binary
150
+ post_install_message:
151
+ rdoc_options: []
152
+ require_paths:
153
+ - lib
154
+ required_ruby_version: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - ">="
157
+ - !ruby/object:Gem::Version
158
+ version: 2.7.0
159
+ required_rubygems_version: !ruby/object:Gem::Requirement
160
+ requirements:
161
+ - - ">="
162
+ - !ruby/object:Gem::Version
163
+ version: '0'
164
+ requirements: []
165
+ rubygems_version: 3.1.6
166
+ signing_key:
167
+ specification_version: 4
168
+ summary: Binaries for ffi-libarchive
169
+ test_files: []