fast_resize 1.0.2 → 1.0.3
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 +4 -4
- data/VERSION +1 -1
- data/bindings/ruby/ext/fastresize/extconf.rb +79 -105
- data/bindings/ruby/lib/fastresize/platform.rb +102 -56
- data/bindings/ruby/lib/fastresize/version.rb +1 -1
- data/bindings/ruby/lib/fastresize.rb +321 -6
- data/bindings/ruby/prebuilt/linux-aarch64/bin/fast_resize +0 -0
- data/bindings/ruby/prebuilt/linux-aarch64.tar.gz +0 -0
- data/bindings/ruby/prebuilt/linux-x86_64/bin/fast_resize +0 -0
- data/bindings/ruby/prebuilt/linux-x86_64/lib/libfastresize.a +0 -0
- data/bindings/ruby/prebuilt/linux-x86_64.tar.gz +0 -0
- data/bindings/ruby/prebuilt/macos-arm64/bin/fast_resize +0 -0
- data/bindings/ruby/prebuilt/macos-arm64/lib/libfastresize.a +0 -0
- data/bindings/ruby/prebuilt/macos-arm64.tar.gz +0 -0
- data/bindings/ruby/prebuilt/macos-x86_64/bin/fast_resize +0 -0
- data/bindings/ruby/prebuilt/macos-x86_64/lib/libfastresize.a +0 -0
- data/bindings/ruby/prebuilt/macos-x86_64.tar.gz +0 -0
- metadata +4 -22
- data/CMakeLists.txt +0 -311
- data/bindings/ruby/ext/fastresize/fastresize_ext.cpp +0 -377
- data/include/fastresize.h +0 -189
- data/include/stb_image.h +0 -7988
- data/include/stb_image_resize2.h +0 -10651
- data/include/stb_image_write.h +0 -1724
- data/src/cli.cpp +0 -540
- data/src/decoder.cpp +0 -647
- data/src/encoder.cpp +0 -376
- data/src/fastresize.cpp +0 -445
- data/src/internal.h +0 -108
- data/src/pipeline.cpp +0 -284
- data/src/pipeline.h +0 -175
- data/src/resizer.cpp +0 -199
- data/src/simd_resize.cpp +0 -384
- data/src/simd_resize.h +0 -72
- data/src/simd_utils.h +0 -127
- data/src/thread_pool.cpp +0 -232
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 50cddc83a608aca540d2cd79db11f89cf5143cabbaa790b00a52514e37d0bf87
|
|
4
|
+
data.tar.gz: 25ccb548c17f7b408098040ae0e32f2527653637c605e41daeb6e25c4692b405
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9ad5ea5b9ff6668a134056ef1b07b8362c452e9ad1a08b6eba54e3a90c832e9b2ab18d39471e325053774ae8a40945c8c11ade93f4e1403df16c8a473954285d
|
|
7
|
+
data.tar.gz: f96258c219287d2c497b2011832df371d2813b8f2145d87180dbaeadeb65620a122e4dc6cb0621f4f8911386450cfecb37ec01c22fd5f1e34598584b9fae5bb7
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0.
|
|
1
|
+
1.0.3
|
|
@@ -39,133 +39,107 @@
|
|
|
39
39
|
require 'mkmf'
|
|
40
40
|
require 'rbconfig'
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
# Check if pre-built binary exists
|
|
43
|
+
def check_prebuilt_binary
|
|
45
44
|
os = RbConfig::CONFIG['host_os']
|
|
46
45
|
arch = RbConfig::CONFIG['host_cpu']
|
|
47
46
|
|
|
48
47
|
platform = case os
|
|
49
48
|
when /darwin/
|
|
50
49
|
case arch
|
|
51
|
-
when /arm64|aarch64/
|
|
52
|
-
|
|
50
|
+
when /arm64|aarch64/
|
|
51
|
+
'macos-arm64'
|
|
52
|
+
when /x86_64|x64/
|
|
53
|
+
'macos-x86_64'
|
|
54
|
+
else
|
|
55
|
+
nil
|
|
53
56
|
end
|
|
54
57
|
when /linux/
|
|
55
58
|
case arch
|
|
56
|
-
when /x86_64|x64/
|
|
57
|
-
|
|
59
|
+
when /x86_64|x64/
|
|
60
|
+
'linux-x86_64'
|
|
61
|
+
when /arm64|aarch64/
|
|
62
|
+
'linux-aarch64'
|
|
63
|
+
else
|
|
64
|
+
nil
|
|
58
65
|
end
|
|
66
|
+
else
|
|
67
|
+
nil
|
|
59
68
|
end
|
|
60
69
|
|
|
61
|
-
return
|
|
70
|
+
return false unless platform
|
|
62
71
|
|
|
72
|
+
# When installed as gem, binaries are in bindings/ruby/prebuilt/
|
|
63
73
|
ext_dir = File.dirname(__FILE__)
|
|
64
74
|
prebuilt_dir = File.expand_path("../../prebuilt/#{platform}", ext_dir)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
if File.exist?(lib_path)
|
|
68
|
-
puts "✅ Found pre-built library at #{lib_path}"
|
|
69
|
-
puts "⚡ Will compile Ruby binding with pre-built core library"
|
|
70
|
-
return prebuilt_dir
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
puts "⚠️ No pre-built library found for #{platform}"
|
|
74
|
-
puts "📦 Will compile everything from source..."
|
|
75
|
-
nil
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
prebuilt_dir = check_prebuilt_library
|
|
79
|
-
|
|
80
|
-
puts "🔨 Compiling FastResize Ruby binding..."
|
|
75
|
+
binary_path = File.join(prebuilt_dir, 'bin', 'fast_resize')
|
|
81
76
|
|
|
82
|
-
|
|
83
|
-
|
|
77
|
+
if File.exist?(binary_path)
|
|
78
|
+
puts "✅ Found pre-built binary at #{binary_path}"
|
|
79
|
+
puts "⏭️ Skipping compilation"
|
|
84
80
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
abort "❌ Include directory not found: #{include_dir}"
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
$INCFLAGS << " -I#{include_dir}"
|
|
95
|
-
|
|
96
|
-
['/opt/homebrew/include', '/usr/local/include'].each do |path|
|
|
97
|
-
$INCFLAGS << " -I#{path}" if File.directory?(path)
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
if prebuilt_dir
|
|
101
|
-
# Use pre-built core library
|
|
102
|
-
puts "📦 Using pre-built core library"
|
|
103
|
-
prebuilt_lib_dir = File.join(prebuilt_dir, 'lib')
|
|
104
|
-
$LDFLAGS << " -L#{prebuilt_lib_dir} -lfastresize"
|
|
105
|
-
|
|
106
|
-
# Link required image libraries that libfastresize.a depends on
|
|
107
|
-
puts "🔍 Linking required image libraries..."
|
|
108
|
-
|
|
109
|
-
# These libraries are required by the pre-built libfastresize.a
|
|
110
|
-
unless find_library('png', 'png_create_read_struct', '/opt/homebrew/lib', '/usr/local/lib', '/usr/lib')
|
|
111
|
-
abort "❌ ERROR: libpng not found. Please install: brew install libpng (macOS) or apt-get install libpng-dev (Linux)"
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
unless find_library('jpeg', 'jpeg_CreateDecompress', '/opt/homebrew/lib', '/usr/local/lib', '/usr/lib')
|
|
115
|
-
abort "❌ ERROR: libjpeg not found. Please install: brew install jpeg (macOS) or apt-get install libjpeg-dev (Linux)"
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
unless find_library('z', 'inflate', '/opt/homebrew/lib', '/usr/local/lib', '/usr/lib')
|
|
119
|
-
abort "❌ ERROR: zlib not found. Please install: brew install zlib (macOS) or apt-get install zlib1g-dev (Linux)"
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
# WebP is optional
|
|
123
|
-
if find_library('webp', 'WebPDecode', '/opt/homebrew/lib', '/usr/local/lib', '/usr/lib')
|
|
124
|
-
puts "✅ WebP support enabled"
|
|
125
|
-
find_library('webpdemux', 'WebPDemuxGetFrame', '/opt/homebrew/lib', '/usr/local/lib', '/usr/lib')
|
|
126
|
-
find_library('sharpyuv', 'SharpYuvGetCPUInfo', '/opt/homebrew/lib', '/usr/local/lib', '/usr/lib')
|
|
127
|
-
else
|
|
128
|
-
puts "⚠️ WebP support disabled (library not found)"
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
# Only compile the Ruby binding
|
|
132
|
-
$srcs = ['fastresize_ext.cpp']
|
|
133
|
-
else
|
|
134
|
-
# Compile everything from source
|
|
135
|
-
puts "🔨 Compiling from source..."
|
|
136
|
-
|
|
137
|
-
unless File.directory?(src_dir)
|
|
138
|
-
abort "❌ Source directory not found: #{src_dir}"
|
|
139
|
-
end
|
|
140
|
-
|
|
141
|
-
puts "🔍 Searching for required libraries..."
|
|
142
|
-
|
|
143
|
-
unless find_library('jpeg', 'jpeg_CreateDecompress', '/opt/homebrew/lib', '/usr/local/lib', '/usr/lib')
|
|
144
|
-
abort "❌ ERROR: libjpeg not found. Please install: brew install jpeg (macOS) or apt-get install libjpeg-dev (Linux)"
|
|
145
|
-
end
|
|
146
|
-
|
|
147
|
-
unless find_library('png', 'png_create_read_struct', '/opt/homebrew/lib', '/usr/local/lib', '/usr/lib')
|
|
148
|
-
abort "❌ ERROR: libpng not found. Please install: brew install libpng (macOS) or apt-get install libpng-dev (Linux)"
|
|
149
|
-
end
|
|
81
|
+
# Create a dummy Makefile that does nothing
|
|
82
|
+
File.open('Makefile', 'w') do |f|
|
|
83
|
+
f.puts "all:\n\t@echo 'Using pre-built binary'\n"
|
|
84
|
+
f.puts "install:\n\t@echo 'Using pre-built binary'\n"
|
|
85
|
+
f.puts "clean:\n\t@echo 'Nothing to clean'\n"
|
|
86
|
+
end
|
|
150
87
|
|
|
151
|
-
|
|
152
|
-
abort "❌ ERROR: zlib not found. Please install: brew install zlib (macOS) or apt-get install zlib1g-dev (Linux)"
|
|
88
|
+
return true
|
|
153
89
|
end
|
|
154
90
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
91
|
+
# Check for tarball
|
|
92
|
+
tarball_path = File.join(File.expand_path("../../prebuilt", ext_dir), "#{platform}.tar.gz")
|
|
93
|
+
if File.exist?(tarball_path)
|
|
94
|
+
puts "📦 Found tarball at #{tarball_path}"
|
|
95
|
+
puts "📦 Extracting pre-built binary..."
|
|
96
|
+
|
|
97
|
+
require 'fileutils'
|
|
98
|
+
FileUtils.mkdir_p(prebuilt_dir)
|
|
99
|
+
system("tar -xzf '#{tarball_path}' -C '#{File.dirname(prebuilt_dir)}'")
|
|
100
|
+
|
|
101
|
+
if File.exist?(binary_path)
|
|
102
|
+
File.chmod(0755, binary_path)
|
|
103
|
+
puts "✅ Extracted pre-built binary to #{binary_path}"
|
|
104
|
+
puts "⏭️ Skipping compilation"
|
|
105
|
+
|
|
106
|
+
# Create a dummy Makefile that does nothing
|
|
107
|
+
File.open('Makefile', 'w') do |f|
|
|
108
|
+
f.puts "all:\n\t@echo 'Using pre-built binary'\n"
|
|
109
|
+
f.puts "install:\n\t@echo 'Using pre-built binary'\n"
|
|
110
|
+
f.puts "clean:\n\t@echo 'Nothing to clean'\n"
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
return true
|
|
114
|
+
end
|
|
161
115
|
end
|
|
162
116
|
|
|
163
|
-
|
|
164
|
-
$VPATH << src_dir
|
|
117
|
+
false
|
|
165
118
|
end
|
|
166
119
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
120
|
+
# Try to use pre-built binary first
|
|
121
|
+
exit 0 if check_prebuilt_binary
|
|
122
|
+
|
|
123
|
+
# If no pre-built binary, show error message
|
|
124
|
+
# We don't support compiling from source in this version
|
|
125
|
+
puts "❌ No pre-built binary found for this platform"
|
|
126
|
+
puts ""
|
|
127
|
+
puts "FastResize requires a pre-built binary. Please check:"
|
|
128
|
+
puts " 1. Your platform is supported (macOS/Linux, x86_64/ARM64)"
|
|
129
|
+
puts " 2. The gem was properly downloaded with all files"
|
|
130
|
+
puts " 3. Report this issue at: https://github.com/tranhuucanh/fast_resize/issues"
|
|
131
|
+
puts ""
|
|
132
|
+
|
|
133
|
+
# Create a Makefile that will fail gracefully
|
|
134
|
+
File.open('Makefile', 'w') do |f|
|
|
135
|
+
f.puts "all:"
|
|
136
|
+
f.puts "\t@echo 'ERROR: No pre-built binary available for this platform'"
|
|
137
|
+
f.puts "\t@exit 1"
|
|
138
|
+
f.puts "install:"
|
|
139
|
+
f.puts "\t@echo 'ERROR: No pre-built binary available for this platform'"
|
|
140
|
+
f.puts "\t@exit 1"
|
|
141
|
+
f.puts "clean:"
|
|
142
|
+
f.puts "\t@echo 'Nothing to clean'"
|
|
143
|
+
end
|
|
170
144
|
|
|
171
|
-
|
|
145
|
+
exit 1
|
|
@@ -1,69 +1,139 @@
|
|
|
1
|
-
#
|
|
1
|
+
# FastResize - The Fastest Image Resizing Library On The Planet
|
|
2
|
+
# Copyright (C) 2025 Tran Huu Canh (0xTh3OKrypt) and FastResize Contributors
|
|
3
|
+
#
|
|
4
|
+
# Resize 1,000 images in 2 seconds. Up to 2.9x faster than libvips,
|
|
5
|
+
# 3.1x faster than imageflow. Uses 3-4x less RAM than alternatives.
|
|
6
|
+
#
|
|
7
|
+
# Author: Tran Huu Canh (0xTh3OKrypt)
|
|
8
|
+
# Email: tranhuucanh39@gmail.com
|
|
9
|
+
# Homepage: https://github.com/tranhuucanh/fast_resize
|
|
10
|
+
#
|
|
11
|
+
# BSD 3-Clause License
|
|
12
|
+
#
|
|
13
|
+
# Redistribution and use in source and binary forms, with or without
|
|
14
|
+
# modification, are permitted provided that the following conditions are met:
|
|
15
|
+
#
|
|
16
|
+
# 1. Redistributions of source code must retain the above copyright notice,
|
|
17
|
+
# this list of conditions and the following disclaimer.
|
|
18
|
+
#
|
|
19
|
+
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
20
|
+
# this list of conditions and the following disclaimer in the documentation
|
|
21
|
+
# and/or other materials provided with the distribution.
|
|
22
|
+
#
|
|
23
|
+
# 3. Neither the name of the copyright holder nor the names of its
|
|
24
|
+
# contributors may be used to endorse or promote products derived from
|
|
25
|
+
# this software without specific prior written permission.
|
|
26
|
+
#
|
|
27
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
28
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
29
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
30
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
31
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
32
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
33
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
34
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
35
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
36
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
|
37
|
+
# THE POSSIBILITY OF SUCH DAMAGE.
|
|
2
38
|
|
|
3
39
|
require 'rbconfig'
|
|
40
|
+
require 'fileutils'
|
|
4
41
|
|
|
5
42
|
module FastResize
|
|
6
|
-
# Platform detection and
|
|
43
|
+
# Platform detection and pre-built binary management
|
|
7
44
|
module Platform
|
|
8
45
|
class << self
|
|
9
|
-
#
|
|
46
|
+
# Detects the current platform
|
|
10
47
|
# @return [String] Platform identifier (e.g., 'macos-arm64', 'linux-x86_64')
|
|
11
48
|
def detect
|
|
12
49
|
os = RbConfig::CONFIG['host_os']
|
|
13
50
|
arch = RbConfig::CONFIG['host_cpu']
|
|
14
51
|
|
|
15
|
-
|
|
52
|
+
case os
|
|
16
53
|
when /darwin/
|
|
17
54
|
case arch
|
|
18
|
-
when /arm64|aarch64/
|
|
19
|
-
|
|
55
|
+
when /arm64|aarch64/
|
|
56
|
+
'macos-arm64'
|
|
57
|
+
when /x86_64|x64/
|
|
58
|
+
'macos-x86_64'
|
|
20
59
|
else
|
|
21
60
|
raise "Unsupported macOS architecture: #{arch}"
|
|
22
61
|
end
|
|
23
62
|
when /linux/
|
|
24
63
|
case arch
|
|
25
|
-
when /x86_64|x64/
|
|
26
|
-
|
|
64
|
+
when /x86_64|x64/
|
|
65
|
+
'linux-x86_64'
|
|
66
|
+
when /arm64|aarch64/
|
|
67
|
+
'linux-aarch64'
|
|
27
68
|
else
|
|
28
69
|
raise "Unsupported Linux architecture: #{arch}"
|
|
29
70
|
end
|
|
30
71
|
else
|
|
31
|
-
raise "Unsupported
|
|
72
|
+
raise "Unsupported platform: #{os}"
|
|
32
73
|
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# Check if pre-built binary is available
|
|
77
|
+
# @return [Boolean] true if binary exists
|
|
78
|
+
def prebuilt_available?
|
|
79
|
+
binary_path = find_binary
|
|
80
|
+
binary_path && File.exist?(binary_path)
|
|
81
|
+
rescue StandardError
|
|
82
|
+
false
|
|
83
|
+
end
|
|
33
84
|
|
|
34
|
-
|
|
85
|
+
# Get binary name
|
|
86
|
+
# @return [String] 'fast_resize'
|
|
87
|
+
def binary_name
|
|
88
|
+
'fast_resize'
|
|
35
89
|
end
|
|
36
90
|
|
|
37
|
-
#
|
|
38
|
-
# @
|
|
39
|
-
# @
|
|
40
|
-
def
|
|
91
|
+
# Extracts pre-built binary from tarball
|
|
92
|
+
# @param tarball_path [String] Path to the tarball
|
|
93
|
+
# @param dest_dir [String] Destination directory
|
|
94
|
+
def extract_binary(tarball_path, dest_dir)
|
|
95
|
+
FileUtils.mkdir_p(dest_dir)
|
|
96
|
+
system("tar -xzf '#{tarball_path}' -C '#{dest_dir}'") or raise "Failed to extract #{tarball_path}"
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# Finds the fast_resize binary
|
|
100
|
+
# @return [String] Path to fast_resize binary
|
|
101
|
+
def find_binary
|
|
41
102
|
platform = detect
|
|
42
103
|
base_dir = File.expand_path('../../prebuilt', __dir__)
|
|
43
|
-
|
|
104
|
+
binary_path = File.join(base_dir, platform, 'bin', 'fast_resize')
|
|
44
105
|
|
|
45
|
-
|
|
46
|
-
|
|
106
|
+
if platform.start_with?('linux')
|
|
107
|
+
# Linux: Check if binary exists and is executable
|
|
108
|
+
if File.exist?(binary_path) && File.executable?(binary_path)
|
|
109
|
+
# Test if binary can run (version check)
|
|
110
|
+
begin
|
|
111
|
+
output = `#{binary_path} --version 2>&1`.strip
|
|
112
|
+
if $?.success? && output.include?('FastResize')
|
|
113
|
+
return binary_path
|
|
114
|
+
end
|
|
115
|
+
rescue => e
|
|
116
|
+
# Binary failed, continue to fallback
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
else
|
|
120
|
+
# macOS: Use regular binary
|
|
121
|
+
return binary_path if File.exist?(binary_path)
|
|
122
|
+
end
|
|
47
123
|
|
|
48
|
-
# Try
|
|
124
|
+
# Try to extract from tarball
|
|
49
125
|
tarball_path = File.join(base_dir, "#{platform}.tar.gz")
|
|
50
126
|
if File.exist?(tarball_path)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
raise "Pre-built library not found for #{platform}. " \
|
|
56
|
-
"Please install from source or report this issue."
|
|
57
|
-
end
|
|
127
|
+
puts "Extracting pre-built binary from #{tarball_path}..."
|
|
128
|
+
extract_binary(tarball_path, File.join(base_dir, platform))
|
|
58
129
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
lib_path = File.join(base_dir, platform, 'lib', 'libfastresize.a')
|
|
130
|
+
if File.exist?(binary_path)
|
|
131
|
+
File.chmod(0755, binary_path)
|
|
132
|
+
return binary_path
|
|
133
|
+
end
|
|
134
|
+
end
|
|
65
135
|
|
|
66
|
-
|
|
136
|
+
raise "Pre-built binary not found for #{platform}"
|
|
67
137
|
end
|
|
68
138
|
|
|
69
139
|
# Get human-readable platform information
|
|
@@ -77,30 +147,6 @@ module FastResize
|
|
|
77
147
|
prebuilt_available: prebuilt_available?
|
|
78
148
|
}
|
|
79
149
|
end
|
|
80
|
-
|
|
81
|
-
private
|
|
82
|
-
|
|
83
|
-
# Extract library from tarball
|
|
84
|
-
# @param tarball_path [String] Path to tarball
|
|
85
|
-
# @param dest_dir [String] Destination directory
|
|
86
|
-
def extract_library(tarball_path, dest_dir)
|
|
87
|
-
require 'rubygems/package'
|
|
88
|
-
require 'zlib'
|
|
89
|
-
|
|
90
|
-
File.open(tarball_path, 'rb') do |file|
|
|
91
|
-
Gem::Package::TarReader.new(Zlib::GzipReader.new(file)) do |tar|
|
|
92
|
-
tar.each do |entry|
|
|
93
|
-
next unless entry.file?
|
|
94
|
-
|
|
95
|
-
dest_path = File.join(dest_dir, entry.full_name.sub(%r{^[^/]+/}, ''))
|
|
96
|
-
FileUtils.mkdir_p(File.dirname(dest_path))
|
|
97
|
-
File.open(dest_path, 'wb') do |f|
|
|
98
|
-
f.write(entry.read)
|
|
99
|
-
end
|
|
100
|
-
end
|
|
101
|
-
end
|
|
102
|
-
end
|
|
103
|
-
end
|
|
104
150
|
end
|
|
105
151
|
end
|
|
106
152
|
end
|