File: shared-ld-sh

package info (click to toggle)
mysql%2B%2B 3.2.5-2
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 18,344 kB
  • sloc: cpp: 35,787; sh: 3,693; perl: 789; makefile: 730
file content (100 lines) | stat: -rwxr-xr-x 2,085 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/sh
#-----------------------------------------------------------------------------
#-- Name:        distrib/mac/shared-ld-sh
#-- Purpose:     Link a mach-o dynamic shared library for Darwin / Mac OS X
#-- Author:      Gilles Depeyrot
#-- Copyright:   (c) 2002 Gilles Depeyrot
#-- Licence:     any use permitted
#-----------------------------------------------------------------------------

verbose=0
args=""
objects=""
linking_flag="-dynamiclib"
ldargs="-r -keep_private_externs -nostdlib"

if test "x$CXX" = "x"; then
    CXX="c++"
fi

while test $# -gt 0; do
    case $1 in

       -v)
        verbose=1
        ;;

       -o|-compatibility_version|-current_version|-framework|-undefined|-install_name)
        # collect these options and values
        args="${args} $1 $2"
        shift
        ;;

       -arch|-isysroot)
        # collect these options and values
        ldargs="${ldargs} $1 $2"
        shift
        ;;

       -s|-Wl,*)
        # collect these load args
        ldargs="${ldargs} $1"
        ;;

       -l*|-L*|-flat_namespace|-headerpad_max_install_names)
        # collect these options
        args="${args} $1"
        ;;

       -dynamiclib|-bundle)
        linking_flag="$1"
        ;;

       -*)
        echo "shared-ld: unhandled option '$1'"
        exit 1
        ;;

        *.o | *.a | *.dylib)
        # collect object files
        objects="${objects} $1"
        ;;

        *)
        echo "shared-ld: unhandled argument '$1'"
        exit 1
        ;;

    esac
    shift
done

status=0

#
# Link one module containing all the others
#
if test ${verbose} = 1; then
    echo "$CXX ${ldargs} ${objects} -o master.$$.o"
fi
$CXX ${ldargs} ${objects} -o master.$$.o
status=$?

#
# Link the shared library from the single module created, but only if the
# previous command didn't fail:
#
if test ${status} = 0; then
    if test ${verbose} = 1; then
        echo "$CXX ${linking_flag} master.$$.o ${args}"
    fi
    $CXX ${linking_flag} master.$$.o ${args}
    status=$?
fi

#
# Remove intermediate module
#
rm -f master.$$.o

exit $status