Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/devel/ruby-redmine devel/ruby-redmine: fix build probl...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/0cbcab5e8712
branches:  trunk
changeset: 430912:0cbcab5e8712
user:      taca <taca%pkgsrc.org@localhost>
date:      Wed May 06 08:15:01 2020 +0000

description:
devel/ruby-redmine: fix build problem of rmagick

Fix build problem of rmagick with newer ImageMagick6.

diffstat:

 devel/ruby-redmine/distinfo                                            |    4 +-
 devel/ruby-redmine/patches/patch-rmagick-2.16.0_ext_RMagick_extconf.rb |  759 ++++++++++
 devel/ruby-redmine/patches/patch-rmagick-2.16.0_ext_RMagick_rmpixel.c  |   31 +
 3 files changed, 793 insertions(+), 1 deletions(-)

diffs (truncated from 813 to 300 lines):

diff -r 42e73b3ea433 -r 0cbcab5e8712 devel/ruby-redmine/distinfo
--- a/devel/ruby-redmine/distinfo       Wed May 06 08:13:28 2020 +0000
+++ b/devel/ruby-redmine/distinfo       Wed May 06 08:15:01 2020 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.9 2020/03/15 16:00:55 taca Exp $
+$NetBSD: distinfo,v 1.10 2020/05/06 08:15:01 taca Exp $
 
 SHA1 (actioncable-5.2.4.1.gem) = 71ad415759312c7194ae717137177f0da8247eae
 RMD160 (actioncable-5.2.4.1.gem) = ed89210c5d2095a9f24116ed947b11fee3b46c43
@@ -312,3 +312,5 @@
 RMD160 (yard-0.9.20.gem) = fa7f80200c7aa66a642de137b26c227f836297c1
 SHA512 (yard-0.9.20.gem) = 4269037ba61185c999df9f1195825ec92a76b32ccb18fc2b86b54e34ff2e5efd22a536c3e207304ef47a52905215103a2094634d1bb8d8ab722b11488cf04e13
 Size (yard-0.9.20.gem) = 640512 bytes
+SHA1 (patch-rmagick-2.16.0_ext_RMagick_extconf.rb) = 227e2f02855019fb8750130af6cb8b10baee5bbf
+SHA1 (patch-rmagick-2.16.0_ext_RMagick_rmpixel.c) = ef9243b90961bdb2435176e70facc4eb89d66b9a
diff -r 42e73b3ea433 -r 0cbcab5e8712 devel/ruby-redmine/patches/patch-rmagick-2.16.0_ext_RMagick_extconf.rb
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/ruby-redmine/patches/patch-rmagick-2.16.0_ext_RMagick_extconf.rb    Wed May 06 08:15:01 2020 +0000
@@ -0,0 +1,759 @@
+$NetBSD: patch-rmagick-2.16.0_ext_RMagick_extconf.rb,v 1.1 2020/05/06 08:15:01 taca Exp $
+
+* Partly use rmagick 4.1.2's extconf.rb to build with newer ImageMagick6.
+
+--- rmagick-2.16.0/ext/RMagick/extconf.rb.orig 2020-04-28 14:51:55.125428720 +0000
++++ rmagick-2.16.0/ext/RMagick/extconf.rb
+@@ -2,27 +2,43 @@ lib_dir = File.expand_path('../../lib', 
+ $LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
+ require 'rubygems'
+ require 'mkmf'
+-require 'date'
+ 
+ module RMagick
+   class Extconf
+     require 'rmagick/version'
+     RMAGICK_VERS = ::Magick::VERSION
+     MIN_RUBY_VERS = ::Magick::MIN_RUBY_VERSION
+-    MIN_RUBY_VERS_NO = MIN_RUBY_VERS.tr('.','').to_i
+ 
+     attr_reader :headers
++
+     def initialize
+-      configure_compile_options
++      @stdout = $stdout.dup
++
++      setup_pkg_config_path
+       assert_can_compile!
++      configure_compile_options
+       configure_headers
+     end
+ 
++    def setup_pkg_config_path
++      return if RUBY_PLATFORM =~ /mswin|mingw/
++
++      if find_executable('brew')
++        pkg_config_path = "#{`brew --prefix imagemagick@6`.strip}/lib/pkgconfig"
++      elsif find_executable('pacman')
++        pkg_config_path = '/usr/lib/imagemagick6/pkgconfig'
++      else
++        return
++      end
++
++      pkg_config_paths = ENV['PKG_CONFIG_PATH'].to_s.split(':')
++      if File.exist?(pkg_config_path) && !pkg_config_paths.include?(pkg_config_path)
++        ENV['PKG_CONFIG_PATH'] = [ENV['PKG_CONFIG_PATH'], pkg_config_path].compact.join(':')
++      end
++    end
++
+     def configured_compile_options
+       {
+-        :magick_config => $magick_config,
+-        :with_magick_wand => $with_magick_wand,
+-        :pkg_config    => $pkg_config,
+         :magick_version => $magick_version,
+         :local_libs     => $LOCAL_LIBS,
+         :cflags         => $CFLAGS,
+@@ -34,15 +50,19 @@ module RMagick
+     end
+ 
+     def configure_headers
+-      #headers = %w{assert.h ctype.h errno.h float.h limits.h math.h stdarg.h stddef.h stdint.h stdio.h stdlib.h string.h time.h}
++      @headers = %w[assert.h ctype.h stdio.h stdlib.h math.h time.h sys/types.h]
+       @headers = %w{assert.h ctype.h stdio.h stdlib.h math.h time.h}
+       headers << 'stdint.h' if have_header('stdint.h')  # defines uint64_t
+       headers << 'sys/types.h' if have_header('sys/types.h')
+ 
+       if have_header('wand/MagickWand.h')
+         headers << 'wand/MagickWand.h'
++      elsif have_header('MagickCore/MagickCore.h')
++        headers << 'MagickCore/MagickCore.h'
++      elsif have_header('magick/MagickCore.h')
++        headers << 'magick/MagickCore.h'
+       else
+-        exit_failure "\nCan't install RMagick #{RMAGICK_VERS}. Can't find MagickWand.h."
++        exit_failure "Can't install RMagick #{RMAGICK_VERS}. Can't find magick/MagickCore.h."
+       end
+     end
+ 
+@@ -50,159 +70,94 @@ module RMagick
+       # Magick-config is not available on Windows
+       if RUBY_PLATFORM !~ /mswin|mingw/
+ 
+-        # Check for compiler. Extract first word so ENV['CC'] can be a program name with arguments.
+-        config = defined?(RbConfig) ? ::RbConfig : ::Config
+-        cc = (ENV['CC'] || config::CONFIG['CC'] || 'gcc').split(' ').first
+-        unless find_executable(cc)
+-          exit_failure "No C compiler found in ${ENV['PATH']}. See mkmf.log for details."
+-        end
+-
+-        # ugly way to handle which config tool we're going to use...
+-        $with_magick_wand = false
+-        $magick_config = false
+-        $pkg_config = false
+-
+-        # Check for Magick-config
+-        if find_executable('Magick-config') && !has_graphicsmagick_libmagick_dev_compat?
+-          $magick_config = true
+-          $magick_version = `Magick-config --version`[/^(\d+\.\d+\.\d+)/]
+-        elsif find_executable('pkg-config')
+-          $pkg_config = true
+-          $magick_version = `pkg-config MagickCore --modversion`[/^(\d+\.\d+\.\d+)/]
+-        else
+-          exit_failure "Can't install RMagick #{RMAGICK_VERS}. Can't find Magick-config or pkg-config in #{ENV['PATH']}\n"
+-        end
+-
+         check_multiple_imagemagick_versions
+         check_partial_imagemagick_versions
+ 
+-        # Ensure minimum ImageMagick version
+-        # Check minimum ImageMagick version if possible
+-        checking_for("outdated ImageMagick version (<= #{Magick::MIN_IM_VERSION})") do
+-          Logging.message("Detected ImageMagick version: #{$magick_version}\n")
++        # Save flags
++        $CFLAGS     = "#{ENV['CFLAGS']} "   + `pkg-config --cflags #{$magick_package}`.chomp
++        $CPPFLAGS   = "#{ENV['CPPFLAGS']} " + `pkg-config --cflags #{$magick_package}`.chomp
++        $LDFLAGS    = "#{ENV['LDFLAGS']} "  + `pkg-config --libs #{$magick_package}`.chomp
++        $LOCAL_LIBS = "#{ENV['LIBS']} "     + `pkg-config --libs #{$magick_package}`.chomp
+ 
+-          if Gem::Version.new($magick_version) < Gem::Version.new(Magick::MIN_IM_VERSION)
+-            exit_failure "Can't install RMagick #{RMAGICK_VERS}. You must have ImageMagick #{Magick::MIN_IM_VERSION} or later.\n"
+-          end
+-        end
++        configure_archflags_for_osx($magick_package) if RUBY_PLATFORM =~ /darwin/ # osx
+ 
+-        # From ImageMagick 6.9 binaries are split to two and we have to use
+-        # MagickWand instead of MagickCore
+-        checking_for("presence of MagickWand API (ImageMagick version >= #{Magick::MIN_WAND_VERSION})") do
+-          $with_magick_wand = Gem::Version.new($magick_version) >= Gem::Version.new(Magick::MIN_WAND_VERSION)
+-          if $with_magick_wand
+-            Logging.message('Detected 6.9+ version, using MagickWand API')
+-          else
+-            Logging.message('Older version detected, using MagickCore API')
+-          end
+-        end
++      elsif RUBY_PLATFORM =~ /mingw/ # mingw
+ 
+-        # either set flags using Magick-config, MagickWand-config or pkg-config (new Debian default)
+-        if $with_magick_wand
+-          if $magick_config
+-            # Save flags
+-            $CFLAGS     = ENV['CFLAGS'].to_s   + ' ' + `MagickWand-config --cflags`.chomp
+-            $CPPFLAGS   = ENV['CPPFLAGS'].to_s + ' ' + `MagickWand-config --cppflags`.chomp
+-            $LDFLAGS    = ENV['LDFLAGS'].to_s  + ' ' + `MagickWand-config --ldflags`.chomp
+-            $LOCAL_LIBS = ENV['LIBS'].to_s     + ' ' + `MagickWand-config --libs`.chomp
+-          end
++        dir_paths = search_paths_for_library_for_windows
++        $CPPFLAGS = %(-I"#{dir_paths[:include]}")
++        $LDFLAGS = %(-L"#{dir_paths[:lib]}")
++        $LDFLAGS << ' -lucrt' if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.4.0')
+ 
+-          if $pkg_config
+-            # Save flags
+-            $CFLAGS     = ENV['CFLAGS'].to_s   + ' ' + `pkg-config --cflags MagickWand`.chomp
+-            $CPPFLAGS   = ENV['CPPFLAGS'].to_s + ' ' + `pkg-config --cflags MagickWand`.chomp
+-            $LDFLAGS    = ENV['LDFLAGS'].to_s  + ' ' + `pkg-config --libs MagickWand`.chomp
+-            $LOCAL_LIBS = ENV['LIBS'].to_s     + ' ' + `pkg-config --libs MagickWand`.chomp
+-          end
+-        else
+-          if $magick_config
+-            # Save flags
+-            $CFLAGS     = ENV['CFLAGS'].to_s   + ' ' + `Magick-config --cflags`.chomp
+-            $CPPFLAGS   = ENV['CPPFLAGS'].to_s + ' ' + `Magick-config --cppflags`.chomp
+-            $LDFLAGS    = ENV['LDFLAGS'].to_s  + ' ' + `Magick-config --ldflags`.chomp
+-            $LOCAL_LIBS = ENV['LIBS'].to_s     + ' ' + `Magick-config --libs`.chomp
+-          end
++        have_library(im_version_at_least?('7.0.0') ? 'CORE_RL_MagickCore_' : 'CORE_RL_magick_')
+ 
+-          if $pkg_config
+-            # Save flags
+-            $CFLAGS     = ENV['CFLAGS'].to_s   + ' ' + `pkg-config --cflags MagickCore`.chomp
+-            $CPPFLAGS   = ENV['CPPFLAGS'].to_s + ' ' + `pkg-config --cflags MagickCore`.chomp
+-            $LDFLAGS    = ENV['LDFLAGS'].to_s  + ' ' + `pkg-config --libs MagickCore`.chomp
+-            $LOCAL_LIBS = ENV['LIBS'].to_s     + ' ' + `pkg-config --libs MagickCore`.chomp
+-          end
+-        end
++      else # mswin
+ 
+-        if RUBY_PLATFORM =~ /darwin/ # osx
+-          set_archflags_for_osx
+-        end
++        dir_paths = search_paths_for_library_for_windows
++        $CPPFLAGS << %( -I"#{dir_paths[:include]}")
++        $LDFLAGS << %( -libpath:"#{dir_paths[:lib]}")
++        $LDFLAGS << ' -libpath:ucrt' if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.4.0')
+ 
+-      elsif RUBY_PLATFORM =~ /mingw/  # mingw
++        $LOCAL_LIBS = im_version_at_least?('7.0.0') ? 'CORE_RL_MagickCore_.lib' : 'CORE_RL_magick_.lib'
+ 
+-        `identify -version` =~ /Version: ImageMagick (\d+\.\d+\.\d+)-+\d+ /
+-        abort 'Unable to get ImageMagick version' unless $1
+-        $magick_version = $1
+-        unless have_library('CORE_RL_magick_')
+-          search_paths_for_library_for_mingw
+-        end
+-        have_library('X11')
++      end
++
++      $CFLAGS << (have_macro('__GNUC__') ? ' -std=gnu99' : ' -std=c99')
++    end
+ 
+-      else  # mswin
++    def exit_failure(msg)
++      msg = "ERROR: #{msg}"
+ 
+-        `identify -version` =~ /Version: ImageMagick (\d+\.\d+\.\d+)-+\d+ /
+-        abort 'Unable to get ImageMagick version' unless $1
+-        $magick_version = $1
+-        $CFLAGS = '-W3'
+-        $CPPFLAGS = %Q{-I"C:\\Program Files\\Microsoft Platform SDK for Windows Server 2003 R2\\Include" -I"C:\\Program Files\\ImageMagick-#{$magick_version}-Q8\\include"}
+-        # The /link option is required by the Makefile but causes warnings in the mkmf.log file.
+-        $LDFLAGS = %Q{/link /LIBPATH:"C:\\Program Files\\Microsoft Platform SDK for Windows Server 2003 R2\\Lib" /LIBPATH:"C:\\Program Files\\ImageMagick-#{$magick_version}-Q8\\lib" 
/LIBPATH:"C:\\ruby\\lib"}
+-        $LOCAL_LIBS = 'CORE_RL_magick_.lib'
+-        have_library('X11')
++      Logging.message msg
+ 
++      @stdout.puts "\n\n"
++      if ENV['NO_COLOR']
++        @stdout.puts msg
++      else
++        @stdout.print "\e[31m\e[1m#{msg}\e[0m"
+       end
++      @stdout.puts "\n\n"
++      @stdout.flush
++
++      exit(1)
+     end
+ 
+-    # Test for a specific value in an enum type
+-    def have_enum_value(enum, value, headers=nil, &b)
+-      checking_for "#{enum}.#{value}" do
+-        if try_compile(<<"SRC", &b)
+-#{COMMON_HEADERS}
+-#{cpp_include(headers)}
+-/*top*/
+-int main() { #{enum} t = #{value}; t = t; return 0; }
+-SRC
+-          $defs.push(format('-DHAVE_ENUM_%s', value.upcase))
+-          true
+-        else
+-          false
+-        end
++    def determine_imagemagick_package
++      packages = `pkg-config --list-all`.scan(/(ImageMagick\-[\.A-Z0-9]+) .*/).flatten
++
++      # For ancient version of ImageMagick 6 we need a different regex
++      if packages.empty?
++        packages = `pkg-config --list-all`.scan(/(ImageMagick) .*/).flatten
+       end
+-    end
+ 
+-    # Test for multiple values of the same enum type
+-    def have_enum_values(enum, values, headers=nil, &b)
+-      values.each do |value|
+-        have_enum_value(enum, value, headers, &b)
++      if packages.empty?
++        exit_failure "Can't install RMagick #{RMAGICK_VERS}. Can't find ImageMagick with pkg-config\n"
++      end
++
++      if packages.length > 1
++
++        im7_packages = packages.grep(/\AImageMagick-7/)
++
++        if im7_packages.any?
++          checking_for('forced use of ImageMagick 6') do
++            if ENV['USE_IMAGEMAGICK_6']
++              packages -= im7_packages
++              true
++            else
++              packages = im7_packages
++              false
++            end
++          end
++        end
+       end
+-    end
+ 
+-    def has_graphicsmagick_libmagick_dev_compat?
+-      config_path = `which Magick-config`.chomp
+-      if File.exist?(config_path) &&
+-         File.symlink?(config_path) &&
+-         File.readlink(config_path) =~ /GraphicsMagick/



Home | Main Index | Thread Index | Old Index