cleanup MTD option handling
[openwrt.git] / package / libpcap / patches / 100-debian_shared_lib.patch
1 Debian-specific modifications to the upstream Makefile.in to
2 build a shared library.
3 ---
4 Makefile.in | 45 ++++++++++++++++++++++++++++++++++++++++++---
5 configure | 2 +-
6 configure.in | 2 +-
7 3 files changed, 44 insertions(+), 5 deletions(-)
8
9 --- a/Makefile.in
10 +++ b/Makefile.in
11 @@ -40,6 +40,14 @@ mandir = @mandir@
12 srcdir = @srcdir@
13 VPATH = @srcdir@
14
15 +# some defines for shared library compilation
16 +MAJ=1.0
17 +LIBVERSION=$(MAJ).0
18 +LIBNAME=pcap
19 +LIBRARY=lib$(LIBNAME).a
20 +SOLIBRARY=lib$(LIBNAME).so
21 +SHAREDLIB=$(SOLIBRARY).$(LIBVERSION)
22 +
23 #
24 # You shouldn't need to edit anything below.
25 #
26 @@ -56,6 +64,7 @@ PROG=libpcap
27
28 # Standard CFLAGS
29 CFLAGS = $(CCOPT) $(INCLS) $(DEFS)
30 +CFLAGS_SHARED = -shared -Wl,-soname,$(SOLIBRARY).$(MAJ)
31
32 INSTALL = @INSTALL@
33 INSTALL_PROGRAM = @INSTALL_PROGRAM@
34 @@ -75,7 +84,11 @@ YACC = @V_YACC@
35 # problem if you don't own the file but can write to the directory.
36 .c.o:
37 @rm -f $@
38 - $(CC) $(CFLAGS) -c $(srcdir)/$*.c
39 + $(CC) $(CFLAGS) -c -o $@ $(srcdir)/$*.c
40 +
41 +%_pic.o: %.c
42 + @rm -f $@
43 + $(CC) -fPIC $(CFLAGS) -c -o $@ $(srcdir)/$*.c
44
45 PSRC = pcap-@V_PCAP@.c @USB_SRC@ @BT_SRC@
46 FSRC = fad-@V_FINDALLDEVS@.c
47 @@ -90,6 +103,7 @@ SRC = $(PSRC) $(FSRC) $(CSRC) $(SSRC) $(
48 # We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
49 # hack the extra indirection
50 OBJ = $(PSRC:.c=.o) $(FSRC:.c=.o) $(CSRC:.c=.o) $(SSRC:.c=.o) $(GENSRC:.c=.o) $(LIBOBJS)
51 +OBJ_PIC = $(PSRC:.c=_pic.o) $(FSRC:.c=_pic.o) $(CSRC:.c=_pic.o) $(SSRC:.c=_pic.o) $(GENSRC:.c=_pic.o)
52 HDR = \
53 acconfig.h \
54 arcnet.h \
55 @@ -122,7 +136,8 @@ TAGHDR = \
56 TAGFILES = \
57 $(SRC) $(HDR) $(TAGHDR)
58
59 -CLEANFILES = $(OBJ) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c
60 +CLEANFILES = $(OBJ) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c \
61 + $(OBJ_PIC) libpcap.so*
62
63 MAN1 = pcap-config.1
64
65 @@ -311,7 +326,7 @@ EXTRA_DIST = \
66 Win32/Src/inet_net.c \
67 Win32/Src/inet_pton.c
68
69 -all: libpcap.a pcap-config
70 +all: libpcap.a pcap-config $(SHAREDLIB)
71
72 libpcap.a: $(OBJ)
73 @rm -f $@
74 @@ -344,6 +359,13 @@ libpcap.dylib: $(OBJ)
75 -compatibility_version 1 \
76 -current_version `sed 's/[^0-9.].*$$//' $(srcdir)/VERSION`
77
78 +$(SHAREDLIB): $(OBJ_PIC)
79 + -@rm -f $@
80 + -@rm -f $(SOLIBRARY) $(SOLIBRARY).$(MAJ)
81 + $(CC) $(CFLAGS_SHARED) -o $(SHAREDLIB) $(OBJ_PIC) -lc
82 + ln -s $(SHAREDLIB) $(SOLIBRARY).$(MAJ)
83 + ln -s $(SOLIBRARY).$(MAJ) $(SOLIBRARY)
84 +
85 scanner.c: $(srcdir)/scanner.l
86 @rm -f $@
87 ./runlex.sh $(LEX) -o$@ $<
88 @@ -351,6 +373,9 @@ scanner.c: $(srcdir)/scanner.l
89 scanner.o: scanner.c tokdefs.h
90 $(CC) $(CFLAGS) -c scanner.c
91
92 +scanner_pic.o: scanner.c tokdefs.h
93 + $(CC) -fPIC $(CFLAGS) -o $@ -c scanner.c
94 +
95 pcap.o: version.h
96
97 tokdefs.h: grammar.c
98 @@ -364,9 +389,17 @@ grammar.o: grammar.c
99 @rm -f $@
100 $(CC) $(CFLAGS) -Dyylval=pcap_lval -c grammar.c
101
102 +grammar_pic.o: grammar.c
103 + @rm -f $@
104 + $(CC) -fPIC $(CFLAGS) -Dyylval=pcap_lval -o $@ -c grammar.c
105 +
106 version.o: version.c
107 $(CC) $(CFLAGS) -c version.c
108
109 +version_pic.o: version.c
110 + $(CC) -fPIC $(CFLAGS) -c version.c -o $@
111 +
112 +
113 snprintf.o: $(srcdir)/missing/snprintf.c
114 $(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c
115
116 @@ -392,6 +425,9 @@ bpf_filter.c: $(srcdir)/bpf/net/bpf_filt
117 bpf_filter.o: bpf_filter.c
118 $(CC) $(CFLAGS) -c bpf_filter.c
119
120 +bpf_filter_pic.o: bpf_filter.c
121 + $(CC) -fPIC $(CFLAGS) -c bpf_filter.c -o $@
122 +
123 #
124 # Generate the pcap-config script.
125 #
126 @@ -418,6 +454,9 @@ install: libpcap.a pcap-config
127 (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
128 $(INSTALL_DATA) libpcap.a $(DESTDIR)$(libdir)/libpcap.a
129 $(RANLIB) $(DESTDIR)$(libdir)/libpcap.a
130 + $(INSTALL_DATA) $(SHAREDLIB) $(DESTDIR)$(libdir)/
131 + ln -sf $(SHAREDLIB) $(DESTDIR)$(libdir)/$(SOLIBRARY).$(MAJ)
132 + ln -sf $(SOLIBRARY).$(MAJ) $(DESTDIR)$(libdir)/$(SOLIBRARY)
133 [ -d $(DESTDIR)$(includedir) ] || \
134 (mkdir -p $(DESTDIR)$(includedir); chmod 755 $(DESTDIR)$(includedir))
135 [ -d $(DESTDIR)$(includedir)/pcap ] || \
136 --- a/configure
137 +++ b/configure
138 @@ -8658,7 +8658,7 @@ irix*)
139 ;;
140
141 linux*)
142 - V_CCOPT="$V_CCOPT -fPIC"
143 + V_CCOPT="$V_CCOPT"
144 ;;
145
146 osf*)
147 --- a/configure.in
148 +++ b/configure.in
149 @@ -943,7 +943,7 @@ irix*)
150 ;;
151
152 linux*)
153 - V_CCOPT="$V_CCOPT -fPIC"
154 + V_CCOPT="$V_CCOPT"
155 ;;
156
157 osf*)
This page took 0.058989 seconds and 5 git commands to generate.