rmagick 4.2.2 → 5.4.4
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/.devcontainer/Dockerfile +14 -0
- data/.devcontainer/ImageMagick6/devcontainer.json +11 -0
- data/.devcontainer/devcontainer.json +11 -0
- data/.devcontainer/setup-repo.sh +10 -0
- data/.devcontainer/setup-user.sh +45 -0
- data/.editorconfig +1 -1
- data/.github/workflows/ci.yml +59 -24
- data/.gitignore +3 -0
- data/.rubocop_todo.yml +0 -1
- data/.yardopts +1 -1
- data/CHANGELOG.md +131 -0
- data/README.md +12 -17
- data/Rakefile +53 -81
- data/before_install_linux.sh +4 -4
- data/before_install_osx.sh +7 -6
- data/ext/RMagick/extconf.rb +94 -45
- data/ext/RMagick/{rmagick.c → rmagick.cpp} +19 -22
- data/ext/RMagick/rmagick.h +90 -60
- data/ext/RMagick/rmagick_gvl.h +224 -0
- data/ext/RMagick/{rmdraw.c → rmdraw.cpp} +160 -146
- data/ext/RMagick/{rmenum.c → rmenum.cpp} +69 -50
- data/ext/RMagick/{rmfill.c → rmfill.cpp} +81 -20
- data/ext/RMagick/{rmilist.c → rmilist.cpp} +184 -93
- data/ext/RMagick/{rmimage.c → rmimage.cpp} +1276 -731
- data/ext/RMagick/{rminfo.c → rminfo.cpp} +119 -131
- data/ext/RMagick/{rmkinfo.c → rmkinfo.cpp} +41 -16
- data/ext/RMagick/rmmain.cpp +1957 -0
- data/ext/RMagick/{rmmontage.c → rmmontage.cpp} +49 -28
- data/ext/RMagick/{rmpixel.c → rmpixel.cpp} +109 -84
- data/ext/RMagick/{rmstruct.c → rmstruct.cpp} +12 -12
- data/ext/RMagick/{rmutil.c → rmutil.cpp} +52 -91
- data/lib/rmagick/version.rb +3 -1
- data/lib/rmagick.rb +2 -0
- data/lib/rmagick_internal.rb +9 -48
- data/lib/rvg/rvg.rb +2 -2
- data/rmagick.gemspec +8 -7
- metadata +54 -23
- data/.codeclimate.yml +0 -63
- data/deprecated/RMagick.rb +0 -6
- data/ext/RMagick/rmmain.c +0 -1951
data/Rakefile
CHANGED
@@ -63,26 +63,13 @@ end
|
|
63
63
|
desc 'Release'
|
64
64
|
task release: %i[assert_clean_repo push_and_tag]
|
65
65
|
|
66
|
-
|
67
|
-
|
66
|
+
namespace :website do
|
67
|
+
PATH_TO_LOCAL_WEBSITE_REPOSITORY = File.expand_path('../rmagick.github.io')
|
68
68
|
|
69
|
-
|
70
|
-
require 'find'
|
71
|
-
|
72
|
-
task :redcloth do
|
73
|
-
require 'redcloth'
|
74
|
-
end
|
75
|
-
|
76
|
-
README = 'README.html'
|
77
|
-
MANIFEST = 'ext/RMagick/MANIFEST'
|
78
|
-
|
79
|
-
# Change the version number placeholders in a file.
|
80
|
-
# Returns an array of lines from the file.
|
81
|
-
def reversion(name)
|
69
|
+
def replace_reversion(lines)
|
82
70
|
now = Time.new
|
83
71
|
now = now.strftime('%m/%d/%y')
|
84
72
|
|
85
|
-
lines = File.readlines name
|
86
73
|
lines.each do |line|
|
87
74
|
line.gsub!(/0\.0\.0/, Magick::VERSION)
|
88
75
|
line.gsub!(%r{YY/MM/DD}, now)
|
@@ -90,83 +77,68 @@ namespace :legacy do
|
|
90
77
|
lines
|
91
78
|
end
|
92
79
|
|
93
|
-
|
94
|
-
|
95
|
-
lines =
|
96
|
-
|
97
|
-
mv name, tmp_name
|
98
|
-
begin
|
99
|
-
File.open(name, 'w') { |f| lines.each { |line| f.write line } }
|
100
|
-
rescue StandardError
|
101
|
-
mv tmp_name, name
|
102
|
-
ensure
|
103
|
-
rm tmp_name
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
desc 'Update version in extconf'
|
108
|
-
task :extconf do
|
109
|
-
reversion_file 'ext/RMagick/extconf.rb'
|
110
|
-
end
|
111
|
-
|
112
|
-
desc 'Build README.txt from README.textile using RedCloth'
|
113
|
-
task 'README.txt' => [:redcloth] do
|
114
|
-
reversion_file 'README.textile'
|
115
|
-
body = File.readlines 'README.textile'
|
116
|
-
body = RedCloth.new(body.join).to_html + "\n"
|
117
|
-
File.open('README.txt', 'w') { |f| f.write body }
|
80
|
+
def update_html(input_dir, output_dir, file_name)
|
81
|
+
lines = File.readlines(File.join(input_dir, file_name))
|
82
|
+
lines = replace_reversion(lines)
|
83
|
+
File.open(File.join(output_dir, file_name), 'w') { |f| lines.each { |line| f.write line } }
|
118
84
|
end
|
119
85
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
86
|
+
ENTITY = {
|
87
|
+
'&' => '&',
|
88
|
+
'>' => '>',
|
89
|
+
'<' => '<'
|
90
|
+
}.freeze
|
91
|
+
|
92
|
+
def file_to_html(input_dir, input_file_name, output_dir, output_file_name)
|
93
|
+
File.open(File.join(input_dir, input_file_name)) do |src|
|
94
|
+
File.open(File.join(output_dir, output_file_name), 'w') do |dest|
|
95
|
+
dest.puts <<~END_EXHTMLHEAD
|
96
|
+
<!DOCTYPE public PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
97
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
127
98
|
<head>
|
128
|
-
<
|
129
|
-
<meta http-equiv="Content-Type" content="text/html; charset=
|
130
|
-
<
|
99
|
+
<meta name="generator" content="ex2html.rb" />
|
100
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
101
|
+
<link rel="stylesheet" type="text/css" href="css/popup.css" />
|
102
|
+
<title>RMagick example: #{input_file_name}</title>
|
131
103
|
</head>
|
132
104
|
<body>
|
133
|
-
|
134
|
-
|
135
|
-
|
105
|
+
<h1>#{input_file_name}</h1>
|
106
|
+
<div class="bodybox">
|
107
|
+
<div class="bodyfloat">
|
108
|
+
<pre>
|
109
|
+
END_EXHTMLHEAD
|
110
|
+
|
111
|
+
src.each do |line|
|
112
|
+
line.gsub!(/[&><]/) { |s| ENTITY[s] }
|
113
|
+
dest.puts(line)
|
114
|
+
end
|
115
|
+
|
116
|
+
dest.puts <<~END_EXHTMLTAIL
|
117
|
+
</pre>
|
118
|
+
</div>
|
119
|
+
</div>
|
120
|
+
<div id="close"><a href="javascript:window.close();">Close window</a></div>
|
136
121
|
</body>
|
137
|
-
|
138
|
-
|
122
|
+
</html>
|
123
|
+
END_EXHTMLTAIL
|
124
|
+
end
|
139
125
|
end
|
140
126
|
end
|
141
127
|
|
142
|
-
desc 'Update
|
143
|
-
task :
|
144
|
-
|
145
|
-
|
128
|
+
desc 'Update RMagick website'
|
129
|
+
task :update do
|
130
|
+
unless File.exist?(PATH_TO_LOCAL_WEBSITE_REPOSITORY)
|
131
|
+
puts "Please clone the rmagick.github.io repository to #{PATH_TO_LOCAL_WEBSITE_REPOSITORY}"
|
132
|
+
exit 1
|
146
133
|
end
|
147
|
-
end
|
148
|
-
|
149
|
-
# Remove files we don't want in the tarball.
|
150
|
-
# Ensure files are not executable. (ref: bug #10080)
|
151
|
-
desc "Remove files we don't want in the .gem; ensure files are not executable"
|
152
|
-
task :fix_files do
|
153
|
-
rm 'README.txt', verbose: true
|
154
|
-
chmod 0o644, FileList['doc/*.html', 'doc/ex/*.rb', 'doc/ex/images/*', 'examples/*.rb']
|
155
|
-
end
|
156
134
|
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
now = now.strftime('%H:%M:%S %m/%d/%y')
|
161
|
-
puts "generating #{MANIFEST}"
|
162
|
-
|
163
|
-
File.open(MANIFEST, 'w') do |f|
|
164
|
-
f.puts "MANIFEST for #{Magick::VERSION} - #{now}\n\n"
|
165
|
-
Find.find('.') do |name|
|
166
|
-
next if File.directory? name
|
135
|
+
Dir.glob('doc/*.html') do |file|
|
136
|
+
update_html('doc', PATH_TO_LOCAL_WEBSITE_REPOSITORY, File.basename(file))
|
137
|
+
end
|
167
138
|
|
168
|
-
|
169
|
-
|
139
|
+
Dir.glob('doc/ex/*.rb') do |file|
|
140
|
+
file_name = File.basename(file)
|
141
|
+
file_to_html('doc/ex', file_name, PATH_TO_LOCAL_WEBSITE_REPOSITORY, "#{file_name}.html")
|
170
142
|
end
|
171
143
|
end
|
172
144
|
end
|
data/before_install_linux.sh
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
set -euox pipefail
|
4
4
|
|
5
|
-
gem install bundler
|
5
|
+
gem install bundler -v 2.3.26 # Bundler 2.4.x has dropped support for Ruby 2.3
|
6
6
|
|
7
7
|
if [ -v STYLE_CHECKS ]; then
|
8
8
|
set +ux
|
@@ -24,7 +24,7 @@ sudo apt-get autoremove -y imagemagick* libmagick* --purge
|
|
24
24
|
# install build tools, ImageMagick delegates
|
25
25
|
sudo apt-get install -y build-essential libx11-dev libxext-dev zlib1g-dev \
|
26
26
|
liblcms2-dev libpng-dev libjpeg-dev libfreetype6-dev libxml2-dev \
|
27
|
-
libtiff5-dev libwebp-dev liblqr-1-0-dev vim gsfonts ghostscript
|
27
|
+
libtiff5-dev libwebp-dev liblqr-1-0-dev vim gsfonts ghostscript
|
28
28
|
|
29
29
|
if [ ! -d /usr/include/freetype ]; then
|
30
30
|
# If `/usr/include/freetype` is not existed, ImageMagick 6.7 configuration fails about Freetype.
|
@@ -41,7 +41,7 @@ build_imagemagick() {
|
|
41
41
|
mkdir -p build-ImageMagick
|
42
42
|
|
43
43
|
version=(${IMAGEMAGICK_VERSION//./ })
|
44
|
-
wget "https://imagemagick.org/
|
44
|
+
wget "https://imagemagick.org/archive/releases/ImageMagick-${IMAGEMAGICK_VERSION}.tar.xz"
|
45
45
|
tar -xf "ImageMagick-${IMAGEMAGICK_VERSION}.tar.xz"
|
46
46
|
rm "ImageMagick-${IMAGEMAGICK_VERSION}.tar.xz"
|
47
47
|
mv "ImageMagick-${IMAGEMAGICK_VERSION}" "${build_dir}"
|
@@ -52,7 +52,7 @@ build_imagemagick() {
|
|
52
52
|
fi
|
53
53
|
|
54
54
|
cd "${build_dir}"
|
55
|
-
|
55
|
+
./configure --prefix=/usr "${options}"
|
56
56
|
make -j
|
57
57
|
}
|
58
58
|
|
data/before_install_osx.sh
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
set -euox pipefail
|
4
4
|
|
5
|
-
gem install bundler
|
5
|
+
gem install bundler -v 2.3.26 # Bundler 2.4.x has dropped support for Ruby 2.3
|
6
6
|
|
7
7
|
if [ -v STYLE_CHECKS ]; then
|
8
8
|
set +ux
|
@@ -16,10 +16,11 @@ if [ ! -v IMAGEMAGICK_VERSION ]; then
|
|
16
16
|
fi
|
17
17
|
|
18
18
|
export HOMEBREW_NO_AUTO_UPDATE=true
|
19
|
-
brew
|
19
|
+
brew uninstall --force imagemagick imagemagick@6
|
20
|
+
brew install wget ghostscript freetype jpeg little-cms2 openexr libomp libpng libtiff liblqr libtool zlib webp
|
20
21
|
|
21
|
-
export LDFLAGS="-L
|
22
|
-
export CPPFLAGS="-I/
|
22
|
+
export LDFLAGS="-L$(brew --prefix libxml2)/lib -L$(brew --prefix zlib)/lib -L$(brew --prefix glib)/lib -L$(brew --prefix openexr)/lib"
|
23
|
+
export CPPFLAGS="-I$(brew --prefix libxml2)/include -I$(brew --prefix zlib)/include -I$(brew --prefix glib)/include/glib-2.0 -I$(brew --prefix glib)/lib/glib-2.0/include -I$(brew --prefix openexr)/include/OpenEXR"
|
23
24
|
|
24
25
|
project_dir=$(pwd)
|
25
26
|
build_dir="${project_dir}/build-ImageMagick/ImageMagick-${IMAGEMAGICK_VERSION}"
|
@@ -31,7 +32,7 @@ build_imagemagick() {
|
|
31
32
|
mkdir -p build-ImageMagick
|
32
33
|
|
33
34
|
version=(${IMAGEMAGICK_VERSION//./ })
|
34
|
-
wget "https://imagemagick.org/
|
35
|
+
wget "https://imagemagick.org/archive/releases/ImageMagick-${IMAGEMAGICK_VERSION}.tar.xz"
|
35
36
|
tar -xf "ImageMagick-${IMAGEMAGICK_VERSION}.tar.xz"
|
36
37
|
rm "ImageMagick-${IMAGEMAGICK_VERSION}.tar.xz"
|
37
38
|
mv "ImageMagick-${IMAGEMAGICK_VERSION}" "${build_dir}"
|
@@ -42,7 +43,7 @@ build_imagemagick() {
|
|
42
43
|
fi
|
43
44
|
|
44
45
|
cd "${build_dir}"
|
45
|
-
./configure --prefix=/usr/local "${options}"
|
46
|
+
./configure --prefix=/usr/local "${options}" --without-raw --without-jxl
|
46
47
|
make -j
|
47
48
|
}
|
48
49
|
|
data/ext/RMagick/extconf.rb
CHANGED
@@ -2,6 +2,13 @@ lib_dir = File.expand_path('../../lib', File.dirname(__FILE__))
|
|
2
2
|
$LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
|
3
3
|
require 'rubygems'
|
4
4
|
require 'mkmf'
|
5
|
+
require 'pkg-config'
|
6
|
+
|
7
|
+
module MakeMakefile
|
8
|
+
# Use the C++ compiler to retrieve the information needed to create a Makefile for mswin environment.
|
9
|
+
remove_const(:CONFTEST_C)
|
10
|
+
CONFTEST_C = "#{CONFTEST}.cpp"
|
11
|
+
end
|
5
12
|
|
6
13
|
module RMagick
|
7
14
|
class Extconf
|
@@ -9,6 +16,33 @@ module RMagick
|
|
9
16
|
RMAGICK_VERS = ::Magick::VERSION
|
10
17
|
MIN_RUBY_VERS = ::Magick::MIN_RUBY_VERSION
|
11
18
|
|
19
|
+
# ImageMagick 6.7 package
|
20
|
+
IM6_7_PACKAGES = ['ImageMagick'].freeze
|
21
|
+
|
22
|
+
# ImageMagick 6.8+ packages
|
23
|
+
IM6_PACKAGES = %w[
|
24
|
+
ImageMagick-6.Q64HDRI
|
25
|
+
ImageMagick-6.Q32HDRI
|
26
|
+
ImageMagick-6.Q16HDRI
|
27
|
+
ImageMagick-6.Q8HDRI
|
28
|
+
ImageMagick-6.Q64
|
29
|
+
ImageMagick-6.Q32
|
30
|
+
ImageMagick-6.Q16
|
31
|
+
ImageMagick-6.Q8
|
32
|
+
].freeze
|
33
|
+
|
34
|
+
# ImageMagick 7 packages
|
35
|
+
IM7_PACKAGES = %w[
|
36
|
+
ImageMagick-7.Q64HDRI
|
37
|
+
ImageMagick-7.Q32HDRI
|
38
|
+
ImageMagick-7.Q16HDRI
|
39
|
+
ImageMagick-7.Q8HDRI
|
40
|
+
ImageMagick-7.Q64
|
41
|
+
ImageMagick-7.Q32
|
42
|
+
ImageMagick-7.Q16
|
43
|
+
ImageMagick-7.Q8
|
44
|
+
].freeze
|
45
|
+
|
12
46
|
attr_reader :headers
|
13
47
|
|
14
48
|
def initialize
|
@@ -41,7 +75,6 @@ module RMagick
|
|
41
75
|
{
|
42
76
|
magick_version: $magick_version,
|
43
77
|
local_libs: $LOCAL_LIBS,
|
44
|
-
cflags: $CFLAGS,
|
45
78
|
cppflags: $CPPFLAGS,
|
46
79
|
ldflags: $LDFLAGS,
|
47
80
|
defs: $defs,
|
@@ -50,7 +83,7 @@ module RMagick
|
|
50
83
|
end
|
51
84
|
|
52
85
|
def configure_headers
|
53
|
-
@headers = %w[assert.h ctype.h stdio.h stdlib.h math.h time.h sys/types.h]
|
86
|
+
@headers = %w[assert.h ctype.h stdio.h stdlib.h math.h time.h sys/types.h ruby.h ruby/io.h]
|
54
87
|
|
55
88
|
if have_header('MagickCore/MagickCore.h')
|
56
89
|
headers << 'MagickCore/MagickCore.h'
|
@@ -68,19 +101,31 @@ module RMagick
|
|
68
101
|
check_multiple_imagemagick_versions
|
69
102
|
check_partial_imagemagick_versions
|
70
103
|
|
104
|
+
original_ldflags = $LDFLAGS.dup
|
105
|
+
|
106
|
+
libdir = PKGConfig.libs_only_L($magick_package).chomp.sub('-L', '')
|
107
|
+
ldflags = "#{ENV['LDFLAGS']} " + PKGConfig.libs($magick_package).chomp
|
108
|
+
rpath = libdir.empty? ? '' : "-Wl,-rpath,#{libdir}"
|
109
|
+
|
71
110
|
# Save flags
|
72
|
-
$
|
73
|
-
$CPPFLAGS
|
74
|
-
$
|
75
|
-
$
|
111
|
+
$CPPFLAGS += " #{ENV['CPPFLAGS']} " + PKGConfig.cflags($magick_package).chomp
|
112
|
+
$CPPFLAGS += ' -x c++ -std=c++11 -Wno-register'
|
113
|
+
$LOCAL_LIBS += " #{ENV['LIBS']} " + PKGConfig.libs($magick_package).chomp
|
114
|
+
$LDFLAGS += " #{ldflags} #{rpath}"
|
115
|
+
|
116
|
+
unless try_link("int main() { }")
|
117
|
+
# if linker does not recognizes '-Wl,-rpath,somewhere' option, it revert to original option
|
118
|
+
$LDFLAGS = "#{original_ldflags} #{ldflags}"
|
119
|
+
end
|
76
120
|
|
77
121
|
configure_archflags_for_osx($magick_package) if RUBY_PLATFORM =~ /darwin/ # osx
|
78
122
|
|
79
123
|
elsif RUBY_PLATFORM =~ /mingw/ # mingw
|
80
124
|
|
81
125
|
dir_paths = search_paths_for_library_for_windows
|
82
|
-
$CPPFLAGS
|
83
|
-
$
|
126
|
+
$CPPFLAGS += %( -I"#{dir_paths[:include]}")
|
127
|
+
$CPPFLAGS += ' -x c++ -std=c++11 -Wno-register'
|
128
|
+
$LDFLAGS += %( -L"#{dir_paths[:lib]}")
|
84
129
|
$LDFLAGS << ' -lucrt' if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.4.0')
|
85
130
|
|
86
131
|
have_library(im_version_at_least?('7.0.0') ? 'CORE_RL_MagickCore_' : 'CORE_RL_magick_')
|
@@ -92,11 +137,13 @@ module RMagick
|
|
92
137
|
$LDFLAGS << %( -libpath:"#{dir_paths[:lib]}")
|
93
138
|
$LDFLAGS << ' -libpath:ucrt' if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.4.0')
|
94
139
|
|
95
|
-
$LOCAL_LIBS
|
140
|
+
$LOCAL_LIBS += ' ' + (im_version_at_least?('7.0.0') ? 'CORE_RL_MagickCore_.lib' : 'CORE_RL_magick_.lib')
|
96
141
|
|
142
|
+
$CPPFLAGS += ' /std:c++11'
|
97
143
|
end
|
98
|
-
|
99
|
-
$
|
144
|
+
ruby_version = RUBY_VERSION.split('.')
|
145
|
+
$CPPFLAGS += " -DRUBY_VERSION_MAJOR=#{ruby_version[0]} -DRUBY_VERSION_MINOR=#{ruby_version[1]}"
|
146
|
+
$CPPFLAGS += ' $(optflags) $(debugflags)'
|
100
147
|
end
|
101
148
|
|
102
149
|
def exit_failure(msg)
|
@@ -116,31 +163,40 @@ module RMagick
|
|
116
163
|
exit(1)
|
117
164
|
end
|
118
165
|
|
166
|
+
def detect_imagemagick_packages(packages)
|
167
|
+
packages.select do |package|
|
168
|
+
PKGConfig.exist?(package)
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
def installed_im6_packages
|
173
|
+
@installed_im6_packages ||= detect_imagemagick_packages(IM6_PACKAGES)
|
174
|
+
end
|
175
|
+
|
176
|
+
def installed_im7_packages
|
177
|
+
@installed_im7_packages ||= detect_imagemagick_packages(IM7_PACKAGES)
|
178
|
+
end
|
179
|
+
|
119
180
|
def determine_imagemagick_package
|
120
|
-
packages =
|
181
|
+
packages = [installed_im7_packages, installed_im6_packages].flatten
|
121
182
|
|
122
|
-
# For ancient version of ImageMagick 6 we need a different regex
|
123
183
|
if packages.empty?
|
124
|
-
|
184
|
+
# ImageMagick 6.7 does not have package file like ImageMagick-6.Q16.pc
|
185
|
+
packages = detect_imagemagick_packages(IM6_7_PACKAGES)
|
125
186
|
end
|
126
187
|
|
127
188
|
if packages.empty?
|
128
189
|
exit_failure "Can't install RMagick #{RMAGICK_VERS}. Can't find ImageMagick with pkg-config\n"
|
129
190
|
end
|
130
191
|
|
131
|
-
if
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
true
|
140
|
-
else
|
141
|
-
packages = im7_packages
|
142
|
-
false
|
143
|
-
end
|
192
|
+
if installed_im6_packages.any? && installed_im7_packages.any?
|
193
|
+
checking_for('forced use of ImageMagick 6') do
|
194
|
+
if ENV['USE_IMAGEMAGICK_6']
|
195
|
+
packages = installed_im6_packages
|
196
|
+
true
|
197
|
+
else
|
198
|
+
packages = installed_im7_packages
|
199
|
+
false
|
144
200
|
end
|
145
201
|
end
|
146
202
|
end
|
@@ -212,7 +268,7 @@ module RMagick
|
|
212
268
|
# issue #169
|
213
269
|
# set ARCHFLAGS appropriately for OSX
|
214
270
|
def configure_archflags_for_osx(magick_package)
|
215
|
-
return unless
|
271
|
+
return unless PKGConfig.libs_only_L(magick_package).match(%r{-L(.+)/lib})
|
216
272
|
|
217
273
|
imagemagick_dir = Regexp.last_match(1)
|
218
274
|
command = Dir.glob(File.join(imagemagick_dir, "bin/*")).select { |file| File.executable? file }.first
|
@@ -255,10 +311,8 @@ module RMagick
|
|
255
311
|
exit_failure <<~END_MINGW
|
256
312
|
Can't install RMagick #{RMAGICK_VERS}.
|
257
313
|
Can't find the ImageMagick library.
|
258
|
-
|
259
|
-
|
260
|
-
e.g.
|
261
|
-
gem install rmagick -- '--with-opt-dir=\"C:\Program Files\ImageMagick-6.9.1-Q16\"'
|
314
|
+
|
315
|
+
Please check PATH environment variable for ImageMagick installation path.
|
262
316
|
END_MINGW
|
263
317
|
end
|
264
318
|
|
@@ -266,9 +320,9 @@ module RMagick
|
|
266
320
|
assert_minimum_ruby_version!
|
267
321
|
assert_has_dev_libs!
|
268
322
|
|
269
|
-
# Check for compiler. Extract first word so ENV['
|
270
|
-
|
271
|
-
exit_failure "No C compiler found in ${ENV['PATH']}. See mkmf.log for details." unless find_executable(
|
323
|
+
# Check for compiler. Extract first word so ENV['CXX'] can be a program name with arguments.
|
324
|
+
cxx = (ENV['CXX'] || RbConfig::CONFIG['CXX'] || 'g++').split(' ').first
|
325
|
+
exit_failure "No C++ compiler found in ${ENV['PATH']}. See mkmf.log for details." unless find_executable(cxx)
|
272
326
|
end
|
273
327
|
|
274
328
|
def assert_minimum_ruby_version!
|
@@ -287,16 +341,12 @@ module RMagick
|
|
287
341
|
END_FAILURE
|
288
342
|
|
289
343
|
if RUBY_PLATFORM !~ /mswin|mingw/
|
290
|
-
unless
|
291
|
-
exit_failure "Can't install RMagick #{RMAGICK_VERS}. Can't find pkg-config in #{ENV['PATH']}\n"
|
292
|
-
end
|
293
|
-
|
294
|
-
unless `pkg-config --libs MagickCore`[/\bl\s*(MagickCore|Magick)6?\b/]
|
344
|
+
unless PKGConfig.libs('MagickCore')[/\bl\s*(MagickCore|Magick)6?\b/]
|
295
345
|
exit_failure failure_message
|
296
346
|
end
|
297
347
|
|
298
348
|
$magick_package = determine_imagemagick_package
|
299
|
-
$magick_version =
|
349
|
+
$magick_version = PKGConfig.modversion($magick_package)[/^(\d+\.\d+\.\d+)/]
|
300
350
|
else
|
301
351
|
`#{magick_command} -version` =~ /Version: ImageMagick (\d+\.\d+\.\d+)-+\d+ /
|
302
352
|
$magick_version = Regexp.last_match(1)
|
@@ -314,7 +364,9 @@ module RMagick
|
|
314
364
|
|
315
365
|
def create_header_file
|
316
366
|
ruby_api = [
|
317
|
-
'rb_gc_adjust_memory_usage' # Ruby 2.4.0
|
367
|
+
'rb_gc_adjust_memory_usage', # Ruby 2.4.0
|
368
|
+
'rb_gc_mark_movable', # Ruby 2.7.0
|
369
|
+
'rb_io_path' # Ruby 3.2.0
|
318
370
|
]
|
319
371
|
memory_api = %w[
|
320
372
|
posix_memalign
|
@@ -353,9 +405,6 @@ module RMagick
|
|
353
405
|
|
354
406
|
def create_makefile_file
|
355
407
|
create_header_file
|
356
|
-
# Prior to 1.8.5 mkmf duplicated the symbols on the command line and in the
|
357
|
-
# extconf.h header. Suppress that behavior by removing the symbol array.
|
358
|
-
$defs = []
|
359
408
|
|
360
409
|
# Force re-compilation if the generated Makefile changed.
|
361
410
|
$config_h = 'Makefile'
|
@@ -5,8 +5,8 @@
|
|
5
5
|
*
|
6
6
|
* Changes since Nov. 2009 copyright © by Benjamin Thomas and Omer Bar-or
|
7
7
|
*
|
8
|
-
* @file rmagick.
|
9
|
-
* @version $Id: rmagick.
|
8
|
+
* @file rmagick.cpp
|
9
|
+
* @version $Id: rmagick.cpp,v 1.4 2009/12/20 02:33:32 baror Exp $
|
10
10
|
* @author Tim Hunter
|
11
11
|
******************************************************************************/
|
12
12
|
|
@@ -14,8 +14,6 @@
|
|
14
14
|
|
15
15
|
|
16
16
|
|
17
|
-
static VALUE rm_yield_handle_exception(VALUE, VALUE) ATTRIBUTE_NORETURN;
|
18
|
-
|
19
17
|
static VALUE
|
20
18
|
rm_yield_body(VALUE object)
|
21
19
|
{
|
@@ -42,7 +40,7 @@ rm_yield_handle_exception(VALUE allocated_area, VALUE exc)
|
|
42
40
|
*
|
43
41
|
*/
|
44
42
|
VALUE
|
45
|
-
Magick_colors(VALUE
|
43
|
+
Magick_colors(VALUE klass)
|
46
44
|
{
|
47
45
|
const ColorInfo **color_info_list;
|
48
46
|
size_t number_colors, x;
|
@@ -60,10 +58,10 @@ Magick_colors(VALUE class)
|
|
60
58
|
{
|
61
59
|
for (x = 0; x < number_colors; x++)
|
62
60
|
{
|
63
|
-
rb_rescue(rm_yield_body, Import_ColorInfo(color_info_list[x]), rm_yield_handle_exception, (VALUE)color_info_list);
|
61
|
+
rb_rescue(RESCUE_FUNC(rm_yield_body), Import_ColorInfo(color_info_list[x]), RESCUE_EXCEPTION_HANDLER_FUNC(rm_yield_handle_exception), (VALUE)color_info_list);
|
64
62
|
}
|
65
63
|
magick_free((void *)color_info_list);
|
66
|
-
return
|
64
|
+
return klass;
|
67
65
|
}
|
68
66
|
else
|
69
67
|
{
|
@@ -93,7 +91,7 @@ Magick_colors(VALUE class)
|
|
93
91
|
*
|
94
92
|
*/
|
95
93
|
VALUE
|
96
|
-
Magick_fonts(VALUE
|
94
|
+
Magick_fonts(VALUE klass)
|
97
95
|
{
|
98
96
|
const TypeInfo **type_info;
|
99
97
|
size_t number_types, x;
|
@@ -109,10 +107,10 @@ Magick_fonts(VALUE class)
|
|
109
107
|
{
|
110
108
|
for (x = 0; x < number_types; x++)
|
111
109
|
{
|
112
|
-
rb_rescue(rm_yield_body, Import_TypeInfo((const TypeInfo *)type_info[x]), rm_yield_handle_exception, (VALUE)type_info);
|
110
|
+
rb_rescue(RESCUE_FUNC(rm_yield_body), Import_TypeInfo((const TypeInfo *)type_info[x]), RESCUE_EXCEPTION_HANDLER_FUNC(rm_yield_handle_exception), (VALUE)type_info);
|
113
111
|
}
|
114
112
|
magick_free((void *)type_info);
|
115
|
-
return
|
113
|
+
return klass;
|
116
114
|
}
|
117
115
|
else
|
118
116
|
{
|
@@ -170,7 +168,7 @@ MagickInfo_to_format(const MagickInfo *magick_info)
|
|
170
168
|
* @return [Hash] the formats hash.
|
171
169
|
*/
|
172
170
|
VALUE
|
173
|
-
Magick_init_formats(VALUE
|
171
|
+
Magick_init_formats(VALUE klass ATTRIBUTE_UNUSED)
|
174
172
|
{
|
175
173
|
const MagickInfo **magick_info;
|
176
174
|
size_t number_formats, x;
|
@@ -210,11 +208,11 @@ Magick_init_formats(VALUE class ATTRIBUTE_UNUSED)
|
|
210
208
|
* Set resource limits.
|
211
209
|
* @param resource [String, Symbol] the type of resource
|
212
210
|
* @param limit [Numeric] the new limit number
|
213
|
-
*
|
211
|
+
*
|
214
212
|
* @return [Numeric] the old limit.
|
215
213
|
*/
|
216
214
|
VALUE
|
217
|
-
Magick_limit_resource(int argc, VALUE *argv, VALUE
|
215
|
+
Magick_limit_resource(int argc, VALUE *argv, VALUE klass)
|
218
216
|
{
|
219
217
|
VALUE resource, limit;
|
220
218
|
ResourceType res = UndefinedResource;
|
@@ -227,7 +225,7 @@ Magick_limit_resource(int argc, VALUE *argv, VALUE class)
|
|
227
225
|
switch (TYPE(resource))
|
228
226
|
{
|
229
227
|
case T_NIL:
|
230
|
-
return
|
228
|
+
return klass;
|
231
229
|
|
232
230
|
case T_SYMBOL:
|
233
231
|
id = (ID)SYM2ID(resource);
|
@@ -265,7 +263,7 @@ Magick_limit_resource(int argc, VALUE *argv, VALUE class)
|
|
265
263
|
str = StringValueCStr(resource);
|
266
264
|
if (*str == '\0')
|
267
265
|
{
|
268
|
-
return
|
266
|
+
return klass;
|
269
267
|
}
|
270
268
|
else if (rm_strcasecmp("area", str) == 0)
|
271
269
|
{
|
@@ -321,12 +319,12 @@ Magick_limit_resource(int argc, VALUE *argv, VALUE class)
|
|
321
319
|
* @param threshold [Numeric] the number of megabytes to set.
|
322
320
|
*/
|
323
321
|
VALUE
|
324
|
-
Magick_set_cache_threshold(VALUE
|
322
|
+
Magick_set_cache_threshold(VALUE klass, VALUE threshold)
|
325
323
|
{
|
326
324
|
unsigned long thrshld = NUM2ULONG(threshold);
|
327
325
|
SetMagickResourceLimit(MemoryResource, (MagickSizeType)thrshld);
|
328
326
|
SetMagickResourceLimit(MapResource, (MagickSizeType)(2*thrshld));
|
329
|
-
return
|
327
|
+
return klass;
|
330
328
|
}
|
331
329
|
|
332
330
|
|
@@ -354,7 +352,7 @@ Magick_set_cache_threshold(VALUE class, VALUE threshold)
|
|
354
352
|
* @param args [String] the mask of log event.
|
355
353
|
*/
|
356
354
|
VALUE
|
357
|
-
Magick_set_log_event_mask(int argc, VALUE *argv, VALUE
|
355
|
+
Magick_set_log_event_mask(int argc, VALUE *argv, VALUE klass)
|
358
356
|
{
|
359
357
|
int x;
|
360
358
|
|
@@ -366,7 +364,7 @@ Magick_set_log_event_mask(int argc, VALUE *argv, VALUE class)
|
|
366
364
|
{
|
367
365
|
SetLogEventMask(StringValueCStr(argv[x]));
|
368
366
|
}
|
369
|
-
return
|
367
|
+
return klass;
|
370
368
|
}
|
371
369
|
|
372
370
|
/**
|
@@ -388,9 +386,8 @@ Magick_set_log_event_mask(int argc, VALUE *argv, VALUE class)
|
|
388
386
|
* @param format [String] the format to set.
|
389
387
|
*/
|
390
388
|
VALUE
|
391
|
-
Magick_set_log_format(VALUE
|
389
|
+
Magick_set_log_format(VALUE klass, VALUE format)
|
392
390
|
{
|
393
391
|
SetLogFormat(StringValueCStr(format));
|
394
|
-
return
|
392
|
+
return klass;
|
395
393
|
}
|
396
|
-
|