mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 23:14:46 +00:00
Make the plugin loader work on OSX with the standard python install.
This commit is contained in:
parent
01ce2d2060
commit
e564f783ca
3 changed files with 27 additions and 3 deletions
27
acinclude.m4
27
acinclude.m4
|
@ -71,19 +71,42 @@ dnl function also defines PYTHON_LIBS
|
||||||
AC_DEFUN([AM_CHECK_PYTHON_LIBS],
|
AC_DEFUN([AM_CHECK_PYTHON_LIBS],
|
||||||
[AC_REQUIRE([AM_CHECK_PYTHON_HEADERS])
|
[AC_REQUIRE([AM_CHECK_PYTHON_HEADERS])
|
||||||
AC_MSG_CHECKING(for libraries required to embed python)
|
AC_MSG_CHECKING(for libraries required to embed python)
|
||||||
|
|
||||||
dnl deduce PYTHON_LIBS
|
dnl deduce PYTHON_LIBS
|
||||||
py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
|
|
||||||
if $PYTHON-config --help 2>/dev/null; then
|
if $PYTHON-config --help 2>/dev/null; then
|
||||||
PYTHON_LIBS=`$PYTHON-config --ldflags 2>/dev/null`
|
PYTHON_LIBS=`$PYTHON-config --ldflags 2>/dev/null`
|
||||||
PYTHON_LIB=`$PYTHON -c "import distutils.sysconfig as s; print s.get_python_lib(standard_lib=1)"`
|
PYTHON_LIB=`$PYTHON -c "import distutils.sysconfig as s; print s.get_python_lib(standard_lib=1)"`
|
||||||
PYTHON_LIB_LOC=$PYTHON_LIB/config
|
if echo "$host_os" | grep darwin >/dev/null 2>&1; then
|
||||||
|
dnl OSX is a pain. Python as shipped by apple installs libpython in /usr/lib
|
||||||
|
dnl so we hardcode that. Other systems can use --with-libpython-dir to
|
||||||
|
dnl overrid this.
|
||||||
|
PYTHON_LIB_LOC=/usr/lib
|
||||||
|
else
|
||||||
|
PYTHON_LIB_LOC=$PYTHON_LIB/config
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
asd
|
asd
|
||||||
PYTHON_LIBS="-L${py_prefix}/lib -lpython${PYTHON_VERSION}"
|
PYTHON_LIBS="-L${py_prefix}/lib -lpython${PYTHON_VERSION}"
|
||||||
PYTHON_LIB_LOC="${py_prefix}/lib"
|
PYTHON_LIB_LOC="${py_prefix}/lib"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AC_ARG_WITH([libpython-dir],
|
||||||
|
AS_HELP_STRING([--with-libpython-dir], [the directory containing libpython${PYTHON_VERSION}]),
|
||||||
|
[
|
||||||
|
PYTHON_LIB_LOC=`echo "$withval" | sed -e 's/\/$//g'`
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
if echo "$host_os" | grep darwin >/dev/null 2>&1; then
|
||||||
|
dnl workaround libtool brokenness under OSX
|
||||||
|
PYTHON_LIB_SUFFIX=\\\"dylib\\\"
|
||||||
|
else
|
||||||
|
PYTHON_LIB_SUFFIX=G_MODULE_SUFFIX
|
||||||
|
fi
|
||||||
|
|
||||||
AC_SUBST(PYTHON_LIBS)
|
AC_SUBST(PYTHON_LIBS)
|
||||||
AC_SUBST(PYTHON_LIB_LOC)
|
AC_SUBST(PYTHON_LIB_LOC)
|
||||||
|
AC_SUBST(PYTHON_LIB_SUFFIX)
|
||||||
dnl check if the headers exist:
|
dnl check if the headers exist:
|
||||||
save_LIBS="$LIBS"
|
save_LIBS="$LIBS"
|
||||||
LIBS="$LIBS $PYTHON_LIBS"
|
LIBS="$LIBS $PYTHON_LIBS"
|
||||||
|
|
|
@ -3,6 +3,7 @@ plugin_LTLIBRARIES = libgstpython.la
|
||||||
INCLUDES = $(PYGOBJECT_CFLAGS) $(GST_CFLAGS)\
|
INCLUDES = $(PYGOBJECT_CFLAGS) $(GST_CFLAGS)\
|
||||||
-DPYTHON_VERSION=\"$(PYTHON_VERSION)\" \
|
-DPYTHON_VERSION=\"$(PYTHON_VERSION)\" \
|
||||||
-DPY_LIB_LOC="\"$(PYTHON_LIB_LOC)\"" \
|
-DPY_LIB_LOC="\"$(PYTHON_LIB_LOC)\"" \
|
||||||
|
-DPY_LIB_SUFFIX=$(PYTHON_LIB_SUFFIX) \
|
||||||
$(PYTHON_INCLUDES)
|
$(PYTHON_INCLUDES)
|
||||||
|
|
||||||
libgstpython_la_SOURCES = gstpythonplugin.c
|
libgstpython_la_SOURCES = gstpythonplugin.c
|
||||||
|
|
|
@ -349,7 +349,7 @@ plugin_init (GstPlugin * plugin)
|
||||||
GST_LOG ("loading libpython");
|
GST_LOG ("loading libpython");
|
||||||
libpython =
|
libpython =
|
||||||
g_module_open (PY_LIB_LOC "/libpython" PYTHON_VERSION "."
|
g_module_open (PY_LIB_LOC "/libpython" PYTHON_VERSION "."
|
||||||
G_MODULE_SUFFIX, 0);
|
PY_LIB_SUFFIX, 0);
|
||||||
if (!libpython) {
|
if (!libpython) {
|
||||||
GST_WARNING ("Couldn't g_module_open libpython. Reason: %s",
|
GST_WARNING ("Couldn't g_module_open libpython. Reason: %s",
|
||||||
g_module_error ());
|
g_module_error ());
|
||||||
|
|
Loading…
Reference in a new issue