From 19bcf35a949b22abbbf6d9b02b4b3067da5284c2 Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Tue, 14 Aug 2012 12:35:05 +0200 Subject: [PATCH 1/2] Fix auto-detection of optional libraries for OS X The OS X version of grep doesn't support -P (--perl-regexp). It was breaking the building. Solved by slightly changing the RegExp and using -E (--extended-regexp). --- util/has_lib.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/util/has_lib.sh b/util/has_lib.sh index afcfb99..cb9c663 100755 --- a/util/has_lib.sh +++ b/util/has_lib.sh @@ -1,15 +1,15 @@ #!/usr/bin/env bash has_lib() { - local regex="lib$1.+(so|dylib)(?!\.)" + local regex="lib$1.+(so|dylib)$" # Try using ldconfig on linux systems - for LINE in `which ldconfig > /dev/null && ldconfig -p 2>/dev/null | grep -P $regex`; do + for LINE in `which ldconfig > /dev/null && ldconfig -p 2>/dev/null | grep -E $regex`; do return 0 done # Try just checking common library locations for dir in /lib /usr/lib /usr/local/lib /opt/local/lib; do - test -d $dir && ls $dir | grep -P $regex && return 0 + test -d $dir && ls $dir | grep -E $regex && return 0 done return 1 From 25234db5df31384ed7d24ccdec1cb68f2fe83855 Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Tue, 14 Aug 2012 14:58:04 +0200 Subject: [PATCH 2/2] Fix cases where GIF_LIB_VERSION is not defined Versions up to 4.1.6 of GIFLIB defined a GIF_LIB_VERSION macro that was string-valued. Versions after 4.1.6 define integer-valued GIFLIB_MAJOR, GIFLIB_MINOR, and GIFLIB_RELEASE macros for the three components of the version. Check for GIF_LIB_VERSION, otherwise use the new macros. --- src/init.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/init.cc b/src/init.cc index fa592a8..88e543a 100755 --- a/src/init.cc +++ b/src/init.cc @@ -51,9 +51,16 @@ init (Handle target) { } target->Set(String::New("jpegVersion"), String::New(jpeg_version)); #endif + #ifdef HAVE_GIF +#ifndef GIF_LIB_VERSION + char gif_version[10]; + snprintf(gif_version, 10, "%d.%d.%d", GIFLIB_MAJOR, GIFLIB_MINOR, GIFLIB_RELEASE); + target->Set(String::New("gifVersion"), String::New(gif_version)); +#else target->Set(String::New("gifVersion"), String::New(GIF_LIB_VERSION)); #endif +#endif } NODE_MODULE(canvas,init);