Lines 1-62
Link Here
|
1 |
--- /dev/null Fri Sep 19 10:51:17 2003 |
|
|
2 |
+++ bin/mklib.freebsd Fri Sep 19 10:51:54 2003 |
3 |
@@ -0,0 +1,59 @@ |
4 |
+#!/bin/sh |
5 |
+ |
6 |
+# Make a FreeBSD ELF shared library |
7 |
+ |
8 |
+# $Id$ |
9 |
+ |
10 |
+#--common-------------------------------------------------------------- |
11 |
+ |
12 |
+# Usage: mklib <archflags> <libname> <major> <minor> <file.o ... > |
13 |
+# |
14 |
+# <archflags> are arcitecture specific build flags |
15 |
+# <libname> is name of output library (LIBRARY) |
16 |
+# <major> is major version number (MAJOR) |
17 |
+# <minor> is minor version number (MINOR) |
18 |
+# <file.o ... > remaining arguments are object files (OBJECTS) |
19 |
+# |
20 |
+# added local installation target prefix (RM_INSTALL) |
21 |
+# tidied up the build |
22 |
+# |
23 |
+# 04/23/01 jdb |
24 |
+# |
25 |
+ |
26 |
+ARCHFLAGS=$1 |
27 |
+shift 1 |
28 |
+ |
29 |
+LIBRARY=$1 |
30 |
+shift 1 |
31 |
+ |
32 |
+MAJOR=$1 |
33 |
+shift 1 |
34 |
+ |
35 |
+MINOR=$1 |
36 |
+shift 1 |
37 |
+ |
38 |
+# we don't care about ${MINOR} here |
39 |
+VERSION=$MAJOR |
40 |
+ |
41 |
+OBJECTS=$* |
42 |
+ |
43 |
+DEPLIBS="-lGL -lGLU -L${X11BASE}/lib -lXmu" |
44 |
+ |
45 |
+#--platform------------------------------------------------------------ |
46 |
+ |
47 |
+# build library objects |
48 |
+${ECHO_CMD} "Building shared object $LIBRARY.so.$VERSION and the archive library $LIBRARY.a" |
49 |
+${RM} -f ${LIBRARY}.a ${LIBRARY}.so.${VERSION} |
50 |
+${AR} qv ${LIBRARY}.a ${OBJECTS} |
51 |
+ |
52 |
+# FreeBSD specific build |
53 |
+${CC} -shared -Wl,-soname,${LIBRARY}.so.${VERSION} -o ${LIBRARY}.so.${VERSION} ${OBJECTS} ${DEPLIBS} |
54 |
+if [ ${ARCHFLAGS##*-} != "debug" ]; then |
55 |
+ ${STRIP_CMD} ${LIBRARY}.so.${VERSION} |
56 |
+ ${ECHO_CMD} "library has been stripped (non-debug build)." |
57 |
+fi |
58 |
+ |
59 |
+# code tree |
60 |
+${CP} ${LIBRARY}.a ${LIBRARY}.so.${VERSION} ../lib |
61 |
+${RM} -f ../lib/${LIBRARY}.so |
62 |
+${LN} -s ${LIBRARY}.so.${VERSION} ${LIBRARY}.so |