aboutsummaryrefslogtreecommitdiffstats
path: root/package/libcgi/libcgi.patch
blob: 12a7b106c73be94a17d8a843c4643b2810d5d478 (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
--- libcgi-1.0.orig/src/cgi.c
+++ libcgi-1.0/src/cgi.c
@@ -336,7 +336,7 @@
 	hextable['b'] = 11;
 	hextable['c'] = 12;
 	hextable['d'] = 13;
-	hextable['e'] = 13;
+	hextable['e'] = 14;
 	hextable['f'] = 15;
 	hextable['A'] = 10;
 	hextable['B'] = 11;
--- libcgi-1.0.orig/src/string.c
+++ libcgi-1.0/src/string.c
@@ -584,7 +584,7 @@
 
 	va_start(ptr, s);
 
-	va_copy(bkp, str);
+	va_copy(bkp, ptr);
 	len = strlen(s);
 
 	while (*str) {
--- libcgi-1.0.orig/Makefile.in
+++ libcgi-1.0/Makefile.in
@@ -5,22 +5,27 @@
 prefix = @prefix@
 exec_prefix = @exec_prefix@
 
-SHAREDOPT = -shared
+SHAREDOPT = -shared -fPIC -Wl,-soname,libcgi.so.0
 LIBDIR = $(prefix)/lib
-INCDIR = $(prefix)/include
+INCDIR = $(prefix)/include/libcgi/
 MANDIR	= $(prefix)/man/man3
 SHELL = /bin/sh
 EXTRA_LIBS = 
 
 INCS =  -Isrc
-FLAGS = -Wall -fpic
+FLAGS = -Wall -D_REENTRANT
 
 OBJS = src/error.o src/cgi.o src/session.o src/base64.o src/md5.o \
 	src/string.o src/general.o src/list.o src/cookie.o
+SHOBJS=$(OBJS:.o=.sh.o)
 
-.c.o: $(CC) $(FLAGS) -c $<
+%.o: %.c
+	$(CC) $(FLAGS) -c $*.c -o $@
 
-all: $(OBJS) src/libcgi.so
+%.sh.o: %.c
+	$(CC) $(FLAGS) -fPIC -c $*.c -o $@
+
+all: src/libcgi.so src/libcgi.a
 
 	@echo ""
 	@echo ""
@@ -48,14 +53,15 @@
 src/libcgi.a: $(OBJS)
 	$(AR) rc src/libcgi.a $(OBJS)
 
-src/libcgi.so: src/libcgi.a
-	$(CC) $(SHAREDOPT) -o src/libcgi.so $(OBJS) $(EXTRA_LIBS)
+src/libcgi.so: $(SHOBJS)
+	$(CC) $(SHAREDOPT) -o src/libcgi.so $(SHOBJS) $(EXTRA_LIBS)
 
 install:
-	cp src/libcgi.a $(LIBDIR)
-	cp src/libcgi.so $(LIBDIR)
-	cp src/cgi.h $(INCDIR)
-	cp src/session.h $(INCDIR)
+	cp src/libcgi.a $(DESTDIR)/$(LIBDIR)
+	cp src/libcgi.so $(DESTDIR)/$(LIBDIR)
+	[ -d $(DESTDIR)/$(INCDIR) ] || mkdir -p $(DESTDIR)/$(INCDIR)
+	cp src/cgi.h $(DESTDIR)/$(INCDIR)
+	cp src/session.h $(DESTDIR)/$(INCDIR)
 
 
 src/error.o: src/error.c src/error.h
@@ -69,8 +75,9 @@
 src/list.o: src/list.c
 
 clean:
-	find src/ -name *.*o -exec rm -f {} \;
+	find src/ -name *.o -exec rm -f {} \;
 	find src/ -name *.a -exec rm -f {} \;
+	find src/ -name *.so -exec rm -f {} \;
 
 uninstall: clean
 	rm -f $(LIBDIR)/libcgi.*
@@ -78,11 +85,11 @@
 	rm -f $(INCDIR)/session.h
 	rm -f $(MANDIR)/libcgi*
 
-install_man:
-	cp doc/man/man3/libcgi_base64.3 $(MANDIR)
-	cp doc/man/man3/libcgi_cgi.3 $(MANDIR)
-	cp doc/man/man3/libcgi_general.3 $(MANDIR)
-	cp doc/man/man3/libcgi_string.3 $(MANDIR)
-	cp doc/man/man3/libcgi_session.3 $(MANDIR)
-	cp doc/man/man3/libcgi_cookie.3 $(MANDIR)
+#install_man:
+#	cp doc/man/man3/libcgi_base64.3 $(MANDIR)
+#	cp doc/man/man3/libcgi_cgi.3 $(MANDIR)
+#	cp doc/man/man3/libcgi_general.3 $(MANDIR)
+#	cp doc/man/man3/libcgi_string.3 $(MANDIR)
+#	cp doc/man/man3/libcgi_session.3 $(MANDIR)
+#	cp doc/man/man3/libcgi_cookie.3 $(MANDIR)