mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
building: add python bindings
This commit is contained in:
parent
66efde4cc5
commit
f9b9ec6204
6 changed files with 176 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
||||||
DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc
|
DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc
|
||||||
|
|
||||||
SUBDIRS = ges tests tools common m4 pkgconfig docs
|
SUBDIRS = ges tests tools common m4 pkgconfig docs bindings
|
||||||
|
|
||||||
DIST_SUBDIRS = $(SUBDIRS)
|
DIST_SUBDIRS = $(SUBDIRS)
|
||||||
|
|
||||||
|
|
66
acinclude.m4
Normal file
66
acinclude.m4
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
## this one is commonly used with AM_PATH_PYTHONDIR ...
|
||||||
|
dnl AM_CHECK_PYMOD(MODNAME [,SYMBOL [,ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]]])
|
||||||
|
dnl Check if a module containing a given symbol is visible to python.
|
||||||
|
AC_DEFUN([AM_CHECK_PYMOD],
|
||||||
|
[AC_REQUIRE([AM_PATH_PYTHON])
|
||||||
|
py_mod_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'`
|
||||||
|
AC_MSG_CHECKING(for ifelse([$2],[],,[$2 in ])python module $1)
|
||||||
|
AC_CACHE_VAL(py_cv_mod_$py_mod_var, [
|
||||||
|
ifelse([$2],[], [prog="
|
||||||
|
import sys
|
||||||
|
try:
|
||||||
|
import $1
|
||||||
|
except ImportError:
|
||||||
|
sys.exit(1)
|
||||||
|
except:
|
||||||
|
sys.exit(0)
|
||||||
|
sys.exit(0)"], [prog="
|
||||||
|
import $1
|
||||||
|
$1.$2"])
|
||||||
|
if $PYTHON -c "$prog" 1>&AC_FD_CC 2>&AC_FD_CC
|
||||||
|
then
|
||||||
|
eval "py_cv_mod_$py_mod_var=yes"
|
||||||
|
else
|
||||||
|
eval "py_cv_mod_$py_mod_var=no"
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
py_val=`eval "echo \`echo '$py_cv_mod_'$py_mod_var\`"`
|
||||||
|
if test "x$py_val" != xno; then
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
ifelse([$3], [],, [$3
|
||||||
|
])dnl
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
ifelse([$4], [],, [$4
|
||||||
|
])dnl
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
|
||||||
|
dnl a macro to check for ability to create python extensions
|
||||||
|
dnl AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
|
||||||
|
dnl function also defines PYTHON_INCLUDES
|
||||||
|
AC_DEFUN([AM_CHECK_PYTHON_HEADERS],
|
||||||
|
[AC_REQUIRE([AM_PATH_PYTHON])
|
||||||
|
AC_MSG_CHECKING(for headers required to compile python extensions)
|
||||||
|
dnl deduce PYTHON_INCLUDES
|
||||||
|
py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
|
||||||
|
py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
|
||||||
|
if $PYTHON-config --help 2>/dev/null; then
|
||||||
|
PYTHON_INCLUDES=`$PYTHON-config --includes 2>/dev/null`
|
||||||
|
else
|
||||||
|
PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
|
||||||
|
if test "$py_prefix" != "$py_exec_prefix"; then
|
||||||
|
PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
AC_SUBST(PYTHON_INCLUDES)
|
||||||
|
dnl check if the headers exist:
|
||||||
|
save_CPPFLAGS="$CPPFLAGS"
|
||||||
|
CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
|
||||||
|
AC_TRY_CPP([#include <Python.h>],dnl
|
||||||
|
[AC_MSG_RESULT(found)
|
||||||
|
$1],dnl
|
||||||
|
[AC_MSG_RESULT(not found)
|
||||||
|
$2])
|
||||||
|
CPPFLAGS="$save_CPPFLAGS"
|
||||||
|
])
|
1
bindings/makefile.am
Normal file
1
bindings/makefile.am
Normal file
|
@ -0,0 +1 @@
|
||||||
|
SUBDIRS = python
|
41
bindings/python/Makefile.am
Normal file
41
bindings/python/Makefile.am
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
SUBDIRS = codegen
|
||||||
|
pkgpyexecdir = $(pyexecdir)/gst-$(GST_MAJORMINOR)/gst
|
||||||
|
|
||||||
|
# we install everything in pyexecdir; otherwise you end up with a mess for
|
||||||
|
# multilib
|
||||||
|
pygesdir = $(pkgpyexecdir)
|
||||||
|
pyges_PYTHON =
|
||||||
|
|
||||||
|
pygesexecdir = $(pkgpyexecdir)
|
||||||
|
pygesexec_LTLIBRARIES = ges.la
|
||||||
|
|
||||||
|
DEFS = $(srcdir)/ges-types.defs $(srcdir)/ges.defs
|
||||||
|
defs_DATA = $(DEFS)
|
||||||
|
defsdir = $(pkgdatadir)/$(GST_MAJORMINOR)/defs
|
||||||
|
OVERRIDES = ges.override
|
||||||
|
|
||||||
|
INCLUDES = -I$(top_srcdir) -I$(srcdir) $(PYTHON_INCLUDES)
|
||||||
|
|
||||||
|
ges_la_CFLAGS = -I$(top_srcdir)\
|
||||||
|
$(PYGOBJECT_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) -Wno-write-strings
|
||||||
|
ges_la_LDFLAGS = -export-symbols-regex "^(initges|_PyGObject_API).*" \
|
||||||
|
-module -avoid-version $(GST_PLUGIN_LDFLAGS)
|
||||||
|
ges_la_LIBADD = $(top_builddir)/ges/libges-@GST_MAJORMINOR@.la \
|
||||||
|
$(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) \
|
||||||
|
-lges-@GST_MAJORMINOR@ -lges-@GST_MAJORMINOR@ \
|
||||||
|
-lges-@GST_MAJORMINOR@ $(GST_LIBS) $(LIBM)
|
||||||
|
ges_la_SOURCES = gesmodule.c
|
||||||
|
nodist_ges_la_SOURCES = ges.c
|
||||||
|
|
||||||
|
EXTRA_DIST = $(defs_DATA) $(OVERRIDES) arg-types.py
|
||||||
|
|
||||||
|
CLEANFILES = ges.c
|
||||||
|
|
||||||
|
.defs.c:
|
||||||
|
($(PYTHON) $(srcdir)/codegen/codegen.py \
|
||||||
|
--load-types $(srcdir)/codegen/argtypes.py \
|
||||||
|
--register $(srcdir)/ges-types.defs \
|
||||||
|
--override $(srcdir)/$*.override \
|
||||||
|
--prefix pyges $<) > gen-$*.c \
|
||||||
|
&& cp gen-$*.c $*.c \
|
||||||
|
&& rm -f gen-$*.c
|
15
bindings/python/codegen/Makefile.am
Normal file
15
bindings/python/codegen/Makefile.am
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
EXTRA_DIST = \
|
||||||
|
argtypes.py \
|
||||||
|
code-coverage.py \
|
||||||
|
codegen.py \
|
||||||
|
definitions.py \
|
||||||
|
defsparser.py \
|
||||||
|
docextract.py \
|
||||||
|
docgen.py \
|
||||||
|
h2def.py \
|
||||||
|
__init__.py \
|
||||||
|
mergedefs.py \
|
||||||
|
mkskel.py \
|
||||||
|
override.py \
|
||||||
|
reversewrapper.py \
|
||||||
|
scmexpr.py
|
52
configure.ac
52
configure.ac
|
@ -60,6 +60,7 @@ AS_AUTOTOOLS_ALTERNATE
|
||||||
|
|
||||||
dnl Add parameters for aclocal
|
dnl Add parameters for aclocal
|
||||||
AC_SUBST(ACLOCAL_AMFLAGS, "-I m4 -I common/m4")
|
AC_SUBST(ACLOCAL_AMFLAGS, "-I m4 -I common/m4")
|
||||||
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
|
|
||||||
dnl *** check for arguments to configure ***
|
dnl *** check for arguments to configure ***
|
||||||
|
|
||||||
|
@ -117,6 +118,54 @@ GTK_DOC_CHECK([1.3])
|
||||||
AS_PATH_PYTHON([2.1])
|
AS_PATH_PYTHON([2.1])
|
||||||
AG_GST_PLUGIN_DOCS([1.3],[2.1])
|
AG_GST_PLUGIN_DOCS([1.3],[2.1])
|
||||||
|
|
||||||
|
dnl check for python
|
||||||
|
AM_PATH_PYTHON
|
||||||
|
AC_MSG_CHECKING(for python >= 2.3)
|
||||||
|
prog="
|
||||||
|
import sys, string
|
||||||
|
minver = (2,3,0,'final',0)
|
||||||
|
if sys.version_info < minver:
|
||||||
|
sys.exit(1)
|
||||||
|
sys.exit(0)"
|
||||||
|
|
||||||
|
if $PYTHON -c "$prog" 1>&AC_FD_CC 2>&AC_FD_CC
|
||||||
|
then
|
||||||
|
HAVE_PYTHON=yes
|
||||||
|
AC_MSG_RESULT(okay)
|
||||||
|
else
|
||||||
|
HAVE_PYTHON=no
|
||||||
|
AC_MSG_RESULT(no python)
|
||||||
|
fi
|
||||||
|
|
||||||
|
AM_CHECK_PYTHON_HEADERS([HAVE_PYTHON_HEADERS=yes],[HAVE_PYTHON_HEADERS=no])
|
||||||
|
|
||||||
|
dnl check for pygobject (optional, used in the bindings)
|
||||||
|
PYGOBJECT_REQ=2.11.2
|
||||||
|
PKG_CHECK_MODULES(PYGOBJECT, pygobject-2.0 >= $PYGOBJECT_REQ,
|
||||||
|
[HAVE_PYGOBJECT="yes"], [HAVE_PYGOBJECT="no"])
|
||||||
|
AC_SUBST(PYGOBJECT_CFLAGS)
|
||||||
|
|
||||||
|
dnl check for gst-python
|
||||||
|
PKG_CHECK_MODULES(PYGST, gst-python-0.10,
|
||||||
|
[HAVE_PYGST="yes"], [HAVE_PYGST="no"])
|
||||||
|
|
||||||
|
if test "x$HAVE_PYGST" = "xyes"; then
|
||||||
|
PYGST_DEFSDIR=`pkg-config gst-python-0.10 --variable=defsdir`
|
||||||
|
fi
|
||||||
|
AC_SUBST(PYGST_DEFSDIR, $PYGST_DEFSDIR)
|
||||||
|
|
||||||
|
if test \
|
||||||
|
"x$HAVE_PYTHON" = "xyes" -a \
|
||||||
|
"x$HAVE_PYTHON_HEADERS" = "xyes" -a \
|
||||||
|
"x$HAVE_PYGOBJECT" = "xyes" -a \
|
||||||
|
"x$HAVE_PYGST" = "xyes"; then
|
||||||
|
HAVE_PYTHON_BINDINGS="yes"
|
||||||
|
else
|
||||||
|
HAVE_PYTHON_BINDINGS="no"
|
||||||
|
fi
|
||||||
|
|
||||||
|
AM_CONDITIONAL(WITH_PYTHON, [test "x$HAVE_PYTHON_BINDINGS" = "xyes"])
|
||||||
|
|
||||||
dnl *** checks for libraries ***
|
dnl *** checks for libraries ***
|
||||||
|
|
||||||
dnl check for libm, for sin() etc.
|
dnl check for libm, for sin() etc.
|
||||||
|
@ -301,6 +350,9 @@ common/m4/Makefile
|
||||||
gst-editing-services.spec
|
gst-editing-services.spec
|
||||||
m4/Makefile
|
m4/Makefile
|
||||||
ges/Makefile
|
ges/Makefile
|
||||||
|
bindings/makefile
|
||||||
|
bindings/python/Makefile
|
||||||
|
bindings/python/codegen/Makefile
|
||||||
tests/Makefile
|
tests/Makefile
|
||||||
tests/check/Makefile
|
tests/check/Makefile
|
||||||
tests/examples/Makefile
|
tests/examples/Makefile
|
||||||
|
|
Loading…
Reference in a new issue