Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
1142de3f
Commit
1142de3f
authored
Mar 29, 2002
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch #527027: Allow building python as shared library.
parent
eddd68d5
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
599 additions
and
481 deletions
+599
-481
Makefile.pre.in
Makefile.pre.in
+26
-28
Misc/ACKS
Misc/ACKS
+1
-0
Misc/NEWS
Misc/NEWS
+2
-0
README
README
+9
-0
configure
configure
+496
-437
configure.in
configure.in
+65
-16
No files found.
Makefile.pre.in
View file @
1142de3f
...
...
@@ -108,6 +108,9 @@ PYTHONFRAMEWORKDIR= @PYTHONFRAMEWORKDIR@
PYTHONFRAMEWORKPREFIX
=
@PYTHONFRAMEWORKPREFIX@
PYTHONFRAMEWORKINSTALLDIR
=
@PYTHONFRAMEWORKINSTALLDIR@
# Environment to run shared python without installed libraries
RUNSHARED
=
@RUNSHARED@
# Modes for directories, executables and data files created by the
# install process. Default to user-only-writable for all file types.
DIRMODE
=
755
...
...
@@ -136,6 +139,7 @@ LDLIBRARY= @LDLIBRARY@
BLDLIBRARY
=
@BLDLIBRARY@
DLLLIBRARY
=
@DLLLIBRARY@
LDLIBRARYDIR
=
@LDLIBRARYDIR@
INSTSONAME
=
@INSTSONAME@
LIBS
=
@LIBS@
...
...
@@ -292,20 +296,20 @@ LIBRARY_OBJS= \
all
:
$(BUILDPYTHON) oldsharedmods sharedmods
# Build the interpreter
$(BUILDPYTHON)
:
Modules/$(MAINOBJ) $(LDLIBRARY)
$(BUILDPYTHON)
:
Modules/$(MAINOBJ) $(L
IBRARY) $(L
DLIBRARY)
$(LINKCC)
$(LDFLAGS)
$(LINKFORSHARED)
-o
$@
\
Modules/
$(MAINOBJ)
\
$(BLDLIBRARY)
$(LIBS)
$(MODLIBS)
$(SYSLIBS)
$(LDLAST)
platform
:
$(BUILDPYTHON)
./
$(BUILDPYTHON)
-E
-c
'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]'
>
platform
$(RUNSHARED)
./
$(BUILDPYTHON)
-E
-c
'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]'
>
platform
# Build the shared modules
sharedmods
:
$(BUILDPYTHON)
case
$$
MAKEFLAGS
in
\
*
-s
*
)
CC
=
'
$(CC)
'
LDSHARED
=
'
$(BLDSHARED)
'
OPT
=
'
$(OPT)
'
./
$(BUILDPYTHON)
-E
$(srcdir)
/setup.py
-q
build
;;
\
*
)
CC
=
'
$(CC)
'
LDSHARED
=
'
$(BLDSHARED)
'
OPT
=
'
$(OPT)
'
./
$(BUILDPYTHON)
-E
$(srcdir)
/setup.py build
;;
\
*
-s
*
)
$(RUNSHARED)
CC
=
'
$(CC)
'
LDSHARED
=
'
$(BLDSHARED)
'
OPT
=
'
$(OPT)
'
./
$(BUILDPYTHON)
-E
$(srcdir)
/setup.py
-q
build
;;
\
*
)
$(RUNSHARED)
CC
=
'
$(CC)
'
LDSHARED
=
'
$(BLDSHARED)
'
OPT
=
'
$(OPT)
'
./
$(BUILDPYTHON)
-E
$(srcdir)
/setup.py build
;;
\
esac
# buildno should really depend on something like LIBRARY_SRC
...
...
@@ -333,18 +337,11 @@ $(LIBRARY): $(LIBRARY_OBJS)
$(AR)
cr
$@
$(MODOBJS)
$(RANLIB)
$@
# This rule is only here for DG/UX and BeOS!!!
libpython$(VERSION).so
:
$(LIBRARY)
case
`
uname
-s
|
tr
-d
'/ '
|
tr
'[A-Z]'
'[a-z]'
`
in
\
*
dgux
*
)
\
test
-d
dgux
||
mkdir
dgux
;
\
(
cd
dgux
;
ar x ../
$^
;
ld
-G
-o
../
$@
*
)
;
\
/bin/rm
-rf
./dgux
\
;;
\
beos
)
\
$(AR)
so
$(LIBRARY)
$@
\
;;
\
esac
libpython$(VERSION).so
:
$(LIBRARY_OBJS)
$(LDSHARED)
-o
$@
$(LIBRARY_OBJS)
$(LIBC)
$(LIBM)
libpython$(VERSION).sl
:
$(LIBRARY_OBJS)
$(LDSHARED)
-o
$@
$(LIBRARY_OBJS)
$(LIBC)
$(LIBM)
# This rule is here for OPENSTEP/Rhapsody/MacOSX
$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)
:
$(LIBRARY) $(PYTHONFRAMEWORKDIR)
...
...
@@ -420,10 +417,10 @@ Parser/metagrammar.o: $(srcdir)/Parser/metagrammar.c
Python/compile.o Python/symtable.o
:
$(GRAMMAR_H)
Python/getplatform.o
:
$(srcdir)/Python/getplatform.c
$(CC)
-c
$(CFLAGS)
$(CPPFLAGS)
-DPLATFORM
=
'"
$(MACHDEP)
"'
-o
$@
$(srcdir)
/Python/getplatform.c
$(CC)
-c
$(CFLAGS)
$(CPPFLAGS)
$(CFLAGSFORSHARED)
-DPLATFORM
=
'"
$(MACHDEP)
"'
-o
$@
$(srcdir)
/Python/getplatform.c
Python/importdl.o
:
$(srcdir)/Python/importdl.c
$(CC)
-c
$(CFLAGS)
$(CPPFLAGS)
-I
$(DLINCLDIR)
-o
$@
$(srcdir)
/Python/importdl.c
$(CC)
-c
$(CFLAGS)
$(CPPFLAGS)
$(CFLAGSFORSHARED)
-I
$(DLINCLDIR)
-o
$@
$(srcdir)
/Python/importdl.c
Objects/unicodectype.o
:
$(srcdir)/Objects/unicodectype.c
\
$(srcdir)/Objects/unicodetype_db.h
...
...
@@ -486,7 +483,7 @@ $(LIBRARY_OBJS) $(MODOBJS) Modules/$(MAINOBJ): $(PYTHON_HEADERS)
# Test the interpreter (twice, once without .pyc files, once with)
TESTOPTS
=
-l
TESTPROG
=
$(srcdir)
/Lib/test/regrtest.py
TESTPYTHON
=
./
$(BUILDPYTHON)
-E
-tt
TESTPYTHON
=
$(RUNSHARED)
./
$(BUILDPYTHON)
-E
-tt
test
:
all platform
-
find
$(srcdir)
/Lib
-name
'*.py[co]'
-print
| xargs
rm
-f
-
$(TESTPYTHON)
$(TESTPROG)
$(TESTOPTS)
...
...
@@ -556,8 +553,8 @@ altbininstall: $(BUILDPYTHON)
fi
;
\
done
$(INSTALL_PROGRAM)
$(BUILDPYTHON)
$(BINDIR)
/python
$(VERSION)$(EXE)
if
test
-f
libpython
$(VERSION)
.so
;
then
\
$(INSTALL_
DATA)
libpython
$(VERSION)
.so
$(LIBDIR
)
;
\
if
test
-f
libpython
$(VERSION)
$(SO)
;
then
\
$(INSTALL_
SHARED)
libpython
$(VERSION)$(SO)
$(LIBDIR)
/
$(INSTSONAME
)
;
\
else
true
;
\
fi
if
test
-f
"
$(DLLLIBRARY)
"
;
then
\
...
...
@@ -640,10 +637,10 @@ libinstall: $(BUILDPYTHON) $(srcdir)/Lib/$(PLATDIR)
done
;
\
done
$(INSTALL_DATA)
$(srcdir)
/LICENSE
$(LIBDEST)
/LICENSE.txt
PYTHONPATH
=
$(LIBDEST)
\
PYTHONPATH
=
$(LIBDEST)
$(RUNSHARED)
\
./
$(BUILDPYTHON)
-tt
$(LIBDEST)
/compileall.py
-x
badsyntax
\
$(LIBDEST)
PYTHONPATH
=
$(LIBDEST)
\
PYTHONPATH
=
$(LIBDEST)
$(RUNSHARED)
\
./
$(BUILDPYTHON)
-O
$(LIBDEST)
/compileall.py
-x
badsyntax
$(LIBDEST)
# Create the PLATDIR source directory, if one wasn't distributed..
...
...
@@ -686,12 +683,12 @@ libainstall: all
else
true
;
\
fi
;
\
done
@
if
test
-d
$(L
DL
IBRARY)
;
then
:
;
else
\
@
if
test
-d
$(LIBRARY)
;
then
:
;
else
\
if
test
"
$(PYTHONFRAMEWORKDIR)
"
=
no-framework
;
then
\
$(INSTALL_DATA)
$(L
DLIBRARY)
$(LIBPL)
/
$(LD
LIBRARY)
;
\
$(RANLIB)
$(LIBPL)
/
$(L
DL
IBRARY)
;
\
$(INSTALL_DATA)
$(L
IBRARY)
$(LIBPL)
/
$(
LIBRARY)
;
\
$(RANLIB)
$(LIBPL)
/
$(LIBRARY)
;
\
else
\
echo
Skip
install
of
$(L
DL
IBRARY)
- use make frameworkinstall
;
\
echo
Skip
install
of
$(LIBRARY)
- use make frameworkinstall
;
\
fi
;
\
fi
$(INSTALL_DATA)
Modules/config.c
$(LIBPL)
/config.c
...
...
@@ -733,7 +730,8 @@ libainstall: all
# Install the dynamically loadable modules
# This goes into $(exec_prefix)
sharedinstall
:
./
$(BUILDPYTHON)
-E
$(srcdir)
/setup.py
install
\
$(RUNSHARED)
./
$(BUILDPYTHON)
-E
$(srcdir)
/setup.py
install
\
--prefix
=
$(prefix)
\
--install-scripts
=
$(BINDIR)
\
--install-platlib
=
$(DESTSHARED)
...
...
Misc/ACKS
View file @
1142de3f
...
...
@@ -335,6 +335,7 @@ Todd R. Palmer
Dan Parisien
Harri Pasanen
Randy Pausch
Ondrej Palkovsky
Marcel van der Peijl
Samuele Pedroni
Steven Pemberton
...
...
Misc/NEWS
View file @
1142de3f
...
...
@@ -89,6 +89,8 @@ Tools/Demos
Build
- On Unix, a shared libpython2.3.so can be created with --enable-shared.
- References to the CACHE_HASH and INTERN_STRINGS preprocessor symbols
were eliminated. They were always defined, and the internal features
they enabled stopped being experimental long ago.
...
...
README
View file @
1142de3f
...
...
@@ -558,6 +558,15 @@ Linker (ld) libraries and flags for threads
(jph@emilia.engr.sgi.com)
Building a shared libpython
---------------------------
Starting with Python 2.3, the majority of the interpreter can be built
into a shared library, which can then be used by the interpreter
executable, and by applications embedding Python. To enable this feature,
configure with --enable-shared.
Configuring additional built-in modules
---------------------------------------
...
...
configure
View file @
1142de3f
This source diff could not be displayed because it is too large. You can
view the blob
instead.
configure.in
View file @
1142de3f
...
...
@@ -8,6 +8,9 @@ AC_CONFIG_HEADER(pyconfig.h)
AC_SUBST(VERSION)
VERSION=2.3
AC_SUBST(SOVERSION)
SOVERSION=1.0
# Arguments passed to configure.
AC_SUBST(CONFIG_ARGS)
CONFIG_ARGS="$ac_configure_args"
...
...
@@ -257,14 +260,22 @@ AC_MSG_RESULT($LIBRARY)
# (defined in the Makefiles). On Cygwin LDLIBRARY is the import library,
# DLLLIBRARY is the shared (i.e., DLL) library.
#
# RUNSHARED is used to run shared python without installed libraries
#
# INSTSONAME is the name of the shared library that will be use to install
# on the system - some systems like version suffix, others don't
AC_SUBST(LDLIBRARY)
AC_SUBST(DLLLIBRARY)
AC_SUBST(BLDLIBRARY)
AC_SUBST(LDLIBRARYDIR)
AC_SUBST(INSTSONAME)
AC_SUBST(RUNSHARED)
LDLIBRARY="$LIBRARY"
BLDLIBRARY='$(LDLIBRARY)'
INSTSONMAE='$(LDLIBRARY)'
DLLLIBRARY=''
LDLIBRARYDIR=''
RUNSHARED=''
# LINKCC is the command that links the python executable -- default is $(CC).
# If CXX is set, and if it is needed to link a main function that was
...
...
@@ -301,22 +312,18 @@ then
fi
AC_MSG_RESULT($LINKCC)
AC_MSG_CHECKING(LDLIBRARY)
AC_MSG_CHECKING(for --enable-shared)
AC_ARG_ENABLE(shared,
[ --enable-shared disable/enable building shared python library])
# DG/UX requires some fancy ld contortions to produce a .so from an .a
case $MACHDEP in
dguxR4)
LDLIBRARY='libpython$(VERSION).so'
OPT="$OPT -pic"
;;
beos*)
LDLIBRARY='libpython$(VERSION).so'
;;
cygwin*)
LDLIBRARY='libpython$(VERSION).dll.a'
DLLLIBRARY='libpython$(VERSION).dll'
;;
esac
if test -z "$enable_shared"
then
enable_shared="no"
fi
AC_MSG_RESULT($enable_shared)
AC_MSG_CHECKING(LDLIBRARY)
# MacOSX framework builds need more magic. LDLIBRARY is the dynamic
# library that we build, but we do not want to link against it (we
...
...
@@ -333,6 +340,47 @@ else
BLDLIBRARY='$(LDLIBRARY)'
fi
# Other platforms follow
if test $enable_shared = "yes"; then
case $ac_sys_system in
BeOS*)
LDLIBRARY='libpython$(VERSION).so'
;;
CYGWIN*)
LDLIBRARY='libpython$(VERSION).dll.a'
DLLLIBRARY='libpython$(VERSION).dll'
;;
SunOS*)
LDLIBRARY='libpython$(VERSION).so'
BLDLIBRARY='-Wl,-rpath,$(LIBDIR) -L. -lpython$(VERSION)'
RUNSHARED=LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH
;;
Linux*)
LDLIBRARY='libpython$(VERSION).so'
BLDLIBRARY='-L. -lpython$(VERSION)'
RUNSHARED=LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH
INSTSONAME="$LDLIBRARY".$SOVERSION
;;
hp*|HP*)
LDLIBRARY='libpython$(VERSION).sl'
BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(VERSION)'
RUNSHARED=SHLIB_PATH=`pwd`:$SHLIB_PATH
;;
OSF*)
LDLIBRARY='libpython$(VERSION).so'
BLDLIBRARY='-rpath $(LIBDIR) -L. -lpython$(VERSION)'
RUNSHARED=LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH
;;
esac
# DG/UX requires some fancy ld contortions to produce a .so from an .a
case $MACHDEP in
dguxR4)
LDLIBRARY='libpython$(VERSION).so'
OPT="$OPT -pic"
;;
esac
fi
AC_MSG_RESULT($LDLIBRARY)
AC_PROG_RANLIB
...
...
@@ -861,7 +909,8 @@ then
case $ac_sys_system/$ac_sys_release in
AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
hp*|HP*)
LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
LINKFORSHARED="-Wl,-E -Wl,+s";;
# LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
# -u libsys_s pulls in all symbols in libsys
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment