/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. # Make sure we got reasonable arguments.
  24. TARGET=""
  25. ARGS=""
  26. while [ "$#" != "0" ]; do
  27. case "$1" in
  28. -o) TARGET="$2"; shift; shift;;
  29. *) ARGS="$ARGS $1"; shift;;
  30. esac
  31. done
  32. if [ "$TARGET" = "" ] ; then
  33. echo "Usage:"
  34. echo
  35. echo " $0 [args] -o foomodule.so [args] foomodule.o [args]"
  36. echo
  37. echo "Where:"
  38. echo
  39. echo " [args] normal compiler arguments"
  40. exit 1
  41. fi
  42. # The shared libraries and glue objects we need to link against; these
  43. # libs are overkill for most of the standard modules, but it makes life
  44. # in this shell script easier.
  45. LIBS="-lbe -lnet -lroot"
  46. case $BE_HOST_CPU in
  47. ppc)
  48. # Boy, do we need a lot of crap...
  49. GLUE_LOC=/boot/develop/lib/ppc
  50. GLUE="${GLUE_LOC}/glue-noinit.a ${GLUE_LOC}/init_term_dyn.o"
  51. case $(uname -r) in
  52. 4.0*) CC="mwcc -xms -export pragma -nodup" ;;
  53. *) CC="mwcc -shared -export pragma -nodup" ;;
  54. esac
  55. ;;
  56. x86)
  57. # We don't need as much crap here...
  58. GLUE=""
  59. CC="gcc -nostart -Wl,-soname=${TARGET}"
  60. ;;
  61. *)
  62. # What the?!?
  63. echo "$0 doesn't support $BE_HOST_CPU systems..."
  64. echo "You're on your own... I'd be surprised if this works."
  65. GLUE=""
  66. CC="cc"
  67. ;;
  68. esac
  69. # Now link that shared lib...
  70. $CC -o $TARGET $ARGS $GLUE $LIBS