summaryrefslogtreecommitdiff
path: root/openwrt/package/gsm/patches/01-debian-libsgm-1.0.10-13.patch
blob: 4e6e71cce6b234f05262737ac200bcc08f5be074 (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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
diff -ruN gsm-1.0.10-orig/Makefile gsm-1.0.10-1/Makefile
--- gsm-1.0.10-orig/Makefile	1996-07-02 16:36:06.000000000 +0200
+++ gsm-1.0.10-1/Makefile	2005-04-08 18:47:52.000000000 +0200
@@ -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
+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.
 
@@ -44,7 +46,8 @@
 # CCFLAGS 	= -c -O
 
 CC		= gcc -ansi -pedantic
-CCFLAGS 	= -c -O2 -DNeedFunctionPrototypes=1
+COPTS		= -O2
+CCFLAGS 	= -c $(COPTS) -DNeedFunctionPrototypes=1
 
 LD 		= $(CC)
 
@@ -78,10 +81,10 @@
 # Leave GSM_INSTALL_ROOT empty to not install the GSM library outside of
 # this directory.
 
-GSM_INSTALL_ROOT = $(INSTALL_ROOT)
+GSM_INSTALL_ROOT = $(INSTALL_ROOT)/usr
 GSM_INSTALL_LIB = $(GSM_INSTALL_ROOT)/lib
-GSM_INSTALL_INC = $(GSM_INSTALL_ROOT)/inc
-GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/man/man3
+GSM_INSTALL_INC = $(GSM_INSTALL_ROOT)/include
+GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/share/man/man3
 
 
 # Where do you want to install the toast binaries and their manpage?
@@ -89,14 +92,14 @@
 # Leave TOAST_INSTALL_ROOT empty to not install the toast binaries outside
 # of this directory.
 
-TOAST_INSTALL_ROOT	  = $(INSTALL_ROOT)
+TOAST_INSTALL_ROOT	  = $(INSTALL_ROOT)/usr
 TOAST_INSTALL_BIN = $(TOAST_INSTALL_ROOT)/bin
-TOAST_INSTALL_MAN = $(TOAST_INSTALL_ROOT)/man/man1
+TOAST_INSTALL_MAN = $(TOAST_INSTALL_ROOT)/share/man/man1
 
 #  Other tools
 
 SHELL		= /bin/sh
-LN		= ln
+LN		= ln -s
 BASENAME 	= basename
 AR		= ar
 ARFLAGS		= cr
@@ -126,7 +129,7 @@
 
 # Flags
 
-# DEBUG	= -DNDEBUG
+DEBUG	= -DNDEBUG
 ######### Remove -DNDEBUG to enable assertions.
 
 CFLAGS	= $(CCFLAGS) $(SASR) $(DEBUG) $(MULHACK) $(FAST) $(LTP_CUT) \
@@ -140,6 +143,7 @@
 # Targets
 
 LIBGSM	= $(LIB)/libgsm.a
+LIBGSMSO= $(LIB)/libgsm.so
 
 TOAST	= $(BIN)/toast
 UNTOAST	= $(BIN)/untoast
@@ -258,6 +262,9 @@
 
 GSM_INSTALL_TARGETS =	\
 		$(GSM_INSTALL_LIB)/libgsm.a		\
+		$(GSM_INSTALL_LIB)/libgsm.so		\
+		$(GSM_INSTALL_LIB)/libgsm.so.1		\
+		$(GSM_INSTALL_LIB)/libgsm.so.1.0.10	\
 		$(GSM_INSTALL_INC)/gsm.h		\
 		$(GSM_INSTALL_MAN)/gsm.3		\
 		$(GSM_INSTALL_MAN)/gsm_explode.3	\
@@ -279,7 +286,7 @@
 
 # Target rules
 
-all:		$(LIBGSM) $(TOAST) $(TCAT) $(UNTOAST)
+all:		$(LIBGSM) $(LIBGSMSO) $(TOAST) $(TCAT) $(UNTOAST)
 		@-echo $(ROOT): Done.
 
 tst:		$(TST)/lin2cod $(TST)/cod2lin $(TOAST) $(TST)/test-result
@@ -299,6 +306,11 @@
 
 # The basic API: libgsm
 
+$(LIBGSMSO):	$(LIB) $(GSM_OBJECTS)
+		$(LD) -o $@.1.0.10 -shared -Xlinker -soname -Xlinker libgsm.so.1 $(GSM_OBJECTS) -lc
+		ln -fs libgsm.so.1.0.10 lib/libgsm.so.1
+		ln -fs libgsm.so.1.0.10 lib/libgsm.so
+
 $(LIBGSM):	$(LIB) $(GSM_OBJECTS)
 		-rm $(RMFLAGS) $(LIBGSM)
 		$(AR) $(ARFLAGS) $(LIBGSM) $(GSM_OBJECTS)
@@ -308,15 +320,15 @@
 # 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) $(LIBGSMSO) $(LDLIB)
 
 $(UNTOAST):	$(BIN) $(TOAST)
 		-rm $(RMFLAGS) $(UNTOAST)
-		$(LN) $(TOAST) $(UNTOAST)
+		$(LN) toast $(UNTOAST)
 
 $(TCAT):	$(BIN) $(TOAST)
 		-rm $(RMFLAGS) $(TCAT)
-		$(LN) $(TOAST) $(TCAT)
+		$(LN) toast $(TCAT)
 
 
 # The local bin and lib directories
@@ -351,53 +363,66 @@
 		fi
 
 $(TOAST_INSTALL_BIN)/toast:	$(TOAST)
-		-rm $@
-		cp $(TOAST) $@
+		mkdir -p $(TOAST_INSTALL_BIN)
+		cp -f $(TOAST) $@
 		chmod 755 $@
 
 $(TOAST_INSTALL_BIN)/untoast:	$(TOAST_INSTALL_BIN)/toast
-		-rm $@
-		ln $? $@
+		mkdir -p $(TOAST_INSTALL_BIN)
+		ln -sf $? $@
 
 $(TOAST_INSTALL_BIN)/tcat:	$(TOAST_INSTALL_BIN)/toast
-		-rm $@
-		ln $? $@
+		mkdir -p $(TOAST_INSTALL_BIN)
+		ln -sf $? $@
 
 $(TOAST_INSTALL_MAN)/toast.1:	$(MAN)/toast.1
-		-rm $@
-		cp $? $@
+		mkdir -p $(TOAST_INSTALL_MAN)
+		cp -f $? $@
 		chmod 444 $@
 
 $(GSM_INSTALL_MAN)/gsm.3:	$(MAN)/gsm.3
-		-rm $@
-		cp $? $@
+		mkdir -p $(GSM_INSTALL_MAN)
+		cp -f $? $@
 		chmod 444 $@
 
 $(GSM_INSTALL_MAN)/gsm_option.3:	$(MAN)/gsm_option.3
-		-rm $@
-		cp $? $@
+		mkdir -p $(GSM_INSTALL_MAN)
+		cp -f $? $@
 		chmod 444 $@
 
 $(GSM_INSTALL_MAN)/gsm_explode.3:	$(MAN)/gsm_explode.3
-		-rm $@
-		cp $? $@
+		mkdir -p $(GSM_INSTALL_MAN)
+		cp -f $? $@
 		chmod 444 $@
 
 $(GSM_INSTALL_MAN)/gsm_print.3:	$(MAN)/gsm_print.3
-		-rm $@
-		cp $? $@
+		mkdir -p $(GSM_INSTALL_MAN)
+		cp -f $? $@
 		chmod 444 $@
 
 $(GSM_INSTALL_INC)/gsm.h:	$(INC)/gsm.h
-		-rm $@
-		cp $? $@
+		mkdir -p $(GSM_INSTALL_INC)
+		cp -f $? $@
 		chmod 444 $@
 
 $(GSM_INSTALL_LIB)/libgsm.a:	$(LIBGSM)
-		-rm $@
-		cp $? $@
+		mkdir -p $(GSM_INSTALL_LIB)
+		cp -f $? $@
 		chmod 444 $@
 
+$(GSM_INSTALL_LIB)/libgsm.so:	$(LIBGSMSO)
+		mkdir -p $(GSM_INSTALL_LIB)
+		cp -f $? $@
+
+$(GSM_INSTALL_LIB)/libgsm.so.1:	$(LIBGSMSO)
+		mkdir -p $(GSM_INSTALL_LIB)
+		cp -f $? $@
+
+$(GSM_INSTALL_LIB)/libgsm.so.1.0.10:	$(LIBGSMSO)
+		mkdir -p $(GSM_INSTALL_LIB)
+		cp -f $? $@
+		chmod 755 $@
+
 
 # Distribution
 
@@ -426,7 +451,9 @@
 
 clean:	semi-clean
 		-rm $(RMFLAGS) $(LIBGSM) $(ADDTST)/add		\
-			$(TOAST) $(TCAT) $(UNTOAST)	\
+			$(LIBGSMSO) $(LIB)/libgsm.so.1.0.10	\
+			$(LIB)libgsm.so.1			\
+			$(TOAST) $(TCAT) $(UNTOAST)		\
 			$(ROOT)/gsm-1.0.tar.Z
 
 
diff -ruN gsm-1.0.10-orig/inc/config.h gsm-1.0.10-1/inc/config.h
--- gsm-1.0.10-orig/inc/config.h	1996-07-02 16:32:27.000000000 +0200
+++ gsm-1.0.10-1/inc/config.h	2005-04-08 18:24:31.000000000 +0200
@@ -9,29 +9,29 @@
 #ifndef	CONFIG_H
 #define	CONFIG_H
 
-/*efine	SIGHANDLER_T	int 		/* signal handlers are void	*/
-/*efine HAS_SYSV_SIGNAL	1		/* sigs not blocked/reset?	*/
+/*efine	SIGHANDLER_T	int 		-* signal handlers are void	*/
+/*efine HAS_SYSV_SIGNAL	1		-* sigs not blocked/reset?	*/
 
 #define	HAS_STDLIB_H	1		/* /usr/include/stdlib.h	*/
-/*efine	HAS_LIMITS_H	1		/* /usr/include/limits.h	*/
+#define	HAS_STDIO_H 	1		/* /usr/include/stdio.h 	*/
+/*efine	HAS_LIMITS_H	1		-* /usr/include/limits.h	*/
 #define	HAS_FCNTL_H	1		/* /usr/include/fcntl.h		*/
-/*efine	HAS_ERRNO_DECL	1		/* errno.h declares errno	*/
 
 #define	HAS_FSTAT 	1		/* fstat syscall		*/
 #define	HAS_FCHMOD 	1		/* fchmod syscall		*/
 #define	HAS_CHMOD 	1		/* chmod syscall		*/
 #define	HAS_FCHOWN 	1		/* fchown syscall		*/
 #define	HAS_CHOWN 	1		/* chown syscall		*/
-/*efine	HAS__FSETMODE 	1		/* _fsetmode -- set file mode	*/
+/*efine	HAS__FSETMODE 	1		-* _fsetmode -- set file mode	*/
 
 #define	HAS_STRING_H 	1		/* /usr/include/string.h 	*/
-/*efine	HAS_STRINGS_H	1		/* /usr/include/strings.h 	*/
+/*efine	HAS_STRINGS_H	1		-* /usr/include/strings.h 	*/
 
 #define	HAS_UNISTD_H	1		/* /usr/include/unistd.h	*/
 #define	HAS_UTIME	1		/* POSIX utime(path, times)	*/
-/*efine	HAS_UTIMES	1		/* use utimes()	syscall instead	*/
+/*efine	HAS_UTIMES	1		-* use utimes()	syscall instead	*/
 #define	HAS_UTIME_H	1		/* UTIME header file		*/
-/*efine	HAS_UTIMBUF	1		/* struct utimbuf		*/
-/*efine	HAS_UTIMEUSEC   1		/* microseconds in utimbuf?	*/
+/*efine	HAS_UTIMBUF	1		-* struct utimbuf		*/
+/*efine	HAS_UTIMEUSEC   1		-* microseconds in utimbuf?	*/
 
 #endif	/* CONFIG_H */
diff -ruN gsm-1.0.10-orig/inc/gsm.h gsm-1.0.10-1/inc/gsm.h
--- gsm-1.0.10-orig/inc/gsm.h	1996-07-05 20:31:51.000000000 +0200
+++ gsm-1.0.10-1/inc/gsm.h	2005-04-08 18:24:31.000000000 +0200
@@ -54,6 +54,10 @@
 #define	GSM_OPT_FRAME_INDEX	5
 #define	GSM_OPT_FRAME_CHAIN	6
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern gsm  gsm_create 	GSM_P((void));
 extern void gsm_destroy GSM_P((gsm));	
 
@@ -66,6 +70,10 @@
 extern int  gsm_explode GSM_P((gsm, gsm_byte   *, gsm_signal *));
 extern void gsm_implode GSM_P((gsm, gsm_signal *, gsm_byte   *));
 
+#ifdef __cplusplus
+}
+#endif
+
 #undef	GSM_P
 
 #endif	/* GSM_H */
diff -ruN gsm-1.0.10-orig/inc/toast.h gsm-1.0.10-1/inc/toast.h
--- gsm-1.0.10-orig/inc/toast.h	1996-07-02 16:32:29.000000000 +0200
+++ gsm-1.0.10-1/inc/toast.h	2005-04-08 18:24:31.000000000 +0200
@@ -16,11 +16,12 @@
 
 #include <stdio.h>
 #include <ctype.h>
+#include <pthread.h>
 #include <signal.h>
 
 #include <errno.h>
-#ifndef	HAS_ERRNO_DECL
-	 extern int	errno;
+#ifndef errno
+ extern int	errno;
 #endif
 
 #ifdef	HAS_LIMITS_H
@@ -37,6 +38,10 @@
 # endif
 #endif
 
+#ifdef  HAS_STDIO_H
+# include <stdio.h>
+#endif
+
 #include "gsm.h"
 
 #ifndef	S_ISREG
diff -ruN gsm-1.0.10-orig/src/code.c gsm-1.0.10-1/src/code.c
--- gsm-1.0.10-orig/src/code.c	1996-07-02 16:32:36.000000000 +0200
+++ gsm-1.0.10-1/src/code.c	2005-04-08 18:24:31.000000000 +0200
@@ -9,8 +9,8 @@
 #include	"config.h"
 
 
-#ifdef	HAS_STDLIB_H
-#include	<stdlib.h>
+#ifdef	HAS_STRING_H
+#include	<string.h>
 #else
 #	include "proto.h"
 	extern char	* memcpy P((char *, char *, int));
diff -ruN gsm-1.0.10-orig/src/debug.c gsm-1.0.10-1/src/debug.c
--- gsm-1.0.10-orig/src/debug.c	1996-07-02 16:32:37.000000000 +0200
+++ gsm-1.0.10-1/src/debug.c	2005-04-08 18:24:31.000000000 +0200
@@ -49,7 +49,7 @@
 	fprintf( stderr, "%s [%d .. %d]: ", name, from, to );
 	while (from <= to) {
 
-		fprintf(stderr, "%d ", ptr[ from ] );
+		fprintf(stderr, "%ld ", ptr[ from ] );
 		from++;
 		if (nprinted++ >= 7) {
 			nprinted = 0;
@@ -63,14 +63,14 @@
 	char		* name,
 	longword	  value	)
 {
-	fprintf(stderr, "%s: %d\n", name, (long)value );
+	fprintf(stderr, "%s: %ld\n", name, (long)value );
 }
 
 void gsm_debug_word P2(  (name, value),
 	char	* name,
 	word	  value	)
 {
-	fprintf(stderr, "%s: %d\n", name, (long)value);
+	fprintf(stderr, "%s: %ld\n", name, (long)value);
 }
 
 #endif
diff -ruN gsm-1.0.10-orig/src/toast.c gsm-1.0.10-1/src/toast.c
--- gsm-1.0.10-orig/src/toast.c	1996-07-02 16:32:55.000000000 +0200
+++ gsm-1.0.10-1/src/toast.c	2005-04-08 18:24:31.000000000 +0200
@@ -251,8 +251,8 @@
 {
 	char * s;
 	if (!(s = malloc(len))) {
-		fprintf(stderr, "%s: failed to malloc %d bytes -- abort\n",
-			progname, len);
+		fprintf(stderr, "%s: failed to malloc %ld bytes -- abort\n",
+			progname, (long) len);
 		onintr();
 		exit(1);
 	}
@@ -270,7 +270,7 @@
 	maxlen = strlen(name) + 1 + strlen(want) + strlen(cut);
 	p = strcpy(emalloc(maxlen), name);
 
-	if (s = suffix(p, cut)) strcpy(s, want);
+	if ((s = suffix(p, cut))) strcpy(s, want);
 	else if (*want && !suffix(p, want)) strcat(p, want);
 
 	return p;
@@ -386,7 +386,7 @@
 		ut[0] = instat.st_atime;
 		ut[1] = instat.st_mtime;
 
-		(void) utime(outname, ut);
+		(void) utime(outname, (struct utimbuf *)ut);
 
 #endif	/* UTIMBUF */
 	}
@@ -416,7 +416,7 @@
 	}
 	if (st->st_nlink > 1 && !f_cat && !f_precious) {
 		fprintf(stderr, 
-		      "%s: \"%s\" has %s other link%s -- unchanged.\n",
+		      "%s: \"%s\" has %d other link%s -- unchanged.\n",
 			progname,name,st->st_nlink - 1,"s" + (st->st_nlink<=2));
 		return 0;
 	}
@@ -585,8 +585,8 @@
 
 		if (cc != sizeof(s)) {
 			if (cc >= 0) fprintf(stderr,
-			"%s: incomplete frame (%d byte%s missing) from %s\n",
-					progname, sizeof(s) - cc,
+			"%s: incomplete frame (%ld byte%s missing) from %s\n",
+					progname, (long) sizeof(s) - cc,
 					"s" + (sizeof(s) - cc == 1),
 					inname ? inname : "stdin" );
 			gsm_destroy(r);
@@ -624,8 +624,6 @@
 
 static int process P1((name), char * name)
 {
-	int step = 0;
-
 	out     = (FILE *)0;
 	in      = (FILE *)0;
 
@@ -779,7 +777,6 @@
 	case 'h': help();    exit(0);
 
 	default: 
-	usage:
 		fprintf(stderr,
 	"Usage: %s [-fcpdhvuaslFC] [files...] (-h for help)\n",
 			progname);