pngcheck 0.2.5-x64-mingw-ucrt → 0.2.6-x64-mingw-ucrt

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: 7ea66a67ea2478557283fc8550cd09bbea1243c492bbee19ef726601f7695ae7
4
- data.tar.gz: 1b32274920f2e4630db46d66e072449a5a7f03e22f8b21888352cc740cb057a5
3
+ metadata.gz: 025540310fcdd544da892f27aa4d1fa1f06c0a1b9ed33afec85d416008a6b7c5
4
+ data.tar.gz: c958afebb08ffe0c33b0d4bb0dfae6cb26b1f7fa740f3e3e88ea0672921d9e62
5
5
  SHA512:
6
- metadata.gz: 04dec712ea62ccb38d3016ed29a538d1cf24a99ea8667bb338a85d77200cda19676b04648f0c54f6dcf60417745d72fa3957fbcd723f1bd8a33e642be27719bc
7
- data.tar.gz: 75a3ee1ed6553fdb4a8ebb68931cc0917e039f467b752ad9a10f338e8e661adf8218adf18a02ab58e7f386555a87fe136e2eea975a89bac4b014552ce39fea41
6
+ metadata.gz: d16a2883cafcb152093cf5899c8f47b3357e1fff6adf08d2107a6c6d63be3e66fed949d2025bd36d9396eda304f78bb043b128ea92482ea2b739212dccd77e8a
7
+ data.tar.gz: cd07af965fe27a022e8a39a050969303d12d48b092c6817c5e787b00d4eab231f4b58d053077943e82be91f959f5c25ab0ab25de17fdbe142ee54125b7b4392a
Binary file
@@ -13,12 +13,16 @@ module PngCheck
13
13
  ROOT = Pathname.new(File.expand_path("../..", __dir__))
14
14
  COMMON_FLAGS = "-shared -fPIC -Wall -O -DUSE_ZLIB"
15
15
 
16
- def files_to_load
16
+ def files_to_load_all
17
17
  @files << {
18
18
  url: "http://www.libpng.org/pub/png/src/pngcheck-3.0.3.tar.gz",
19
19
  sha256: "c36a4491634af751f7798ea421321642f9590faa032eccb0dd5fb4533609dee6", # rubocop:disable Layout/LineLength
20
20
  }
21
- if target_platform.eql?("aarch64-linux")
21
+ end
22
+
23
+ def files_to_load_cross
24
+ if target_platform.eql?("aarch64-linux") &&
25
+ !host_platform.eql?("aarch64-linux")
22
26
  @files << {
23
27
  url: "http://ports.ubuntu.com/pool/main/z/zlib/zlib1g-dev_1.2.11.dfsg-2ubuntu1.3_arm64.deb", # rubocop:disable Layout/LineLength
24
28
  sha256: "0ebadc1ff2a70f0958d4e8e21ffa97d9fa4da23555eaae87782e963044a26fcf", # rubocop:disable Layout/LineLength
@@ -28,17 +32,27 @@ module PngCheck
28
32
 
29
33
  def initialize
30
34
  super("pngcheck", "3.0.3")
31
- files_to_load
35
+ files_to_load_all
36
+ files_to_load_cross
32
37
  @target = ROOT.join(@target).to_s
33
38
  @printed = {}
34
39
  end
35
40
 
41
+ def lib_filename
42
+ @lib_filename ||=
43
+ if MiniPortile.windows?
44
+ "pngcheck.dll"
45
+ else
46
+ "pngcheck.so"
47
+ end
48
+ end
49
+
50
+ def lib_workpath
51
+ @lib_workpath ||= File.join(work_path, lib_filename)
52
+ end
53
+
36
54
  def make_cmd
37
- if MiniPortile.windows?
38
- "gcc #{COMMON_FLAGS} -o pngcheck.dll wrapper.c -lz"
39
- else
40
- "#{cc} #{cflags} #{COMMON_FLAGS} -o pngcheck.so wrapper.c -lz"
41
- end
55
+ "#{cc} #{cflags} #{COMMON_FLAGS} -o #{lib_filename} wrapper.c -lz"
42
56
  end
43
57
 
44
58
  def cook_if_not
@@ -56,29 +70,25 @@ module PngCheck
56
70
 
57
71
  def configure
58
72
  FileUtils.cp(ROOT.join("ext", "wrapper.c"), work_path, verbose: false)
59
- if target_platform.eql?("aarch64-linux")
73
+ if target_platform.eql?("aarch64-linux") &&
74
+ !host_platform.eql?("aarch64-linux")
60
75
  extract_file("#{work_path}/../data.tar.xz", work_path.to_s)
61
76
  end
62
77
  end
63
78
 
64
- def libs_to_verify
65
- Dir.glob(ROOT.join("lib", "pngcheck",
66
- "pngcheck.{so,dylib,dll}"))
67
- end
68
-
69
- def verify_libs
70
- libs_to_verify.each do |l|
71
- out, st = Open3.capture2("file #{l}")
72
- out = out.strip
73
-
74
- raise "Failed to query file #{l}: #{out}" unless st.exitstatus.zero?
79
+ def verify_lib
80
+ begin
81
+ out, = Open3.capture2("file #{lib_workpath}")
82
+ rescue StandardError
83
+ message("Failed to call file, skipped library verification ...\n")
84
+ return
85
+ end
75
86
 
76
- if out.include?(target_format)
77
- message("Verifying #{l} ... OK\n")
78
- else
79
- raise "Invalid file format '#{out}', '#{@target_format}' expected"
80
- end
87
+ unless out.include?(target_format)
88
+ raise "Invalid file format '#{out.strip}', '#{@target_format}' expected"
81
89
  end
90
+
91
+ message("Verifying #{lib_workpath} ... OK\n")
82
92
  end
83
93
 
84
94
  def install
@@ -86,7 +96,7 @@ module PngCheck
86
96
  .grep(%r{/(?:lib)?[a-zA-Z0-9\-]+\.(?:so|dylib|dll)$})
87
97
 
88
98
  FileUtils.cp_r(libs, ROOT.join("lib", "pngcheck"), verbose: false)
89
- verify_libs
99
+ verify_lib
90
100
  end
91
101
 
92
102
  def execute(action, command, command_opts = {})
@@ -174,11 +184,11 @@ module PngCheck
174
184
 
175
185
  def cflags
176
186
  @cflags ||=
177
- if target_platform.eql?(host_platform) ||
178
- !target_platform.eql?("aarch64-linux")
179
- ""
180
- else
187
+ if target_platform.eql?("aarch64-linux") &&
188
+ !host_platform.eql?("aarch64-linux")
181
189
  "-I./usr/include -L./usr/lib/#{target_platform}-gnu"
190
+ else
191
+ ""
182
192
  end
183
193
  end
184
194
  # rubocop:enable Metrics/CyclomaticComplexity
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PngCheck
4
- VERSION = "0.2.5"
4
+ VERSION = "0.2.6"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pngcheck
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: x64-mingw-ucrt
6
6
  authors:
7
7
  - Ribose Inc.