Skip to content

Commit

Permalink
Make extconf.rb 1.8 compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
bf4 committed Dec 1, 2014
1 parent 43bc089 commit bc48594
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions ext/RMagick/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

module RMagick
class Extconf
require_relative '../../lib/rmagick/version'
require 'rmagick/version'
RMAGICK_VERS = ::Magick::VERSION
MIN_RUBY_VERS = ::Magick::MIN_RUBY_VERSION
MIN_RUBY_VERS_NO = MIN_RUBY_VERS.tr(".","").to_i
Expand Down Expand Up @@ -75,13 +75,21 @@ def configure_compile_options
# Ensure minimum ImageMagick version
unless checking_for("ImageMagick version >= #{MIN_IM_VERS}") do
# extract version info from convert binary (could use identify as well)
convert_version_string = /^Version: ImageMagick\s+(?<Version>\d+\.\d+\.\d+\-\d+)\s+(?<Unknown>\S+)\s+(?<Arch>\S+)\s+(?<Date>\S+)/
convert_version_string = /^Version:\sImageMagick\s+
(\d+\.\d+\.\d+\-\d+) # version
\s+
(\S+) # unknown
\s+
(\S+) # arch
\s+
(\S+) # date
/x
match_data = `convert -version`.match(convert_version_string)
unless match_data.nil?
# taken from previous version, this doesn't look right though
# for example 6.8.12 whould show as greater than 6.12.9
# is there some property of imagemagick versioning that prevents this situation?
version = match_data['Version'].chomp.tr(".","").to_i
version = match_data[1].chomp.tr(".","").to_i
version >= MIN_IM_VERS_NO
end
end
Expand Down

0 comments on commit bc48594

Please sign in to comment.