1998-08-04 17:57:28 +00:00
|
|
|
#! /bin/sh
|
|
|
|
#
|
|
|
|
# linkcc for Python
|
|
|
|
# Chris Herborth (chrish@qnx.com)
|
|
|
|
#
|
|
|
|
# This is covered by the same copyright/licensing terms as the rest of
|
|
|
|
# Python.
|
|
|
|
#
|
|
|
|
# Shell script to build the Python shared library properly; if we haven't
|
|
|
|
# already built the export list, we'll need to link twice (argh...) so we
|
|
|
|
# can eliminate some unwatnted global symbols from the system glue/init
|
|
|
|
# objects.
|
|
|
|
#
|
|
|
|
# This is called by the Modules/Makefile as part of $(LINKCC):
|
|
|
|
#
|
|
|
|
# $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) $(MAINOBJ) \
|
|
|
|
# -L.. -lpython$(VERSION) $(MODLIBS) $(LIBS) $(SYSLIBS) -o python $(LDLAST)
|
|
|
|
#
|
|
|
|
# In 1.5.1 this changed to:
|
|
|
|
#
|
|
|
|
# $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) $(MAINOBJ) \
|
|
|
|
# $(LIBRARY) $(MODLIBS) $(LIBS) $(SYSLIBS) -o python $(LDLAST)
|
|
|
|
#
|
|
|
|
# For BeOS we should set $(LINKCC) to this in configure (similar to the
|
|
|
|
# AIX situation):
|
|
|
|
#
|
1998-12-17 18:00:33 +00:00
|
|
|
# $(srcdir)../BeOS/linkcc $(LIBRARY) $(PURIFY) $(CC) $(OPT)
|
1998-08-04 17:57:28 +00:00
|
|
|
#
|
|
|
|
# -L.. -lpython$(VERSION) will automagically pick up the shared library.
|
1998-12-17 18:00:33 +00:00
|
|
|
#
|
|
|
|
# As of Python 1.5.2, this isn't strictly necessary, but it makes me
|
|
|
|
# feel safer. It makes sure we've got all the BeOS-specific libraries,
|
|
|
|
# and it creates the "lib" symlink that we'll need for chance of running
|
|
|
|
# "make test" successfully.
|
1998-08-04 17:57:28 +00:00
|
|
|
|
|
|
|
LIBRARY="$1"; shift
|
|
|
|
|
|
|
|
# What we want to end up with.
|
1999-01-04 16:49:09 +00:00
|
|
|
DYNAMIC=${LIBRARY/.a/.so}
|
1998-12-17 18:00:33 +00:00
|
|
|
LINK_DYNAMIC="-l$(basename ${DYNAMIC%.so} | sed -e s,lib,,)"
|
1998-08-04 17:57:28 +00:00
|
|
|
|
|
|
|
# Grab the rest of the args and build them into the command used to
|
|
|
|
# link the python binary. Make sure we link against the shared lib
|
|
|
|
# and not the static lib.
|
|
|
|
LINK_CMD=""
|
|
|
|
while [ "$#" != "0" ] ; do
|
|
|
|
case "$1" in
|
|
|
|
$LIBRARY)
|
|
|
|
LINK_CMD="$LINK_CMD -L.. $LINK_DYNAMIC"
|
|
|
|
shift
|
|
|
|
;;
|
1998-12-17 18:00:33 +00:00
|
|
|
|
1998-08-04 17:57:28 +00:00
|
|
|
*)
|
|
|
|
LINK_CMD="$LINK_CMD $1"
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
1998-12-17 18:00:33 +00:00
|
|
|
# The shared libraries and glue objects we need to link against; this is
|
|
|
|
# a little overkill, but it'll be OK.
|
1998-08-04 17:57:28 +00:00
|
|
|
LIBS="-lbe -lnet -lroot"
|
|
|
|
|
1999-01-04 16:49:09 +00:00
|
|
|
case $BE_HOST_CPU in
|
|
|
|
ppc)
|
|
|
|
LIBS="-nodup $LIBS"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
1998-12-17 18:00:33 +00:00
|
|
|
# We'll need this or the python binary won't load libpython.so... handy
|
|
|
|
# for testing.
|
1999-01-04 16:49:09 +00:00
|
|
|
( cd .. ; ln -sf $(pwd) lib )
|
1998-08-04 17:57:28 +00:00
|
|
|
|
|
|
|
# Now build the python binary.
|
1999-01-04 16:49:09 +00:00
|
|
|
echo "Link command: $LINK_CMD $LIBS"
|
|
|
|
$LINK_CMD $LIBS
|