Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | # Make a shared library. |
| 4 | # Basically do a switch/case depending on the OS and make a shared |
| 5 | # lib conforming to that OS. |
| 6 | |
| 7 | |
| 8 | # Usage: |
| 9 | # mklib [options] objects ... |
| 10 | # Options: |
Brian Paul | 1a644b3 | 2003-12-06 17:57:12 +0000 | [diff] [blame] | 11 | # -o LIBRARY specifies the name of resulting library |
| 12 | # ("-o GL" for example, might result in "libGL.so" being made) |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 13 | # -major N specifies major version number (default is 1) |
| 14 | # -minor N specifies minor version number (default is 0) |
| 15 | # -patch N specifies patch version number (default is 0) |
| 16 | # -lLIBRARY specifies a dependency on LIBRARY |
| 17 | # -LDIR search in DIR for library dependencies |
| 18 | # -cplusplus link with C++ runtime |
| 19 | # -static make a static library (default is dynamic/shared) |
| 20 | # -install DIR move resulting library files to DIR |
| 21 | # -arch ARCH override using `uname` to determine architecture |
| 22 | # -archopt OPT specify an extra achitecture-specific option OPT |
| 23 | # |
| 24 | # The library name should just be "GL" or "GLU", etc. The 'lib' prefix |
| 25 | # will be added here if needed, as well as the ".so" or ".a" suffix, etc. |
| 26 | # |
| 27 | # objects should be: foo.o bar.o etc.o |
| 28 | # |
| 29 | # Environment variables recognized: |
| 30 | # CC C compiler command |
| 31 | # CXX C++ compiler command |
| 32 | # |
| 33 | |
| 34 | |
| 35 | # |
| 36 | # Option defaults |
| 37 | # |
| 38 | LIBNAME="" |
| 39 | MAJOR=1 |
| 40 | MINOR=0 |
| 41 | PATCH=0 |
| 42 | DEPS="" |
| 43 | CPLUSPLUS=0 |
| 44 | STATIC=0 |
| 45 | INSTALLDIR="." |
| 46 | ARCH="auto" |
| 47 | ARCHOPT="" |
| 48 | |
| 49 | |
| 50 | # |
| 51 | # Parse arguments |
| 52 | # |
| 53 | while true |
| 54 | do |
| 55 | case $1 in |
| 56 | '-o') shift 1; LIBNAME=$1;; |
| 57 | '-major') shift 1; MAJOR=$1;; |
| 58 | '-minor') shift 1; MINOR=$1;; |
| 59 | '-patch') shift 1; PATCH=$1;; |
| 60 | -l*) DEPS="$DEPS $1";; |
| 61 | -L*) DEPS="$DEPS $1";; |
| 62 | '-cplusplus') CPLUSPLUS=1;; |
| 63 | '-static') STATIC=1;; |
| 64 | '-install') shift 1; INSTALLDIR=$1;; |
| 65 | '-arch') shift 1; ARCH=$1;; |
| 66 | '-archopt') shift 1; ARCHOPT=$1;; |
| 67 | -*) echo "mklib: Unknown option: " $1 ; exit 1;; |
| 68 | *) break |
| 69 | esac |
| 70 | shift 1 |
| 71 | done |
| 72 | OBJECTS=$@ |
| 73 | |
| 74 | if [ ${ARCH} = "auto" ] ; then |
| 75 | ARCH=`uname` |
| 76 | fi |
| 77 | |
| 78 | |
| 79 | # |
| 80 | # Error checking |
| 81 | # |
| 82 | if [ "x${LIBNAME}" = "x" ] ; then |
| 83 | echo "mklib: Error: no library name specified" |
| 84 | exit 1 |
| 85 | fi |
| 86 | if [ "x${OBJECTS}" = "x" ] ; then |
| 87 | echo "mklib: Error: no object files specified" |
| 88 | exit 1 |
| 89 | fi |
| 90 | |
| 91 | |
| 92 | # |
| 93 | # Debugging info |
| 94 | # |
| 95 | if [ ] ; then |
| 96 | echo "-----------------" |
| 97 | echo ARCH is $ARCH |
| 98 | echo LIBNAME is $LIBNAME |
| 99 | echo MAJOR is $MAJOR |
| 100 | echo MINOR is $MINOR |
| 101 | echo PATCH is $PATCH |
| 102 | echo DEPS are $DEPS |
| 103 | echo "-----------------" |
| 104 | fi |
| 105 | |
| 106 | |
| 107 | # |
| 108 | # OK, make the library now |
| 109 | # |
| 110 | case $ARCH in |
| 111 | |
Brian Paul | 12d6cae | 2004-01-10 22:12:21 +0000 | [diff] [blame] | 112 | 'Linux' | 'OpenBSD') |
| 113 | # GCC-based environment |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 114 | LIBNAME="lib${LIBNAME}" # prefix with "lib" |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 115 | |
Brian Paul | 1c4b711 | 2003-10-10 17:58:38 +0000 | [diff] [blame] | 116 | if [ $STATIC = 1 ] ; then |
Brian Paul | 5b9a9d4 | 2004-01-17 18:31:12 +0000 | [diff] [blame] | 117 | echo "mklib: Making" $ARCH "static library: " ${LIBNAME}.a |
Brian Paul | 1c4b711 | 2003-10-10 17:58:38 +0000 | [diff] [blame] | 118 | LINK="ar" |
| 119 | OPTS="-ruv" |
| 120 | # make lib |
| 121 | ${LINK} ${OPTS} ${LIBNAME}.a ${OBJECTS} |
| 122 | # finish up |
| 123 | FINAL_LIBS="${LIBNAME}.a" |
| 124 | else |
Brian Paul | 5b9a9d4 | 2004-01-17 18:31:12 +0000 | [diff] [blame] | 125 | if [ $ARCH = 'Linux' ] ; then |
| 126 | OPTS="-Xlinker -Bsymbolic -shared -Wl,-soname,${LIBNAME}.so.${MAJOR}" |
| 127 | else |
| 128 | OPTS="-shared -Wl,-soname,${LIBNAME}.so.${MAJOR}" |
| 129 | fi |
Brian Paul | 1c4b711 | 2003-10-10 17:58:38 +0000 | [diff] [blame] | 130 | VERSION="${MAJOR}.${MINOR}.${PATCH}" |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 131 | |
Brian Paul | 12d6cae | 2004-01-10 22:12:21 +0000 | [diff] [blame] | 132 | echo "mklib: Making " $ARCH " shared library: " ${LIBNAME}.so.${VERSION} |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 133 | |
Brian Paul | 1c4b711 | 2003-10-10 17:58:38 +0000 | [diff] [blame] | 134 | if [ $CPLUSPLUS = 1 ] ; then |
| 135 | LINK="g++" |
| 136 | else |
| 137 | LINK="gcc" |
| 138 | fi |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 139 | |
Brian Paul | 1c4b711 | 2003-10-10 17:58:38 +0000 | [diff] [blame] | 140 | # rm any old libs |
| 141 | rm -f ${LIBNAME}.so.${VERSION} |
| 142 | rm -f ${LIBNAME}.so.${MAJOR} |
| 143 | rm -f ${LIBNAME}.so |
| 144 | |
| 145 | # make lib |
| 146 | ${LINK} ${OPTS} -o ${LIBNAME}.so.${VERSION} ${OBJECTS} ${DEPS} |
| 147 | # make usual symlinks |
| 148 | ln -s ${LIBNAME}.so.${VERSION} ${LIBNAME}.so.${MAJOR} |
| 149 | ln -s ${LIBNAME}.so.${MAJOR} ${LIBNAME}.so |
| 150 | # finish up |
| 151 | FINAL_LIBS="${LIBNAME}.so.${VERSION} ${LIBNAME}.so.${MAJOR} ${LIBNAME}.so" |
| 152 | fi |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 153 | ;; |
| 154 | |
| 155 | 'SunOS') |
| 156 | LIBNAME="lib${LIBNAME}.so" |
| 157 | echo "mklib: Making SunOS shared library: " ${LIBNAME} |
Brian Paul | 4b60344 | 2004-01-14 23:18:47 +0000 | [diff] [blame] | 158 | # XXX OPTS for gcc should be -shared, but that doesn't work. |
| 159 | # Using -G does work though. |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 160 | if [ $CPLUSPLUS = 1 ] ; then |
Brian Paul | 1a644b3 | 2003-12-06 17:57:12 +0000 | [diff] [blame] | 161 | # determine linker and options for C++ code |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 162 | if [ "x${CXX}" = "xg++" ] ; then |
Brian Paul | 1a644b3 | 2003-12-06 17:57:12 +0000 | [diff] [blame] | 163 | # use g++ |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 164 | LINK="g++" |
Brian Paul | 4b60344 | 2004-01-14 23:18:47 +0000 | [diff] [blame] | 165 | OPTS="-G" |
Brian Paul | 1761087 | 2003-09-08 14:59:11 +0000 | [diff] [blame] | 166 | elif [ "x${CXX}" = "xCC" ] ; then |
Brian Paul | 1a644b3 | 2003-12-06 17:57:12 +0000 | [diff] [blame] | 167 | # use Sun CC |
Brian Paul | 1761087 | 2003-09-08 14:59:11 +0000 | [diff] [blame] | 168 | LINK="CC" |
Brian Paul | 1a644b3 | 2003-12-06 17:57:12 +0000 | [diff] [blame] | 169 | OPTS="-G" |
| 170 | elif [ "x${CXX}" = "xc++" ] ; then |
| 171 | # use Sun c++ |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 172 | LINK="c++" |
Brian Paul | 1a644b3 | 2003-12-06 17:57:12 +0000 | [diff] [blame] | 173 | OPTS="-G" |
| 174 | elif [ `which c++` ] ; then |
| 175 | # use Sun c++ |
| 176 | LINK="c++" |
| 177 | OPTS="-G" |
Brian Paul | 1761087 | 2003-09-08 14:59:11 +0000 | [diff] [blame] | 178 | elif [ `type g++` ] ; then |
Brian Paul | 1a644b3 | 2003-12-06 17:57:12 +0000 | [diff] [blame] | 179 | # use g++ |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 180 | LINK="g++" |
Brian Paul | 4b60344 | 2004-01-14 23:18:47 +0000 | [diff] [blame] | 181 | OPTS="-G" |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 182 | else |
| 183 | echo "mklib: warning: can't find C++ comiler, trying CC." |
| 184 | LINK="CC" |
Brian Paul | 1a644b3 | 2003-12-06 17:57:12 +0000 | [diff] [blame] | 185 | OPTS="-G" |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 186 | fi |
| 187 | elif [ "x${CC}" = "xgcc" ] ; then |
| 188 | # use gcc for linking |
| 189 | LINK="gcc" |
Brian Paul | 4b60344 | 2004-01-14 23:18:47 +0000 | [diff] [blame] | 190 | OPTS="-G" |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 191 | else |
| 192 | # use native Sun linker |
| 193 | LINK="ld" |
Brian Paul | 1a644b3 | 2003-12-06 17:57:12 +0000 | [diff] [blame] | 194 | OPTS="-G" |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 195 | fi |
Brian Paul | 1a644b3 | 2003-12-06 17:57:12 +0000 | [diff] [blame] | 196 | echo "mklib: linker is" ${LINK} ${OPTS} |
Brian Paul | 5b9a9d4 | 2004-01-17 18:31:12 +0000 | [diff] [blame] | 197 | rm -f ${LIBNAME}.${MAJOR} ${LIBNAME} |
| 198 | ${LINK} ${OPTS} -o ${LIBNAME}.${MAJOR} ${OBJECTS} ${DEPS} |
| 199 | ln -s ${LIBNAME}.${MAJOR} ${LIBNAME} |
| 200 | FINAL_LIBS="${LIBNAME}.${MAJOR} ${LIBNAME}" |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 201 | ;; |
| 202 | |
| 203 | 'FreeBSD') |
| 204 | SHLIB="lib${LIBNAME}.so.${MAJOR}.${MINOR}" |
| 205 | STLIB="lib${LIBNAME}.a" |
| 206 | echo "mklib: Making FreeBSD shared library: " ${SHLIB} |
| 207 | rm -f ${SHLIB} ${STLIB} |
| 208 | ar cq ${STLIB} ${OBJECTS} |
| 209 | ranlib ${STLIB} |
| 210 | ld -Bshareable -o ${SHLIB} ${OBJECTS} |
| 211 | # XXX make lib${LIBNAME}.so.${MAJOR} symlink? |
| 212 | FINAL_LIBS="${SHLIB} ${STLIB}" |
| 213 | ;; |
| 214 | |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 215 | 'NetBSD') |
| 216 | LIBNAME="lib${LIBNAME}" |
| 217 | echo "mklib: Making NetBSD PIC shared library: " ${LIBNAME} |
| 218 | VERSION="${MAJOR}.${MINOR}" |
| 219 | rm -f ${LIBNAME}_pic.a ${LIBNAME}.so.${VERSION} |
| 220 | ar cq ${LIBNAME}_pic.a ${OBJECTS} |
| 221 | ranlib ${LIBNAME}_pic.a |
| 222 | ld -x -Bshareable -Bforcearchive -o ${LIBNAME}.so.${VERSION} ${LIBNAME}_pic.a |
| 223 | FINAL_LIBS="${LIBNAME}_pic.a ${LIBNAME}.so.${VERSION}" |
| 224 | ;; |
| 225 | |
| 226 | 'IRIX') |
| 227 | LIBNAME="lib${LIBNAME}.so" # prefix with "lib", suffix with ".so" |
Brian Paul | dc8f8bd | 2004-01-29 14:46:16 +0000 | [diff] [blame^] | 228 | if [ $ARCHOPT = "64" ] ; then |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 229 | # 64-bit ABI |
| 230 | OPTS="-64 -shared -all" |
| 231 | echo "mklib: Making IRIX 64-bit shared library: " ${LIBNAME} |
Brian Paul | dc8f8bd | 2004-01-29 14:46:16 +0000 | [diff] [blame^] | 232 | elif [ $ARCHOPT = "o32" ] ; then |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 233 | # old 32-bit ABI |
| 234 | OPTS="-32 -shared -all" |
| 235 | echo "mklib: Making IRIX o32-bit shared library: " ${LIBNAME} |
| 236 | else |
| 237 | # new 32-bit ABI |
| 238 | OPTS="-n32 -shared -all" |
| 239 | echo "mklib: Making IRIX n32-bit shared library: " ${LIBNAME} |
| 240 | fi |
Brian Paul | 9ca723f | 2004-01-28 22:54:33 +0000 | [diff] [blame] | 241 | if [ $CPLUSPLUS = 1 ] ; then |
| 242 | LINK="CC" |
| 243 | else |
| 244 | LINK="ld" |
| 245 | fi |
| 246 | ${LINK} ${OPTS} -o ${LIBNAME} ${OBJECTS} ${DEPS} |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 247 | FINAL_LIBS="${LIBNAME}" |
| 248 | ;; |
| 249 | |
| 250 | 'IRIX64') |
| 251 | LIBNAME="lib${LIBNAME}.so" # prefix with "lib", suffix with ".so" |
| 252 | echo "mklib: Making IRIX64 library: " ${LIBNAME} |
| 253 | # 64-bit ABI |
| 254 | OPTS="-64 -shared -all" |
Brian Paul | 9ca723f | 2004-01-28 22:54:33 +0000 | [diff] [blame] | 255 | if [ $CPLUSPLUS = 1 ] ; then |
| 256 | LINK="CC" |
| 257 | else |
| 258 | LINK="ld" |
| 259 | fi |
| 260 | ${LINK} ${OPTS} -o ${LIBNAME} ${OBJECTS} ${DEPS} |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 261 | FINAL_LIBS="${LIBNAME}" |
| 262 | ;; |
| 263 | |
| 264 | 'linux-cygwin') |
| 265 | LIBNAME="lib${LIBNAME}.a" |
| 266 | echo "mklib: Making linux-cygwin library: " ${LIBNAME} |
| 267 | gnuwin32ar ruv ${LIBNAME} ${OBJECTS} |
| 268 | FINAL_LIBS=${LIBNAME} |
| 269 | ;; |
| 270 | |
| 271 | 'HPUX') |
| 272 | RUNLIB="lib${LIBNAME}.${MAJOR}" |
| 273 | DEVLIB="lib${LIBNAME}.sl" |
| 274 | echo "mklib: Making HPUX library: " ${RUNLIB} ${DEVLIB} |
| 275 | ld -b -o ${RUNLIB} +b ${RUNLIB} ${OBJECTS} ${DEPS} |
| 276 | ln -s ${RUNLIB} ${DEVLIB} |
| 277 | FINAL_LIBS="{RUNLIB} ${DEVLIB}" |
| 278 | ;; |
| 279 | |
| 280 | 'OpenSTEP') |
| 281 | LIBNAME="lib${LIBNAME}.a" |
| 282 | echo "mklib: Making OpenSTEP static library: " ${LIBNAME} |
| 283 | libtool -static -o ${LIBNAME} - ${OBJECTS} |
| 284 | FINAL_LIBS=${LIBNAME} |
| 285 | ;; |
| 286 | |
| 287 | 'OSF1') |
| 288 | VERSION="${MAJOR}.${MINOR}" |
| 289 | LIBNAME="lib${LIBNAME}.so" |
| 290 | ARNAME="lib${LIBNAME}.a" |
| 291 | echo "mklib: Making OSF/1 library: " ${LIBNAME} |
| 292 | rm -f ${LIBNAME}.${VERSION} |
| 293 | ld -o ${LIBNAME}.${VERSION} -shared -no_archive -set_version ${VERSION} -soname ${LIBNAME}.${VERSION} -expect_unresolved \* -all ${OBJECTS} ${DEPS} |
| 294 | ln -sf ${LIBNAME}.${VERSION} ${LIBNAME} |
| 295 | |
| 296 | # also make static lib |
| 297 | rm -f ${ARNAME} |
| 298 | ar clqz ${ARNAME} ${OBJECTS} |
| 299 | FINAL_LIBS="${ARNAME} ${LIBNAME} ${LIBNAME}.${VERSION}" |
| 300 | ;; |
| 301 | |
| 302 | 'Darwin') |
| 303 | VERSION="${MAJOR}.${MINOR}.${TINY}" |
| 304 | LIBNAME="lib${LIBNAME}.dylib" |
| 305 | ARNAME="lib${LIBNAME}.dylib.a" |
| 306 | echo "mklib: Making Darwin libraries: " ${LIBNAME} ${ARNAME} |
| 307 | FLAGS="-dynamiclib -multiply_defined suppress" |
| 308 | cc ${FLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS} |
| 309 | # also make regular .a files, |
| 310 | # provided by Danek Duvall (duvall@dhduvall.student.princeton.edu) |
| 311 | ar ruv ${ARNAME} ${OBJECTS} |
| 312 | ranlib ${ARNAME} |
| 313 | FINAL_LIBS="${ARNAME} ${LIBNAME}" |
| 314 | ;; |
| 315 | |
| 316 | 'LynxOS') |
| 317 | LIBNAME="lib${LIBNAME}.a" |
| 318 | echo "mklib: Making LynxOS library: " ${LIBNAME} |
| 319 | ar ru ${LIBNAME} ${OBJECTS} |
| 320 | FINAL_LIBS=${LIBNAME} |
| 321 | ;; |
| 322 | |
| 323 | 'BeOS') |
| 324 | LIBNAME="lib${LIBNAME}.so" |
| 325 | echo "mklib: Making BeOS shared library: " ${LIBNAME} |
| 326 | gcc -nostart -Xlinker -soname=${LIBNAME} -L/Be/develop/lib/x86 ${OBJECTS} -lbe -o ${LIBNAME} |
| 327 | FINAL_LIBS=${LIBNAME} |
| 328 | ;; |
| 329 | |
| 330 | 'QNX') |
| 331 | LIBNAME="lib${LIBNAME}.a" |
| 332 | echo "mklib: Making QNX library: " ${LIBNAME} |
| 333 | wlib ${LIBNAME} ${OBJECTS} |
| 334 | FINAL_LIBS=${LIBNAME} |
| 335 | ;; |
| 336 | |
Brian Paul | 65e2ab3 | 2003-10-27 18:13:37 +0000 | [diff] [blame] | 337 | 'MorphOS') |
| 338 | LIBNAME="lib${LIBNAME}.a" |
| 339 | echo "mklib: Making MorphOS library: " ${LIBNAME} |
| 340 | ppc-morphos-ar rc ${LIBNAME} ${OBJECTS} |
| 341 | FINAL_LIBS="${LIBNAME}" |
| 342 | ;; |
| 343 | |
Brian Paul | b3b725b | 2003-12-15 16:14:55 +0000 | [diff] [blame] | 344 | 'icc') |
| 345 | # Intel C compiler |
| 346 | LIBNAME="lib${LIBNAME}" # prefix with "lib" |
| 347 | |
| 348 | if [ $STATIC = 1 ] ; then |
| 349 | echo "mklib: Making Intel ICC static library: " ${LIBNAME}.a |
| 350 | LINK="ar" |
| 351 | OPTS="-ruv" |
| 352 | # make lib |
| 353 | ${LINK} ${OPTS} ${LIBNAME}.a ${OBJECTS} |
| 354 | # finish up |
| 355 | FINAL_LIBS="${LIBNAME}.a" |
| 356 | else |
| 357 | OPTS="-shared" |
| 358 | VERSION="${MAJOR}.${MINOR}.${PATCH}" |
| 359 | |
| 360 | echo "mklib: Making Intel ICC shared library: " ${LIBNAME}.so.${VERSION} |
| 361 | |
| 362 | if [ $CPLUSPLUS = 1 ] ; then |
| 363 | LINK="icc" |
| 364 | else |
| 365 | LINK="icc" |
| 366 | fi |
| 367 | |
| 368 | # rm any old libs |
| 369 | rm -f ${LIBNAME}.so.${VERSION} |
| 370 | rm -f ${LIBNAME}.so.${MAJOR} |
| 371 | rm -f ${LIBNAME}.so |
| 372 | |
| 373 | # make lib |
| 374 | ${LINK} ${OPTS} -o ${LIBNAME}.so.${VERSION} ${OBJECTS} ${DEPS} |
| 375 | # make usual symlinks |
| 376 | ln -s ${LIBNAME}.so.${VERSION} ${LIBNAME}.so.${MAJOR} |
| 377 | ln -s ${LIBNAME}.so.${MAJOR} ${LIBNAME}.so |
| 378 | # finish up |
| 379 | FINAL_LIBS="${LIBNAME}.so.${VERSION} ${LIBNAME}.so.${MAJOR} ${LIBNAME}.so" |
| 380 | fi |
| 381 | ;; |
| 382 | |
Brian Paul | 12d6cae | 2004-01-10 22:12:21 +0000 | [diff] [blame] | 383 | 'aix-gcc') |
| 384 | # AIX with gcc |
| 385 | LIBNAME="lib${LIBNAME}.so" # prefix with "lib", suffix with ".so" |
| 386 | echo "mklib: Making AIX GCC shared library: " ${LIBNAME} |
| 387 | # remove old lib |
| 388 | rm -f ${LIBNAME} |
| 389 | # make the lib |
| 390 | gcc -shared -Wl,-G ${OBJECTS} ${DEPS} -o ${LIBNAME} |
| 391 | |
| 392 | # NOTE: the application linking with this library must specify |
| 393 | # the -Wl,-brtl flags to gcc |
| 394 | |
| 395 | FINAL_LIBS=${LIBNAME} |
| 396 | ;; |
Brian Paul | b3b725b | 2003-12-15 16:14:55 +0000 | [diff] [blame] | 397 | |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 398 | 'example') |
| 399 | # If you're adding support for a new architecture, you can |
| 400 | # start with this: |
| 401 | LIBNAME="lib${LIBNAME}.so" # prefix with "lib" |
| 402 | echo "mklib: Making library for example arch: " ${LIBNAME} |
| 403 | ld -o ${LIBNAME} ${OBJECTS} ${DEPS} |
| 404 | FINAL_LIBS="${LIBNAME}" |
| 405 | ;; |
| 406 | |
| 407 | *) |
| 408 | echo "mklib: WARNING: making library for unknown platform!" |
| 409 | echo "mklib: WARNING: this may not work!" |
| 410 | echo "mklib: WARNING: please update the bin/mklib script!" |
| 411 | # XXX this is a total hack for Mesa - remove someday |
| 412 | # fall-back to an old mklib.* script |
Brian Paul | f023391 | 2003-11-03 21:59:36 +0000 | [diff] [blame] | 413 | LIBNAME="lib${LIBNAME}.a" |
Brian Paul | e96a121 | 2003-10-27 20:04:43 +0000 | [diff] [blame] | 414 | ${TOP}/${MAKELIB} "lib${LIBNAME}.a" ${MAJOR} ${MINOR} ${PATCH} ${OBJECTS} |
Brian Paul | 65e2ab3 | 2003-10-27 18:13:37 +0000 | [diff] [blame] | 415 | FINAL_LIBS="${LIBNAME}" |
Brian Paul | 8c20c7b | 2003-06-01 16:21:45 +0000 | [diff] [blame] | 416 | ;; |
| 417 | esac |
| 418 | |
| 419 | |
| 420 | # |
| 421 | # Put library files into installation directory if specified. |
| 422 | # |
| 423 | if [ ${INSTALLDIR} != "." ] ; then |
| 424 | echo "mklib: Installing" ${FINAL_LIBS} "in" ${INSTALLDIR} |
| 425 | mv ${FINAL_LIBS} ${INSTALLDIR}/ |
| 426 | fi |