fast_resize 1.0.0 → 1.0.2

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
2
  SHA256:
3
- metadata.gz: db4d679d44f55e55330bf72356fafd9bd297c3ed7ec874f9aa340efb852ae5b3
4
- data.tar.gz: 65010fc04ff3553480cad0aef1679d1c08099a49b9cf5674ff79843640744959
3
+ metadata.gz: bd3aea592f3a52ae5fc7ebb84ef68060882a074cb6b4c5410c21849ba0febdb0
4
+ data.tar.gz: ca6510f5daf824934331282efea95e1f9bae18583348fd843effb7e654a9d6f7
5
5
  SHA512:
6
- metadata.gz: 6c75f1f8ddb58e98f1f488beb0747f4f5a5d6533438e56dc6ac6a031a73cdd9a256464c900c199fbec3fdac05a7b85fb56c58ca7bf2749efe3c475b153ddce87
7
- data.tar.gz: f3964ea686e7888e9a46f6c169dad56a507815df96f333e3f364cb1b6ae1b45f16b1622ec84e86767ea5e0e1bd34315bb30cf2bb2793b6b3a74842fb659dd58a
6
+ metadata.gz: 82f40d7012d6591a553fce82986a15541d4ae2919114aac5424802f0487e03ea23fa9e02a2dd4ce053584d10a09b3e702c9056a04beb7eca5e7ff33e7a4df789
7
+ data.tar.gz: 32d55b77ba417f169ffbc801eb7c014fe1b73303ee931cf4c397e6bd2e5d59ee85b4499903c7cfd8d9097700b3c6213bf4ac6d8408808d7e8381a3c2a1a177d2
data/CMakeLists.txt CHANGED
@@ -1,5 +1,5 @@
1
1
  cmake_minimum_required(VERSION 3.15)
2
- project(fast_resize VERSION 1.0.0 LANGUAGES CXX C)
2
+ project(fast_resize VERSION 1.0.2 LANGUAGES CXX C)
3
3
 
4
4
  set(CMAKE_CXX_STANDARD 14)
5
5
  set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -10,8 +10,11 @@ if(NOT CMAKE_BUILD_TYPE)
10
10
  set(CMAKE_BUILD_TYPE Release)
11
11
  endif()
12
12
 
13
- set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -flto")
14
- set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG -flto")
13
+ # Disable LTO for static library builds to ensure compatibility across GCC versions
14
+ # LTO bytecode format changes between GCC versions, causing link failures
15
+ # when the static library is used with a different GCC version
16
+ set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
17
+ set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG")
15
18
 
16
19
  # Option for building shared vs static libraries
17
20
  option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.0.2
@@ -58,7 +58,7 @@ def check_prebuilt_library
58
58
  end
59
59
  end
60
60
 
61
- return false unless platform
61
+ return nil unless platform
62
62
 
63
63
  ext_dir = File.dirname(__FILE__)
64
64
  prebuilt_dir = File.expand_path("../../prebuilt/#{platform}", ext_dir)
@@ -66,36 +66,20 @@ def check_prebuilt_library
66
66
 
67
67
  if File.exist?(lib_path)
68
68
  puts "✅ Found pre-built library at #{lib_path}"
69
- puts "⚡ Skipping compilation (using pre-built binary)"
70
-
71
- File.open('Makefile', 'w') do |f|
72
- f.puts "all:"
73
- f.puts "\t@echo '✅ Using pre-built library for #{platform}'"
74
- f.puts ""
75
- f.puts "install:"
76
- f.puts "\t@echo '✅ Using pre-built library for #{platform}'"
77
- f.puts ""
78
- f.puts "clean:"
79
- f.puts "\t@echo 'Nothing to clean'"
80
- end
81
-
82
- return true
69
+ puts "⚡ Will compile Ruby binding with pre-built core library"
70
+ return prebuilt_dir
83
71
  end
84
72
 
85
73
  puts "⚠️ No pre-built library found for #{platform}"
86
- puts "📦 Will compile from source..."
87
- false
74
+ puts "📦 Will compile everything from source..."
75
+ nil
88
76
  end
89
77
 
90
- if check_prebuilt_library
91
- puts "🎉 Installation complete (pre-built binary)!"
92
- exit 0
93
- end
78
+ prebuilt_dir = check_prebuilt_library
94
79
 
95
- puts "🔨 Compiling FastResize from source..."
80
+ puts "🔨 Compiling FastResize Ruby binding..."
96
81
 
97
82
  $CXXFLAGS << " -std=c++14"
98
-
99
83
  $CXXFLAGS << " -O3"
100
84
 
101
85
  ext_dir = File.dirname(__FILE__)
@@ -107,46 +91,81 @@ unless File.directory?(include_dir)
107
91
  abort "❌ Include directory not found: #{include_dir}"
108
92
  end
109
93
 
110
- unless File.directory?(src_dir)
111
- abort "❌ Source directory not found: #{src_dir}"
112
- end
113
-
114
- puts "📂 Building from source tree: #{project_root}"
115
-
116
94
  $INCFLAGS << " -I#{include_dir}"
117
95
 
118
96
  ['/opt/homebrew/include', '/usr/local/include'].each do |path|
119
97
  $INCFLAGS << " -I#{path}" if File.directory?(path)
120
98
  end
121
99
 
122
- puts "🔍 Searching for required libraries..."
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"
123
105
 
124
- unless find_library('jpeg', 'jpeg_CreateDecompress', '/opt/homebrew/lib', '/usr/local/lib', '/usr/lib')
125
- abort " ERROR: libjpeg not found. Please install: brew install jpeg (macOS) or apt-get install libjpeg-dev (Linux)"
126
- end
106
+ # Link required image libraries that libfastresize.a depends on
107
+ puts "🔍 Linking required image libraries..."
127
108
 
128
- unless find_library('png', 'png_create_read_struct', '/opt/homebrew/lib', '/usr/local/lib', '/usr/lib')
129
- abort "❌ ERROR: libpng not found. Please install: brew install libpng (macOS) or apt-get install libpng-dev (Linux)"
130
- end
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
131
113
 
132
- unless find_library('z', 'inflate', '/opt/homebrew/lib', '/usr/local/lib', '/usr/lib')
133
- abort "❌ ERROR: zlib not found. Please install: brew install zlib (macOS) or apt-get install zlib1g-dev (Linux)"
134
- end
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
135
117
 
136
- if find_library('webp', 'WebPDecode', '/opt/homebrew/lib', '/usr/local/lib', '/usr/lib')
137
- puts " WebP support enabled"
138
- find_library('webpdemux', 'WebPDemuxGetFrame', '/opt/homebrew/lib', '/usr/local/lib', '/usr/lib')
139
- find_library('sharpyuv', 'SharpYuvGetCPUInfo', '/opt/homebrew/lib', '/usr/local/lib', '/usr/lib')
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']
140
133
  else
141
- puts "⚠️ WebP support disabled (library not found)"
142
- end
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
143
146
 
144
- $srcs = ['fastresize_ext.cpp'] + Dir.glob(File.join(src_dir, '*.cpp')).map { |f| File.basename(f) }
145
- $VPATH << src_dir
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
150
+
151
+ unless find_library('z', 'inflate', '/opt/homebrew/lib', '/usr/local/lib', '/usr/lib')
152
+ abort "❌ ERROR: zlib not found. Please install: brew install zlib (macOS) or apt-get install zlib1g-dev (Linux)"
153
+ end
154
+
155
+ if find_library('webp', 'WebPDecode', '/opt/homebrew/lib', '/usr/local/lib', '/usr/lib')
156
+ puts "✅ WebP support enabled"
157
+ find_library('webpdemux', 'WebPDemuxGetFrame', '/opt/homebrew/lib', '/usr/local/lib', '/usr/lib')
158
+ find_library('sharpyuv', 'SharpYuvGetCPUInfo', '/opt/homebrew/lib', '/usr/local/lib', '/usr/lib')
159
+ else
160
+ puts "⚠️ WebP support disabled (library not found)"
161
+ end
162
+
163
+ $srcs = ['fastresize_ext.cpp'] + Dir.glob(File.join(src_dir, '*.cpp')).map { |f| File.basename(f) }
164
+ $VPATH << src_dir
165
+ end
146
166
 
147
167
  puts "📝 Generating Makefile..."
148
168
 
149
169
  create_makefile('fastresize/fastresize_ext')
150
170
 
151
171
  puts "✅ Makefile generated successfully!"
152
- puts "💡 Run 'make' to compile the extension"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FastResize
4
- VERSION = "1.0.0"
4
+ VERSION = "1.0.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fast_resize
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tran Huu Canh (0xTh3OKrypt)