From 526c0876e848ba7e5f98a3b7508b88d995afe201 Mon Sep 17 00:00:00 2001 From: Valentino Dell'Aica Date: Sat, 8 Sep 2012 13:10:16 +0200 Subject: [PATCH 1/2] Adding pkg_config libs to native extension Signed-off-by: Valentino Dell'Aica --- ext/charlock_holmes/extconf.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ext/charlock_holmes/extconf.rb b/ext/charlock_holmes/extconf.rb index c955636..de9137c 100644 --- a/ext/charlock_holmes/extconf.rb +++ b/ext/charlock_holmes/extconf.rb @@ -37,6 +37,8 @@ def sys(cmd) end end +pkg_config 'icu-i18n' + unless have_library 'icui18n' and have_header 'unicode/ucnv.h' STDERR.puts "\n\n" STDERR.puts "***************************************************************************************" @@ -77,6 +79,8 @@ def sys(cmd) exit(1) end +pkg_config 'zlib' + $CFLAGS << ' -Wall -funroll-loops' $CFLAGS << ' -Wextra -O0 -ggdb3' if ENV['DEBUG'] From fd2b75724d7583b367aab91e519ee57a30f9db6f Mon Sep 17 00:00:00 2001 From: Valentino Dell'Aica Date: Fri, 9 Nov 2012 13:52:03 +0100 Subject: [PATCH 2/2] Adding code for find ICU on MacPorts Adding the code suggested by @sodabrew to find pkgconfig and icu-18n on MacPorts --- ext/charlock_holmes/extconf.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ext/charlock_holmes/extconf.rb b/ext/charlock_holmes/extconf.rb index de9137c..060042b 100644 --- a/ext/charlock_holmes/extconf.rb +++ b/ext/charlock_holmes/extconf.rb @@ -39,6 +39,15 @@ def sys(cmd) pkg_config 'icu-i18n' +unless have_library 'icui18n' and have_header 'unicode/ucnv.h' + pcs = `which -a pkg-config` + pcs.lines.each do |pc| + $PKGCONFIG = pc.chomp + pkg_config 'icu-i18n' + break if have_library 'icui18n' and have_header 'unicode/ucnv.h' + end +end + unless have_library 'icui18n' and have_header 'unicode/ucnv.h' STDERR.puts "\n\n" STDERR.puts "***************************************************************************************"