mirror of
https://github.com/boostorg/python.git
synced 2026-01-24 06:02:14 +00:00
added a build system and updated documentation
[SVN r8369]
This commit is contained in:
15
libs/python/Makefile
Normal file
15
libs/python/Makefile
Normal file
@@ -0,0 +1,15 @@
|
||||
all: lib test
|
||||
|
||||
|
||||
lib::
|
||||
@cd src ; $(MAKE) lib ; cd ..
|
||||
|
||||
test::
|
||||
@cd test ; $(MAKE) test ; cd ..
|
||||
|
||||
install: all
|
||||
@cd src ; $(MAKE) install ; cd ..
|
||||
|
||||
clean:
|
||||
@cd src ; $(MAKE) clean ; cd ..
|
||||
@cd test ; $(MAKE) clean ; cd ..
|
||||
48
libs/python/README
Normal file
48
libs/python/README
Normal file
@@ -0,0 +1,48 @@
|
||||
To build using g++:
|
||||
===================
|
||||
|
||||
> setenv CXX g++
|
||||
>
|
||||
> ./configure \
|
||||
--with-pythoninc=/usr/local/include/python1.5 \
|
||||
--with-extra-includes=/usr/local/STLport
|
||||
>
|
||||
> make install
|
||||
|
||||
where
|
||||
--with-pythoninc: the directory where 'Python.h' lives
|
||||
--with-extra-includes: the directory where STLport includes
|
||||
or the 'limits' header are
|
||||
|
||||
|
||||
To build using another compiler:
|
||||
================================
|
||||
|
||||
> setenv CXX CC # your compiler
|
||||
>
|
||||
> ./configure \
|
||||
--with-pythoninc=/usr/local/include/python1.5 \
|
||||
--enable-shared-linker=-G \
|
||||
--enable-position-independent-code=-pic
|
||||
>
|
||||
> make install
|
||||
|
||||
where
|
||||
--with-pythoninc: as above
|
||||
--enable-shared-linker: flag that tells the compiler to build a
|
||||
shared library (needed for Python modules)
|
||||
--enable-position-independent-code: flag that tells the compiler
|
||||
to create position independent code (needed for shared linking)
|
||||
|
||||
|
||||
more options:
|
||||
=============
|
||||
|
||||
> ./configure --help
|
||||
|
||||
of particular interest are:
|
||||
|
||||
--libdir: the install directory for 'libboostpython.a'
|
||||
--enable-shared-library-extension: the file extension for shared libraries
|
||||
|
||||
for most options, configure provides reaonable defaults, given in brackets
|
||||
21
libs/python/build/Makefile.in
Normal file
21
libs/python/build/Makefile.in
Normal file
@@ -0,0 +1,21 @@
|
||||
CXXINCLUDES = @CXXINCLUDES@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CXX = @CXX@
|
||||
CXX_SHARED_LINKER = @CXX_SHARED_LINKER@
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
TARGET_LIBDIR = @libdir@
|
||||
TARGET_LIBNAME = boostpython
|
||||
TARGET_LIBFILENAME = lib$(TARGET_LIBNAME).a
|
||||
MODULE_EXTENSION = @shared_library_extension@
|
||||
|
||||
%.o: %.cpp
|
||||
$(CXX) $(CXXFLAGS) $(CXXINCLUDES) -c $*.cpp
|
||||
|
||||
%.d: %.cpp
|
||||
@echo creating $@
|
||||
@set -e; $(CXX) -M $(CXXFLAGS) $(CXXINCLUDES) -c $*.cpp \
|
||||
| sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
|
||||
[ -s $@ ] || rm -f $@
|
||||
|
||||
1012
libs/python/build/config.guess
vendored
Executable file
1012
libs/python/build/config.guess
vendored
Executable file
File diff suppressed because it is too large
Load Diff
1238
libs/python/build/config.sub
vendored
Executable file
1238
libs/python/build/config.sub
vendored
Executable file
File diff suppressed because it is too large
Load Diff
251
libs/python/build/install-sh
Executable file
251
libs/python/build/install-sh
Executable file
@@ -0,0 +1,251 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# install - install a program, script, or datafile
|
||||
# This comes from X11R5 (mit/util/scripts/install.sh).
|
||||
#
|
||||
# Copyright 1991 by the Massachusetts Institute of Technology
|
||||
#
|
||||
# Permission to use, copy, modify, distribute, and sell this software and its
|
||||
# documentation for any purpose is hereby granted without fee, provided that
|
||||
# the above copyright notice appear in all copies and that both that
|
||||
# copyright notice and this permission notice appear in supporting
|
||||
# documentation, and that the name of M.I.T. not be used in advertising or
|
||||
# publicity pertaining to distribution of the software without specific,
|
||||
# written prior permission. M.I.T. makes no representations about the
|
||||
# suitability of this software for any purpose. It is provided "as is"
|
||||
# without express or implied warranty.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch. It can only install one file at a time, a restriction
|
||||
# shared with many OS's install programs.
|
||||
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit="${DOITPROG-}"
|
||||
|
||||
|
||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
mkdirprog="${MKDIRPROG-mkdir}"
|
||||
|
||||
transformbasename=""
|
||||
transform_arg=""
|
||||
instcmd="$mvprog"
|
||||
chmodcmd="$chmodprog 0755"
|
||||
chowncmd=""
|
||||
chgrpcmd=""
|
||||
stripcmd=""
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=""
|
||||
dst=""
|
||||
dir_arg=""
|
||||
|
||||
while [ x"$1" != x ]; do
|
||||
case $1 in
|
||||
-c) instcmd="$cpprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd="$stripprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
*) if [ x"$src" = x ]
|
||||
then
|
||||
src=$1
|
||||
else
|
||||
# this colon is to work around a 386BSD /bin/sh bug
|
||||
:
|
||||
dst=$1
|
||||
fi
|
||||
shift
|
||||
continue;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ x"$src" = x ]
|
||||
then
|
||||
echo "install: no input file specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
dst=$src
|
||||
src=""
|
||||
|
||||
if [ -d $dst ]; then
|
||||
instcmd=:
|
||||
chmodcmd=""
|
||||
else
|
||||
instcmd=mkdir
|
||||
fi
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
|
||||
if [ -f $src -o -d $src ]
|
||||
then
|
||||
true
|
||||
else
|
||||
echo "install: $src does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ x"$dst" = x ]
|
||||
then
|
||||
echo "install: no destination specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# If destination is a directory, append the input filename; if your system
|
||||
# does not like double slashes in filenames, you may need to add some logic
|
||||
|
||||
if [ -d $dst ]
|
||||
then
|
||||
dst="$dst"/`basename $src`
|
||||
else
|
||||
true
|
||||
fi
|
||||
fi
|
||||
|
||||
## this sed command emulates the dirname command
|
||||
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
|
||||
# Make sure that the destination directory exists.
|
||||
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if [ ! -d "$dstdir" ]; then
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-${defaultIFS}}"
|
||||
|
||||
oIFS="${IFS}"
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
IFS="${oIFS}"
|
||||
|
||||
pathcomp=''
|
||||
|
||||
while [ $# -ne 0 ] ; do
|
||||
pathcomp="${pathcomp}${1}"
|
||||
shift
|
||||
|
||||
if [ ! -d "${pathcomp}" ] ;
|
||||
then
|
||||
$mkdirprog "${pathcomp}"
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
pathcomp="${pathcomp}/"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]
|
||||
then
|
||||
$doit $instcmd $dst &&
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
|
||||
else
|
||||
|
||||
# If we're going to rename the final executable, determine the name now.
|
||||
|
||||
if [ x"$transformarg" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
dstfile=`basename $dst $transformbasename |
|
||||
sed $transformarg`$transformbasename
|
||||
fi
|
||||
|
||||
# don't allow the sed command to completely eliminate the filename
|
||||
|
||||
if [ x"$dstfile" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
|
||||
$doit $instcmd $src $dsttmp &&
|
||||
|
||||
trap "rm -f ${dsttmp}" 0 &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits
|
||||
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||
|
||||
fi &&
|
||||
|
||||
|
||||
exit 0
|
||||
1438
libs/python/configure
vendored
Executable file
1438
libs/python/configure
vendored
Executable file
File diff suppressed because it is too large
Load Diff
230
libs/python/configure.in
Normal file
230
libs/python/configure.in
Normal file
@@ -0,0 +1,230 @@
|
||||
AC_INIT(src/extension_class.cpp)
|
||||
|
||||
AC_PREFIX_DEFAULT([`pwd | sed 's?/libs/python$??'`])
|
||||
|
||||
AC_CONFIG_AUX_DIR(build)
|
||||
AC_CANONICAL_SYSTEM
|
||||
|
||||
AC_CYGWIN
|
||||
AC_MINGW32
|
||||
|
||||
CCFLAGS=-O
|
||||
CXXFLAGS=-O
|
||||
AC_PROG_CXX
|
||||
|
||||
#########################################################
|
||||
|
||||
AC_DEFUN(AC_SHARED_LIBRARY_EXTENSION,
|
||||
[
|
||||
AC_REQUIRE([AC_CYGWIN])
|
||||
AC_REQUIRE([AC_MINGW32])
|
||||
if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
|
||||
shared_library_extension=".dll"
|
||||
else
|
||||
shared_library_extension=".so"
|
||||
fi
|
||||
AC_ARG_ENABLE(shared-library-extension,
|
||||
[ --enable-shared-library-extension: file extension for shared libraries
|
||||
(including the dot) [UNIX: .so | Win32: .dll] ],, )
|
||||
AC_SUBST(shared_library_extension)
|
||||
])
|
||||
|
||||
#########################################################
|
||||
|
||||
AC_DEFUN([AC_WITH_EXTRA_INCLUDES],
|
||||
[
|
||||
AC_ARG_WITH(extra-includes,
|
||||
[ --with-extra-includes=\"dir1 dir2 ...\" : look in these directories for include files],,)
|
||||
|
||||
for i in $with_extra_includes; do
|
||||
CINCLUDES="$CINCLUDES -I"$i
|
||||
CXXINCLUDES="$CXXINCLUDES -I"$i
|
||||
done
|
||||
])
|
||||
|
||||
#########################################################
|
||||
|
||||
AC_DEFUN([AC_ENABLE_SHARED_LINKER],
|
||||
[
|
||||
AC_ARG_ENABLE(shared-linker,
|
||||
[ --enable-shared-linker: which flag tells the compiler to create a shared library ?
|
||||
[-shared] ],
|
||||
, [enable_shared_linker="-shared"])
|
||||
AC_MSG_CHECKING(for how to build shared libraries )
|
||||
if test ! "$enable_shared_linker" = "no"; then
|
||||
CC_SHARED_LINKER="$(CC) $enable_shared_linker"
|
||||
CXX_SHARED_LINKER="$(CXX) $enable_shared_linker"
|
||||
AC_SUBST(CC_SHARED_LINKER)
|
||||
AC_SUBST(CXX_SHARED_LINKER)
|
||||
AC_MSG_RESULT([$(CC) $enable_shared_linker])
|
||||
else
|
||||
AC_MSG_RESULT("disabled")
|
||||
fi
|
||||
])
|
||||
|
||||
#########################################################
|
||||
|
||||
AC_DEFUN([AC_ENABLE_POSITION_INDEPENDENT_CODE],
|
||||
[
|
||||
AC_ARG_ENABLE(position-independent-code,
|
||||
[ --enable-position-independent-code: which flag tells the compiler to create
|
||||
position independent code ? [-fPIC] ],
|
||||
, [enable_position_independent_code="-fPIC"])
|
||||
AC_MSG_CHECKING(for how to create position independent code )
|
||||
if test ! "$enable_position_independent_code" = "no"; then
|
||||
CCFLAGS="$CCFLAGS $enable_position_independent_code"
|
||||
CXXFLAGS="$CXXFLAGS $enable_position_independent_code"
|
||||
AC_MSG_RESULT([$enable_position_independent_code])
|
||||
else
|
||||
AC_MSG_RESULT("disabled")
|
||||
fi
|
||||
])
|
||||
|
||||
#########################################################
|
||||
|
||||
dnl AC_EXTRACT_REGEX(list, regEx)
|
||||
dnl variable $regExResult returns the first entry in 'list' that matches the
|
||||
dnl regular expression 'regEx', using the 'expr' utility
|
||||
dnl $regExResult = "" if nothing is found
|
||||
AC_DEFUN(AC_EXTRACT_REGEX,
|
||||
[
|
||||
regExResult=""
|
||||
if test "$1" != ""; then
|
||||
for i in $1; do
|
||||
regExResult=`expr "$i" : "$2"`
|
||||
if test "$regExResult" != ""; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
])
|
||||
|
||||
#########################################################
|
||||
|
||||
dnl AC_FIND_PACKAGE(packageName, packageLib, packageInc, packageComment)
|
||||
dnl defines with_packageName=yes/no
|
||||
dnl packageNamelib=<path>/not found
|
||||
dnl packageNameinclude=<path>/not found
|
||||
dnl and adds the paths to $LIBS, $CINCLUDES, and $CXXINCLUDES
|
||||
dnl example:
|
||||
dnl AC_FIND_PACKAGE(tiff, tiff, tiff.h, support import/export of tiff images)
|
||||
AC_DEFUN([AC_FIND_PACKAGE],
|
||||
[
|
||||
AC_ARG_WITH([$1], [ --with-$1=dir : $4.
|
||||
if dir=yes: $1 package files will be searched for in
|
||||
some standard directories.
|
||||
if dir is a directory: $1 package files will be searched for
|
||||
using 'find' below dir.
|
||||
alternatively, you can specify:], ,)
|
||||
ifelse($2, "", ,[AC_ARG_WITH([$1lib], [ --with-$1lib=dir : the $1 package's lib directory], ,)])
|
||||
ifelse($3, "", ,[AC_ARG_WITH([$1inc], [ --with-$1inc=dir : the $1 package's include directory], ,)])
|
||||
|
||||
[$1]lib="not found"
|
||||
[$1]include="not found"
|
||||
|
||||
if test ${with_[$1]:-""} = "" -a ${with_[$1]lib:-""} = "" -a ${with_[$1]inc:-""} = ""; then
|
||||
with_[$1]="no"
|
||||
fi
|
||||
|
||||
if test ${with_[$1]:-""} != "no"; then
|
||||
if test ! [$2] = "" ; then # check for library
|
||||
AC_MSG_CHECKING([for lib$2 ])
|
||||
dirs=""
|
||||
if test -f ${with_[$1]lib:-""}/lib[$2].so; then
|
||||
dirs=${with_[$1]lib:-""}/lib[$2].so
|
||||
elif test -f ${with_[$1]lib:-""}/lib[$2].a; then
|
||||
dirs=${with_[$1]lib:-""}/lib[$2].a
|
||||
elif test -d ${with_[$1]:-""}; then
|
||||
dirs=`find $with_[$1] -name "lib[$2].so" -print; find $with_[$1] -name "lib[$2].a" -print`
|
||||
elif test ${with_[$1]:-""} = "yes"; then
|
||||
for i in /usr/local/lib /usr/local/gnu/lib /usr/local/[$1] /opt/lib /opt/gnu/lib /opt/[$1]; do
|
||||
if test -d $i; then
|
||||
dirs="$dirs "`find $i -name "lib[$2].so" -print; find $i -name "lib[$2].a" -print`
|
||||
fi
|
||||
done
|
||||
fi
|
||||
AC_EXTRACT_REGEX($dirs, \(.*lib\)/lib$2\.so)
|
||||
if test "$regExResult" = ""; then
|
||||
AC_EXTRACT_REGEX($dirs, \(.*lib\)/lib$2\.a)
|
||||
fi
|
||||
if test "$regExResult" = ""; then
|
||||
AC_EXTRACT_REGEX($dirs, \(.*\)/lib$2\.so)
|
||||
fi
|
||||
if test "$regExResult" = ""; then
|
||||
AC_EXTRACT_REGEX($dirs, \(.*\)/lib$2\.a)
|
||||
fi
|
||||
[$1]lib=${regExResult:-"not found"}
|
||||
AC_MSG_RESULT($[$1]lib)
|
||||
else
|
||||
[$1]lib=""
|
||||
fi
|
||||
|
||||
if test ! [$3] = "" ; then # check for header
|
||||
AC_MSG_CHECKING([for $3 ])
|
||||
if test -f ${with_[$1]inc:-""}/[$3]; then
|
||||
dirs=$with_[$1]inc/[$3]
|
||||
elif test -d ${with_[$1]:-""}; then
|
||||
dirs=`find $with_[$1] -name patsubst([$3], .*/, ) -print`
|
||||
elif test ${with_[$1]:-""} = "yes"; then
|
||||
for i in /usr/local/include /usr/local/gnu/include /usr/local/[$1] \
|
||||
/opt/include /opt/gnu/include /opt/[$1]; do
|
||||
if test -d $i; then
|
||||
dirs="$dirs "`find $i -name patsubst([$3], .*/, ) -print`
|
||||
fi
|
||||
done
|
||||
fi
|
||||
AC_EXTRACT_REGEX($dirs, \(.*include\)/patsubst([$3], \., \\.))
|
||||
if test "$regExResult" = ""; then
|
||||
AC_EXTRACT_REGEX($dirs, \(.*\)/patsubst([$3], \., \\.))
|
||||
fi
|
||||
[$1]include=${regExResult:-"not found"}
|
||||
AC_MSG_RESULT($[$1]include)
|
||||
else
|
||||
[$1]include=""
|
||||
fi
|
||||
|
||||
if test "$[$1]lib" = "not found" -o "$[$1]include" = "not found"; then
|
||||
with_[$1]="no"
|
||||
AC_MSG_WARN( Configuring without [$1] support)
|
||||
else
|
||||
with_[$1]="yes"
|
||||
if test ! [$2] = "" ; then
|
||||
LIBS="$LIBS -L$[$1]lib -l[$2]"
|
||||
fi
|
||||
if test ! [$3] = "" ; then
|
||||
CINCLUDES="$CINCLUDES -I$[$1]include"
|
||||
CXXINCLUDES="$CXXINCLUDES -I$[$1]include"
|
||||
AC_SUBST(CXXINCLUDES)
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
])
|
||||
|
||||
#########################################################
|
||||
|
||||
AC_WITH_EXTRA_INCLUDES()
|
||||
AC_ENABLE_SHARED_LINKER()
|
||||
AC_ENABLE_POSITION_INDEPENDENT_CODE()
|
||||
AC_SHARED_LIBRARY_EXTENSION()
|
||||
|
||||
#########################################################
|
||||
|
||||
AC_CHECK_PROG(python_prog, python, [yes], [not found])
|
||||
if test "$python_prog" = "yes"; then
|
||||
AC_FIND_PACKAGE(python, "", Python.h, Python includes (required!))
|
||||
else
|
||||
with_python="no"
|
||||
fi
|
||||
if test "$with_python" = "no"; then
|
||||
AC_MSG_ERROR(Python support required to install BPL)
|
||||
fi
|
||||
|
||||
#########################################################
|
||||
|
||||
boost_includes=[-I`pwd | sed 's?/libs/python$??'`]
|
||||
CXXINCLUDES="$CXXINCLUDES $boost_includes"
|
||||
|
||||
#########################################################
|
||||
|
||||
AC_OUTPUT(build/Makefile)
|
||||
@@ -11,11 +11,74 @@
|
||||
<p>
|
||||
Right now, the only supported configuration is one in which the BPL
|
||||
source files are statically linked with the source for your extension
|
||||
module. You may first build them into a library and link it with your
|
||||
extension module source, but the effect is the same as compiling all
|
||||
the source files together. Some users have successfully built the
|
||||
sources into a shared library, and support for a shared library
|
||||
build is planned, but not yet implemented. The BPL source files are:
|
||||
module. BPL comes with a standard build process that compiles the
|
||||
BPL sources, builds the library <code>'libboostpython.a'</code>,
|
||||
runs a comprehensive test suite and (upon success)
|
||||
copies the library into an installation directory specified by the
|
||||
user. To involke this build process, you need to do the following:
|
||||
|
||||
<h4>Compilation with GNU g++:</h4>
|
||||
|
||||
<blockquote><pre>
|
||||
> cd <boost_root>/libs/python
|
||||
> setenv CXX g++ # use g++
|
||||
>
|
||||
> ./configure \
|
||||
--with-pythoninc=/usr/local/include/python1.5 \
|
||||
--with-extra-includes=/usr/local/STLport
|
||||
>
|
||||
> make install
|
||||
</pre></blockquote>
|
||||
|
||||
where
|
||||
<blockquote><pre>
|
||||
--with-pythoninc: the directory where 'Python.h' lives
|
||||
--with-extra-includes: the directory where STLport includes
|
||||
or the 'limits' header are
|
||||
</pre></blockquote>
|
||||
|
||||
<h4>Compilation with another compiler:</h4>
|
||||
|
||||
<blockquote><pre>
|
||||
> cd <boost_root>/libs/python
|
||||
> setenv CXX CC # your compiler
|
||||
>
|
||||
> ./configure \
|
||||
--with-pythoninc=/usr/local/include/python1.5 \
|
||||
--enable-shared-linker=-G \
|
||||
--enable-position-independent-code=-pic
|
||||
>
|
||||
> make install
|
||||
</pre></blockquote>
|
||||
|
||||
where
|
||||
<blockquote><pre>
|
||||
--with-pythoninc: as above
|
||||
--enable-shared-linker: flag that tells the compiler to build a
|
||||
shared library (needed for Python modules)
|
||||
--enable-position-independent-code: flag that tells the compiler
|
||||
to create position independent code (needed for shared linking)
|
||||
</pre></blockquote>
|
||||
|
||||
<p>
|
||||
<code>configure</code> provides additional options that are listed
|
||||
after invoking
|
||||
|
||||
<blockquote><pre>
|
||||
> ./configure --help
|
||||
</pre></blockquote>
|
||||
|
||||
Reasonable defaults for each option are givem in brackets.
|
||||
Of particular interest are the following options:
|
||||
|
||||
<blockquote><pre>
|
||||
--libdir: the install directory for 'libboostpython.a'
|
||||
--enable-shared-library-extension: the file extension for shared libraries
|
||||
</pre></blockquote>
|
||||
|
||||
<p>
|
||||
If this build process doesn't work for you, you must compile the
|
||||
source files manually. The BPL source files are:
|
||||
<blockquote>
|
||||
<pre>
|
||||
<a href="../../../libs/python/src/extension_class.cpp">extclass.cpp</a>
|
||||
@@ -28,7 +91,12 @@
|
||||
<a href="../../../libs/python/src/classes.cpp">subclass.cpp</a>
|
||||
</pre>
|
||||
</blockquote>
|
||||
<p>
|
||||
You may first build them into a library and link it with your
|
||||
extension module source, but the effect is the same as compiling all
|
||||
the source files together. Some users have successfully built the
|
||||
sources into a shared library, and support for a shared library
|
||||
build is planned, but not yet implemented.
|
||||
<p>
|
||||
Next: <a href="enums.html">Enums</a>
|
||||
Previous: <a href="under-the-hood.html">A Peek Under the Hood</a>
|
||||
Up: <a href="index.html">Top</a>
|
||||
|
||||
27
libs/python/src/Makefile
Normal file
27
libs/python/src/Makefile
Normal file
@@ -0,0 +1,27 @@
|
||||
include ../build/Makefile
|
||||
|
||||
LIBSRC = \
|
||||
classes.cpp \
|
||||
conversions.cpp \
|
||||
extension_class.cpp \
|
||||
functions.cpp \
|
||||
init_function.cpp \
|
||||
module_builder.cpp \
|
||||
objects.cpp \
|
||||
types.cpp
|
||||
|
||||
LIBOBJ = $(LIBSRC:.cpp=.o)
|
||||
|
||||
lib: $(TARGET_LIBFILENAME)
|
||||
|
||||
install: lib
|
||||
@if [ ! -d $(TARGET_LIBDIR) ] ; then mkdir -p $(TARGET_LIBDIR) ; fi
|
||||
cp $(TARGET_LIBFILENAME) $(TARGET_LIBDIR)
|
||||
|
||||
$(TARGET_LIBFILENAME): $(LIBOBJ)
|
||||
rm -f $(TARGET_LIBFILENAME)
|
||||
ar cq $(TARGET_LIBFILENAME) $(LIBOBJ)
|
||||
|
||||
clean:
|
||||
rm -rf *.o *$(MODULE_EXTENSION) *.a *.d *.pyc *.bak a.out
|
||||
|
||||
19
libs/python/test/Makefile
Normal file
19
libs/python/test/Makefile
Normal file
@@ -0,0 +1,19 @@
|
||||
include ../build/Makefile
|
||||
|
||||
LIBBPL = ../src/$(TARGET_LIBFILENAME)
|
||||
|
||||
test: test_result
|
||||
@if [ ! -f test_result -o -s test_result ] ; then \
|
||||
echo "tests failed:" ; cat test_result ; exit 1; \
|
||||
else echo "tests OK" ; fi
|
||||
|
||||
test_result: testmodule$(MODULE_EXTENSION) comprehensive.py
|
||||
@rm -f test_result
|
||||
python comprehensive.py > test_result
|
||||
|
||||
testmodule$(MODULE_EXTENSION): $(LIBBPL) comprehensive.o
|
||||
$(CXX_SHARED_LINKER) -o testmodule$(MODULE_EXTENSION) comprehensive.o $(LIBBPL)
|
||||
|
||||
clean:
|
||||
rm -rf *.o *$(MODULE_EXTENSION) *.a *.d *.pyc *.bak a.out test_result
|
||||
|
||||
Reference in New Issue
Block a user