e8c58c56682e91de967fd8199b195ffc7796306a
[mesa.git] / bin / mklib
1 #!/bin/sh
2
3 # Make a shared library.
4 # Basically do a switch/case depending on the OS and make a shared (or static)
5 # library conforming to that OS.
6
7
8 # Usage:
9 # mklib [options] objects ...
10 # Options:
11 # -o LIBRARY specifies the name of resulting library
12 # ("-o GL" for example, might result in "libGL.so" being made)
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 file(s) to DIR
21 # -arch ARCH override using `uname` to determine architecture
22 # -archopt OPT specify an extra achitecture-specific option OPT
23 # -noprefix don't prefix library name with "lib" or any suffix
24 # -exports FILE only export the symbols listed in FILE
25 #
26 # The library name should just be "GL" or "GLU", etc. The 'lib' prefix
27 # will be added here if needed, as well as the ".so" or ".a" suffix,
28 # etc (unless the -noprefix option is used).
29 #
30 # objects should be: foo.o bar.o etc.o
31 #
32 # Environment variables recognized:
33 # CC C compiler command
34 # CXX C++ compiler command
35 #
36
37
38 #
39 # Option defaults
40 #
41 LIBNAME=""
42 MAJOR=1
43 MINOR=0
44 PATCH=""
45 DEPS=""
46 CPLUSPLUS=0
47 STATIC=0
48 INSTALLDIR="."
49 ARCH="auto"
50 ARCHOPT=""
51 NOPREFIX=0
52 EXPORTS=""
53
54
55 #
56 # Parse arguments
57 #
58 while true
59 do
60 case $1 in
61 '-o') shift 1; LIBNAME=$1;;
62 '-major') shift 1; MAJOR=$1;;
63 '-minor') shift 1; MINOR=$1;;
64 '-patch') shift 1; PATCH=$1;;
65 -l*) DEPS="$DEPS $1";;
66 -L*) DEPS="$DEPS $1";;
67 '-cplusplus') CPLUSPLUS=1;;
68 '-static') STATIC=1;;
69 '-install') shift 1; INSTALLDIR=$1;;
70 '-arch') shift 1; ARCH=$1;;
71 '-archopt') shift 1; ARCHOPT=$1;;
72 '-noprefix') NOPREFIX=1;;
73 '-exports') shift 1; EXPORTS=$1;;
74 -*) echo "mklib: Unknown option: " $1 ; exit 1;;
75 *) break
76 esac
77 shift 1
78 done
79 OBJECTS=$@
80
81 if [ ${ARCH} = "auto" ] ; then
82 ARCH=`uname`
83 fi
84
85
86 #
87 # Error checking
88 #
89 if [ "x${LIBNAME}" = "x" ] ; then
90 echo "mklib: Error: no library name specified"
91 exit 1
92 fi
93 if [ "x${OBJECTS}" = "x" ] ; then
94 echo "mklib: Error: no object files specified"
95 exit 1
96 fi
97
98
99 #
100 # Debugging info
101 #
102 if [ ] ; then
103 echo "-----------------"
104 echo ARCH is $ARCH
105 echo LIBNAME is $LIBNAME
106 echo MAJOR is $MAJOR
107 echo MINOR is $MINOR
108 echo PATCH is $PATCH
109 echo DEPS are $DEPS
110 echo "EXPORTS in" $EXPORTS
111 echo "-----------------"
112 fi
113
114
115 #
116 # OK, make the library now
117 #
118 case $ARCH in
119
120 'Linux' | 'OpenBSD')
121 # we assume gcc
122
123 # Set default compilers if env vars not set
124 if [ "x$CXX" = "x" ] ; then
125 CXX=g++
126 fi
127 if [ "x$CC" = "x" ] ; then
128 CC=gcc
129 fi
130
131 if [ $NOPREFIX = 1 ] ; then
132 # No "lib" or ".so" part
133 echo "mklib: Making" $ARCH "shared library: " ${LIBNAME}
134 #OPTS="-shared -Wl,-soname,${LIBNAME}" # soname???
135 OPTS="-shared"
136 if [ $CPLUSPLUS = 1 ] ; then
137 LINK=$CXX
138 else
139 LINK=$CC
140 fi
141 rm -f ${LIBNAME}
142
143 # make lib
144 ${LINK} ${OPTS} -o ${LIBNAME} ${OBJECTS} ${DEPS}
145 # finish up
146 FINAL_LIBS="${LIBNAME}"
147 elif [ $STATIC = 1 ] ; then
148 LIBNAME="lib${LIBNAME}" # prefix with "lib"
149 echo "mklib: Making" $ARCH "static library: " ${LIBNAME}.a
150 LINK="ar"
151 OPTS="-ru"
152 # make lib
153 ${LINK} ${OPTS} ${LIBNAME}.a ${OBJECTS}
154 ranlib ${LIBNAME}.a
155 # finish up
156 FINAL_LIBS=${LIBNAME}.a
157 else
158 LIBNAME="lib${LIBNAME}" # prefix with "lib"
159 if [ $ARCH = 'Linux' ] ; then
160 OPTS="-Xlinker -Bsymbolic -shared -Wl,-soname,${LIBNAME}.so.${MAJOR}"
161 else
162 OPTS="-shared -Wl,-soname,${LIBNAME}.so.${MAJOR}"
163 fi
164 if [ $EXPORTS ] ; then
165 #OPTS="${OPTS} -Xlinker --retain-symbols-file ${EXPORTS}"
166 # Make the 'exptmp' file for --version-script option
167 echo "VERSION_${MAJOR}.${MINOR} {" > exptmp
168 echo "global:" >> exptmp
169 sed 's/$/;/' ${EXPORTS} >> exptmp
170 echo "local:" >> exptmp
171 echo "*;" >> exptmp
172 echo "};" >> exptmp
173 OPTS="${OPTS} -Xlinker --version-script=exptmp"
174 # exptmp is removed below
175 fi
176
177 # Check if objects are 32-bit and we're running in 64-bit
178 # environment. If so, pass -m32 flag to linker.
179 set ${OBJECTS}
180 ABI32=`file $1 | grep 32-bit`
181 if [ "${ABI32}" -a `uname -m` = "x86_64" ] ; then
182 OPTS="-m32 ${OPTS}"
183 fi
184
185 if [ x${PATCH} = "x" ] ; then
186 VERSION="${MAJOR}.${MINOR}"
187 else
188 VERSION="${MAJOR}.${MINOR}.${PATCH}"
189 fi
190
191 echo "mklib: Making" $ARCH "shared library: " ${LIBNAME}.so.${VERSION}
192
193 if [ $CPLUSPLUS = 1 ] ; then
194 LINK=$CXX
195 else
196 LINK=$CC
197 fi
198
199 # rm any old libs
200 rm -f ${LIBNAME}.so.${VERSION}
201 rm -f ${LIBNAME}.so.${MAJOR}
202 rm -f ${LIBNAME}.so
203
204 # make lib
205 ${LINK} ${OPTS} -o ${LIBNAME}.so.${VERSION} ${OBJECTS} ${DEPS}
206 # make usual symlinks
207 ln -s ${LIBNAME}.so.${VERSION} ${LIBNAME}.so.${MAJOR}
208 ln -s ${LIBNAME}.so.${MAJOR} ${LIBNAME}.so
209 # finish up
210 FINAL_LIBS="${LIBNAME}.so.${VERSION} ${LIBNAME}.so.${MAJOR} ${LIBNAME}.so"
211 # rm -f exptmp
212 fi
213 ;;
214
215 'SunOS')
216 if [ $STATIC = 1 ] ; then
217 LIBNAME="lib${LIBNAME}.a"
218 echo "mklib: Making SunOS static library: " ${LIBNAME}
219 rm -f ${LIBNAME}
220 ar -ruv ${LIBNAME} ${OBJECTS}
221 FINAL_LIBS=${LIBNAME}
222 else
223 LIBNAME="lib${LIBNAME}.so"
224 echo "mklib: Making SunOS shared library: " ${LIBNAME}
225 # XXX OPTS for gcc should be -shared, but that doesn't work.
226 # Using -G does work though.
227 if [ $CPLUSPLUS = 1 ] ; then
228 # determine linker and options for C++ code
229 if [ "x${CXX}" = "xg++" ] ; then
230 # use g++
231 LINK="g++"
232 OPTS="-G"
233 elif [ "x${CXX}" = "xCC" ] ; then
234 # use Sun CC
235 LINK="CC"
236 OPTS="-G"
237 elif [ "x${CXX}" = "xc++" ] ; then
238 # use Sun c++
239 LINK="c++"
240 OPTS="-G"
241 elif [ `which c++` ] ; then
242 # use Sun c++
243 LINK="c++"
244 OPTS="-G"
245 elif [ `type g++` ] ; then
246 # use g++
247 LINK="g++"
248 OPTS="-G"
249 else
250 echo "mklib: warning: can't find C++ comiler, trying CC."
251 LINK="CC"
252 OPTS="-G"
253 fi
254 elif [ "x${CC}" = "xgcc" ] ; then
255 # use gcc for linking
256 LINK="gcc"
257 OPTS="-G"
258 else
259 # use native Sun linker
260 LINK="ld"
261 OPTS="-G"
262 fi
263 echo "mklib: linker is" ${LINK} ${OPTS}
264 rm -f ${LIBNAME}.${MAJOR} ${LIBNAME}
265 ${LINK} ${OPTS} -o ${LIBNAME}.${MAJOR} ${OBJECTS} ${DEPS}
266 ln -s ${LIBNAME}.${MAJOR} ${LIBNAME}
267 FINAL_LIBS="${LIBNAME}.${MAJOR} ${LIBNAME}"
268 fi
269 ;;
270
271 'FreeBSD')
272 if [ $NOPREFIX = 1 ] ; then
273 # No "lib" or ".so" part
274 echo "mklib: Making FreeBSD shared library: " ${LIBNAME}
275 rm -f ${LIBNAME}
276 ld -Bshareable -o ${LIBNAME} ${OBJECTS}
277 FINAL_LIBS=${LIBNAME}
278 elif [ $STATIC = 1 ] ; then
279 STLIB="lib${LIBNAME}.a"
280 echo "mklib: Making FreeBSD static library: " ${STLIB}
281 rm -f ${STLIB}
282 ar cq ${STLIB} ${OBJECTS}
283 ranlib ${STLIB}
284 FINAL_LIBS=${STLIB}
285 else
286 SHLIB="lib${LIBNAME}.so.${MAJOR}.${MINOR}"
287 echo "mklib: Making FreeBSD shared library: " ${SHLIB}
288 rm -f ${SHLIB}
289 ld -Bshareable -o ${SHLIB} ${OBJECTS}
290 # XXX make lib${LIBNAME}.so.${MAJOR} symlink?
291 FINAL_LIBS=${SHLIB}
292 fi
293 ;;
294
295 'NetBSD')
296 if [ $STATIC = 1 ] ; then
297 LIBNAME="lib${LIBNAME}_pic.a"
298 echo "mklib: Making NetBSD PIC static library: " ${LIBNAME}
299 rm -f ${LIBNAME}
300 ar cq ${LIBNAME} ${OBJECTS}
301 ranlib ${LIBNAME}
302 FINAL_LIBS=${LIBNAME}
303 else
304 LIBNAME="lib${LIBNAME}.so.${MAJOR}.${MINOR}"
305 echo "mklib: Making NetBSD PIC shared library: " ${LIBNAME}
306 rm -f ${LIBNAME}
307 ld -x -Bshareable -Bforcearchive -o ${LIBNAME} ${OBJECTS}
308 FINAL_LIBS=${LIBNAME}
309 fi
310 ;;
311
312 'IRIX' | 'IRIX64')
313 if [ $STATIC = 1 ] ; then
314 LIBNAME="lib${LIBNAME}.a"
315 rm -f ${LIBNAME}
316 ar rc ${LIBNAME} ${OBJECTS}
317 FINAL_LIBS=${LIBNAME}
318 else
319 LIBNAME="lib${LIBNAME}.so" # prefix with "lib", suffix with ".so"
320 if [ $ARCHOPT = "64" ] ; then
321 # 64-bit ABI
322 OPTS="-64 -shared -all"
323 echo "mklib: Making IRIX 64-bit shared library: " ${LIBNAME}
324 elif [ $ARCHOPT = "o32" ] ; then
325 # old 32-bit ABI
326 OPTS="-32 -shared -all"
327 echo "mklib: Making IRIX o32-bit shared library: " ${LIBNAME}
328 else
329 # new 32-bit ABI
330 OPTS="-n32 -shared -all"
331 echo "mklib: Making IRIX n32-bit shared library: " ${LIBNAME}
332 fi
333 if [ $CPLUSPLUS = 1 ] ; then
334 LINK="CC"
335 else
336 LINK="ld"
337 fi
338 ${LINK} ${OPTS} -o ${LIBNAME} ${OBJECTS} ${DEPS}
339 FINAL_LIBS=${LIBNAME}
340 fi
341 ;;
342
343 'linux-cygwin')
344 LIBNAME="lib${LIBNAME}.a"
345 echo "mklib: Making linux-cygwin library: " ${LIBNAME}
346 rm -f ${LIBNAME}
347 gnuwin32ar ruv ${LIBNAME} ${OBJECTS}
348 FINAL_LIBS=${LIBNAME}
349 ;;
350
351 'HP-UX')
352 if [ $STATIC = 1 ] ; then
353 LIBNAME="lib${LIBNAME}.a"
354 echo "mklib: Making HP-UX static library: " ${LIBNAME}
355 rm -f ${LIBNAME}
356 ar -ruv ${LIBNAME} ${OBJECTS}
357 FINAL_LIBS=${LIBNAME}
358 else
359 RUNLIB="lib${LIBNAME}.${MAJOR}"
360 DEVLIB="lib${LIBNAME}.sl"
361 echo "mklib: Making HP-UX shared library: " ${RUNLIB} ${DEVLIB}
362 ld -b -o ${RUNLIB} +b ${RUNLIB} ${OBJECTS} ${DEPS}
363 ln -s ${RUNLIB} ${DEVLIB}
364 FINAL_LIBS="${RUNLIB} ${DEVLIB}"
365 fi
366 ;;
367
368 'AIX' | 'AIX64')
369 if [ $ARCH = "AIX64" ] ; then
370 X64="-X64"
371 fi
372
373 if [ $STATIC = 1 ] ; then
374 LIBNAME="lib${LIBNAME}.a"
375 echo "mklib: Making AIX static library: " ${LIBNAME}
376 ar -ruv ${X64} ${LIBNAME} ${OBJECTS}
377 FINAL_LIBS=${LIBNAME}
378 else
379 EXPFILE="lib${LIBNAME}.exp"
380 OFILE=shr.o #Want to be consistent with the IBM libGL.a
381 LIBNAME="lib${LIBNAME}.a" # shared objects are still stored in the .a libraries
382 if [ $ARCH = "AIX64" ] ; then
383 OPTS="-bE:${EXPFILE} -bM:SRE -bnoentry -q64"
384 else
385 OPTS="-bE:${EXPFILE} -bM:SRE -bnoentry"
386 fi
387 rm -f ${EXPFILE} ${OFILE}
388 NM="/bin/nm -eC ${X64}"
389 echo "#! /usr/lib/${LIBNAME}" > ${EXPFILE}
390 ${NM} ${OBJECTS} | awk '{
391 if ((($2 == "T") || ($2 == "D") || ($2 == "B")) \
392 && ( substr($1,1,1) != ".")) {
393 if (substr ($1, 1, 7) != "__sinit" &&
394 substr ($1, 1, 7) != "__sterm") {
395 if (substr ($1, 1, 5) == "__tf1")
396 print (substr ($1, 7))
397 else if (substr ($1, 1, 5) == "__tf9")
398 print (substr ($1, 15))
399 else
400 print $1
401 }
402 }
403 }' | sort -u >> ${EXPFILE}
404 cc ${OPTS} -o ${OFILE} ${OBJECTS} ${DEPS}
405 ar ${X64} -r ${LIBNAME} ${OFILE}
406 FINAL_LIBS="${LIBNAME}"
407 fi
408 ;;
409
410 'OpenSTEP')
411 LIBNAME="lib${LIBNAME}.a"
412 echo "mklib: Making OpenSTEP static library: " ${LIBNAME}
413 libtool -static -o ${LIBNAME} - ${OBJECTS}
414 FINAL_LIBS=${LIBNAME}
415 ;;
416
417 'OSF1')
418 if [ $STATIC = 1 ] ; then
419 LIBNAME="lib${LIBNAME}.a"
420 echo "mklib: Making OSF/1 static library: " ${LIBNAME}
421 rm -f ${LIBNAME}
422 ar -ruv ${LIBNAME} ${OBJECTS}
423 FINAL_LIBS=${LIBNAME}
424 else
425 VERSION="${MAJOR}.${MINOR}"
426 LIBNAME="lib${LIBNAME}.so"
427 echo "mklib: Making OSF/1 shared library: " ${LIBNAME}
428 if [ $CPLUSPLUS = 1 ] ; then
429 LINK=$CXX
430 else
431 LINK=$CC
432 fi
433 rm -f ${LIBNAME}.${VERSION}
434 ${LINK} -o ${LIBNAME}.${VERSION} -shared -set_version ${VERSION} -soname ${LIBNAME}.${VERSION} -expect_unresolved \* -all ${OBJECTS} ${DEPS}
435 ln -sf ${LIBNAME}.${VERSION} ${LIBNAME}
436 FINAL_LIBS="${LIBNAME} ${LIBNAME}.${VERSION}"
437 fi
438 ;;
439
440 'Darwin')
441 if [ $STATIC = 1 ] ; then
442 LIBNAME="lib${LIBNAME}.a"
443 echo "mklib: Making Darwin static library: " ${LIBNAME}
444 LINK="ar"
445 OPTS="-ruv"
446 ${LINK} ${OPTS} ${LIBNAME} ${OBJECTS}
447 FINAL_LIBS=${LIBNAME}
448 else
449 LIBNAME="lib${LIBNAME}.dylib"
450 echo "mklib: Making Darwin shared library: " ${LIBNAME}
451 FLAGS="-dynamiclib -multiply_defined suppress"
452 if [ $CPLUSPLUS = 1 ] ; then
453 LINK="g++"
454 else
455 LINK="cc"
456 fi
457 ${LINK} ${FLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS}
458 FINAL_LIBS=${LIBNAME}
459 fi
460 ;;
461
462 'LynxOS')
463 LIBNAME="lib${LIBNAME}.a"
464 echo "mklib: Making LynxOS static library: " ${LIBNAME}
465 rm -f ${LIBNAME}
466 ar ru ${LIBNAME} ${OBJECTS}
467 FINAL_LIBS=${LIBNAME}
468 ;;
469
470 'BeOS')
471 if [ $STATIC = 1 ] ; then
472 LIBNAME="lib${LIBNAME}.a"
473 echo "mklib: Making BeOS static library: " ${LIBNAME}
474 ar -cru "${LIBNAME}" ${OBJECTS}
475 else
476 LIBNAME="lib${LIBNAME}.so"
477 echo "mklib: Making BeOS shared library: " ${LIBNAME}
478 gcc -nostart -Xlinker "-soname=${LIBNAME}" -L/Be/develop/lib/x86 -lbe ${DEPS} ${OBJECTS} -o "${LIBNAME}"
479 mimeset -f "${LIBNAME}"
480 setversion "${LIBNAME}" -app ${MAJOR} ${MINOR} ${PATCH} -short "Powered by Mesa3D!" -long "Powered by Mesa3D!"
481 fi
482 FINAL_LIBS=${LIBNAME}
483 ;;
484
485 'QNX')
486 LIBNAME="lib${LIBNAME}.a"
487 echo "mklib: Making QNX library: " ${LIBNAME}
488 wlib ${LIBNAME} ${OBJECTS}
489 FINAL_LIBS=${LIBNAME}
490 ;;
491
492 'MorphOS')
493 LIBNAME="lib${LIBNAME}.a"
494 echo "mklib: Making MorphOS library: " ${LIBNAME}
495 ppc-morphos-ar rc ${LIBNAME} ${OBJECTS}
496 FINAL_LIBS="${LIBNAME}"
497 ;;
498
499 'icc')
500 # Intel C compiler
501 LIBNAME="lib${LIBNAME}" # prefix with "lib"
502
503 if [ $STATIC = 1 ] ; then
504 echo "mklib: Making Intel ICC static library: " ${LIBNAME}.a
505 LINK="ar"
506 OPTS="-ruv"
507 # make lib
508 ${LINK} ${OPTS} ${LIBNAME}.a ${OBJECTS}
509 # finish up
510 FINAL_LIBS="${LIBNAME}.a"
511 else
512 OPTS="-shared"
513 VERSION="${MAJOR}.${MINOR}.${PATCH}"
514 echo "mklib: Making Intel ICC shared library: " ${LIBNAME}.so.${VERSION}
515
516 if [ $CPLUSPLUS = 1 ] ; then
517 LINK="icc"
518 else
519 LINK="icc"
520 fi
521 # rm any old libs
522 rm -f ${LIBNAME}.so.${VERSION}
523 rm -f ${LIBNAME}.so.${MAJOR}
524 rm -f ${LIBNAME}.so
525 # make lib
526 ${LINK} ${OPTS} -o ${LIBNAME}.so.${VERSION} ${OBJECTS} ${DEPS}
527 # make usual symlinks
528 ln -s ${LIBNAME}.so.${VERSION} ${LIBNAME}.so.${MAJOR}
529 ln -s ${LIBNAME}.so.${MAJOR} ${LIBNAME}.so
530 # finish up
531 FINAL_LIBS="${LIBNAME}.so.${VERSION} ${LIBNAME}.so.${MAJOR} ${LIBNAME}.so"
532 fi
533 ;;
534
535 'aix-gcc')
536 # AIX with gcc
537 if [ $STATIC = 1 ] ; then
538 LIBNAME="lib${LIBNAME}.a"
539 echo "mklib: Making AIX GCC static library: " ${LIBNAME}
540 rm -f ${LIBNAME}
541 ar ru ${LIBNAME} ${OBJECTS}
542 FINAL_LIBS=${LIBNAME}
543 else
544 LIBNAME="lib${LIBNAME}.so" # prefix with "lib", suffix with ".so"
545 echo "mklib: Making AIX GCC shared library: " ${LIBNAME}
546 # remove old lib
547 rm -f ${LIBNAME}
548 # make the lib
549 gcc -shared -Wl,-G ${OBJECTS} ${DEPS} -o ${LIBNAME}
550 # NOTE: the application linking with this library must specify
551 # the -Wl,-brtl flags to gcc
552 FINAL_LIBS=${LIBNAME}
553 fi
554 ;;
555
556 'ultrix')
557 # XXX untested
558 if [ $STATIC = 0 ] ; then
559 echo "mklib: Warning shared libs not supported on Ultrix"
560 fi
561 LIBNAME="lib${LIBNAME}.a"
562 echo "mklib: Making static library for Ultrix: " ${LIBNAME}
563 rm -f ${LIBNAME}
564 ar ru ${LIBNAME} ${OBJECTS}
565 FINAL_LIBS="${LIBNAME}"
566 ;;
567
568 CYGWIN*)
569 # GCC-based environment
570 CYGNAME="cyg${LIBNAME}" # prefix with "cyg"
571 LIBNAME="lib${LIBNAME}" # prefix with "lib"
572
573 if [ $STATIC = 1 ] ; then
574 echo "mklib: Making" $ARCH "static library: " ${LIBNAME}.a
575 LINK="ar"
576 OPTS="-ru"
577 # make lib
578 ${LINK} ${OPTS} ${LIBNAME}.a ${OBJECTS}
579 ranlib ${LIBNAME}.a
580 # finish up
581 FINAL_LIBS=${LIBNAME}.a
582 else
583 OPTS="-shared -Wl,-export-all -Wl,--out-implib=${LIBNAME}-${MAJOR}.dll.a"
584 echo "mklib: Making" $ARCH "shared library: " ${LIBNAME}-${MAJOR}.dll
585
586 if [ $CPLUSPLUS = 1 ] ; then
587 LINK="g++"
588 else
589 LINK="gcc"
590 fi
591
592 # rm any old libs
593 rm -f ${LIBNAME}-${MAJOR}.dll
594 rm -f ${LIBNAME}.dll.a
595 rm -f ${LIBNAME}.a
596
597 # make lib
598 ${LINK} ${OPTS} -o ${CYGNAME}-${MAJOR}.dll ${OBJECTS} ${DEPS}
599 # make usual symlinks
600 ln -s ${LIBNAME}-${MAJOR}.dll.a ${LIBNAME}.dll.a
601 # finish up
602 FINAL_LIBS="${LIBNAME}-${MAJOR}.dll.a ${LIBNAME}.dll.a"
603 # special case for installing in bin
604 FINAL_BINS="${CYGNAME}-${MAJOR}.dll"
605 fi
606 ;;
607
608 'example')
609 # If you're adding support for a new architecture, you can
610 # start with this:
611 if [ $STATIC = 1 ] ; then
612 LIBNAME="lib${LIBNAME}.a"
613 echo "mklib: Making static library for example arch: " ${LIBNAME}
614 rm -f ${LIBNAME}
615 ar rv ${LIBNAME} ${OBJECTS}
616 FINAL_LIBS="${LIBNAME}"
617 else
618 LIBNAME="lib${LIBNAME}.so" # prefix with "lib"
619 echo "mklib: Making shared library for example arch: " ${LIBNAME}
620 ld -o ${LIBNAME} ${OBJECTS} ${DEPS}
621 FINAL_LIBS="${LIBNAME}"
622 fi
623 ;;
624
625 *)
626 echo "mklib: ERROR: Don't know how to make a static/shared library for" ${ARCH}
627 echo "mklib: Please add necessary commands to mklib script."
628 ;;
629 esac
630
631
632 #
633 # Put library files into installation directory if specified.
634 #
635 if [ ${INSTALLDIR} != "." ] ; then
636 echo "mklib: Installing" ${FINAL_LIBS} "in" ${INSTALLDIR}
637 mv ${FINAL_LIBS} ${INSTALLDIR}/
638 fi