Browse Source

Merge pull request #701 from LinusU/build-cleanup

cleanup build scripts
v1.x
Linus Unnebäck 9 years ago
parent
commit
febc2d1815
  1. 5
      binding.gyp
  2. 6
      util/cairo_include.sh
  3. 13
      util/has_cairo_freetype.sh
  4. 56
      util/has_lib.sh
  5. 6
      util/lib_lookup.sh

5
binding.gyp

@ -12,9 +12,8 @@
'variables': {
'with_jpeg%': '<!(./util/has_lib.sh jpeg)',
'with_gif%': '<!(./util/has_lib.sh gif)',
# disable pango as it causes issues with freetype.
'with_pango%': '<!(./util/has_lib.sh pangocairo)',
'with_freetype%': '<!(./util/has_cairo_freetype.sh)'
'with_pango%': '<!(./util/has_lib.sh pango)',
'with_freetype%': '<!(./util/has_lib.sh freetype)'
}
}]
],

6
util/cairo_include.sh

@ -1,6 +0,0 @@
#!/usr/bin/env sh
# Make pkg-config lookup include files from the build directory.
export PKG_CONFIG_PATH=$(cd "$(dirname "$0")"; pwd)/../build_cairo/lib/pkgconfig;
pkg-config cairo --cflags-only-I | sed s/-I//g

13
util/has_cairo_freetype.sh

@ -1,13 +0,0 @@
#!/usr/bin/env sh
has_freetype() {
pkg-config cairo --cflags-only-I | grep freetype2
}
has_freetype > /dev/null
if test $? -eq 0; then
echo true
else
echo false
fi

56
util/has_lib.sh

@ -1,5 +1,10 @@
#!/usr/bin/env sh
has_lib() {
#!/bin/bash
has_ldconfig() {
hash ldconfig 2>/dev/null
}
has_system_lib() {
local regex="lib$1.+(so|dylib)"
# Add /sbin to path as ldconfig is located there on some systems - e.g. Debian
@ -7,21 +12,52 @@ has_lib() {
PATH="$PATH:/sbin"
export PATH
# Try using ldconfig on linux systems
for LINE in `which ldconfig > /dev/null && ldconfig -p 2>/dev/null | grep -E $regex`; do
return 0
done
if $(has_ldconfig); then
for _ in $(ldconfig -p 2>/dev/null | grep -E "$regex"); do
return 0
done
fi
# Try just checking common library locations
for dir in /lib /usr/lib /usr/local/lib /opt/local/lib /usr/lib/x86_64-linux-gnu /usr/lib/i386-linux-gnu; do
test -d $dir && ls $dir | grep -E $regex && return 0
test -d $dir && ls $dir | grep -E "$regex" && return 0
done
return 1
}
has_lib $1 > /dev/null
if test $? -eq 0; then
echo true
has_freetype() {
pkg-config cairo --cflags-only-I | grep freetype2
}
has_pkgconfig_lib() {
pkg-config --exists "$1"
}
case "$1" in
gif)
has_system_lib "gif" > /dev/null
result=$?
;;
jpeg)
has_system_lib "jpeg" > /dev/null
result=$?
;;
pango)
has_pkgconfig_lib "pango" > /dev/null
result=$?
;;
freetype)
has_freetype > /dev/null
result=$?
;;
*)
>&2 echo "Unknown library: $1"
exit 1
esac
if test $result -eq 0; then
echo "true"
else
echo false
echo "false"
fi

6
util/lib_lookup.sh

@ -1,6 +0,0 @@
#!/usr/bin/env sh
# Make pkg-config lookup include files from the build directory.
export PKG_CONFIG_PATH=$(cd "$(dirname "$0")"; pwd)/../build_cairo/lib/pkgconfig;
pkg-config $1 --libs
Loading…
Cancel
Save