Browse Source

Merge pull request #203 from lpinca/master

Build improvements
v1.x
TJ Holowaychuk 13 years ago
parent
commit
c5468473d3
  1. 7
      src/init.cc
  2. 6
      util/has_lib.sh

7
src/init.cc

@ -51,9 +51,16 @@ init (Handle<Object> target) {
} }
target->Set(String::New("jpegVersion"), String::New(jpeg_version)); target->Set(String::New("jpegVersion"), String::New(jpeg_version));
#endif #endif
#ifdef HAVE_GIF #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)); target->Set(String::New("gifVersion"), String::New(GIF_LIB_VERSION));
#endif #endif
#endif
} }
NODE_MODULE(canvas,init); NODE_MODULE(canvas,init);

6
util/has_lib.sh

@ -1,15 +1,15 @@
#!/usr/bin/env bash #!/usr/bin/env bash
has_lib() { has_lib() {
local regex="lib$1.+(so|dylib)(?!\.)" local regex="lib$1.+(so|dylib)$"
# Try using ldconfig on linux systems # 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 return 0
done done
# Try just checking common library locations # Try just checking common library locations
for dir in /lib /usr/lib /usr/local/lib /opt/local/lib; do 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 done
return 1 return 1

Loading…
Cancel
Save