Added all documentation.
[python/dscho.git] / BeOS / linkcc
blob687c92ecd60b412c56cb1a0b3f8c562f16a9123a
1 #! /bin/sh
3 # linkcc for Python
4 # Chris Herborth (chrish@qnx.com)
6 # This is covered by the same copyright/licensing terms as the rest of
7 # Python.
9 # Shell script to build the Python shared library properly; if we haven't
10 # already built the export list, we'll need to link twice (argh...) so we
11 # can eliminate some unwatnted global symbols from the system glue/init
12 # objects.
14 # This is called by the Modules/Makefile as part of $(LINKCC):
16 # $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) $(MAINOBJ) \
17 # -L.. -lpython$(VERSION) $(MODLIBS) $(LIBS) $(SYSLIBS) -o python $(LDLAST)
19 # In 1.5.1 this changed to:
21 # $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) $(MAINOBJ) \
22 # $(LIBRARY) $(MODLIBS) $(LIBS) $(SYSLIBS) -o python $(LDLAST)
24 # For BeOS we should set $(LINKCC) to this in configure (similar to the
25 # AIX situation):
27 # $(srcdir)../BeOS/linkcc $(LIBRARY) $(PURIFY) $(CC) $(OPT)
29 # -L.. -lpython$(VERSION) will automagically pick up the shared library.
31 # As of Python 1.5.2, this isn't strictly necessary, but it makes me
32 # feel safer. It makes sure we've got all the BeOS-specific libraries,
33 # and it creates the "lib" symlink that we'll need for chance of running
34 # "make test" successfully.
36 LIBRARY="$1"; shift
38 # What we want to end up with.
39 DYNAMIC=${LIBRARY/.a/.so}
40 LINK_DYNAMIC="-l$(basename ${DYNAMIC%.so} | sed -e s,lib,,)"
42 # Grab the rest of the args and build them into the command used to
43 # link the python binary. Make sure we link against the shared lib
44 # and not the static lib.
45 LINK_CMD=""
46 while [ "$#" != "0" ] ; do
47 case "$1" in
48 $LIBRARY)
49 LINK_CMD="$LINK_CMD -L.. $LINK_DYNAMIC"
50 shift
54 LINK_CMD="$LINK_CMD $1"
55 shift
57 esac
58 done
60 # The shared libraries and glue objects we need to link against; this is
61 # a little overkill, but it'll be OK.
62 LIBS="-lbe -lnet -lroot"
64 case $BE_HOST_CPU in
65 ppc)
66 LIBS="-nodup $LIBS"
68 esac
70 # We'll need this or the python binary won't load libpython.so... handy
71 # for testing.
72 ( cd .. ; ln -sf $(pwd) lib )
74 # Now build the python binary.
75 echo "Link command: $LINK_CMD $LIBS"
76 $LINK_CMD $LIBS