]> git.sesse.net Git - mlt/blob - src/swig/python/build
Further integrate swig into build system.
[mlt] / src / swig / python / build
1 #!/bin/sh
2
3 if [ "$1" = "clean" ]
4 then
5         ( cd `dirname $0`; rm -f *.cxx *.so mlt.i ../.python mlt.py? )
6         exit 0
7 fi
8
9 path=`which python 2> /dev/null`
10
11 if [ $? = 0 ]
12 then
13         # Change this as needed
14         export PYTHON_INCLUDE=`python -c "import sys;print \"%s/include/python%d.%d\"%(sys.prefix,sys.version_info[0],sys.version_info[1])"`
15
16         [ ! -d "$PYTHON_INCLUDE" ] && echo python development missing && exit 1
17
18         ln -sf ../mlt.i
19
20         # Invoke swig
21         swig -c++ -I../../mlt++ -I../.. -python mlt.i || exit $?
22
23         # Compile the wrapper
24         g++ -fPIC -D_GNU_SOURCE -c -rdynamic -pthread -I../.. -I$PYTHON_INCLUDE mlt_wrap.cxx || exit $?
25
26         # Create the module
27         gcc -shared mlt_wrap.o -L../../mlt++ -lmlt++ -o _mlt.so || exit $?
28 else
29         echo Python not installed.
30         exit 1
31 fi