Set download url to sourceforge
[openwrt.git] / openwrt / package / libpcap / patches / 100-shared-lib.patch
1 --- libpcap-0.8.3-orig/Makefile.in 2003-12-15 02:42:23.000000000 +0100
2 +++ libpcap-0.8.3-7/Makefile.in 2005-03-08 03:38:22.000000000 +0100
3 @@ -37,6 +37,15 @@
4 srcdir = @srcdir@
5 VPATH = @srcdir@
6
7 +# some defines for shared library compilation
8 +MAJ=0.8
9 +MIN=3
10 +VERSION=$(MAJ).$(MIN)
11 +LIBNAME=pcap
12 +LIBRARY=lib$(LIBNAME).a
13 +SOLIBRARY=lib$(LIBNAME).so
14 +SHAREDLIB=$(SOLIBRARY).$(VERSION)
15 +
16 #
17 # You shouldn't need to edit anything below.
18 #
19 @@ -49,6 +58,7 @@
20
21 # Standard CFLAGS
22 CFLAGS = $(CCOPT) $(INCLS) $(DEFS)
23 +CFLAGS_SHARED = -shared -Wl,-soname,$(SOLIBRARY).$(MAJ)
24
25 INSTALL = @INSTALL@
26 INSTALL_PROGRAM = @INSTALL_PROGRAM@
27 @@ -68,7 +78,11 @@
28 # problem if you don't own the file but can write to the directory.
29 .c.o:
30 @rm -f $@
31 - $(CC) $(CFLAGS) -c $(srcdir)/$*.c
32 + $(CC) $(CFLAGS) -c -o $@ $(srcdir)/$*.c
33 +
34 +%_pic.o: %.c
35 + @rm -f $@
36 + $(CC) -fPIC $(CFLAGS) -c -o $@ $(srcdir)/$*.c
37
38 PSRC = pcap-@V_PCAP@.c
39 FSRC = fad-@V_FINDALLDEVS@.c
40 @@ -83,6 +97,7 @@
41 # We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
42 # hack the extra indirection
43 OBJ = $(PSRC:.c=.o) $(FSRC:.c=.o) $(CSRC:.c=.o) $(SSRC:.c=.o) $(GENSRC:.c=.o) $(LIBOBJS)
44 +OBJ_PIC = $(PSRC:.c=_pic.o) $(FSRC:.c=_pic.o) $(CSRC:.c=_pic.o) $(SSRC:.c=_pic.o) $(GENSRC:.c=_pic.o)
45 HDR = pcap.h pcap-int.h pcap-namedb.h pcap-nit.h pcap-pf.h \
46 ethertype.h gencode.h gnuc.h
47 GENHDR = \
48 @@ -94,15 +109,22 @@
49 TAGFILES = \
50 $(SRC) $(HDR) $(TAGHDR)
51
52 -CLEANFILES = $(OBJ) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c
53 +CLEANFILES = $(OBJ) $(OBJ_PIC) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c libpcap.so*
54
55 -all: libpcap.a
56 +all: libpcap.a $(SHAREDLIB)
57
58 libpcap.a: $(OBJ)
59 @rm -f $@
60 ar rc $@ $(OBJ) $(LIBS)
61 $(RANLIB) $@
62
63 +$(SHAREDLIB): $(OBJ_PIC)
64 + -@rm -f $@
65 + -@rm -f $(SOLIBRARY) $(SOLIBRARY).$(MAJ)
66 + $(CC) $(CFLAGS_SHARED) -o $(SHAREDLIB) $(OBJ_PIC) -lc
67 + ln -s $(SHAREDLIB) $(SOLIBRARY).$(MAJ)
68 + ln -s $(SOLIBRARY).$(MAJ) $(SOLIBRARY)
69 +
70 scanner.c: $(srcdir)/scanner.l
71 @rm -f $@
72 $(LEX) -t $< > $$$$.$@; mv $$$$.$@ $@
73 @@ -110,6 +132,9 @@
74 scanner.o: scanner.c tokdefs.h
75 $(CC) $(CFLAGS) -c scanner.c
76
77 +scanner_pic.o: scanner.c tokdefs.h
78 + $(CC) -fPIC $(CFLAGS) -o $@ -c scanner.c
79 +
80 pcap.o: version.h
81
82 tokdefs.h: grammar.c
83 @@ -123,9 +148,17 @@
84 @rm -f $@
85 $(CC) $(CFLAGS) -Dyylval=pcap_lval -c grammar.c
86
87 +grammar_pic.o: grammar.c
88 + @rm -f $@
89 + $(CC) -fPIC $(CFLAGS) -Dyylval=pcap_lval -o $@ -c grammar.c
90 +
91 version.o: version.c
92 $(CC) $(CFLAGS) -c version.c
93
94 +version_pic.o: version.c
95 + $(CC) -fPIC $(CFLAGS) -c version.c -o $@
96 +
97 +
98 snprintf.o: $(srcdir)/missing/snprintf.c
99 $(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c
100
101 @@ -151,10 +184,16 @@
102 bpf_filter.o: bpf_filter.c
103 $(CC) $(CFLAGS) -c bpf_filter.c
104
105 +bpf_filter_pic.o: bpf_filter.c
106 + $(CC) -fPIC $(CFLAGS) -c bpf_filter.c -o $@
107 +
108 install:
109 [ -d $(DESTDIR)$(libdir) ] || \
110 (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
111 $(INSTALL_DATA) libpcap.a $(DESTDIR)$(libdir)/libpcap.a
112 + $(INSTALL_DATA) $(SHAREDLIB) $(DESTDIR)$(libdir)/
113 + ln -sf $(SHAREDLIB) $(DESTDIR)$(libdir)/$(SOLIBRARY).$(MAJ)
114 + ln -sf $(SOLIBRARY).$(MAJ) $(DESTDIR)$(libdir)/$(SOLIBRARY)
115 $(RANLIB) $(DESTDIR)$(libdir)/libpcap.a
116 [ -d $(DESTDIR)$(includedir) ] || \
117 (mkdir -p $(DESTDIR)$(includedir); chmod 755 $(DESTDIR)$(includedir))
This page took 0.049641 seconds and 5 git commands to generate.