diff options
-rwxr-xr-x | autogen.sh | 2 | ||||
-rw-r--r-- | configure.ac | 15 | ||||
-rw-r--r-- | swig/Makefile.am | 10 | ||||
-rw-r--r-- | swig/slv2.i | 22 |
4 files changed, 39 insertions, 10 deletions
@@ -8,7 +8,7 @@ if [ -x "`which glibtoolize`" ]; then # OSX else # Unix libtoolize --force fi -aclocal +aclocal -I m4 autoheader -Wall automake --foreign --add-missing autoconf diff --git a/configure.ac b/configure.ac index dced69b..79ac998 100644 --- a/configure.ac +++ b/configure.ac @@ -96,15 +96,24 @@ if test "$strict" = "yes"; then fi # SWIG bindings -bindings="no" +bindings="yes" AC_ARG_ENABLE(bindings, - [AS_HELP_STRING(--enable-bindings, [Build language bindings via SWIG (false)])], + [AS_HELP_STRING(--enable-bindings, [Build language bindings via SWIG (true if available)])], [bindings="$enableval"]) if test "$bindings" = "yes"; then - AC_CHECK_PROGS(SWIG, swig) + AC_CHECK_PROGS(SWIG, "swig swig-1.3") + if test "$SWIG" = ""; then + AC_MSG_WARN("SWIG not found, language bindings disabled") + fi fi AM_CONDITIONAL(WITH_SWIG, [test "$bindings" = "yes"]) +python="no" +if test "$bindings" = "yes"; then + AC_PYTHON_DEVEL([>= '2.3.0']) +fi +AM_CONDITIONAL(WITH_PYTHON, [test ! "$PYTHON_VERSION" = "yes"]) + # Check for Redland build_redland="no" AC_CHECK_PROG(REDLAND_CONFIG, redland-config, redland-config) diff --git a/swig/Makefile.am b/swig/Makefile.am index 17a9e68..b6c5564 100644 --- a/swig/Makefile.am +++ b/swig/Makefile.am @@ -1,10 +1,16 @@ EXTRA_DIST = slv2.i lv2_list.py if WITH_SWIG + +if WITH_PYTHON all: swig -Wall -python slv2.i - gcc -fPIC -shared -I/usr/include/python2.4 slv2_wrap.c ../src/.libs/libslv2.so -o _slv2.so -endif + gcc -fPIC -shared $(PYTHON_CPPFLAGS) $(PYTHON_EXTRA_LDFLAGS) \ + $(PYTHON_EXTRA_LIBS) $(PYTHON_EXTRA_LDFLAGS) \ + -I/usr/include/python2.4 slv2_wrap.c ../src/.libs/libslv2.so -o _slv2.so +endif # WITH_PYTHON + +endif # WITH_SWIG clean-local: rm -f *.cxx diff --git a/swig/slv2.i b/swig/slv2.i index 5020767..593411e 100644 --- a/swig/slv2.i +++ b/swig/slv2.i @@ -41,8 +41,15 @@ typedef struct { SLV2Plugin me; } Plugin; free($self); } - char* name() { return slv2_plugin_get_name($self->me); } - const char* uri() { return slv2_plugin_get_uri($self->me); } + char* name() { + SLV2Value nm = slv2_plugin_get_name($self->me); + char* ret = nm ? strdup((char*)slv2_value_as_string(nm)) : strdup(""); + slv2_value_free(nm); + return ret; + } + const char* uri() { + return strdup((char*)slv2_value_as_string(slv2_plugin_get_uri($self->me))); + } }; typedef struct { SLV2World world; SLV2Plugins me; } Plugins; @@ -101,8 +108,15 @@ typedef struct { SLV2World me; } World; } void load_all() { slv2_world_load_all($self->me); } - void load_bundle(const char* path) { slv2_world_load_bundle($self->me, path); } - Plugins* get_all_plugins() { return new_Plugins($self->me, slv2_world_get_all_plugins($self->me)); } + void load_bundle(const char* uri) { + SLV2Value bundle_uri = slv2_value_new_uri($self->me, (const unsigned char*)uri); + slv2_world_load_bundle($self->me, bundle_uri); + slv2_value_free(bundle_uri); + } + + Plugins* get_all_plugins() { + return new_Plugins($self->me, slv2_world_get_all_plugins($self->me)); + } }; |