[packages] libtorrent: apply fix from [22233] to armeb as well
[openwrt/svn-archive/archive.git] / libs / gsm / patches / 001-debian-libsgm-1.0.10-13.patch
1 --- a/Makefile
2 +++ b/Makefile
3 @@ -8,10 +8,12 @@ SASR = -DSASR
4 ######### Define SASR if >> is a signed arithmetic shift (-1 >> 1 == -1)
5
6 # MULHACK = -DUSE_FLOAT_MUL
7 +MULHACK =
8 ######### Define this if your host multiplies floats faster than integers,
9 ######### e.g. on a SPARCstation.
10
11 # FAST = -DFAST
12 +FAST =
13 ######### Define together with USE_FLOAT_MUL to enable the GSM library's
14 ######### approximation option for incorrect, but good-enough results.
15
16 @@ -22,8 +24,8 @@ LTP_CUT =
17 ######### both integer and floating point multiplications.
18 ######### This flag is still in the experimental stage.
19
20 -WAV49 = -DWAV49
21 -# WAV49 =
22 +# WAV49 = -DWAV49
23 +WAV49 =
24 ######### Define to enable the GSM library's option to pack GSM frames
25 ######### in the style used by the WAV #49 format. If you want to write
26 ######### a tool that produces .WAV files which contain GSM-encoded data,
27 @@ -44,7 +46,8 @@ WAV49 = -DWAV49
28 # CCFLAGS = -c -O
29
30 CC = gcc -ansi -pedantic
31 -CCFLAGS = -c -O2 -DNeedFunctionPrototypes=1
32 +COPTS = -O2
33 +CCFLAGS = -c $(COPTS) -DNeedFunctionPrototypes=1
34
35 LD = $(CC)
36
37 @@ -78,10 +81,10 @@ INSTALL_ROOT =
38 # Leave GSM_INSTALL_ROOT empty to not install the GSM library outside of
39 # this directory.
40
41 -GSM_INSTALL_ROOT = $(INSTALL_ROOT)
42 +GSM_INSTALL_ROOT = $(INSTALL_ROOT)/usr
43 GSM_INSTALL_LIB = $(GSM_INSTALL_ROOT)/lib
44 -GSM_INSTALL_INC = $(GSM_INSTALL_ROOT)/inc
45 -GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/man/man3
46 +GSM_INSTALL_INC = $(GSM_INSTALL_ROOT)/include
47 +GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/share/man/man3
48
49
50 # Where do you want to install the toast binaries and their manpage?
51 @@ -89,14 +92,14 @@ GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/ma
52 # Leave TOAST_INSTALL_ROOT empty to not install the toast binaries outside
53 # of this directory.
54
55 -TOAST_INSTALL_ROOT = $(INSTALL_ROOT)
56 +TOAST_INSTALL_ROOT = $(INSTALL_ROOT)/usr
57 TOAST_INSTALL_BIN = $(TOAST_INSTALL_ROOT)/bin
58 -TOAST_INSTALL_MAN = $(TOAST_INSTALL_ROOT)/man/man1
59 +TOAST_INSTALL_MAN = $(TOAST_INSTALL_ROOT)/share/man/man1
60
61 # Other tools
62
63 SHELL = /bin/sh
64 -LN = ln
65 +LN = ln -s
66 BASENAME = basename
67 AR = ar
68 ARFLAGS = cr
69 @@ -126,7 +129,7 @@ INC = $(ROOT)/inc
70
71 # Flags
72
73 -# DEBUG = -DNDEBUG
74 +DEBUG = -DNDEBUG
75 ######### Remove -DNDEBUG to enable assertions.
76
77 CFLAGS = $(CCFLAGS) $(SASR) $(DEBUG) $(MULHACK) $(FAST) $(LTP_CUT) \
78 @@ -140,6 +143,7 @@ LFLAGS = $(LDFLAGS) $(LDINC)
79 # Targets
80
81 LIBGSM = $(LIB)/libgsm.a
82 +LIBGSMSO= $(LIB)/libgsm.so
83
84 TOAST = $(BIN)/toast
85 UNTOAST = $(BIN)/untoast
86 @@ -258,6 +262,9 @@ STUFF = ChangeLog \
87
88 GSM_INSTALL_TARGETS = \
89 $(GSM_INSTALL_LIB)/libgsm.a \
90 + $(GSM_INSTALL_LIB)/libgsm.so \
91 + $(GSM_INSTALL_LIB)/libgsm.so.1 \
92 + $(GSM_INSTALL_LIB)/libgsm.so.1.0.10 \
93 $(GSM_INSTALL_INC)/gsm.h \
94 $(GSM_INSTALL_MAN)/gsm.3 \
95 $(GSM_INSTALL_MAN)/gsm_explode.3 \
96 @@ -279,7 +286,7 @@ TOAST_INSTALL_TARGETS = \
97
98 # Target rules
99
100 -all: $(LIBGSM) $(TOAST) $(TCAT) $(UNTOAST)
101 +all: $(LIBGSM) $(LIBGSMSO) $(TOAST) $(TCAT) $(UNTOAST)
102 @-echo $(ROOT): Done.
103
104 tst: $(TST)/lin2cod $(TST)/cod2lin $(TOAST) $(TST)/test-result
105 @@ -299,6 +306,11 @@ install: toastinstall gsminstall
106
107 # The basic API: libgsm
108
109 +$(LIBGSMSO): $(LIB) $(GSM_OBJECTS)
110 + $(LD) -o $@.1.0.10 -shared -Xlinker -soname -Xlinker libgsm.so.1 $(GSM_OBJECTS) -lc
111 + ln -fs libgsm.so.1.0.10 lib/libgsm.so.1
112 + ln -fs libgsm.so.1.0.10 lib/libgsm.so
113 +
114 $(LIBGSM): $(LIB) $(GSM_OBJECTS)
115 -rm $(RMFLAGS) $(LIBGSM)
116 $(AR) $(ARFLAGS) $(LIBGSM) $(GSM_OBJECTS)
117 @@ -308,15 +320,15 @@ $(LIBGSM): $(LIB) $(GSM_OBJECTS)
118 # Toast, Untoast and Tcat -- the compress-like frontends to gsm.
119
120 $(TOAST): $(BIN) $(TOAST_OBJECTS) $(LIBGSM)
121 - $(LD) $(LFLAGS) -o $(TOAST) $(TOAST_OBJECTS) $(LIBGSM) $(LDLIB)
122 + $(LD) $(LFLAGS) -o $(TOAST) $(TOAST_OBJECTS) $(LIBGSMSO) $(LDLIB)
123
124 $(UNTOAST): $(BIN) $(TOAST)
125 -rm $(RMFLAGS) $(UNTOAST)
126 - $(LN) $(TOAST) $(UNTOAST)
127 + $(LN) toast $(UNTOAST)
128
129 $(TCAT): $(BIN) $(TOAST)
130 -rm $(RMFLAGS) $(TCAT)
131 - $(LN) $(TOAST) $(TCAT)
132 + $(LN) toast $(TCAT)
133
134
135 # The local bin and lib directories
136 @@ -351,53 +363,66 @@ toastuninstall:
137 fi
138
139 $(TOAST_INSTALL_BIN)/toast: $(TOAST)
140 - -rm $@
141 - cp $(TOAST) $@
142 + mkdir -p $(TOAST_INSTALL_BIN)
143 + cp -f $(TOAST) $@
144 chmod 755 $@
145
146 $(TOAST_INSTALL_BIN)/untoast: $(TOAST_INSTALL_BIN)/toast
147 - -rm $@
148 - ln $? $@
149 + mkdir -p $(TOAST_INSTALL_BIN)
150 + ln -sf $? $@
151
152 $(TOAST_INSTALL_BIN)/tcat: $(TOAST_INSTALL_BIN)/toast
153 - -rm $@
154 - ln $? $@
155 + mkdir -p $(TOAST_INSTALL_BIN)
156 + ln -sf $? $@
157
158 $(TOAST_INSTALL_MAN)/toast.1: $(MAN)/toast.1
159 - -rm $@
160 - cp $? $@
161 + mkdir -p $(TOAST_INSTALL_MAN)
162 + cp -f $? $@
163 chmod 444 $@
164
165 $(GSM_INSTALL_MAN)/gsm.3: $(MAN)/gsm.3
166 - -rm $@
167 - cp $? $@
168 + mkdir -p $(GSM_INSTALL_MAN)
169 + cp -f $? $@
170 chmod 444 $@
171
172 $(GSM_INSTALL_MAN)/gsm_option.3: $(MAN)/gsm_option.3
173 - -rm $@
174 - cp $? $@
175 + mkdir -p $(GSM_INSTALL_MAN)
176 + cp -f $? $@
177 chmod 444 $@
178
179 $(GSM_INSTALL_MAN)/gsm_explode.3: $(MAN)/gsm_explode.3
180 - -rm $@
181 - cp $? $@
182 + mkdir -p $(GSM_INSTALL_MAN)
183 + cp -f $? $@
184 chmod 444 $@
185
186 $(GSM_INSTALL_MAN)/gsm_print.3: $(MAN)/gsm_print.3
187 - -rm $@
188 - cp $? $@
189 + mkdir -p $(GSM_INSTALL_MAN)
190 + cp -f $? $@
191 chmod 444 $@
192
193 $(GSM_INSTALL_INC)/gsm.h: $(INC)/gsm.h
194 - -rm $@
195 - cp $? $@
196 + mkdir -p $(GSM_INSTALL_INC)
197 + cp -f $? $@
198 chmod 444 $@
199
200 $(GSM_INSTALL_LIB)/libgsm.a: $(LIBGSM)
201 - -rm $@
202 - cp $? $@
203 + mkdir -p $(GSM_INSTALL_LIB)
204 + cp -f $? $@
205 chmod 444 $@
206
207 +$(GSM_INSTALL_LIB)/libgsm.so: $(LIBGSMSO)
208 + mkdir -p $(GSM_INSTALL_LIB)
209 + cp -f $? $@
210 +
211 +$(GSM_INSTALL_LIB)/libgsm.so.1: $(LIBGSMSO)
212 + mkdir -p $(GSM_INSTALL_LIB)
213 + cp -f $? $@
214 +
215 +$(GSM_INSTALL_LIB)/libgsm.so.1.0.10: $(LIBGSMSO)
216 + mkdir -p $(GSM_INSTALL_LIB)
217 + cp -f $? $@
218 + chmod 755 $@
219 +
220
221 # Distribution
222
223 @@ -426,7 +451,9 @@ semi-clean:
224
225 clean: semi-clean
226 -rm $(RMFLAGS) $(LIBGSM) $(ADDTST)/add \
227 - $(TOAST) $(TCAT) $(UNTOAST) \
228 + $(LIBGSMSO) $(LIB)/libgsm.so.1.0.10 \
229 + $(LIB)libgsm.so.1 \
230 + $(TOAST) $(TCAT) $(UNTOAST) \
231 $(ROOT)/gsm-1.0.tar.Z
232
233
234 --- a/inc/config.h
235 +++ b/inc/config.h
236 @@ -9,8 +9,8 @@
237 #ifndef CONFIG_H
238 #define CONFIG_H
239
240 -/*efine SIGHANDLER_T int /* signal handlers are void */
241 -/*efine HAS_SYSV_SIGNAL 1 /* sigs not blocked/reset? */
242 +/*efine SIGHANDLER_T int *//* signal handlers are void */
243 +/*efine HAS_SYSV_SIGNAL 1 *//* sigs not blocked/reset? */
244
245 #define HAS_STDLIB_H 1 /* /usr/include/stdlib.h */
246 #define HAS_LIMITS_H 1 /* /usr/include/limits.h */
247 @@ -22,16 +22,16 @@
248 #define HAS_CHMOD 1 /* chmod syscall */
249 #define HAS_FCHOWN 1 /* fchown syscall */
250 #define HAS_CHOWN 1 /* chown syscall */
251 -/*efine HAS__FSETMODE 1 /* _fsetmode -- set file mode */
252 +/*efine HAS__FSETMODE 1 *//* _fsetmode -- set file mode */
253
254 #define HAS_STRING_H 1 /* /usr/include/string.h */
255 -/*efine HAS_STRINGS_H 1 /* /usr/include/strings.h */
256 +/*efine HAS_STRINGS_H 1 *//* /usr/include/strings.h */
257
258 #define HAS_UNISTD_H 1 /* /usr/include/unistd.h */
259 #define HAS_UTIME 1 /* POSIX utime(path, times) */
260 -/*efine HAS_UTIMES 1 /* use utimes() syscall instead */
261 +/*efine HAS_UTIMES 1 *//* use utimes() syscall instead */
262 #define HAS_UTIME_H 1 /* UTIME header file */
263 #define HAS_UTIMBUF 1 /* struct utimbuf */
264 -/*efine HAS_UTIMEUSEC 1 /* microseconds in utimbuf? */
265 +/*efine HAS_UTIMEUSEC 1 *//* microseconds in utimbuf? */
266
267 #endif /* CONFIG_H */
268 --- a/inc/gsm.h
269 +++ b/inc/gsm.h
270 @@ -54,6 +54,10 @@ typedef gsm_byte gsm_frame[33]; /* 33
271 #define GSM_OPT_FRAME_INDEX 5
272 #define GSM_OPT_FRAME_CHAIN 6
273
274 +#ifdef __cplusplus
275 +extern "C" {
276 +#endif
277 +
278 extern gsm gsm_create GSM_P((void));
279 extern void gsm_destroy GSM_P((gsm));
280
281 @@ -66,6 +70,10 @@ extern int gsm_decode GSM_P((gsm, gsm_
282 extern int gsm_explode GSM_P((gsm, gsm_byte *, gsm_signal *));
283 extern void gsm_implode GSM_P((gsm, gsm_signal *, gsm_byte *));
284
285 +#ifdef __cplusplus
286 +}
287 +#endif
288 +
289 #undef GSM_P
290
291 #endif /* GSM_H */
292 --- a/inc/toast.h
293 +++ b/inc/toast.h
294 @@ -16,11 +16,12 @@
295
296 #include <stdio.h>
297 #include <ctype.h>
298 +#include <pthread.h>
299 #include <signal.h>
300
301 #include <errno.h>
302 -#ifndef HAS_ERRNO_DECL
303 - extern int errno;
304 +#ifndef errno
305 + extern int errno;
306 #endif
307
308 #ifdef HAS_LIMITS_H
309 @@ -37,6 +38,10 @@
310 # endif
311 #endif
312
313 +#ifdef HAS_STDIO_H
314 +# include <stdio.h>
315 +#endif
316 +
317 #include "gsm.h"
318
319 #ifndef S_ISREG
320 --- a/src/code.c
321 +++ b/src/code.c
322 @@ -9,8 +9,8 @@
323 #include "config.h"
324
325
326 -#ifdef HAS_STDLIB_H
327 -#include <stdlib.h>
328 +#ifdef HAS_STRING_H
329 +#include <string.h>
330 #else
331 # include "proto.h"
332 extern char * memcpy P((char *, char *, int));
333 --- a/src/debug.c
334 +++ b/src/debug.c
335 @@ -49,7 +49,7 @@ void gsm_debug_longwords P4( (name, from
336 fprintf( stderr, "%s [%d .. %d]: ", name, from, to );
337 while (from <= to) {
338
339 - fprintf(stderr, "%d ", ptr[ from ] );
340 + fprintf(stderr, "%ld ", ptr[ from ] );
341 from++;
342 if (nprinted++ >= 7) {
343 nprinted = 0;
344 @@ -63,14 +63,14 @@ void gsm_debug_longword P2( (name, valu
345 char * name,
346 longword value )
347 {
348 - fprintf(stderr, "%s: %d\n", name, (long)value );
349 + fprintf(stderr, "%s: %ld\n", name, (long)value );
350 }
351
352 void gsm_debug_word P2( (name, value),
353 char * name,
354 word value )
355 {
356 - fprintf(stderr, "%s: %d\n", name, (long)value);
357 + fprintf(stderr, "%s: %ld\n", name, (long)value);
358 }
359
360 #endif
361 --- a/src/toast.c
362 +++ b/src/toast.c
363 @@ -251,8 +251,8 @@ static char * emalloc P1((len), size_t l
364 {
365 char * s;
366 if (!(s = malloc(len))) {
367 - fprintf(stderr, "%s: failed to malloc %d bytes -- abort\n",
368 - progname, len);
369 + fprintf(stderr, "%s: failed to malloc %ld bytes -- abort\n",
370 + progname, (long) len);
371 onintr();
372 exit(1);
373 }
374 @@ -270,7 +270,7 @@ static char* normalname P3((name, want,
375 maxlen = strlen(name) + 1 + strlen(want) + strlen(cut);
376 p = strcpy(emalloc(maxlen), name);
377
378 - if (s = suffix(p, cut)) strcpy(s, want);
379 + if ((s = suffix(p, cut))) strcpy(s, want);
380 else if (*want && !suffix(p, want)) strcat(p, want);
381
382 return p;
383 @@ -386,7 +386,7 @@ static void update_times P0()
384 ut[0] = instat.st_atime;
385 ut[1] = instat.st_mtime;
386
387 - (void) utime(outname, ut);
388 + (void) utime(outname, (struct utimbuf *)ut);
389
390 #endif /* UTIMBUF */
391 }
392 @@ -416,7 +416,7 @@ static int okay_as_input P3((name,f,st),
393 }
394 if (st->st_nlink > 1 && !f_cat && !f_precious) {
395 fprintf(stderr,
396 - "%s: \"%s\" has %s other link%s -- unchanged.\n",
397 + "%s: \"%s\" has %d other link%s -- unchanged.\n",
398 progname,name,st->st_nlink - 1,"s" + (st->st_nlink<=2));
399 return 0;
400 }
401 @@ -585,8 +585,8 @@ static int process_decode P0()
402
403 if (cc != sizeof(s)) {
404 if (cc >= 0) fprintf(stderr,
405 - "%s: incomplete frame (%d byte%s missing) from %s\n",
406 - progname, sizeof(s) - cc,
407 + "%s: incomplete frame (%ld byte%s missing) from %s\n",
408 + progname, (long) sizeof(s) - cc,
409 "s" + (sizeof(s) - cc == 1),
410 inname ? inname : "stdin" );
411 gsm_destroy(r);
412 @@ -624,8 +624,6 @@ static int process_decode P0()
413
414 static int process P1((name), char * name)
415 {
416 - int step = 0;
417 -
418 out = (FILE *)0;
419 in = (FILE *)0;
420
421 @@ -779,7 +777,6 @@ int main P2((ac, av), int ac, char **av)
422 case 'h': help(); exit(0);
423
424 default:
425 - usage:
426 fprintf(stderr,
427 "Usage: %s [-fcpdhvuaslFC] [files...] (-h for help)\n",
428 progname);