3 # linkmodule for Python
4 # Chris Herborth (chrish@qnx.com)
6 # This is covered by the same copyright/licensing terms as the rest of
9 # Shell script to build shared library versions of the modules; the
10 # idea is to build an export list containing only the init*() function
11 # for the module. We _could_ assume for foomodule.o it was initfoo, but
12 # that's asking for trouble... this is a little less efficient but correct.
14 # This is called by the Modules/Makefile as $(LDSHARED):
16 # $(LDSHARED) foomodule.o -o foomodule$(SO)
18 # Could also be called as:
20 # $(LDSHARED) readline.o -L/boot/home/config/lib -lreadline -ltermcap \
23 # Check to make sure we know what we're doing.
25 if [ "$system" != "BeMac" ] && [ "$system" != "BeBox" ] ; then
26 echo "Sorry, BeOS Python doesn't support x86 yet."
30 # Make sure we got reasonable arguments.
34 while [ "$#" != "0" ]; do
36 -o) TARGET
="$2"; shift; shift;;
37 *) ARGS
="$ARGS $1"; shift;;
41 if [ "$TARGET" = "" ] ; then
44 echo " $0 [args] -o foomodule.so [args] foomodule.o [args]"
48 echo " [args] normal mwcc arguments"
52 EXPORTS
=${TARGET%.so}.exp
54 # The shared libraries and glue objects we need to link against; these
55 # libs are overkill for most of the standard modules, but it makes life
56 # in this shell script easier.
57 LIBS
="-L.. -lpython1.5 -lbe -lnet -lroot"
58 GLUE
="/boot/develop/lib/ppc/glue-noinit.a /boot/develop/lib/ppc/init_term_dyn.o"
60 # Check to see if we've already got an exports file; we don't need to
61 # update this once we've got it because we only ever want to export
63 if [ ! -e $EXPORTS ] ; then
64 # The init*() function has to be related to the module's .so name
65 # for importdl to work.
66 echo init
${TARGET%.so} |
sed -e s
/module
// > $EXPORTS
69 # Now link against the clean exports file.
70 mwcc
-xms -f $EXPORTS -o $TARGET $ARGS $GLUE $LIBS -nodup