From 8e9defcb79ac776a6846d1f3c429309414efae0f Mon Sep 17 00:00:00 2001 From: c-spencer Date: Thu, 9 Aug 2012 19:35:06 +0100 Subject: [PATCH] Tidy up build files and util script. --- binding.gyp | 6 +-- configure | 94 --------------------------------- src/CanvasRenderingContext2d.cc | 2 - has_lib.sh => util/has_lib.sh | 0 4 files changed, 3 insertions(+), 99 deletions(-) delete mode 100755 configure rename has_lib.sh => util/has_lib.sh (100%) diff --git a/binding.gyp b/binding.gyp index 95f5ba3..f72bb60 100644 --- a/binding.gyp +++ b/binding.gyp @@ -9,9 +9,9 @@ } }, { # 'OS!="win"' 'variables': { - 'with_jpeg%': ' -# - -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 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 -# - -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 diff --git a/src/CanvasRenderingContext2d.cc b/src/CanvasRenderingContext2d.cc index 7a820e3..93de1ac 100644 --- a/src/CanvasRenderingContext2d.cc +++ b/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]; } diff --git a/has_lib.sh b/util/has_lib.sh similarity index 100% rename from has_lib.sh rename to util/has_lib.sh