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