3 # Builds a shared library, incorporating the random portability work that we
4 # have to do. Gets the basic information from Autoconf and knows how to find
5 # the appropriate system-specific map or version file and set library SONAMEs.
7 # This is not libtool. If it appears to be in danger of evolving into
8 # libtool, please shoot it and start over, possibly by rewriting AFS in Ada.
10 # We take the following regular arguments: -d <srcdir>, -f <filename>, -l
11 # <library>, -M <major>, and -m <minor>. If -f is given, it overrides -l and
12 # specifies the complete filename of the shared library to build. We then
13 # expect a -- option indicating the end of our arguments and the rest of the
14 # arguments are passed along verbatim to the linker.
18 linker="@SHLIB_LINKER@"
19 suffix="@SHLIB_SUFFIX@"
20 sysname="@AFS_SYSNAME@"
27 while [ -z "$done" ] && [ $# -gt 0 ] ; do
59 echo 'Usage: shlib-build -l <lib> -M <major> -m <minor> -- ...' >&2
64 if [ -z "$library" ] ; then
65 echo 'Usage: shlib-install -l <lib> -M <major> -m <minor>' >&2
69 # Print out what we're doing while we do it for debugging.
71 if [ -z "$filename" ] ; then
72 if [ -z "$major" ] ; then
73 filename="$library.$suffix"
76 filename="$library.$suffix.$major.$minor"
77 soname="$library.$suffix.$major"
82 if [ -f "$srcdir/$library.map" ] ; then
83 cat $srcdir/$library.map | \
84 awk '/local:/ {inglobal=0};
85 inglobal { sub(/;/,""); print };
86 /global:/ { inglobal=1};' \
88 export="-bE:$library.exp"
90 echo "$linker $export -o $filename $*"
91 $linker $export -o "$filename" "$@"
94 if [ -f "$srcdir/$library.map" ] ; then
95 export="-Wl,-M$srcdir/$library.map"
97 if [ -z "$soname" ] ; then
98 echo "$linker $export -o $filename $*"
99 $linker $export -o "$filename" "$@"
101 echo "$linker $export -h $soname -o $filename $*"
102 $linker $export -h "$soname" -o "$filename" "$@"
106 if [ -f "$srcdir/$library.map" ] ; then
107 export="-Wl,--version-script=$srcdir/$library.map"
109 if [ -z "$soname" ] ; then
110 echo "$linker $export -o $filename $*"
111 $linker $export -o "$filename" "$@"
113 echo "$linker $export -Wl,-h,$soname -o $filename $*"
114 $linker $export -Wl,-h,"$soname" -o "$filename" "$@"
118 if [ -f "$srcdir/$library.hp" ] ; then
119 export="-c $srcdir/$library.hp"
121 echo "$linker $export -o $filename $*"
122 $linker $export -o "$filename" "$@"
125 if [ -f "$srcdir/$library.map" ] ; then
126 # For 10.4 and later, the Mac exports list is a list of symbols,
127 # prefixed with an '_'
128 cat $srcdir/$library.map | \
129 awk '/local:/ {inglobal=0};
131 inglobal { sub(/;/,""); sub(/[\t ]+/,"_"); print };
132 /global:/ { inglobal=1};' \
134 export="-Wl,-exported_symbols_list,$library.exp"
136 echo "$linker $export -o $filename $*"
137 $linker $export -o "$filename" "$@"
140 echo "$linker -o $filename $*"
141 $linker -o "$filename" "$@"