File: libraries

package info (click to toggle)
firedns 0.9.12-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,192 kB
  • ctags: 322
  • sloc: ansic: 4,026; sh: 964; makefile: 6
file content (115 lines) | stat: -rw-r--r-- 3,243 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/bin/sh
#require prefix
#require compiletest
#require cflags
#require version
#phase init
#after init_cflags
#phase config
#phase makefile
#after makefile_makefiletop
case $PHASE in
	init)
		PROGRAM="int foo() { return 0; }"

		dispn "Checking if your compiler supports -fPIC..."
		if library_test "$PROGRAM" "-fPIC" ""; then
			disp "yes, adding \"-fPIC\" to CFLAGS"
			FM_CFLAGS="$FM_CFLAGS -fPIC"
		else
			disp "no, hoping we don't need it"
		fi

		dispn "Checking if your compiler supports -shared..."
		if shared_test "$PROGRAM" "-shared" ""; then
			disp "yes, adding \"-shared\" to SHAREDFLAGS"
			FM_SHAREDFLAGS="$FM_SHAREDFLAGS -shared"
		else
			disp "no, hoping we don't need it"
		fi

		dispn "Checking if your compiler supports -dynamiclib -lcc_dynamic..." # this is a bad hack for Darwin
		if shared_test "$PROGRAM" "-dynamiclib" "-lcc_dynamic"; then
			disp "yes:"
			disp "	Adding \"-dynamiclib\" to SHAREDFLAGS"
			FM_SHAREDFLAGS="$FM_SHAREDFLAGS -dynamiclib"
			disp "	Adding \"-dynamiclib\" to SHAREDLIBS"
			FM_SHAREDLIBS="$FM_SHAREDLIBS -lcc_dynamic"
		else
			disp "no, hoping we don't need it"
		fi
		rm -f compiletest.c.*

		dispn "Checking for SONAME support..."
		if shared_test "$PROGRAM" "-Wl,-soname,testname.so.0" ""; then
			disp "yes"
			FM_SONAME="-Wl,-soname,"
		else
			disp "no"
			FM_SONAME=""
		fi
		;;
	config)
		dispn "Reading firemake.libraries..."
		LIBRARIES=`cut -d ':' -f 1 firemake.libraries 2>/dev/null`
		disp "done"
		;;
	makefile)
		VERSION2=`$ECHO "$VERSION" | cut -d . -f 1-2`

		disp "Writing library creation entries..."
		for LIBRARY in $LIBRARIES; do
			dispn "	$LIBRARY..."
			DEPS=`grep "^$LIBRARY:" firemake.libraries | cut -d ':' -f 2`
			$ECHO "$LIBRARY: $LIBRARY.a $LIBRARY.so.$VERSION"
			$ECHO

			$ECHO "$LIBRARY.a: $DEPS"
			$ECHO "	rm -f $LIBRARY.a"
			$ECHO "	ar cru $LIBRARY.a $DEPS $FM_STATICLIBS"
			$ECHO "	ranlib $LIBRARY.a || $ECHO \"Ignore ranlib errors.\""
			$ECHO

			if test "$FM_SONAME" != ""; then
				SOTEMP="$FM_SONAME$LIBRARY.so.$VERSION2"
			else
				SOTEMP=""
			fi

			$ECHO "$LIBRARY.so.$VERSION: $DEPS"
			$ECHO "	$CC $FM_CFLAGS $FM_LDFLAGS $FM_SHAREDFLAGS $SOTEMP -o $LIBRARY.so.$VERSION $DEPS $FM_STATICLIBS $FM_LIBS $FM_SHAREDLIBS"
			$ECHO
			LIBRARYLIST="$LIRBRARYLIST $LIBRARY"
			LIBRARY_CLEANLIST="$LIBRARY_CLEANLIST ${LIBRARY}.a ${LIBRARY}.so.$VERSION $DEPS"
			disp "done"
			if module dependencies; then
				DEPPREPEND="$PREPEND"
				PREPEND="$PREPEND	"
				customdeplist "$DEPS"
				PREPEND="$DEPPREPEND"
			fi
		done
		dispn "Writing library index entry..."
		$ECHO "libraries: $LIBRARYLIST"
		$ECHO
		disp "done"

		disp "Writing library install entries..."
		$ECHO "install_libraries: $LIBRARYLIST"
		for LIBRARY in $LIBRARIES; do
			dispn "	$LIBRARY..."
			$ECHO "	$INSTALL ${LIBRARY}.a \$(LIBDIR) $INSTALL_USER $INSTALL_GROUP 0755"
			$ECHO "	$INSTALL ${LIBRARY}.so.$VERSION \$(LIBDIR) $INSTALL_USER $INSTALL_GROUP 0755"
			$ECHO "	ln -sf ${LIBRARY}.so.$VERSION \$(LIBDIR)/${LIBRARY}.so.$VERSION2"
			$ECHO "	ln -sf ${LIBRARY}.so.$VERSION \$(LIBDIR)/${LIBRARY}.so"
			disp "done"
		done
		$ECHO

		dispn "Writing library cleanup entry..."
		$ECHO "clean_libraries:"
		$ECHO "	rm -f $LIBRARY_CLEANLIST"
		$ECHO
		disp "done"
		;;
esac