PageRenderTime 344ms CodeModel.GetById 181ms app.highlight 3ms RepoModel.GetById 158ms app.codeStats 0ms

/Modules/ld_so_beos

http://unladen-swallow.googlecode.com/
Shell | 78 lines | 42 code | 7 blank | 29 comment | 2 complexity | 29992e517cfc952c3e87cc8b22d151a3 MD5 | raw file
 1#! /bin/sh
 2#
 3# linkmodule for Python
 4# Chris Herborth (chrish@qnx.com)
 5#
 6# This is covered by the same copyright/licensing terms as the rest of
 7# Python.
 8#
 9# Shell script to build shared library versions of the modules; since
10# the change to the *ahem* "proper" import/export mechanism, this script
11# is much simpler.  It handles PowerPC and x86, too.
12#
13# This is called by the Modules/Makefile as $(LDSHARED):
14#
15# $(LDSHARED) foomodule.o -o foomodule$(SO)
16#
17# Could also be called as:
18#
19# $(LDSHARED)  readline.o  -L/boot/home/config/lib -lreadline -ltermcap \
20# -o readline$(SO)
21#
22# so we need to preserve the arguments, sort of.
23
24# Make sure we got reasonable arguments.
25TARGET=""
26ARGS=""
27
28while [ "$#" != "0" ]; do
29	case "$1" in
30		-o)	TARGET="$2"; shift; shift;;
31		*)	ARGS="$ARGS $1"; shift;;
32	esac
33done
34
35if [ "$TARGET" = "" ] ; then
36	echo "Usage:"
37	echo
38	echo "	$0 [args] -o foomodule.so [args] foomodule.o [args]"
39	echo
40	echo "Where:"
41	echo
42	echo "	[args]	normal compiler arguments"
43	exit 1
44fi
45
46# The shared libraries and glue objects we need to link against; these
47# libs are overkill for most of the standard modules, but it makes life
48# in this shell script easier.
49LIBS="-lbe -lnet -lroot"
50
51case $BE_HOST_CPU in
52	ppc)
53		# Boy, do we need a lot of crap...
54		GLUE_LOC=/boot/develop/lib/ppc
55		GLUE="${GLUE_LOC}/glue-noinit.a ${GLUE_LOC}/init_term_dyn.o"
56		case $(uname -r) in
57			4.0*) CC="mwcc -xms -export pragma -nodup" ;;
58			*) CC="mwcc -shared -export pragma -nodup" ;;
59		esac
60		;;
61
62	x86)
63		# We don't need as much crap here...
64		GLUE=""
65		CC="gcc -nostart -Wl,-soname=${TARGET}"
66		;;
67
68	*)
69		# What the?!?
70		echo "$0 doesn't support $BE_HOST_CPU systems..."
71		echo "You're on your own... I'd be surprised if this works."
72		GLUE=""
73		CC="cc"
74		;;
75esac
76
77# Now link that shared lib...
78$CC -o $TARGET $ARGS $GLUE $LIBS