Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | # Make a shared library. |
Brian Paul | 7c1ab40 | 2005-07-25 23:49:50 +0000 | [diff] [blame] | 4 | # This script should be useful for projects other than Mesa. |
| 5 | # Improvements/fixes are welcome. |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 6 | |
| 7 | |
Brian Paul | 7c1ab40 | 2005-07-25 23:49:50 +0000 | [diff] [blame] | 8 | # Copyright (C) 1999-2005 Brian Paul All Rights Reserved. |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 9 | # |
Brian Paul | 7c1ab40 | 2005-07-25 23:49:50 +0000 | [diff] [blame] | 10 | # Permission is hereby granted, free of charge, to any person obtaining a |
| 11 | # copy of this software and associated documentation files (the "Software"), |
| 12 | # to deal in the Software without restriction, including without limitation |
| 13 | # the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 14 | # and/or sell copies of the Software, and to permit persons to whom the |
| 15 | # Software is furnished to do so, subject to the following conditions: |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 16 | # |
Brian Paul | 7c1ab40 | 2005-07-25 23:49:50 +0000 | [diff] [blame] | 17 | # The above copyright notice and this permission notice shall be included |
| 18 | # in all copies or substantial portions of the Software. |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 19 | # |
Brian Paul | 7c1ab40 | 2005-07-25 23:49:50 +0000 | [diff] [blame] | 20 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 21 | # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 22 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 23 | # BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
| 24 | # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 25 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 26 | |
| 27 | |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 28 | # |
| 29 | # Option defaults |
| 30 | # |
| 31 | LIBNAME="" |
| 32 | MAJOR=1 |
| 33 | MINOR=0 |
Brian Paul | 6e450f2 | 2004-02-21 18:08:41 +0000 | [diff] [blame] | 34 | PATCH="" |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 35 | DEPS="" |
Brian Paul | 8dcc673 | 2005-07-25 22:59:58 +0000 | [diff] [blame] | 36 | LINK="" |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 37 | CPLUSPLUS=0 |
| 38 | STATIC=0 |
| 39 | INSTALLDIR="." |
| 40 | ARCH="auto" |
| 41 | ARCHOPT="" |
Brian Paul | dd74e36 | 2004-04-08 22:26:22 +0000 | [diff] [blame] | 42 | NOPREFIX=0 |
Brian Paul | 158a251 | 2004-10-16 15:10:45 +0000 | [diff] [blame] | 43 | EXPORTS="" |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 44 | |
| 45 | |
| 46 | # |
| 47 | # Parse arguments |
| 48 | # |
| 49 | while true |
| 50 | do |
| 51 | case $1 in |
Brian Paul | 7c1ab40 | 2005-07-25 23:49:50 +0000 | [diff] [blame] | 52 | '-h' | '--help') |
Eric Anholt | f1a2613 | 2005-08-08 03:26:18 +0000 | [diff] [blame] | 53 | echo 'Usage: mklib [options] objects' |
| 54 | echo 'Create a shared library from object files.' |
| 55 | echo ' -o LIBRARY specifies the name of the resulting library, without' |
| 56 | echo ' the leading "lib" or any suffix.' |
| 57 | echo ' (eg: "-o GL" might result in "libGL.so" being made)' |
| 58 | echo ' -major N specifies major version number (default is 1)' |
| 59 | echo ' -minor N specifies minor version number (default is 0)' |
| 60 | echo ' -patch N specifies patch version number (default is 0)' |
| 61 | echo ' -lLIBRARY specifies a dependency on LIBRARY' |
| 62 | echo ' -LDIR search in DIR for library dependencies' |
| 63 | echo ' -linker L explicity specify the linker program to use (eg: gcc, g++)' |
| 64 | echo ' Not observed on all systems at this time.' |
| 65 | echo ' -cplusplus link with C++ runtime' |
| 66 | echo ' -static make a static library (default is dynamic/shared)' |
| 67 | echo ' -install DIR put resulting library file(s) in DIR' |
| 68 | echo ' -arch ARCH override using `uname` to determine host system' |
| 69 | echo ' -archopt OPT specify an extra achitecture-specific option OPT' |
| 70 | echo " -noprefix don't prefix library name with 'lib' nor add any suffix" |
| 71 | echo ' -exports FILE only export the symbols listed in FILE' |
| 72 | echo ' -h, --help display this information and exit' |
Brian Paul | 7c1ab40 | 2005-07-25 23:49:50 +0000 | [diff] [blame] | 73 | exit 1 |
| 74 | ;; |
| 75 | '-o') |
| 76 | shift 1; |
| 77 | LIBNAME=$1 |
| 78 | ;; |
| 79 | '-major') |
| 80 | shift 1; |
| 81 | MAJOR=$1 |
| 82 | ;; |
| 83 | '-minor') |
| 84 | shift 1; |
| 85 | MINOR=$1 |
| 86 | ;; |
| 87 | '-patch') |
| 88 | shift 1; |
| 89 | PATCH=$1 |
| 90 | ;; |
| 91 | '-linker') |
| 92 | shift 1; |
| 93 | LINK=$1 |
| 94 | ;; |
| 95 | -l*) |
| 96 | DEPS="$DEPS $1" |
| 97 | ;; |
| 98 | -L*) |
| 99 | DEPS="$DEPS $1" |
| 100 | ;; |
| 101 | '-cplusplus') |
| 102 | CPLUSPLUS=1 |
| 103 | ;; |
| 104 | '-static') |
| 105 | STATIC=1 |
| 106 | ;; |
| 107 | '-install') |
| 108 | shift 1; |
| 109 | INSTALLDIR=$1 |
| 110 | ;; |
| 111 | '-arch') |
| 112 | shift 1; |
| 113 | ARCH=$1 |
| 114 | ;; |
| 115 | '-archopt') |
| 116 | shift 1; |
| 117 | ARCHOPT=$1 |
| 118 | ;; |
| 119 | '-noprefix') |
| 120 | NOPREFIX=1 |
| 121 | ;; |
| 122 | '-exports') |
| 123 | shift 1; |
| 124 | EXPORTS=$1 |
| 125 | ;; |
| 126 | -*) |
| 127 | echo "mklib: Unknown option: " $1 ; |
| 128 | exit 1 |
| 129 | ;; |
| 130 | *) |
| 131 | # This should be the first object file, stop parsing |
| 132 | break |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 133 | esac |
| 134 | shift 1 |
| 135 | done |
| 136 | OBJECTS=$@ |
| 137 | |
Brian Paul | 7c1ab40 | 2005-07-25 23:49:50 +0000 | [diff] [blame] | 138 | |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 139 | if [ ${ARCH} = "auto" ] ; then |
| 140 | ARCH=`uname` |
| 141 | fi |
| 142 | |
| 143 | |
| 144 | # |
| 145 | # Error checking |
| 146 | # |
| 147 | if [ "x${LIBNAME}" = "x" ] ; then |
| 148 | echo "mklib: Error: no library name specified" |
| 149 | exit 1 |
| 150 | fi |
| 151 | if [ "x${OBJECTS}" = "x" ] ; then |
| 152 | echo "mklib: Error: no object files specified" |
| 153 | exit 1 |
| 154 | fi |
| 155 | |
| 156 | |
| 157 | # |
| 158 | # Debugging info |
| 159 | # |
| 160 | if [ ] ; then |
| 161 | echo "-----------------" |
| 162 | echo ARCH is $ARCH |
| 163 | echo LIBNAME is $LIBNAME |
| 164 | echo MAJOR is $MAJOR |
| 165 | echo MINOR is $MINOR |
| 166 | echo PATCH is $PATCH |
| 167 | echo DEPS are $DEPS |
Brian Paul | 158a251 | 2004-10-16 15:10:45 +0000 | [diff] [blame] | 168 | echo "EXPORTS in" $EXPORTS |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 169 | echo "-----------------" |
| 170 | fi |
| 171 | |
| 172 | |
| 173 | # |
| 174 | # OK, make the library now |
| 175 | # |
| 176 | case $ARCH in |
| 177 | |
Brian Paul | 12d6cae | 2004-01-10 22:12:21 +0000 | [diff] [blame] | 178 | 'Linux' | 'OpenBSD') |
Brian Paul | 158a251 | 2004-10-16 15:10:45 +0000 | [diff] [blame] | 179 | # we assume gcc |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 180 | |
Brian Paul | 8dcc673 | 2005-07-25 22:59:58 +0000 | [diff] [blame] | 181 | if [ "x$LINK" = "x" ] ; then |
| 182 | # -linker was not specified so set default link command now |
| 183 | if [ $CPLUSPLUS = 1 ] ; then |
| 184 | LINK=g++ |
| 185 | else |
| 186 | LINK=gcc |
| 187 | fi |
Brian Paul | c498742 | 2004-10-16 15:02:16 +0000 | [diff] [blame] | 188 | fi |
| 189 | |
Brian Paul | dd74e36 | 2004-04-08 22:26:22 +0000 | [diff] [blame] | 190 | if [ $NOPREFIX = 1 ] ; then |
| 191 | # No "lib" or ".so" part |
| 192 | echo "mklib: Making" $ARCH "shared library: " ${LIBNAME} |
| 193 | #OPTS="-shared -Wl,-soname,${LIBNAME}" # soname??? |
| 194 | OPTS="-shared" |
Ian Romanick | aba4864 | 2005-08-08 23:22:46 +0000 | [diff] [blame] | 195 | |
| 196 | # Check if objects are 32-bit and we're running in 64-bit |
| 197 | # environment. If so, pass -m32 flag to linker. |
| 198 | set ${OBJECTS} |
| 199 | ABI32=`file $1 | grep 32-bit` |
| 200 | if [ "${ABI32}" -a `uname -m` = "x86_64" ] ; then |
| 201 | OPTS="-m32 ${OPTS}" |
| 202 | fi |
| 203 | |
Brian Paul | dd74e36 | 2004-04-08 22:26:22 +0000 | [diff] [blame] | 204 | rm -f ${LIBNAME} |
Brian Paul | dd74e36 | 2004-04-08 22:26:22 +0000 | [diff] [blame] | 205 | # make lib |
| 206 | ${LINK} ${OPTS} -o ${LIBNAME} ${OBJECTS} ${DEPS} |
| 207 | # finish up |
| 208 | FINAL_LIBS="${LIBNAME}" |
| 209 | elif [ $STATIC = 1 ] ; then |
| 210 | LIBNAME="lib${LIBNAME}" # prefix with "lib" |
Brian Paul | 5b9a9d4 | 2004-01-17 18:31:12 +0000 | [diff] [blame] | 211 | echo "mklib: Making" $ARCH "static library: " ${LIBNAME}.a |
Brian Paul | 7a534dc | 2005-09-14 02:18:09 +0000 | [diff] [blame] | 212 | rm -f ${LIBNAME}.a |
| 213 | ar -ru ${LIBNAME}.a ${OBJECTS} |
Brian Paul | 6e450f2 | 2004-02-21 18:08:41 +0000 | [diff] [blame] | 214 | ranlib ${LIBNAME}.a |
Brian Paul | 1c4b711 | 2003-10-10 17:58:38 +0000 | [diff] [blame] | 215 | # finish up |
Brian Paul | 6e450f2 | 2004-02-21 18:08:41 +0000 | [diff] [blame] | 216 | FINAL_LIBS=${LIBNAME}.a |
Brian Paul | 1c4b711 | 2003-10-10 17:58:38 +0000 | [diff] [blame] | 217 | else |
Brian Paul | dd74e36 | 2004-04-08 22:26:22 +0000 | [diff] [blame] | 218 | LIBNAME="lib${LIBNAME}" # prefix with "lib" |
Brian Paul | 5b9a9d4 | 2004-01-17 18:31:12 +0000 | [diff] [blame] | 219 | if [ $ARCH = 'Linux' ] ; then |
| 220 | OPTS="-Xlinker -Bsymbolic -shared -Wl,-soname,${LIBNAME}.so.${MAJOR}" |
| 221 | else |
| 222 | OPTS="-shared -Wl,-soname,${LIBNAME}.so.${MAJOR}" |
| 223 | fi |
Brian Paul | 158a251 | 2004-10-16 15:10:45 +0000 | [diff] [blame] | 224 | if [ $EXPORTS ] ; then |
| 225 | #OPTS="${OPTS} -Xlinker --retain-symbols-file ${EXPORTS}" |
| 226 | # Make the 'exptmp' file for --version-script option |
| 227 | echo "VERSION_${MAJOR}.${MINOR} {" > exptmp |
| 228 | echo "global:" >> exptmp |
| 229 | sed 's/$/;/' ${EXPORTS} >> exptmp |
| 230 | echo "local:" >> exptmp |
| 231 | echo "*;" >> exptmp |
| 232 | echo "};" >> exptmp |
| 233 | OPTS="${OPTS} -Xlinker --version-script=exptmp" |
| 234 | # exptmp is removed below |
| 235 | fi |
Brian Paul | 3e19618 | 2005-03-03 01:38:13 +0000 | [diff] [blame] | 236 | |
| 237 | # Check if objects are 32-bit and we're running in 64-bit |
| 238 | # environment. If so, pass -m32 flag to linker. |
| 239 | set ${OBJECTS} |
| 240 | ABI32=`file $1 | grep 32-bit` |
| 241 | if [ "${ABI32}" -a `uname -m` = "x86_64" ] ; then |
| 242 | OPTS="-m32 ${OPTS}" |
| 243 | fi |
| 244 | |
Brian Paul | 6e450f2 | 2004-02-21 18:08:41 +0000 | [diff] [blame] | 245 | if [ x${PATCH} = "x" ] ; then |
| 246 | VERSION="${MAJOR}.${MINOR}" |
| 247 | else |
| 248 | VERSION="${MAJOR}.${MINOR}.${PATCH}" |
| 249 | fi |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 250 | |
Brian Paul | 5396ab2 | 2004-02-12 14:48:52 +0000 | [diff] [blame] | 251 | echo "mklib: Making" $ARCH "shared library: " ${LIBNAME}.so.${VERSION} |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 252 | |
Brian Paul | 1c4b711 | 2003-10-10 17:58:38 +0000 | [diff] [blame] | 253 | # rm any old libs |
| 254 | rm -f ${LIBNAME}.so.${VERSION} |
| 255 | rm -f ${LIBNAME}.so.${MAJOR} |
| 256 | rm -f ${LIBNAME}.so |
| 257 | |
| 258 | # make lib |
| 259 | ${LINK} ${OPTS} -o ${LIBNAME}.so.${VERSION} ${OBJECTS} ${DEPS} |
| 260 | # make usual symlinks |
| 261 | ln -s ${LIBNAME}.so.${VERSION} ${LIBNAME}.so.${MAJOR} |
| 262 | ln -s ${LIBNAME}.so.${MAJOR} ${LIBNAME}.so |
| 263 | # finish up |
| 264 | FINAL_LIBS="${LIBNAME}.so.${VERSION} ${LIBNAME}.so.${MAJOR} ${LIBNAME}.so" |
Brian Paul | b17a1a1 | 2004-11-01 22:28:42 +0000 | [diff] [blame] | 265 | # rm -f exptmp |
Brian Paul | 1c4b711 | 2003-10-10 17:58:38 +0000 | [diff] [blame] | 266 | fi |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 267 | ;; |
| 268 | |
| 269 | 'SunOS') |
Brian Paul | 5396ab2 | 2004-02-12 14:48:52 +0000 | [diff] [blame] | 270 | if [ $STATIC = 1 ] ; then |
| 271 | LIBNAME="lib${LIBNAME}.a" |
| 272 | echo "mklib: Making SunOS static library: " ${LIBNAME} |
| 273 | rm -f ${LIBNAME} |
Brian Paul | c193bd0 | 2004-03-18 15:41:59 +0000 | [diff] [blame] | 274 | ar -ruv ${LIBNAME} ${OBJECTS} |
Brian Paul | 5396ab2 | 2004-02-12 14:48:52 +0000 | [diff] [blame] | 275 | FINAL_LIBS=${LIBNAME} |
| 276 | else |
| 277 | LIBNAME="lib${LIBNAME}.so" |
| 278 | echo "mklib: Making SunOS shared library: " ${LIBNAME} |
| 279 | # XXX OPTS for gcc should be -shared, but that doesn't work. |
| 280 | # Using -G does work though. |
Brian Paul | 8dcc673 | 2005-07-25 22:59:58 +0000 | [diff] [blame] | 281 | OPTS="-G" |
| 282 | if [ "x$LINK" = "x" ] ; then |
| 283 | # -linker was not specified, choose default linker now |
| 284 | if [ $CPLUSPLUS = 1 ] ; then |
| 285 | # determine linker and options for C++ code |
| 286 | if [ `which c++` ] ; then |
| 287 | # use Sun c++ |
| 288 | LINK="c++" |
| 289 | elif [ `type g++` ] ; then |
| 290 | # use g++ |
| 291 | LINK="g++" |
| 292 | else |
| 293 | echo "mklib: warning: can't find C++ comiler, trying CC." |
| 294 | LINK="CC" |
| 295 | fi |
Brian Paul | 5396ab2 | 2004-02-12 14:48:52 +0000 | [diff] [blame] | 296 | else |
Brian Paul | 8dcc673 | 2005-07-25 22:59:58 +0000 | [diff] [blame] | 297 | # use native Sun linker for C code |
| 298 | LINK="ld" |
Brian Paul | 5396ab2 | 2004-02-12 14:48:52 +0000 | [diff] [blame] | 299 | fi |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 300 | fi |
Brian Paul | 5396ab2 | 2004-02-12 14:48:52 +0000 | [diff] [blame] | 301 | echo "mklib: linker is" ${LINK} ${OPTS} |
| 302 | rm -f ${LIBNAME}.${MAJOR} ${LIBNAME} |
| 303 | ${LINK} ${OPTS} -o ${LIBNAME}.${MAJOR} ${OBJECTS} ${DEPS} |
| 304 | ln -s ${LIBNAME}.${MAJOR} ${LIBNAME} |
| 305 | FINAL_LIBS="${LIBNAME}.${MAJOR} ${LIBNAME}" |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 306 | fi |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 307 | ;; |
| 308 | |
| 309 | 'FreeBSD') |
Eric Anholt | b83435f | 2005-10-18 23:36:40 +0000 | [diff] [blame] | 310 | # we assume gcc |
| 311 | |
| 312 | if [ "x$LINK" = "x" ] ; then |
| 313 | # -linker was not specified so set default link command now |
| 314 | if [ $CPLUSPLUS = 1 ] ; then |
| 315 | LINK=g++ |
| 316 | else |
| 317 | LINK=gcc |
| 318 | fi |
| 319 | fi |
| 320 | |
Brian Paul | dd74e36 | 2004-04-08 22:26:22 +0000 | [diff] [blame] | 321 | if [ $NOPREFIX = 1 ] ; then |
| 322 | # No "lib" or ".so" part |
| 323 | echo "mklib: Making FreeBSD shared library: " ${LIBNAME} |
Eric Anholt | b83435f | 2005-10-18 23:36:40 +0000 | [diff] [blame] | 324 | OPTS="-shared" |
Brian Paul | dd74e36 | 2004-04-08 22:26:22 +0000 | [diff] [blame] | 325 | rm -f ${LIBNAME} |
Eric Anholt | b83435f | 2005-10-18 23:36:40 +0000 | [diff] [blame] | 326 | ${LINK} ${OPTS} -o ${LIBNAME} ${OBJECTS} ${DEPS} |
Brian Paul | dd74e36 | 2004-04-08 22:26:22 +0000 | [diff] [blame] | 327 | FINAL_LIBS=${LIBNAME} |
| 328 | elif [ $STATIC = 1 ] ; then |
Brian Paul | 5396ab2 | 2004-02-12 14:48:52 +0000 | [diff] [blame] | 329 | STLIB="lib${LIBNAME}.a" |
| 330 | echo "mklib: Making FreeBSD static library: " ${STLIB} |
| 331 | rm -f ${STLIB} |
| 332 | ar cq ${STLIB} ${OBJECTS} |
| 333 | ranlib ${STLIB} |
| 334 | FINAL_LIBS=${STLIB} |
| 335 | else |
Eric Anholt | b83435f | 2005-10-18 23:36:40 +0000 | [diff] [blame] | 336 | SHLIB="lib${LIBNAME}.so.${MAJOR}" |
| 337 | OPTS="-shared -Wl,-soname,${SHLIB}" |
Brian Paul | 5396ab2 | 2004-02-12 14:48:52 +0000 | [diff] [blame] | 338 | echo "mklib: Making FreeBSD shared library: " ${SHLIB} |
| 339 | rm -f ${SHLIB} |
Eric Anholt | b83435f | 2005-10-18 23:36:40 +0000 | [diff] [blame] | 340 | ${LINK} ${OPTS} -o ${SHLIB} ${OBJECTS} ${DEPS} |
Eric Anholt | 1c04be5 | 2005-10-22 01:41:40 +0000 | [diff] [blame^] | 341 | ln -sf ${SHLIB} "lib${LIBNAME}.so" |
| 342 | FINAL_LIBS="${SHLIB} lib${LIBNAME}.so" |
Brian Paul | 5396ab2 | 2004-02-12 14:48:52 +0000 | [diff] [blame] | 343 | fi |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 344 | ;; |
| 345 | |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 346 | 'NetBSD') |
Brian Paul | 5396ab2 | 2004-02-12 14:48:52 +0000 | [diff] [blame] | 347 | if [ $STATIC = 1 ] ; then |
| 348 | LIBNAME="lib${LIBNAME}_pic.a" |
| 349 | echo "mklib: Making NetBSD PIC static library: " ${LIBNAME} |
| 350 | rm -f ${LIBNAME} |
| 351 | ar cq ${LIBNAME} ${OBJECTS} |
| 352 | ranlib ${LIBNAME} |
| 353 | FINAL_LIBS=${LIBNAME} |
| 354 | else |
| 355 | LIBNAME="lib${LIBNAME}.so.${MAJOR}.${MINOR}" |
| 356 | echo "mklib: Making NetBSD PIC shared library: " ${LIBNAME} |
| 357 | rm -f ${LIBNAME} |
| 358 | ld -x -Bshareable -Bforcearchive -o ${LIBNAME} ${OBJECTS} |
| 359 | FINAL_LIBS=${LIBNAME} |
| 360 | fi |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 361 | ;; |
| 362 | |
Brian Paul | f8c31fc | 2004-01-29 15:21:47 +0000 | [diff] [blame] | 363 | 'IRIX' | 'IRIX64') |
Brian Paul | 5396ab2 | 2004-02-12 14:48:52 +0000 | [diff] [blame] | 364 | if [ $STATIC = 1 ] ; then |
| 365 | LIBNAME="lib${LIBNAME}.a" |
| 366 | rm -f ${LIBNAME} |
| 367 | ar rc ${LIBNAME} ${OBJECTS} |
| 368 | FINAL_LIBS=${LIBNAME} |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 369 | else |
Brian Paul | 5396ab2 | 2004-02-12 14:48:52 +0000 | [diff] [blame] | 370 | LIBNAME="lib${LIBNAME}.so" # prefix with "lib", suffix with ".so" |
Brian Paul | 8dcc673 | 2005-07-25 22:59:58 +0000 | [diff] [blame] | 371 | # XXX we should run 'file' on the first object file to determine |
| 372 | # if it's o32, n32 or 64 format, as we do for Linux above. |
Brian Paul | 5396ab2 | 2004-02-12 14:48:52 +0000 | [diff] [blame] | 373 | if [ $ARCHOPT = "64" ] ; then |
| 374 | # 64-bit ABI |
| 375 | OPTS="-64 -shared -all" |
| 376 | echo "mklib: Making IRIX 64-bit shared library: " ${LIBNAME} |
| 377 | elif [ $ARCHOPT = "o32" ] ; then |
| 378 | # old 32-bit ABI |
| 379 | OPTS="-32 -shared -all" |
| 380 | echo "mklib: Making IRIX o32-bit shared library: " ${LIBNAME} |
| 381 | else |
| 382 | # new 32-bit ABI |
| 383 | OPTS="-n32 -shared -all" |
| 384 | echo "mklib: Making IRIX n32-bit shared library: " ${LIBNAME} |
| 385 | fi |
| 386 | if [ $CPLUSPLUS = 1 ] ; then |
| 387 | LINK="CC" |
| 388 | else |
| 389 | LINK="ld" |
| 390 | fi |
| 391 | ${LINK} ${OPTS} -o ${LIBNAME} ${OBJECTS} ${DEPS} |
| 392 | FINAL_LIBS=${LIBNAME} |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 393 | fi |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 394 | ;; |
| 395 | |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 396 | 'linux-cygwin') |
| 397 | LIBNAME="lib${LIBNAME}.a" |
| 398 | echo "mklib: Making linux-cygwin library: " ${LIBNAME} |
Brian Paul | 5396ab2 | 2004-02-12 14:48:52 +0000 | [diff] [blame] | 399 | rm -f ${LIBNAME} |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 400 | gnuwin32ar ruv ${LIBNAME} ${OBJECTS} |
| 401 | FINAL_LIBS=${LIBNAME} |
| 402 | ;; |
| 403 | |
Brian Paul | c193bd0 | 2004-03-18 15:41:59 +0000 | [diff] [blame] | 404 | 'HP-UX') |
Brian Paul | 5396ab2 | 2004-02-12 14:48:52 +0000 | [diff] [blame] | 405 | if [ $STATIC = 1 ] ; then |
| 406 | LIBNAME="lib${LIBNAME}.a" |
Brian Paul | 52fb07e | 2004-03-30 14:47:02 +0000 | [diff] [blame] | 407 | echo "mklib: Making HP-UX static library: " ${LIBNAME} |
Brian Paul | 5396ab2 | 2004-02-12 14:48:52 +0000 | [diff] [blame] | 408 | rm -f ${LIBNAME} |
Brian Paul | c193bd0 | 2004-03-18 15:41:59 +0000 | [diff] [blame] | 409 | ar -ruv ${LIBNAME} ${OBJECTS} |
Brian Paul | 5396ab2 | 2004-02-12 14:48:52 +0000 | [diff] [blame] | 410 | FINAL_LIBS=${LIBNAME} |
| 411 | else |
| 412 | RUNLIB="lib${LIBNAME}.${MAJOR}" |
| 413 | DEVLIB="lib${LIBNAME}.sl" |
Brian Paul | 52fb07e | 2004-03-30 14:47:02 +0000 | [diff] [blame] | 414 | echo "mklib: Making HP-UX shared library: " ${RUNLIB} ${DEVLIB} |
Brian Paul | 5396ab2 | 2004-02-12 14:48:52 +0000 | [diff] [blame] | 415 | ld -b -o ${RUNLIB} +b ${RUNLIB} ${OBJECTS} ${DEPS} |
| 416 | ln -s ${RUNLIB} ${DEVLIB} |
Brian Paul | ac0cfee | 2004-04-25 15:13:56 +0000 | [diff] [blame] | 417 | FINAL_LIBS="${RUNLIB} ${DEVLIB}" |
Brian Paul | 5396ab2 | 2004-02-12 14:48:52 +0000 | [diff] [blame] | 418 | fi |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 419 | ;; |
| 420 | |
Brian Paul | b17a1a1 | 2004-11-01 22:28:42 +0000 | [diff] [blame] | 421 | 'AIX' | 'AIX64') |
| 422 | if [ $ARCH = "AIX64" ] ; then |
| 423 | X64="-X64" |
| 424 | fi |
Brian Paul | c193bd0 | 2004-03-18 15:41:59 +0000 | [diff] [blame] | 425 | |
Brian Paul | c193bd0 | 2004-03-18 15:41:59 +0000 | [diff] [blame] | 426 | if [ $STATIC = 1 ] ; then |
| 427 | LIBNAME="lib${LIBNAME}.a" |
| 428 | echo "mklib: Making AIX static library: " ${LIBNAME} |
Brian Paul | 7a534dc | 2005-09-14 02:18:09 +0000 | [diff] [blame] | 429 | rm -f ${LIBNAME} |
Brian Paul | b17a1a1 | 2004-11-01 22:28:42 +0000 | [diff] [blame] | 430 | ar -ruv ${X64} ${LIBNAME} ${OBJECTS} |
Brian Paul | c193bd0 | 2004-03-18 15:41:59 +0000 | [diff] [blame] | 431 | FINAL_LIBS=${LIBNAME} |
| 432 | else |
Karl Schultz | a16bdb5 | 2004-10-01 13:33:26 +0000 | [diff] [blame] | 433 | EXPFILE="lib${LIBNAME}.exp" |
| 434 | OFILE=shr.o #Want to be consistent with the IBM libGL.a |
| 435 | LIBNAME="lib${LIBNAME}.a" # shared objects are still stored in the .a libraries |
Brian Paul | b17a1a1 | 2004-11-01 22:28:42 +0000 | [diff] [blame] | 436 | if [ $ARCH = "AIX64" ] ; then |
| 437 | OPTS="-bE:${EXPFILE} -bM:SRE -bnoentry -q64" |
| 438 | else |
| 439 | OPTS="-bE:${EXPFILE} -bM:SRE -bnoentry" |
| 440 | fi |
Karl Schultz | a16bdb5 | 2004-10-01 13:33:26 +0000 | [diff] [blame] | 441 | rm -f ${EXPFILE} ${OFILE} |
Brian Paul | b17a1a1 | 2004-11-01 22:28:42 +0000 | [diff] [blame] | 442 | NM="/bin/nm -eC ${X64}" |
Karl Schultz | a16bdb5 | 2004-10-01 13:33:26 +0000 | [diff] [blame] | 443 | echo "#! /usr/lib/${LIBNAME}" > ${EXPFILE} |
| 444 | ${NM} ${OBJECTS} | awk '{ |
| 445 | if ((($2 == "T") || ($2 == "D") || ($2 == "B")) \ |
| 446 | && ( substr($1,1,1) != ".")) { |
| 447 | if (substr ($1, 1, 7) != "__sinit" && |
| 448 | substr ($1, 1, 7) != "__sterm") { |
| 449 | if (substr ($1, 1, 5) == "__tf1") |
| 450 | print (substr ($1, 7)) |
| 451 | else if (substr ($1, 1, 5) == "__tf9") |
| 452 | print (substr ($1, 15)) |
| 453 | else |
| 454 | print $1 |
| 455 | } |
| 456 | } |
| 457 | }' | sort -u >> ${EXPFILE} |
| 458 | cc ${OPTS} -o ${OFILE} ${OBJECTS} ${DEPS} |
Brian Paul | b17a1a1 | 2004-11-01 22:28:42 +0000 | [diff] [blame] | 459 | ar ${X64} -r ${LIBNAME} ${OFILE} |
Karl Schultz | a16bdb5 | 2004-10-01 13:33:26 +0000 | [diff] [blame] | 460 | FINAL_LIBS="${LIBNAME}" |
Brian Paul | c193bd0 | 2004-03-18 15:41:59 +0000 | [diff] [blame] | 461 | fi |
| 462 | ;; |
| 463 | |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 464 | 'OpenSTEP') |
| 465 | LIBNAME="lib${LIBNAME}.a" |
| 466 | echo "mklib: Making OpenSTEP static library: " ${LIBNAME} |
| 467 | libtool -static -o ${LIBNAME} - ${OBJECTS} |
| 468 | FINAL_LIBS=${LIBNAME} |
| 469 | ;; |
| 470 | |
| 471 | 'OSF1') |
Brian Paul | 5396ab2 | 2004-02-12 14:48:52 +0000 | [diff] [blame] | 472 | if [ $STATIC = 1 ] ; then |
| 473 | LIBNAME="lib${LIBNAME}.a" |
| 474 | echo "mklib: Making OSF/1 static library: " ${LIBNAME} |
| 475 | rm -f ${LIBNAME} |
Brian Paul | c193bd0 | 2004-03-18 15:41:59 +0000 | [diff] [blame] | 476 | ar -ruv ${LIBNAME} ${OBJECTS} |
Brian Paul | 5396ab2 | 2004-02-12 14:48:52 +0000 | [diff] [blame] | 477 | FINAL_LIBS=${LIBNAME} |
| 478 | else |
| 479 | VERSION="${MAJOR}.${MINOR}" |
| 480 | LIBNAME="lib${LIBNAME}.so" |
| 481 | echo "mklib: Making OSF/1 shared library: " ${LIBNAME} |
Brian Paul | 8dcc673 | 2005-07-25 22:59:58 +0000 | [diff] [blame] | 482 | if [ "x$LINK" = "x" ] ; then |
| 483 | if [ $CPLUSPLUS = 1 ] ; then |
| 484 | LINK=cxx |
| 485 | else |
| 486 | LINK=cc |
| 487 | fi |
Brian Paul | 0d5e6cc | 2004-11-29 17:23:12 +0000 | [diff] [blame] | 488 | fi |
Brian Paul | 5396ab2 | 2004-02-12 14:48:52 +0000 | [diff] [blame] | 489 | rm -f ${LIBNAME}.${VERSION} |
Brian Paul | 0d5e6cc | 2004-11-29 17:23:12 +0000 | [diff] [blame] | 490 | ${LINK} -o ${LIBNAME}.${VERSION} -shared -set_version ${VERSION} -soname ${LIBNAME}.${VERSION} -expect_unresolved \* -all ${OBJECTS} ${DEPS} |
Brian Paul | 5396ab2 | 2004-02-12 14:48:52 +0000 | [diff] [blame] | 491 | ln -sf ${LIBNAME}.${VERSION} ${LIBNAME} |
| 492 | FINAL_LIBS="${LIBNAME} ${LIBNAME}.${VERSION}" |
| 493 | fi |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 494 | ;; |
| 495 | |
| 496 | 'Darwin') |
Brian Paul | c193bd0 | 2004-03-18 15:41:59 +0000 | [diff] [blame] | 497 | if [ $STATIC = 1 ] ; then |
| 498 | LIBNAME="lib${LIBNAME}.a" |
| 499 | echo "mklib: Making Darwin static library: " ${LIBNAME} |
| 500 | LINK="ar" |
| 501 | OPTS="-ruv" |
| 502 | ${LINK} ${OPTS} ${LIBNAME} ${OBJECTS} |
| 503 | FINAL_LIBS=${LIBNAME} |
| 504 | else |
Brian Paul | ccda216 | 2005-06-30 02:33:25 +0000 | [diff] [blame] | 505 | LIBNAME="lib${LIBNAME}.dylib" |
Brian Paul | c50d77a | 2004-04-13 17:35:17 +0000 | [diff] [blame] | 506 | echo "mklib: Making Darwin shared library: " ${LIBNAME} |
Brian Paul | 32a7ab2 | 2005-10-21 15:39:42 +0000 | [diff] [blame] | 507 | FLAGS="-dynamiclib -multiply_defined suppress -current_version ${MAJOR}.${MINOR}.0 -compatibility_version ${MAJOR}.${MINOR}.0" |
Brian Paul | c05658d | 2004-03-25 21:18:32 +0000 | [diff] [blame] | 508 | if [ $CPLUSPLUS = 1 ] ; then |
| 509 | LINK="g++" |
| 510 | else |
| 511 | LINK="cc" |
| 512 | fi |
| 513 | ${LINK} ${FLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS} |
Brian Paul | aaba075 | 2004-03-23 23:25:47 +0000 | [diff] [blame] | 514 | FINAL_LIBS=${LIBNAME} |
Brian Paul | c193bd0 | 2004-03-18 15:41:59 +0000 | [diff] [blame] | 515 | fi |
| 516 | ;; |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 517 | |
| 518 | 'LynxOS') |
| 519 | LIBNAME="lib${LIBNAME}.a" |
Brian Paul | 5396ab2 | 2004-02-12 14:48:52 +0000 | [diff] [blame] | 520 | echo "mklib: Making LynxOS static library: " ${LIBNAME} |
| 521 | rm -f ${LIBNAME} |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 522 | ar ru ${LIBNAME} ${OBJECTS} |
| 523 | FINAL_LIBS=${LIBNAME} |
| 524 | ;; |
| 525 | |
| 526 | 'BeOS') |
Philippe Houdoin | ef4dd5a | 2004-08-14 10:12:38 +0000 | [diff] [blame] | 527 | if [ $STATIC = 1 ] ; then |
| 528 | LIBNAME="lib${LIBNAME}.a" |
| 529 | echo "mklib: Making BeOS static library: " ${LIBNAME} |
| 530 | ar -cru "${LIBNAME}" ${OBJECTS} |
| 531 | else |
Brian Paul | b784b8f | 2004-08-14 14:30:36 +0000 | [diff] [blame] | 532 | LIBNAME="lib${LIBNAME}.so" |
| 533 | echo "mklib: Making BeOS shared library: " ${LIBNAME} |
| 534 | gcc -nostart -Xlinker "-soname=${LIBNAME}" -L/Be/develop/lib/x86 -lbe ${DEPS} ${OBJECTS} -o "${LIBNAME}" |
| 535 | mimeset -f "${LIBNAME}" |
Brian Paul | 8dcc673 | 2005-07-25 22:59:58 +0000 | [diff] [blame] | 536 | # XXX remove the Mesa3D stuff here since mklib isn't mesa-specific. |
Brian Paul | b784b8f | 2004-08-14 14:30:36 +0000 | [diff] [blame] | 537 | setversion "${LIBNAME}" -app ${MAJOR} ${MINOR} ${PATCH} -short "Powered by Mesa3D!" -long "Powered by Mesa3D!" |
| 538 | fi |
| 539 | FINAL_LIBS=${LIBNAME} |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 540 | ;; |
| 541 | |
| 542 | 'QNX') |
| 543 | LIBNAME="lib${LIBNAME}.a" |
| 544 | echo "mklib: Making QNX library: " ${LIBNAME} |
| 545 | wlib ${LIBNAME} ${OBJECTS} |
| 546 | FINAL_LIBS=${LIBNAME} |
| 547 | ;; |
| 548 | |
Brian Paul | 65e2ab3 | 2003-10-27 18:13:37 +0000 | [diff] [blame] | 549 | 'MorphOS') |
| 550 | LIBNAME="lib${LIBNAME}.a" |
| 551 | echo "mklib: Making MorphOS library: " ${LIBNAME} |
| 552 | ppc-morphos-ar rc ${LIBNAME} ${OBJECTS} |
| 553 | FINAL_LIBS="${LIBNAME}" |
| 554 | ;; |
| 555 | |
Brian Paul | b3b725b | 2003-12-15 16:14:55 +0000 | [diff] [blame] | 556 | 'icc') |
| 557 | # Intel C compiler |
Brian Paul | 7c1ab40 | 2005-07-25 23:49:50 +0000 | [diff] [blame] | 558 | # This should get merged into the Linux code, above, since this isn't |
| 559 | # really a different architecture. |
Brian Paul | b3b725b | 2003-12-15 16:14:55 +0000 | [diff] [blame] | 560 | LIBNAME="lib${LIBNAME}" # prefix with "lib" |
| 561 | |
| 562 | if [ $STATIC = 1 ] ; then |
| 563 | echo "mklib: Making Intel ICC static library: " ${LIBNAME}.a |
| 564 | LINK="ar" |
| 565 | OPTS="-ruv" |
| 566 | # make lib |
| 567 | ${LINK} ${OPTS} ${LIBNAME}.a ${OBJECTS} |
| 568 | # finish up |
| 569 | FINAL_LIBS="${LIBNAME}.a" |
| 570 | else |
| 571 | OPTS="-shared" |
| 572 | VERSION="${MAJOR}.${MINOR}.${PATCH}" |
Brian Paul | b3b725b | 2003-12-15 16:14:55 +0000 | [diff] [blame] | 573 | echo "mklib: Making Intel ICC shared library: " ${LIBNAME}.so.${VERSION} |
| 574 | |
| 575 | if [ $CPLUSPLUS = 1 ] ; then |
| 576 | LINK="icc" |
| 577 | else |
| 578 | LINK="icc" |
| 579 | fi |
Brian Paul | b3b725b | 2003-12-15 16:14:55 +0000 | [diff] [blame] | 580 | # rm any old libs |
| 581 | rm -f ${LIBNAME}.so.${VERSION} |
| 582 | rm -f ${LIBNAME}.so.${MAJOR} |
| 583 | rm -f ${LIBNAME}.so |
Brian Paul | b3b725b | 2003-12-15 16:14:55 +0000 | [diff] [blame] | 584 | # make lib |
| 585 | ${LINK} ${OPTS} -o ${LIBNAME}.so.${VERSION} ${OBJECTS} ${DEPS} |
| 586 | # make usual symlinks |
| 587 | ln -s ${LIBNAME}.so.${VERSION} ${LIBNAME}.so.${MAJOR} |
| 588 | ln -s ${LIBNAME}.so.${MAJOR} ${LIBNAME}.so |
| 589 | # finish up |
| 590 | FINAL_LIBS="${LIBNAME}.so.${VERSION} ${LIBNAME}.so.${MAJOR} ${LIBNAME}.so" |
| 591 | fi |
| 592 | ;; |
| 593 | |
Brian Paul | 12d6cae | 2004-01-10 22:12:21 +0000 | [diff] [blame] | 594 | 'aix-gcc') |
| 595 | # AIX with gcc |
Brian Paul | 5396ab2 | 2004-02-12 14:48:52 +0000 | [diff] [blame] | 596 | if [ $STATIC = 1 ] ; then |
| 597 | LIBNAME="lib${LIBNAME}.a" |
| 598 | echo "mklib: Making AIX GCC static library: " ${LIBNAME} |
| 599 | rm -f ${LIBNAME} |
| 600 | ar ru ${LIBNAME} ${OBJECTS} |
| 601 | FINAL_LIBS=${LIBNAME} |
| 602 | else |
| 603 | LIBNAME="lib${LIBNAME}.so" # prefix with "lib", suffix with ".so" |
| 604 | echo "mklib: Making AIX GCC shared library: " ${LIBNAME} |
| 605 | # remove old lib |
| 606 | rm -f ${LIBNAME} |
| 607 | # make the lib |
| 608 | gcc -shared -Wl,-G ${OBJECTS} ${DEPS} -o ${LIBNAME} |
Brian Paul | 5396ab2 | 2004-02-12 14:48:52 +0000 | [diff] [blame] | 609 | # NOTE: the application linking with this library must specify |
| 610 | # the -Wl,-brtl flags to gcc |
Brian Paul | 5396ab2 | 2004-02-12 14:48:52 +0000 | [diff] [blame] | 611 | FINAL_LIBS=${LIBNAME} |
| 612 | fi |
| 613 | ;; |
| 614 | |
| 615 | 'ultrix') |
| 616 | # XXX untested |
| 617 | if [ $STATIC = 0 ] ; then |
| 618 | echo "mklib: Warning shared libs not supported on Ultrix" |
| 619 | fi |
| 620 | LIBNAME="lib${LIBNAME}.a" |
| 621 | echo "mklib: Making static library for Ultrix: " ${LIBNAME} |
Brian Paul | 12d6cae | 2004-01-10 22:12:21 +0000 | [diff] [blame] | 622 | rm -f ${LIBNAME} |
Brian Paul | 5396ab2 | 2004-02-12 14:48:52 +0000 | [diff] [blame] | 623 | ar ru ${LIBNAME} ${OBJECTS} |
| 624 | FINAL_LIBS="${LIBNAME}" |
Brian Paul | 12d6cae | 2004-01-10 22:12:21 +0000 | [diff] [blame] | 625 | ;; |
Brian Paul | b3b725b | 2003-12-15 16:14:55 +0000 | [diff] [blame] | 626 | |
Brian Paul | 580548d | 2004-04-22 16:16:42 +0000 | [diff] [blame] | 627 | CYGWIN*) |
| 628 | # GCC-based environment |
| 629 | CYGNAME="cyg${LIBNAME}" # prefix with "cyg" |
| 630 | LIBNAME="lib${LIBNAME}" # prefix with "lib" |
| 631 | |
| 632 | if [ $STATIC = 1 ] ; then |
| 633 | echo "mklib: Making" $ARCH "static library: " ${LIBNAME}.a |
| 634 | LINK="ar" |
| 635 | OPTS="-ru" |
| 636 | # make lib |
| 637 | ${LINK} ${OPTS} ${LIBNAME}.a ${OBJECTS} |
| 638 | ranlib ${LIBNAME}.a |
| 639 | # finish up |
| 640 | FINAL_LIBS=${LIBNAME}.a |
| 641 | else |
| 642 | OPTS="-shared -Wl,-export-all -Wl,--out-implib=${LIBNAME}-${MAJOR}.dll.a" |
| 643 | echo "mklib: Making" $ARCH "shared library: " ${LIBNAME}-${MAJOR}.dll |
| 644 | |
| 645 | if [ $CPLUSPLUS = 1 ] ; then |
| 646 | LINK="g++" |
| 647 | else |
| 648 | LINK="gcc" |
| 649 | fi |
| 650 | |
| 651 | # rm any old libs |
| 652 | rm -f ${LIBNAME}-${MAJOR}.dll |
| 653 | rm -f ${LIBNAME}.dll.a |
| 654 | rm -f ${LIBNAME}.a |
| 655 | |
| 656 | # make lib |
| 657 | ${LINK} ${OPTS} -o ${CYGNAME}-${MAJOR}.dll ${OBJECTS} ${DEPS} |
| 658 | # make usual symlinks |
| 659 | ln -s ${LIBNAME}-${MAJOR}.dll.a ${LIBNAME}.dll.a |
| 660 | # finish up |
| 661 | FINAL_LIBS="${LIBNAME}-${MAJOR}.dll.a ${LIBNAME}.dll.a" |
| 662 | # special case for installing in bin |
| 663 | FINAL_BINS="${CYGNAME}-${MAJOR}.dll" |
| 664 | fi |
| 665 | ;; |
| 666 | |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 667 | 'example') |
| 668 | # If you're adding support for a new architecture, you can |
| 669 | # start with this: |
Brian Paul | 5396ab2 | 2004-02-12 14:48:52 +0000 | [diff] [blame] | 670 | if [ $STATIC = 1 ] ; then |
| 671 | LIBNAME="lib${LIBNAME}.a" |
| 672 | echo "mklib: Making static library for example arch: " ${LIBNAME} |
| 673 | rm -f ${LIBNAME} |
| 674 | ar rv ${LIBNAME} ${OBJECTS} |
| 675 | FINAL_LIBS="${LIBNAME}" |
| 676 | else |
Brian Paul | 7c1ab40 | 2005-07-25 23:49:50 +0000 | [diff] [blame] | 677 | LIBNAME="lib${LIBNAME}.so" # prefix with "lib", suffix with ".so" |
Brian Paul | 5396ab2 | 2004-02-12 14:48:52 +0000 | [diff] [blame] | 678 | echo "mklib: Making shared library for example arch: " ${LIBNAME} |
| 679 | ld -o ${LIBNAME} ${OBJECTS} ${DEPS} |
| 680 | FINAL_LIBS="${LIBNAME}" |
| 681 | fi |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 682 | ;; |
| 683 | |
| 684 | *) |
Brian Paul | 5396ab2 | 2004-02-12 14:48:52 +0000 | [diff] [blame] | 685 | echo "mklib: ERROR: Don't know how to make a static/shared library for" ${ARCH} |
| 686 | echo "mklib: Please add necessary commands to mklib script." |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 687 | ;; |
| 688 | esac |
| 689 | |
| 690 | |
| 691 | # |
| 692 | # Put library files into installation directory if specified. |
| 693 | # |
| 694 | if [ ${INSTALLDIR} != "." ] ; then |
| 695 | echo "mklib: Installing" ${FINAL_LIBS} "in" ${INSTALLDIR} |
| 696 | mv ${FINAL_LIBS} ${INSTALLDIR}/ |
| 697 | fi |