]> git.saurik.com Git - wxWidgets.git/blob - distrib/mac/shared-ld-sh
script to link a mach-o dynamic shared library for Darwin / Mac OS X
[wxWidgets.git] / distrib / mac / shared-ld-sh
1 #!/bin/sh
2 #-----------------------------------------------------------------------------
3 #-- Name: distrib/mac/shared-ld-sh
4 #-- Purpose: Link a mach-o dynamic shared library for Darwin / Mac OS X
5 #-- Author: Gilles Depeyrot
6 #-- Modified by:
7 #-- Created: 05.05.2002
8 #-- RCS-ID: $Id$
9 #-- Copyright: (c) 2002 Gilles Depeyrot
10 #-- Licence: wxWindows licence
11 #-----------------------------------------------------------------------------
12
13 verbose=0
14 args=""
15 objects=""
16
17 while test $# -gt 0; do
18 case $1 in
19
20 -v)
21 verbose=1
22 ;;
23
24 -o|-compatibility_version|-current_version|-framework)
25 # collect these options and values
26 args="$args $1 $2"
27 shift
28 ;;
29
30 -l*|-L*)
31 # collect these options
32 args="$args $1"
33 ;;
34
35 -dynamiclib)
36 # skip these options
37 ;;
38
39 -*)
40 echo "shared-ld: unhandled option '$1'"
41 exit 1
42 ;;
43
44 *.o)
45 # collect object files
46 objects="$objects $1"
47 ;;
48
49 *)
50 echo "shared-ld: unhandled argument '$1'"
51 exit 1
52 ;;
53
54 esac
55 shift
56 done
57
58 #
59 # Link one module containing all the others
60 #
61 if test $verbose = 1; then
62 echo "c++ -r -keep_private_externs -nostdlib $objects -o master.$$.o"
63 fi
64 c++ -r -keep_private_externs -nostdlib $objects -o master.$$.o
65 status=$?
66 if test $status != 0; then
67 exit $status
68 fi
69
70 #
71 # Link the shared library from the single module created
72 #
73 if test $verbose = 1; then
74 echo "cc -dynamiclib master.$$.o $args"
75 fi
76 c++ -dynamiclib master.$$.o $args
77 status=$?
78 if test $status != 0; then
79 exit $status
80 fi
81
82 #
83 # Remove intermediate module
84 #
85 rm -f master.$$.o
86
87 exit 0