ffi-libarchive-binary 0.2.5-x86_64-darwin → 0.3.0-x86_64-darwin

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b5a0ba692e713a1f61212dd855f15252875c518df9bcfc3e252e9c4c9050a3c8
4
- data.tar.gz: bf6290fab49d24d277d7ef8a777eeb9416f0fbd52dfa18cb025dd0fe38719583
3
+ metadata.gz: f929550cc5d8aa44ddfd8111c9983616e24892c7bdf4bd2b3b2b9c3a5bf298e2
4
+ data.tar.gz: 1fbd0b55770ca273f3d9752b0600f98991c4455be333db3b218cbe2d0bcacb74
5
5
  SHA512:
6
- metadata.gz: f14bacd0a9d7d4649a7b67c427ffaeb383427466a35a58e61d76da072b29e7e8f140216d273b3cce724ba5a4abc9b07635c7e72dd0ba3c15a8c0dd4b154dd136
7
- data.tar.gz: 9a7c361ca76c1b4c7c42ae5d18eda317533751fd21911fe985f033a541184ec5c983e9508ea3e85366b830140fb29e6b0a1d248fa6df968f7fe0d35379daa68f
6
+ metadata.gz: 9ffa841035249dfe653d8da6c6912917c99fa1146de4a077d770c2b448b6138bd363a6438e8e39094ecd463277d23d1f91248457f5c08f7c4700bfd1fc26bf9f
7
+ data.tar.gz: 338ca9d26c2f8e471e5196f33f5fc09c8dec9a6fa0583f8e672878cca8deb36db36f82330b73305a82165a6053c86f2ea7ff935197016fbae62b9d18cc164f56
data/.gitignore CHANGED
@@ -13,3 +13,7 @@ vendor/
13
13
  *.dll
14
14
  *.dylib
15
15
  *.so
16
+ /.vscode/
17
+
18
+ # remote file cache
19
+ .rubocop-*
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
@@ -3,9 +3,3 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gemspec
6
-
7
- gem "gem-release"
8
-
9
- gem "mini_portile2", "~> 2.0"
10
- gem "rake", "~> 13.0"
11
- gem "rspec", "~> 3.0"
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,15 +27,15 @@ task "platform:any" do
17
27
  end
18
28
 
19
29
  platforms = [
20
- ["x86-mingw32", "i686-w64-mingw32", "libarchive-13.dll"],
21
- ["x64-mingw32", "x86_64-w64-mingw32", "libarchive-13.dll"],
22
- ["x86-linux", "i686-linux-gnu", "libarchive.so"],
23
- ["x86_64-linux", "x86_64-linux-gnu", "libarchive.so"],
24
- ["x86_64-darwin", "x86_64-darwin", "libarchive.dylib"],
25
- ["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"],
26
36
  ]
27
37
 
28
- platforms.each do |platform, host, lib|
38
+ platforms.each do |platform, host|
29
39
  desc "Build pre-compiled gem for the #{platform} platform"
30
40
  task "gem:native:#{platform}" do
31
41
  sh "rake compile[#{host}] platform:#{platform} gem"
@@ -35,7 +45,7 @@ platforms.each do |platform, host, lib|
35
45
  task "platform:#{platform}" do
36
46
  spec = Gem::Specification::load("ffi-libarchive-binary.gemspec").dup
37
47
  spec.platform = Gem::Platform.new(platform)
38
- spec.files += ["lib/ffi-libarchive-binary/#{lib}"]
48
+ spec.files += Dir.glob("lib/ffi-libarchive-binary/*.{dll,so,dylib}")
39
49
  spec.extensions = []
40
50
  spec.dependencies.reject! { |d| d.name == "mini_portile2" }
41
51
 
@@ -47,16 +57,15 @@ end
47
57
  desc "Compile binary for the target host"
48
58
  task :compile, [:host] do |_t, args|
49
59
  recipe = LibarchiveBinary::LibarchiveRecipe.new
50
- recipe.host = args[:host] if args[:host]
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
51
66
  recipe.cook_if_not
52
67
  end
53
68
 
54
- desc "Recompile binary"
55
- task :recompile do
56
- recipe = LibarchiveBinary::LibarchiveRecipe.new
57
- recipe.cook
58
- end
59
-
60
69
  CLOBBER.include("pkg")
61
70
  CLEAN.include("ports",
62
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.4.0")
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 { |f| f.match(%r{\A(?:test|spec|features|bin|.github)/}) }
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 = ['ext/extconf.rb']
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.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"
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
- require "mini_portile2"
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 < MiniPortile
13
+ class LibarchiveRecipe < MiniPortileCMake
9
14
  ROOT = Pathname.new(File.expand_path("../..", __dir__))
10
15
 
11
16
  def initialize
12
- super("libarchive", "3.5.1")
17
+ super("libarchive", "3.6.1")
18
+ @printed = {}
13
19
 
14
20
  @files << {
15
- url: "https://www.libarchive.org/downloads/libarchive-3.5.1.tar.gz",
16
- sha256: "9015d109ec00bb9ae1a384b172bf2fc1dff41e2c66e5a9eeddf933af9db37f5a"
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
- @target = ROOT.join(@target).to_s
37
+ def generator_flags
38
+ MiniPortile::mingw? ? ["-G", "MSYS Makefiles"] : []
23
39
  end
24
40
 
25
- def configure_defaults
41
+ def default_flags
26
42
  [
27
- "--host=#{@host}",
28
- "--disable-bsdtar",
29
- "--disable-bsdcat",
30
- "--disable-bsdcpio",
31
- "--without-bz2lib",
32
- "--without-libb2",
33
- "--without-iconv",
34
- "--without-lz4",
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 configure
46
- paths = [@zlib_recipe.path, @expat_recipe.path]
47
- cflags = paths.map { |k| "-I#{k}/include" }.join(" ")
48
- cmd = ["env", "CFLAGS=#{cflags}", "./configure"] + computed_options
49
-
50
- execute("configure", cmd)
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 replace_in_file(search_str, replace_str, filename)
69
- puts "Replace \"#{search_str}\" with \"#{replace_str}\" in #{filename}"
70
-
71
- f = File.open(filename, "r")
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
- File.open(filename, "w") { |f| f << content }
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, "#{self.name}-#{self.version}-#{self.host}.installed")
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, ROOT.join("lib", "ffi-libarchive-binary"), verbose: true)
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
- require "mini_portile2"
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "base_recipe"
2
4
 
3
5
  module LibarchiveBinary
4
- # based on
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.1")
10
+ super("libexpat", "2.4.9")
10
11
 
11
12
  @files << {
12
- url: "https://github.com/libexpat/libexpat/releases/download/R_2_4_1/expat-2.4.1.tar.gz",
13
- sha256: "a00ae8a6b96b63a3910ddc1100b1a7ef50dc26dceb65ced18ded31ab392f132b"
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
- "--disable-shared",
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", "CFLAGS=-fPIC", "LDFLAGS=-fPIC", "./configure"] + computed_options
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, "#{self.name}-#{self.version}-#{self.host}.installed")
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LibarchiveBinary
4
- VERSION = "0.2.5"
4
+ VERSION = "0.3.0"
5
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