merge of 425cf1b391611c169a1c3b78f1fe86df088902b9
[vuplus_openembedded] / packages / libpcap / libpcap-0.9.5 / shared.patch
1
2 #
3 # Patch managed by http://www.holgerschurig.de/patcher.html
4 #
5
6 --- libpcap-0.9.3/Makefile.in~shared
7 +++ libpcap-0.9.3/Makefile.in
8 @@ -37,6 +37,15 @@
9  srcdir = @srcdir@
10  VPATH = @srcdir@
11  
12 +# some defines for shared library compilation - FIXME, if not matching
13 +MAJ=0.9
14 +MIN=5
15 +VERSION=$(MAJ).$(MIN)
16 +LIBNAME=pcap
17 +LIBRARY=lib$(LIBNAME).a
18 +SOLIBRARY=lib$(LIBNAME).so
19 +SHAREDLIB=$(SOLIBRARY).$(VERSION)
20 +
21  #
22  # You shouldn't need to edit anything below.
23  #
24 @@ -50,6 +59,7 @@
25  
26  # Standard CFLAGS
27  CFLAGS = $(CCOPT) $(INCLS) $(DEFS)
28 +CFLAGS_SHARED = -shared -Wl,-soname,$(SOLIBRARY).$(MAJ)
29  
30  INSTALL = @INSTALL@
31  INSTALL_PROGRAM = @INSTALL_PROGRAM@
32 @@ -70,6 +80,9 @@
33  .c.o:
34         @rm -f $@
35         $(CC) $(CFLAGS) -c $(srcdir)/$*.c
36 +%_pic.o: %.c
37 +       @rm -f $@
38 +       $(CC) -fPIC $(CFLAGS) -c -o $@ $(srcdir)/$*.c
39  
40  PSRC = pcap-@V_PCAP@.c
41  FSRC =  fad-@V_FINDALLDEVS@.c
42 @@ -84,6 +97,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=.o) $(CSRC:.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 +109,22 @@
51  TAGFILES = \
52         $(SRC) $(HDR) $(TAGHDR)
53  
54 -CLEANFILES = $(OBJ) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c
55 +CLEANFILES = $(OBJ) 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  shared: libpcap.$(DYEXT)
73  
74  #
75 @@ -129,6 +150,9 @@
76  scanner.o: scanner.c tokdefs.h
77         $(CC) $(CFLAGS) -c scanner.c
78  
79 +scanner_pic.o: scanner.c tokdefs.h
80 +       $(CC) -fPIC $(CFLAGS) -o $@ -c scanner.c
81 +
82  pcap.o: version.h
83  
84  tokdefs.h: grammar.c
85 @@ -142,9 +166,16 @@
86         @rm -f $@
87         $(CC) $(CFLAGS) -Dyylval=pcap_lval -c grammar.c
88  
89 +grammer_pic.o: grammar.c
90 +       @rm -f $@
91 +       $(CC) -fPIC $(CFLAGS) -Dyylval=pcap_lval -o $@ -c grammar.c 
92 +
93  version.o: version.c
94         $(CC) $(CFLAGS) -c version.c
95  
96 +version_pic.o: version.c
97 +       $(CC) -fPIC $(CFLAGS) -c version.c -o $@
98 +
99  snprintf.o: $(srcdir)/missing/snprintf.c
100         $(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c
101  
102 @@ -170,11 +201,17 @@
103  bpf_filter.o: bpf_filter.c
104         $(CC) $(CFLAGS) -c bpf_filter.c
105  
106 +bpf_filter_pic.o: bpf_filter.c
107 +       $(CC) -fPIC $(CFLAGS) -c bpf_filter.c -o $@
108 +
109  install: libpcap.a 
110         [ -d $(DESTDIR)$(libdir) ] || \
111             (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
112         $(INSTALL_DATA) libpcap.a $(DESTDIR)$(libdir)/libpcap.a
113         $(RANLIB) $(DESTDIR)$(libdir)/libpcap.a
114 +       $(INSTALL_DATA) $(SHAREDLIB) $(DESTDIR)$(libdir)/
115 +       ln -sf $(SHAREDLIB) $(DESTDIR)$(libdir)/$(SOLIBRARY).$(MAJ)
116 +       ln -sf $(SOLIBRARY).$(MAJ) $(DESTDIR)$(libdir)/$(SOLIBRARY)
117         [ -d $(DESTDIR)$(includedir) ] || \
118             (mkdir -p $(DESTDIR)$(includedir); chmod 755 $(DESTDIR)$(includedir))
119         $(INSTALL_DATA) $(srcdir)/pcap.h $(DESTDIR)$(includedir)/pcap.h