Browse Source

Tidy up build files and util script.

v1.x
c-spencer 13 years ago
parent
commit
8e9defcb79
  1. 6
      binding.gyp
  2. 94
      configure
  3. 2
      src/CanvasRenderingContext2d.cc
  4. 0
      util/has_lib.sh

6
binding.gyp

@ -9,9 +9,9 @@
}
}, { # 'OS!="win"'
'variables': {
'with_jpeg%': '<!(./has_lib.sh jpeg)',
'with_gif%': '<!(./has_lib.sh gif)',
'with_pango%': '<!(./has_lib.sh pangocairo)'
'with_jpeg%': '<!(./util/has_lib.sh jpeg)',
'with_gif%': '<!(./util/has_lib.sh gif)',
'with_pango%': '<!(./util/has_lib.sh pangocairo)'
}
}]
],

94
configure

@ -1,94 +0,0 @@
#!/usr/bin/env bash
#
# Build flags
#
cppflags=
#
# Check for <lib>
#
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
}
#
# Check for <lib> and append to cppflags
#
has() {
local lib=$1
check $lib
has_lib $lib > /dev/null
if test $? -eq 0; then
found $lib
cppflags="$cppflags --with-$lib"
else
missing $lib
fi
}
#
# Check pkg-config for <lib>
#
has_pkg_config() {
local lib=$1
check $lib
pkg-config --libs $1 > /dev/null 2> /dev/null
if test $? -eq 0; then
found $lib
else
missing $lib
exit 1
fi
}
#
# Output check
#
check() {
printf " \e[90mcheck %s\e[m" $1
}
#
# Output found
#
found() {
printf "\r \e[32m✔ found \e[90m%s\e[m\n" $1
}
#
# Output missing
#
missing() {
printf "\r \e[31m✖ cannot find \e[90m%s\e[m\n" $1
}
# DO IT
echo
has gif
has jpeg
has_pkg_config cairo
has_pkg_config pangocairo
echo
# TODO: output flags and get npm "install" script working

2
src/CanvasRenderingContext2d.cc

@ -54,7 +54,6 @@ enum {
void state_assign_fontFamily(canvas_state_t *state, const char *str) {
free(state->fontFamily);
state->fontFamily = strndup(str, 100);
strcpy(state->fontFamily, str);
}
#endif
@ -204,7 +203,6 @@ Context2d::saveState() {
memcpy(states[stateno], state, sizeof(canvas_state_t));
#if HAVE_PANGO
states[stateno]->fontFamily = strndup(state->fontFamily, 100);
strcpy(states[stateno]->fontFamily, state->fontFamily);
#endif
state = states[stateno];
}

0
has_lib.sh → util/has_lib.sh

Loading…
Cancel
Save