Permalink
Browse files

Trial auto-detection of libraries

  • Loading branch information...
1 parent 35d491a commit 9c13c23f1174a13c9cd8cd6cdbff3c28d2ddbfc5 @c-spencer c-spencer committed Aug 9, 2012
Showing with 26 additions and 3 deletions.
  1. +3 −3 binding.gyp
  2. +23 −0 has_lib.sh
View
@@ -1,9 +1,9 @@
{
'variables': {
'GTK_Root%': 'C:/GTK', # Set the location of GTK all-in-one bundle
- 'with_jpeg%': 'false',
- 'with_gif%': 'false',
- 'with_pango%': 'false'
+ 'with_jpeg%': '<!(./has_lib.sh jpeg)',
+ 'with_gif%': '<!(./has_lib.sh gif)',
+ 'with_pango%': '<!(./has_lib.sh pangocairo)'
},
'targets': [
{
View
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+has_lib() {
+ local lib=$1
+
+ # Try using ldconfig on linux systems
+ for LINE in `which ldconfig > /dev/null && ldconfig -p 2>/dev/null | grep lib$lib`; 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 $lib && return 0
+ done
+
+ return 1
+}
+
+has_lib $1 > /dev/null
+if test $? -eq 0; then
+ echo true
+else
+ echo false
+fi

0 comments on commit 9c13c23

Please sign in to comment.