Bug 129216 Integrate Python xpcom bindings with build system

patch by Mark Hammond <mhammond@skippinet.com.au> / Remy C. Cool
<dev-python@smartology.nl> / Christian Persch <chpe@gnome.org>
r+a=bsmedberg
This commit is contained in:
cbiesinger%web.de 2005-06-17 21:03:43 +00:00
Родитель 17c630e890
Коммит bed187b21c
8 изменённых файлов: 147 добавлений и 5 удалений

Просмотреть файл

@ -1525,6 +1525,12 @@ for extension in $MOZ_EXTENSIONS; do
extensions/xmlterm/tests/Makefile
extensions/xmlterm/ui/Makefile
" ;;
python/xpcom ) MAKEFILES_extensions="$MAKEFILES_extensions
extensions/python/xpcom/Makefile
extensions/python/xpcom/src/Makefile
extensions/python/xpcom/src/loader/Makefile
extensions/python/xpcom/test/test_component/Makefile
" ;;
sql ) MAKEFILES_extensions="$MAKEFILES_extensions
$MAKEFILES_sql"
;;

Просмотреть файл

@ -510,6 +510,16 @@ MOZ_TOOLS_DIR = @MOZ_TOOLS_DIR@
MOZ_DEBUG_SYMBOLS = @MOZ_DEBUG_SYMBOLS@
MOZ_QUANTIFY = @MOZ_QUANTIFY@
#python options
PYTHON = @MOZ_PYTHON@
PYTHON_PREFIX = @MOZ_PYTHON_PREFIX@
PYTHON_INCLUDES = @MOZ_PYTHON_INCLUDES@
PYTHON_LIBS = @MOZ_PYTHON_LIBS@
PYTHON_DEBUG_SUFFIX = @MOZ_PYTHON_DEBUG_SUFFIX@
PYTHON_DLL_SUFFIX = @MOZ_PYTHON_DLL_SUFFIX@
PYTHON_VER_DOTTED = @MOZ_PYTHON_VER_DOTTED@
PYTHON_VER = @MOZ_PYTHON_VER@
# Codesighs tools option, enables win32 mapfiles.
MOZ_MAPINFO = @MOZ_MAPINFO@

Просмотреть файл

@ -526,6 +526,7 @@ psap.h
Pt.h
pthread.h
pwd.h
Python.h
qaction.h
qapplication.h
qcheckbox.h

Просмотреть файл

@ -6188,6 +6188,79 @@ fi
AC_SUBST(MOZ_XUL)
dnl ========================================================
dnl Python XPCOM bindings - if enabled, we must locate Python.
dnl ========================================================
dnl
dnl Allow PYTHON to point to the Python interpreter to use.
dnl If not set, we use whatever Python we can find. Setting
dnl PYTHON will allow you to build from any Python version you nominate
dnl
dnl If future Python based extensions are added, some of this should
dnl be split out appropriately.
MOZ_PYTHON=
MOZ_PYTHON_PREFIX=
MOZ_PYTHON_INCLUDES=
MOZ_PYTHON_LIBS=
MOZ_PYTHON_VER=
MOZ_PYTHON_VER_DOTTED=
MOZ_PYTHON_DEBUG_SUFFIX=
MOZ_PYTHON_DLL_SUFFIX=
if test `echo "$MOZ_EXTENSIONS" | grep -c python/xpcom` -ne 0; then
dnl If PYTHON is in the environment, we use that
if test -z "$PYTHON"; then
AC_PATH_PROG(PYTHON, python, :)
fi
if test "$OS_ARCH" = "WINNT"; then
dnl Convert to cygwin style "mixed" (ie, "c:/path/file.exe")
PYTHON=`cygpath -t mixed $PYTHON`
fi
if test ! -x "$PYTHON"; then
AC_MSG_ERROR([Could not find Python - please adjust your PATH, or set PYTHON.])
fi
MOZ_PYTHON=$PYTHON
dnl Ask Python what its version number is
MOZ_PYTHON_VER=`$PYTHON -c "import sys;print '%d%d' % sys.version_info[[0:2]]"`
MOZ_PYTHON_VER_DOTTED=`$PYTHON -c "import sys;print '%d.%d' % sys.version_info[[0:2]]"`
dnl Ask for the Python "prefix" (ie, home/source dir)
MOZ_PYTHON_PREFIX=`$PYTHON -c "import sys; print sys.prefix"`
dnl Setup the include and library directories.
if test "$OS_ARCH" = "WINNT"; then
MOZ_PYTHON_PREFIX=`cygpath -t mixed $MOZ_PYTHON_PREFIX`
dnl Source trees have "include" and "PC" for .h, and "PCbuild" for .lib
dnl Binary trees have "include" for .h, and "libs" for .lib
dnl We add 'em both - along with quotes, to handle spaces.
MOZ_PYTHON_DLL_SUFFIX=.pyd
MOZ_PYTHON_INCLUDES="\"-I$MOZ_PYTHON_PREFIX/include\" \"-I$MOZ_PYTHON_PREFIX/PC\""
MOZ_PYTHON_LIBS="\"/libpath:$MOZ_PYTHON_PREFIX/PCBuild\" \"/libpath:$MOZ_PYTHON_PREFIX/libs\""
else
dnl Non-Windows include and libs
MOZ_PYTHON_DLL_SUFFIX=$DLL_SUFFIX
PYTHON_INCLUDE_SRC=$MOZ_PYTHON_PREFIX/include/python$MOZ_PYTHON_VER_DOTTED
PYTHON_LIB_SRC=`$PYTHON -c 'from distutils import sysconfig; print sysconfig.get_config_var("LIBPL")'`
if test ! -f $PYTHON_INCLUDE_SRC/Python.h; then
AC_MSG_ERROR([Include directory $PYTHON_INCLUDE_SRC not found or does not contain development headers])
fi
MOZ_PYTHON_INCLUDES="-I$PYTHON_INCLUDE_SRC"
MOZ_PYTHON_LIBS="-L$PYTHON_LIB_SRC -lpython$MOZ_PYTHON_VER_DOTTED"
fi
dnl Handle "_d" on Windows
if test "$OS_ARCH" = "WINNT" && test -n "$MOZ_DEBUG"; then
MOZ_PYTHON_DEBUG_SUFFIX="_d"
else
MOZ_PYTHON_DEBUG_SUFFIX=
fi
AC_MSG_RESULT(Building PyXPCOM using Python-$MOZ_PYTHON_VER_DOTTED from $MOZ_PYTHON_PREFIX)
fi
AC_SUBST(MOZ_PYTHON)
AC_SUBST(MOZ_PYTHON_PREFIX)
AC_SUBST(MOZ_PYTHON_INCLUDES)
AC_SUBST(MOZ_PYTHON_LIBS)
AC_SUBST(MOZ_PYTHON_VER)
AC_SUBST(MOZ_PYTHON_VER_DOTTED)
AC_SUBST(MOZ_PYTHON_DEBUG_SUFFIX)
AC_SUBST(MOZ_PYTHON_DLL_SUFFIX)
dnl ========================================================
dnl disable profile sharing
dnl ========================================================

Просмотреть файл

@ -46,14 +46,53 @@ DIRS = \
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
pyexecdir = @libdir@/python$(PYTHON_VER_DOTTED)/site-packages
PYSRCS_XPCOM = \
__init__.py \
components.py \
file.py \
nsError.py \
register.py \
xpcom_consts.py \
xpt.py \
$(NULL)
PYSRCS_XPCOMCLIENT = \
__init__.py \
$(NULL)
PYSRCS_XPCOMSERVER = \
__init__.py \
enumerator.py \
factory.py \
loader.py \
module.py \
policy.py \
$(NULL)
PYSRCS_XPCOMTOOLS = \
regxpcom.py \
tracer_demo.py \
$(NULL)
PYSRCS_XPCOM := $(addprefix $(srcdir)/,$(PYSRCS_XPCOM))
PYSRCS_XPCOMCLIENT := $(addprefix $(srcdir)/client/,$(PYSRCS_XPCOMCLIENT))
PYSRCS_XPCOMSERVER := $(addprefix $(srcdir)/server/,$(PYSRCS_XPCOMSERVER))
PYSRCS_XPCOMTOOLS := $(addprefix $(srcdir)/tools/,$(PYSRCS_XPCOMTOOLS))
include $(topsrcdir)/config/rules.mk
libs::
$(INSTALL) *.py $(DIST)/bin/python/xpcom
$(INSTALL) client/*.py $(DIST)/bin/python/xpcom/client
$(INSTALL) server/*.py $(DIST)/bin/python/xpcom/server
$(INSTALL) tools/*.py $(DIST)/bin/python/xpcom/tools
$(INSTALL) $(PYSRCS_XPCOM) $(DIST)/bin/python/xpcom
$(INSTALL) $(PYSRCS_XPCOMCLIENT) $(DIST)/bin/python/xpcom/client
$(INSTALL) $(PYSRCS_XPCOMSERVER) $(DIST)/bin/python/xpcom/server
$(INSTALL) $(PYSRCS_XPCOMTOOLS) $(DIST)/bin/python/xpcom/tools
install::
$(SYSINSTALL) $(IFLAGS1) $(PYSRCS_XPCOM) $(DISTDIR)$(pyexecdir)/xpcom
$(SYSINSTALL) $(IFLAGS1) $(PYSRCS_XPCOMCLIENT) $(DISTDIR)$(pyexecdir)/xpcom/client
$(SYSINSTALL) $(IFLAGS1) $(PYSRCS_XPCOMSERVER) $(DISTDIR)$(pyexecdir)/xpcom/server
clobber::
rm -rf $(DIST)/bin/python/xpcom

Просмотреть файл

@ -41,6 +41,7 @@ DEPTH=../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
pyexecdir = @libdir@/python$(PYTHON_VER_DOTTED)/site-packages
DIRS = loader $(NULL)
@ -50,6 +51,9 @@ MODULE = pyxpcom
LIBRARY_NAME = _xpcom$(PYTHON_DEBUG_SUFFIX)
#MODULE_NAME =
REQUIRES = xpcom string $(NULL)
MOZILLA_INTERNAL_API = 1
FORCE_SHARED_LIB = 1
FORCE_USE_PIC = 1
DLL_SUFFIX=$(PYTHON_DLL_SUFFIX)
LOCAL_INCLUDES = $(PYTHON_INCLUDES)
@ -97,6 +101,12 @@ endif
rm -f $(DIST)/bin/$(SHARED_LIBRARY)
rm -f $(DIST)/lib/$(IMPORT_LIBRARY)
install::
ifneq ($(OS_ARCH),WINNT)
$(SYSINSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(DISTDIR)$(pyexecdir)/xpcom
mv $(DISTDIR)$(pyexecdir)/xpcom/$(SHARED_LIBRARY) $(DISTDIR)$(pyexecdir)/xpcom/_xpcom$(PYTHON_DLL_SUFFIX)
endif
clobber::
rm -f *.ilk *.pdb

Просмотреть файл

@ -47,6 +47,9 @@ include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = pyloader
IS_COMPONENT = 1
REQUIRES = xpcom string xpcom_obsolete $(NULL)
MOZILLA_INTERNAL_API = 1
FORCE_SHARED_LIB = 1
FORCE_USE_PIC = 1
LOCAL_INCLUDES = $(PYTHON_INCLUDES)
EXTRA_LIBS += $(PYTHON_LIBS)

Просмотреть файл

@ -54,7 +54,7 @@ include $(topsrcdir)/config/config.mk
include $(topsrcdir)/config/rules.mk
libs::
$(INSTALL) ./py_test_component.py $(DIST)/bin/components
$(INSTALL) $(srcdir)/py_test_component.py $(DIST)/bin/components
clobber::
$(RM) $(DIST)/bin/components/py_test_component.py