From e7c859b30c7038c6829a1b1d131aec191c363158 Mon Sep 17 00:00:00 2001 From: buty4649 Date: Sun, 28 May 2023 12:22:21 +0900 Subject: [PATCH] Fix build error with mingw When trying to build using mingw, a "lib not found" error occurs. see: https://github.com/mattn/mruby-onig-regexp/issues/105 --- fix-build-error-with-mingw.patch | 14 ++++++++++++++ mrbgem.rake | 1 + 2 files changed, 15 insertions(+) create mode 100644 fix-build-error-with-mingw.patch diff --git a/fix-build-error-with-mingw.patch b/fix-build-error-with-mingw.patch new file mode 100644 index 0000000..a8b0a82 --- /dev/null +++ b/fix-build-error-with-mingw.patch @@ -0,0 +1,14 @@ +--- a/onigmo-6.2.0/configure 2019-01-30 19:33:48.000000000 +0900 ++++ b/onigmo-6.2.0/configure 2023-05-28 03:23:17.874370143 +0900 +@@ -9847,9 +9847,9 @@ + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. +- old_archive_from_new_cmds='true' ++ #old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. +- old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' ++ #old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' + enable_shared_with_static_runtimes=yes + ;; + esac diff --git a/mrbgem.rake b/mrbgem.rake index db60984..6ce9d4e 100644 --- a/mrbgem.rake +++ b/mrbgem.rake @@ -39,6 +39,7 @@ MRuby::Gem::Specification.new('mruby-onig-regexp') do |spec| Dir.chdir(build_dir) do _pp 'extracting', "onigmo-#{version}" `gzip -dc "#{dir}/onigmo-#{version}.tar.gz" | tar xf -` + `patch -p1 < "#{dir}/fix-build-error-with-mingw.patch"` end end