From: Dan Dennedy Date: Tue, 23 Jun 2009 06:45:56 +0000 (-0700) Subject: Further integrate swig into build system. X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=eb466b583e724facabe517a9210fc627d8515a0a;p=mlt Further integrate swig into build system. This is not enabled by default. It adds configure options --enable-swig and --swig-languages. Signed-off-by: Dan Dennedy --- diff --git a/configure b/configure index 9eb329bd..cf22a630 100755 --- a/configure +++ b/configure @@ -249,7 +249,7 @@ else fi # Iterate through each of the components -for i in framework modules melt mlt++ +for i in framework modules melt mlt++ swig do if [ -x src/$i/configure ] then diff --git a/src/framework/Makefile b/src/framework/Makefile index fa95884a..85f554dd 100644 --- a/src/framework/Makefile +++ b/src/framework/Makefile @@ -102,7 +102,7 @@ uninstall: rm -f "$(DESTDIR)$(libdir)/$(SONAME)" rm -f "$(DESTDIR)$(libdir)/$(NAME)" rm -rf "$(DESTDIR)$(prefix)/include/mlt/framework" - rm "$(DESTDIR)$(datadir)/mlt/metaschema.yaml" + rm -f "$(DESTDIR)$(datadir)/mlt/metaschema.yaml" ifneq ($(wildcard .depend),) include .depend diff --git a/src/melt/configure b/src/melt/configure index 82437fa3..c109c84b 100755 --- a/src/melt/configure +++ b/src/melt/configure @@ -5,7 +5,7 @@ then cat << EOF Melt options: - --rename-melt - Give melt executable a different name. + --rename-melt=name - Give melt executable a different name. EOF diff --git a/src/swig/Makefile b/src/swig/Makefile index 510cce8b..5a1d30ba 100644 --- a/src/swig/Makefile +++ b/src/swig/Makefile @@ -1,10 +1,22 @@ -SUBDIRS = java perl php python ruby tcl +include ../../config.mak +include config.mak -all clean install: +all clean depend install: list='$(SUBDIRS)'; \ for subdir in $$list; do \ - if [ -f $$subdir/Makefile -a -f .$$subdir ] ; \ - then $(MAKE) -C $$subdir $@ || exit 1; \ + if [ -x $$subdir/build -a ! -f .$$subdir -o $@ = clean ] ; \ + then echo -n Building $$subdir... ; \ + cd $$subdir && output=`./build $@ 2>&1` ; \ + if [ $$? -eq 0 ] ; \ + then echo OK && touch ../.$$subdir ; \ + else echo $$output && exit 1 ; \ + fi ; \ + cd .. ; \ + if [ -f $$subdir/Makefile -a -f .$$subdir ] ; \ + then $(MAKE) -C $$subdir $@ || exit 1 ; \ + fi ; \ + if [ $@ = clean ] ; \ + then rm -f .$$subdir ; \ + fi ; \ fi \ done - diff --git a/src/swig/configure b/src/swig/configure index 3c21e5f6..cc23df48 100755 --- a/src/swig/configure +++ b/src/swig/configure @@ -1,42 +1,29 @@ -#!/usr/bin/env sh +#!/bin/sh -which swig > /dev/null 2>&1 -[ $? != 0 ] && echo "Please install swig" && exit 1 +if [ "$help" = "1" ] +then + cat << EOF +SWIG options: -pkg-config mlt-framework --cflags > /dev/null 2>&1 -[ $? != 0 ] && echo "Please install mlt" && exit 1 + --enable-swig - Build the high level language bindings. + --swig-languages=[all | [java | perl | php | python | ruby | tcl]*] + - Languages to build (default: all) -if [ "$1" = "all" ] -then languages="java perl php python ruby tcl" -elif [ "$1" != "" ] -then languages=$* -else echo "Usage: ./configure [ all | language * ]" - exit 0 -fi +EOF -for i in java perl php python ruby tcl -do - rm -f .$i -done +else + + which swig > /dev/null 2>&1 + [ $? != 0 ] && echo "Please install swig" && exit 1 + + languages="java perl php python ruby tcl" + touch config.mak -for i in $languages -do - echo -n "Configuring $i ... " - if [ -d "$i" ] - then - cd $i && - output=`./build` - if [ $? == 0 ] - then echo "OK" - touch ../.$i - elif [ "$output" == "" ] - then - echo "Failed" - else - echo $output - fi - cd .. - else - echo "Unknown" - fi -done + # Iterate through arguments + for i in "$@" + do + case $i in + --swig-languages=* ) echo SUBDIRS = ${i#--swig-languages=} > config.mak ;; + esac + done +fi diff --git a/src/swig/java/build b/src/swig/java/build index 5d1ffb8e..e16127b9 100755 --- a/src/swig/java/build +++ b/src/swig/java/build @@ -1,5 +1,11 @@ #!/bin/sh +if [ "$1" = "clean" ] +then + ( cd `dirname $0`; rm -rf *.cxx *.so mlt.i ../.java *.class src_swig ) + exit 0 +fi + path=`which java 2> /dev/null` if [ $? = 0 ] diff --git a/src/swig/perl/build b/src/swig/perl/build index 93e532ca..a376899d 100755 --- a/src/swig/perl/build +++ b/src/swig/perl/build @@ -1,3 +1,9 @@ #!/bin/sh + +if [ "$1" = "clean" ] +then + ( cd `dirname $0`; rm -f *.cxx *.so mlt.i ../.perl mlt.pm ) + exit 0 +fi + perl Makefile.PL || exit 1 -make diff --git a/src/swig/php/build b/src/swig/php/build index 4074b877..b966b328 100755 --- a/src/swig/php/build +++ b/src/swig/php/build @@ -1,5 +1,12 @@ #!/bin/sh +if [ "$1" = "clean" ] +then + ( cd `dirname $0`; rm -f *.cpp *.so mlt.i ../.php mlt.php *.h ) + exit 0 +fi + + ln -sf ../mlt.i swig -c++ -I../../mlt++ -I../.. -php5 -noproxy mlt.i g++ -fPIC -DPIC -D_GNU_SOURCE -c -rdynamic -pthread -I../.. `php-config --includes` mlt_wrap.cpp diff --git a/src/swig/python/build b/src/swig/python/build index a4ad605a..871c90ea 100755 --- a/src/swig/python/build +++ b/src/swig/python/build @@ -1,5 +1,11 @@ #!/bin/sh +if [ "$1" = "clean" ] +then + ( cd `dirname $0`; rm -f *.cxx *.so mlt.i ../.python mlt.py? ) + exit 0 +fi + path=`which python 2> /dev/null` if [ $? = 0 ] diff --git a/src/swig/ruby/build b/src/swig/ruby/build index 4f4f1f19..b878735b 100755 --- a/src/swig/ruby/build +++ b/src/swig/ruby/build @@ -1,8 +1,11 @@ #!/usr/bin/env ruby require 'mkmf' +if ARGV.shift == 'clean' + system( "rm -f *.cxx *.so mlt.i ../.ruby Makefile" ) + exit 0 +end system( "ln -sf ../mlt.i" ) system( "swig -c++ -ruby -I../../mlt++ -I../.. mlt.i" ) $CFLAGS += "-I../.." $LDFLAGS += " -L../../mlt++ -lmlt++" create_makefile('mlt') -system( 'make' ) diff --git a/src/swig/tcl/build b/src/swig/tcl/build index 53e44962..d3219049 100755 --- a/src/swig/tcl/build +++ b/src/swig/tcl/build @@ -1,5 +1,11 @@ #!/bin/sh +if [ "$1" = "clean" ] +then + ( cd `dirname $0`; rm -f *.cxx *.so mlt.i ../.tcl ) + exit 0 +fi + path=`which tclsh 2>/dev/null` if [ "$path" != "" ]