summaryrefslogtreecommitdiff
path: root/audio/gsm/patches/patch-ab
blob: 368f603f18c928d14b4df24a96d3b3e0dd7601f8 (plain)
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
--- Makefile.orig	Tue Jul  2 10:36:06 1996
+++ Makefile	Mon Mar 16 02:32:43 1998
@@ -7,11 +7,13 @@
 SASR	= -DSASR
 ######### Define SASR if >> is a signed arithmetic shift (-1 >> 1 == -1)
 
-MULHACK = -DUSE_FLOAT_MUL
+#MULHACK = -DUSE_FLOAT_MUL      # Don't define it for FreeBSD, cause SIGFPE
+MULHACK =
 ######### Define this if your host multiplies floats faster than integers,
 ######### e.g. on a SPARCstation.
 
-FAST	= -DFAST
+#FAST    = -DFAST
+FAST    =
 ######### Define together with USE_FLOAT_MUL to enable the GSM library's
 ######### approximation option for incorrect, but good-enough results.
 
@@ -43,8 +45,8 @@
 # CC		= /usr/lang/acc
 # CCFLAGS 	= -c -O
 
-CC		= gcc -ansi -pedantic
-CCFLAGS 	= -c -O2 -DNeedFunctionPrototypes=1
+#CC              = gcc -ansi -pedantic
+CCFLAGS         = -c -DNeedFunctionPrototypes=1
 
 LD 		= $(CC)
 
@@ -59,6 +61,7 @@
 ######### Includes needed by $(CC)
 
 # LDINC	= -L/usr/gnu/lib/gcc-2.1/gcc-lib/sparc-sun-sunos4.1.2/2.1
+LDINC = -L$(LIB)
 ######### Library paths needed by $(LD)
 
 # LDLIB	= -lgcc
@@ -71,7 +74,7 @@
 # Leave INSTALL_ROOT empty (or just don't execute "make install") to
 # not install gsm and toast outside of this directory.
 
-INSTALL_ROOT	=
+INSTALL_ROOT    =       $(PREFIX)
 
 # Where do you want to install the gsm library, header file, and manpages?
 #
@@ -80,7 +83,7 @@
 
 GSM_INSTALL_ROOT = $(INSTALL_ROOT)
 GSM_INSTALL_LIB = $(GSM_INSTALL_ROOT)/lib
-GSM_INSTALL_INC = $(GSM_INSTALL_ROOT)/inc
+GSM_INSTALL_INC = $(GSM_INSTALL_ROOT)/include
 GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/man/man3
 
 
@@ -96,7 +99,7 @@
 #  Other tools
 
 SHELL		= /bin/sh
-LN		= ln
+LN		= ln -s
 BASENAME 	= basename
 AR		= ar
 ARFLAGS		= cr
@@ -129,17 +132,19 @@
 # DEBUG	= -DNDEBUG
 ######### Remove -DNDEBUG to enable assertions.
 
-CFLAGS	= $(CCFLAGS) $(SASR) $(DEBUG) $(MULHACK) $(FAST) $(LTP_CUT) \
+CFLAGS += $(CCFLAGS) $(SASR) $(DEBUG) $(MULHACK) $(FAST) $(LTP_CUT) \
 	$(WAV49) $(CCINC) -I$(INC)
 ######### It's $(CC) $(CFLAGS)
 
 LFLAGS	= $(LDFLAGS) $(LDINC)
 ######### It's $(LD) $(LFLAGS)
 
+.SUFFIXES: .c .so .o
 
 # Targets
 
 LIBGSM	= $(LIB)/libgsm.a
+LIBGSM_SHARED	= $(LIB)/libgsm.so.1.0.10
 
 TOAST	= $(BIN)/toast
 UNTOAST	= $(BIN)/untoast
@@ -258,6 +263,7 @@
 
 GSM_INSTALL_TARGETS =	\
 		$(GSM_INSTALL_LIB)/libgsm.a		\
+		$(GSM_INSTALL_LIB)/libgsm.so.1.0.10     \
 		$(GSM_INSTALL_INC)/gsm.h		\
 		$(GSM_INSTALL_MAN)/gsm.3		\
 		$(GSM_INSTALL_MAN)/gsm_explode.3	\
@@ -277,9 +283,12 @@
 		$(CC) $(CFLAGS) $?
 		@-mv `$(BASENAME) $@` $@ > /dev/null 2>&1
 
+.c.so:
+		${CC} -fpic -DPIC ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
+
 # Target rules
 
-all:		$(LIBGSM) $(TOAST) $(TCAT) $(UNTOAST)
+all:		$(LIBGSM) $(LIBGSM_SHARED) $(TOAST) $(TCAT) $(UNTOAST)
 		@-echo $(ROOT): Done.
 
 tst:		$(TST)/lin2cod $(TST)/cod2lin $(TOAST) $(TST)/test-result
@@ -304,11 +313,15 @@
 		$(AR) $(ARFLAGS) $(LIBGSM) $(GSM_OBJECTS)
 		$(RANLIB) $(LIBGSM)
 
+$(LIBGSM_SHARED):	$(LIB) $(GSM_OBJECTS:S/o$/so/g)
+		-rm $(RMFLAGS) $(LIBGSM_SHARED)
+		ld -Bshareable -o $(LIBGSM_SHARED) $(GSM_OBJECTS:S/o$/so/g)
+
 
 # Toast, Untoast and Tcat -- the compress-like frontends to gsm.
 
 $(TOAST):	$(BIN) $(TOAST_OBJECTS) $(LIBGSM)
-		$(LD) $(LFLAGS) -o $(TOAST) $(TOAST_OBJECTS) $(LIBGSM) $(LDLIB)
+		$(LD) $(LFLAGS) -o $(TOAST) $(TOAST_OBJECTS) -lgsm $(LDLIB)
 
 $(UNTOAST):	$(BIN) $(TOAST)
 		-rm $(RMFLAGS) $(UNTOAST)
@@ -332,12 +345,14 @@
 
 gsminstall:
 		-if [ x"$(GSM_INSTALL_ROOT)" != x ] ; then	\
-			make $(GSM_INSTALL_TARGETS) ;	\
+			make INSTALL_ROOT=$(INSTALL_ROOT)	\
+			    $(GSM_INSTALL_TARGETS);		\
 		fi
 
 toastinstall:
 		-if [ x"$(TOAST_INSTALL_ROOT)" != x ]; then	\
-			make $(TOAST_INSTALL_TARGETS);	\
+			make INSTALL_ROOT=$(INSTALL_ROOT)	\
+			    $(TOAST_INSTALL_TARGETS);		\
 		fi
 
 gsmuninstall:
@@ -357,11 +372,11 @@
 
 $(TOAST_INSTALL_BIN)/untoast:	$(TOAST_INSTALL_BIN)/toast
 		-rm $@
-		ln $? $@
+		cd $(TOAST_INSTALL_BIN) && $(LN) toast $@
 
 $(TOAST_INSTALL_BIN)/tcat:	$(TOAST_INSTALL_BIN)/toast
 		-rm $@
-		ln $? $@
+		cd $(TOAST_INSTALL_BIN) && $(LN) toast $@
 
 $(TOAST_INSTALL_MAN)/toast.1:	$(MAN)/toast.1
 		-rm $@
@@ -397,6 +412,12 @@
 		-rm $@
 		cp $? $@
 		chmod 444 $@
+		ranlib $@
+
+$(GSM_INSTALL_LIB)/libgsm.so.1.0.10:    $(LIBGSM_SHARED)
+		-rm $@
+		cp $? $@
+		chmod 444 $@
 
 
 # Distribution
@@ -416,7 +437,7 @@
 		@-echo uninstall: Done.
 
 semi-clean:
-		-rm $(RMFLAGS)  */*.o			\
+		-rm $(RMFLAGS)  */*.o */*.so		\
 			$(TST)/lin2cod $(TST)/lin2txt	\
 			$(TST)/cod2lin $(TST)/cod2txt	\
 			$(TST)/gsm2cod 			\
@@ -425,7 +446,8 @@
 			-print | xargs rm $(RMFLAGS)
 
 clean:	semi-clean
-		-rm $(RMFLAGS) $(LIBGSM) $(ADDTST)/add		\
+		-rm $(RMFLAGS) $(LIBGSM) $(LIBGSM_SHARED) \
+			$(ADDTST)/add			\
 			$(TOAST) $(TCAT) $(UNTOAST)	\
 			$(ROOT)/gsm-1.0.tar.Z