ffi-libarchive-binary 0.2.3-x86-mingw32 → 0.2.6-x86-mingw32

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: b230b15887bb89c83f6c52a8f1b3395166697a11
4
- data.tar.gz: dc14d85dddd3c05b74cfbeaa20ef79087c5bf736
2
+ SHA256:
3
+ metadata.gz: 5fed9d06edd338c6c99b964513c82b1ed5135177238d6c8eb777569249cdfb5d
4
+ data.tar.gz: 64d1fce64723df6148332fcd4899c8d6a7cdd0e21d720b70d0fc8abe87729b7c
5
5
  SHA512:
6
- metadata.gz: fea17625d06bb4df55feae2177b0edbd5e3bc69ac2fd80e53d4cf76bccd96860d90d5c52f7fb50b4017a9112e7c1af72aefaf08a6f3cabd483e99feacfb18152
7
- data.tar.gz: df99858b19dc6f0128413dd900b54267d8cf15836f58fbe56abab66b09e28eeb7a462a7f9a3f66cf913f9e19681e3d37af39a96131c07e7ab2e4615afae6f2d6
6
+ metadata.gz: 5e6bcd861f10241460230457c811e1ef52ffa0603c46a5543c19675f8046e7721d5024579346ddad327476beede8387b16c18f1bebc3dc4a70390fee4b683aa1
7
+ data.tar.gz: '082dbd31cbf95a6133092b6200414198bc1fe6358d952cbbcaa197fa5155695e6844499468f47b68207667d69c8af64f67608f8d7387b33f773e103ebe9680ff'
data/Rakefile CHANGED
@@ -12,9 +12,6 @@ end
12
12
  desc "Define the gem task to build on any platform (compile on install)"
13
13
  task "platform:any" do
14
14
  spec = Gem::Specification::load("ffi-libarchive-binary.gemspec").dup
15
- spec.extensions = ['ext/extconf.rb']
16
- spec.add_runtime_dependency("mini_portile2", "~> 2.0")
17
-
18
15
  task = Gem::PackageTask.new(spec)
19
16
  task.define
20
17
  end
@@ -22,6 +19,7 @@ end
22
19
  platforms = [
23
20
  ["x86-mingw32", "i686-w64-mingw32", "libarchive-13.dll"],
24
21
  ["x64-mingw32", "x86_64-w64-mingw32", "libarchive-13.dll"],
22
+ ["x64-mingw-ucrt", "x86_64-w64-mingw32", "libarchive-13.dll"],
25
23
  ["x86-linux", "i686-linux-gnu", "libarchive.so"],
26
24
  ["x86_64-linux", "x86_64-linux-gnu", "libarchive.so"],
27
25
  ["x86_64-darwin", "x86_64-darwin", "libarchive.dylib"],
@@ -39,6 +37,8 @@ platforms.each do |platform, host, lib|
39
37
  spec = Gem::Specification::load("ffi-libarchive-binary.gemspec").dup
40
38
  spec.platform = Gem::Platform.new(platform)
41
39
  spec.files += ["lib/ffi-libarchive-binary/#{lib}"]
40
+ spec.extensions = []
41
+ spec.dependencies.reject! { |d| d.name == "mini_portile2" }
42
42
 
43
43
  task = Gem::PackageTask.new(spec)
44
44
  task.define
@@ -25,6 +25,8 @@ Gem::Specification.new do |spec|
25
25
  spec.bindir = "exe"
26
26
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
27
27
  spec.require_paths = ["lib"]
28
+ spec.extensions = ['ext/extconf.rb']
28
29
 
29
30
  spec.add_runtime_dependency "ffi-libarchive", "~> 1.0"
31
+ spec.add_runtime_dependency "mini_portile2", "~> 2.0"
30
32
  end
@@ -1,6 +1,9 @@
1
1
  require "mini_portile2"
2
2
  require "pathname"
3
3
 
4
+ require_relative "zlib_recipe"
5
+ require_relative "libexpat_recipe"
6
+
4
7
  module LibarchiveBinary
5
8
  class LibarchiveRecipe < MiniPortile
6
9
  ROOT = Pathname.new(File.expand_path("../..", __dir__))
@@ -13,6 +16,9 @@ module LibarchiveBinary
13
16
  sha256: "9015d109ec00bb9ae1a384b172bf2fc1dff41e2c66e5a9eeddf933af9db37f5a"
14
17
  }
15
18
 
19
+ @zlib_recipe = ZLibRecipe.new
20
+ @expat_recipe = LibexpatRecipe.new
21
+
16
22
  @target = ROOT.join(@target).to_s
17
23
  end
18
24
 
@@ -36,11 +42,56 @@ module LibarchiveBinary
36
42
  ]
37
43
  end
38
44
 
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)
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
+ end
67
+
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)
76
+
77
+ File.open(filename, "w") { |f| f << content }
78
+ end
79
+
80
+ def activate
81
+ @zlib_recipe.activate
82
+ @expat_recipe.activate
83
+
84
+ super
85
+ end
86
+
39
87
  def cook_if_not
40
88
  cook unless File.exist?(checkpoint)
41
89
  end
42
90
 
43
91
  def cook
92
+ @zlib_recipe.cook_if_not
93
+ @expat_recipe.cook_if_not
94
+
44
95
  super
45
96
 
46
97
  FileUtils.touch(checkpoint)
@@ -0,0 +1,46 @@
1
+ require "mini_portile2"
2
+
3
+ module LibarchiveBinary
4
+ # based on
5
+ class LibexpatRecipe < MiniPortile
6
+ ROOT = Pathname.new(File.expand_path("../..", __dir__))
7
+
8
+ def initialize
9
+ super("libexpat", "2.4.1")
10
+
11
+ @files << {
12
+ url: "https://github.com/libexpat/libexpat/releases/download/R_2_4_1/expat-2.4.1.tar.gz",
13
+ sha256: "a00ae8a6b96b63a3910ddc1100b1a7ef50dc26dceb65ced18ded31ab392f132b"
14
+ }
15
+
16
+ @target = ROOT.join(@target).to_s
17
+ end
18
+
19
+ def configure_defaults
20
+ [
21
+ "--host=#{@host}",
22
+ "--disable-shared",
23
+ "--enable-static",
24
+ ]
25
+ end
26
+
27
+ def configure
28
+ cmd = ["env", "CFLAGS=-fPIC", "LDFLAGS=-fPIC", "./configure"] + computed_options
29
+ execute("configure", cmd)
30
+ end
31
+
32
+ def checkpoint
33
+ File.join(@target, "#{self.name}-#{self.version}-#{self.host}.installed")
34
+ end
35
+
36
+ def cook_if_not
37
+ cook unless File.exist?(checkpoint)
38
+ end
39
+
40
+ def cook
41
+ super
42
+
43
+ FileUtils.touch(checkpoint)
44
+ end
45
+ end
46
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LibarchiveBinary
4
- VERSION = "0.2.3"
4
+ VERSION = "0.2.6"
5
5
  end
@@ -0,0 +1,89 @@
1
+ require "mini_portile2"
2
+ require "pathname"
3
+
4
+ module LibarchiveBinary
5
+ def self.windows?
6
+ RbConfig::CONFIG["target_os"] =~ /mingw32|mswin/
7
+ end
8
+
9
+ # inspired by https://github.com/sparklemotion/nokogiri/blob/35823bd/ext/nokogiri/extconf.rb#L655
10
+ class ZLibRecipe < MiniPortile
11
+ ROOT = Pathname.new(File.expand_path("../..", __dir__))
12
+
13
+ def initialize
14
+ super("zlib", "1.2.11")
15
+
16
+ @files << {
17
+ url: "http://zlib.net/fossils/zlib-1.2.11.tar.gz",
18
+ sha256: "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1"
19
+ }
20
+
21
+ @target = ROOT.join(@target).to_s
22
+ end
23
+
24
+ def configure_defaults
25
+ [
26
+ "--static"
27
+ ]
28
+ end
29
+
30
+ def configure
31
+ if LibarchiveBinary::windows?
32
+ Dir.chdir(work_path) do
33
+ mk = File.read("win32/Makefile.gcc")
34
+ File.open("win32/Makefile.gcc", "wb") do |f|
35
+ f.puts "BINARY_PATH = #{path}/bin"
36
+ f.puts "LIBRARY_PATH = #{path}/lib"
37
+ f.puts "INCLUDE_PATH = #{path}/include"
38
+ f.puts "SHARED_MODE = 0"
39
+ f.puts "LOC = -fPIC"
40
+ f.puts mk
41
+ end
42
+ end
43
+ else
44
+ cmd = ["env", "CFLAGS=-fPIC", "LDFLAGS=-fPIC", "./configure"] + computed_options
45
+ execute("configure", cmd)
46
+ end
47
+ end
48
+
49
+ def configured?
50
+ if LibarchiveBinary::windows?
51
+ Dir.chdir(work_path) do
52
+ !!(File.read("win32/Makefile.gcc") =~ /^BINARY_PATH/)
53
+ end
54
+ else
55
+ super
56
+ end
57
+ end
58
+
59
+ def compile
60
+ if LibarchiveBinary::windows?
61
+ execute("compile", "make -f win32/Makefile.gcc libz.a")
62
+ else
63
+ super
64
+ end
65
+ end
66
+
67
+ def install
68
+ if LibarchiveBinary::windows?
69
+ execute("install", "make -f win32/Makefile.gcc install")
70
+ else
71
+ super
72
+ end
73
+ end
74
+
75
+ def checkpoint
76
+ File.join(@target, "#{self.name}-#{self.version}-#{self.host}.installed")
77
+ end
78
+
79
+ def cook_if_not
80
+ cook unless File.exist?(checkpoint)
81
+ end
82
+
83
+ def cook
84
+ super
85
+
86
+ FileUtils.touch(checkpoint)
87
+ end
88
+ end
89
+ end
@@ -7,18 +7,32 @@ module LibarchiveBinary
7
7
  class Error < StandardError; end
8
8
 
9
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-13.dll"
18
+ elsif FFI::Platform.mac?
19
+ "libarchive.dylib"
20
+ else
21
+ "libarchive.so"
22
+ end
23
+ end
10
24
  end
11
25
 
12
26
  module Archive
13
27
  module C
14
28
  def self.ffi_lib(*args)
15
29
  prefixed = args.map do |names|
16
- filenames = names.is_a?(Array) ? names : [names]
17
- with_path = filenames.map(&:to_s).map do |filename|
18
- LibarchiveBinary::LIBRARY_PATH.join(FFI.map_library_name(filename)).to_s
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
19
35
  end
20
-
21
- with_path + filenames
22
36
  end
23
37
 
24
38
  super(*prefixed)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffi-libarchive-binary
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.6
5
5
  platform: x86-mingw32
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-04-03 00:00:00.000000000 Z
11
+ date: 2022-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi-libarchive
@@ -42,7 +42,9 @@ files:
42
42
  - lib/ffi-libarchive-binary.rb
43
43
  - lib/ffi-libarchive-binary/libarchive-13.dll
44
44
  - lib/ffi-libarchive-binary/libarchive_recipe.rb
45
+ - lib/ffi-libarchive-binary/libexpat_recipe.rb
45
46
  - lib/ffi-libarchive-binary/version.rb
47
+ - lib/ffi-libarchive-binary/zlib_recipe.rb
46
48
  - updates/config.guess
47
49
  - updates/config.sub
48
50
  homepage: https://github.com/fontist/ffi-libarchive-binary
@@ -52,7 +54,7 @@ metadata:
52
54
  homepage_uri: https://github.com/fontist/ffi-libarchive-binary
53
55
  source_code_uri: https://github.com/fontist/ffi-libarchive-binary
54
56
  changelog_uri: https://github.com/fontist/ffi-libarchive-binary
55
- post_install_message:
57
+ post_install_message:
56
58
  rdoc_options: []
57
59
  require_paths:
58
60
  - lib
@@ -67,9 +69,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
69
  - !ruby/object:Gem::Version
68
70
  version: '0'
69
71
  requirements: []
70
- rubyforge_project:
71
- rubygems_version: 2.6.14.4
72
- signing_key:
72
+ rubygems_version: 3.1.6
73
+ signing_key:
73
74
  specification_version: 4
74
75
  summary: Binaries for ffi-libarchive
75
76
  test_files: []