From dd4841ca02ee1cb3ee509d74fd6c6421fb5b1a12 Mon Sep 17 00:00:00 2001 From: Ricardo Martins Date: Wed, 23 Jul 2014 18:51:27 +0100 Subject: [PATCH] libcap: updated to version 1.6.1. --- rules/libpcap/default.bash | 18 +- rules/libpcap/patches/10_shared_lib.diff | 180 ------------------ rules/libpcap/patches/15_linker_script.diff | 103 ---------- rules/libpcap/patches/30_man_fixes.diff | 17 -- .../libpcap/patches/40_fix_bus_usb_path.diff | 16 -- rules/libpcap/patches/50_kfreebsd.diff | 147 -------------- 6 files changed, 12 insertions(+), 469 deletions(-) delete mode 100644 rules/libpcap/patches/10_shared_lib.diff delete mode 100644 rules/libpcap/patches/15_linker_script.diff delete mode 100644 rules/libpcap/patches/30_man_fixes.diff delete mode 100644 rules/libpcap/patches/40_fix_bus_usb_path.diff delete mode 100644 rules/libpcap/patches/50_kfreebsd.diff diff --git a/rules/libpcap/default.bash b/rules/libpcap/default.bash index 7bde993..eca106b 100644 --- a/rules/libpcap/default.bash +++ b/rules/libpcap/default.bash @@ -1,6 +1,6 @@ version=\ ( - "1.1.1" + "1.6.1" ) url=\ @@ -10,7 +10,7 @@ url=\ md5=\ ( - "1bca27d206970badae248cfa471bbb47" + "5eb05edf6b6c6e63d536d1c9fbfb2f7c" ) maintainer=\ @@ -26,9 +26,12 @@ requires=\ post_unpack() { - for patch in "$pkg_dir"/patches/*; do - patch -p1 < "$patch" || return 1 - done + if [ -d "$pkg_dir"/patches/${version} ]; + then + for patch in "$pkg_dir"/patches/${version}/*; do + patch -p1 < "$patch" || return 1 + done + fi } configure() @@ -56,7 +59,10 @@ build() host_install() { - $cmd_make install + $cmd_make install && + mv -v \ + "$cfg_dir_toolchain_sysroot/usr/bin/pcap-config" \ + "$cfg_dir_toolchain/bin/$cfg_target_canonical-pcap-config" } target_install() diff --git a/rules/libpcap/patches/10_shared_lib.diff b/rules/libpcap/patches/10_shared_lib.diff deleted file mode 100644 index f24d7cb..0000000 --- a/rules/libpcap/patches/10_shared_lib.diff +++ /dev/null @@ -1,180 +0,0 @@ -Debian-specific modifications to the upstream Makefile.in to -build a shared library. - ---- - Makefile.in | 49 +++++++++++++++++++++++++++++++++++++++++-------- - aclocal.m4 | 4 ++-- - configure | 4 ++-- - 3 files changed, 45 insertions(+), 12 deletions(-) - ---- a/Makefile.in -+++ b/Makefile.in -@@ -40,6 +40,14 @@ - srcdir = @srcdir@ - VPATH = @srcdir@ - -+# some defines for shared library compilation -+MAJ=1.0 -+LIBVERSION=1 -+LIBNAME=pcap -+LIBRARY=lib$(LIBNAME).a -+SOLIBRARY=lib$(LIBNAME).so -+SHAREDLIB=$(SOLIBRARY).$(LIBVERSION) -+ - # - # You shouldn't need to edit anything below. - # -@@ -59,6 +67,7 @@ - - # Standard CFLAGS - CFLAGS = $(CCOPT) $(INCLS) $(DEFS) -+CFLAGS_SHARED = -shared -Wl,-soname,$(SOLIBRARY).$(MAJ) - - INSTALL = @INSTALL@ - INSTALL_PROGRAM = @INSTALL_PROGRAM@ -@@ -78,7 +87,11 @@ - # problem if you don't own the file but can write to the directory. - .c.o: - @rm -f $@ -- $(CC) $(CFLAGS) -c $(srcdir)/$*.c -+ $(CC) $(CFLAGS) -c -o $@ $(srcdir)/$*.c -+ -+%_pic.o: %.c -+ @rm -f $@ -+ $(CC) -fPIC $(CFLAGS) -c -o $@ $(srcdir)/$*.c - - PSRC = pcap-@V_PCAP@.c @USB_SRC@ @BT_SRC@ @CAN_SRC@ - FSRC = fad-@V_FINDALLDEVS@.c -@@ -94,6 +107,7 @@ - # We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot - # hack the extra indirection - OBJ = $(PSRC:.c=.o) $(FSRC:.c=.o) $(CSRC:.c=.o) $(SSRC:.c=.o) $(GENSRC:.c=.o) $(LIBOBJS) -+OBJ_PIC = $(PSRC:.c=_pic.o) $(FSRC:.c=_pic.o) $(CSRC:.c=_pic.o) $(SSRC:.c=_pic.o) $(GENSRC:.c=_pic.o) - PUBHDR = \ - pcap.h \ - pcap-bpf.h \ -@@ -131,7 +145,7 @@ - - CLEANFILES = $(OBJ) libpcap.* filtertest findalldevstest selpolltest \ - opentest $(PROG)-`cat $(srcdir)/VERSION`.tar.gz $(GENSRC) $(GENHDR) \ -- lex.yy.c pcap-config -+ lex.yy.c pcap-config $(OBJ_PIC) - - MAN1 = pcap-config.1 - -@@ -331,7 +345,7 @@ - ar rc $@ $(OBJ) $(ADDLARCHIVEOBJS) - $(RANLIB) $@ - --shared: libpcap.$(DYEXT) -+shared: $(SHAREDLIB) - - libpcap.so: $(OBJ) - @rm -f $@ -@@ -409,6 +423,13 @@ - # - libpcap.none: - -+$(SHAREDLIB): $(OBJ_PIC) -+ -@rm -f $@ -+ -@rm -f $(SOLIBRARY) $(SOLIBRARY).$(MAJ) -+ $(CC) $(CFLAGS_SHARED) -o $(SHAREDLIB) $(OBJ_PIC) -lc -+ ln -s $(SHAREDLIB) $(SOLIBRARY).$(MAJ) -+ ln -s $(SOLIBRARY).$(MAJ) $(SOLIBRARY) -+ - scanner.c: $(srcdir)/scanner.l - @rm -f $@ - $(srcdir)/runlex.sh $(LEX) -o$@ $< -@@ -416,6 +437,9 @@ - scanner.o: scanner.c tokdefs.h - $(CC) $(CFLAGS) -c scanner.c - -+scanner_pic.o: scanner.c tokdefs.h -+ $(CC) -fPIC $(CFLAGS) -o $@ -c scanner.c -+ - pcap.o: version.h - - tokdefs.h: grammar.c -@@ -429,9 +453,17 @@ - @rm -f $@ - $(CC) $(CFLAGS) -Dyylval=pcap_lval -c grammar.c - -+grammar_pic.o: grammar.c -+ @rm -f $@ -+ $(CC) -fPIC $(CFLAGS) -Dyylval=pcap_lval -o $@ -c grammar.c -+ - version.o: version.c - $(CC) $(CFLAGS) -c version.c - -+version_pic.o: version.c -+ $(CC) -fPIC $(CFLAGS) -c version.c -o $@ -+ -+ - snprintf.o: $(srcdir)/missing/snprintf.c - $(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c - -@@ -469,6 +501,9 @@ - bpf_filter.o: bpf_filter.c - $(CC) $(CFLAGS) -c bpf_filter.c - -+bpf_filter_pic.o: bpf_filter.c -+ $(CC) -fPIC $(CFLAGS) -c bpf_filter.c -o $@ -+ - # - # Generate the pcap-config script. - # -@@ -565,11 +600,9 @@ - install-shared-so: libpcap.so - [ -d $(DESTDIR)$(libdir) ] || \ - (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir)) -- VER=`cat $(srcdir)/VERSION`; \ -- MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \ -- $(INSTALL_PROGRAM) libpcap.so.$$VER $(DESTDIR)$(libdir)/libpcap.so.$$VER; \ -- ln -sf libpcap.so.$$VER $(DESTDIR)$(libdir)/libpcap.so.$$MAJOR_VER; \ -- ln -sf libpcap.so.$$MAJOR_VER $(DESTDIR)$(libdir)/libpcap.so -+ $(INSTALL_DATA) $(SHAREDLIB) $(DESTDIR)$(libdir)/ -+ ln -sf $(SHAREDLIB) $(DESTDIR)$(libdir)/$(SOLIBRARY).$(MAJ) -+ ln -sf $(SOLIBRARY).$(MAJ) $(DESTDIR)$(libdir)/$(SOLIBRARY) - install-shared-dylib: libpcap.dylib - [ -d $(DESTDIR)$(libdir) ] || \ - (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir)) ---- a/aclocal.m4 -+++ b/aclocal.m4 -@@ -245,7 +245,7 @@ - # or accepts command-line arguments like - # those the GNU linker accepts. - # -- V_CCOPT="$V_CCOPT -fpic" -+ V_CCOPT="$V_CCOPT" - V_SONAME_OPT="-Wl,-soname," - V_RPATH_OPT="-Wl,-rpath," - ;; -@@ -308,7 +308,7 @@ - # - # "cc" is GCC. - # -- V_CCOPT="$V_CCOPT -fpic" -+ V_CCOPT="$V_CCOPT" - V_SHLIB_CMD="\$(CC)" - V_SHLIB_OPT="-shared" - V_SONAME_OPT="-Wl,-soname," ---- a/configure -+++ b/configure -@@ -3229,7 +3229,7 @@ - # or accepts command-line arguments like - # those the GNU linker accepts. - # -- V_CCOPT="$V_CCOPT -fpic" -+ V_CCOPT="$V_CCOPT" - V_SONAME_OPT="-Wl,-soname," - V_RPATH_OPT="-Wl,-rpath," - ;; -@@ -3292,7 +3292,7 @@ - # - # "cc" is GCC. - # -- V_CCOPT="$V_CCOPT -fpic" -+ V_CCOPT="$V_CCOPT" - V_SHLIB_CMD="\$(CC)" - V_SHLIB_OPT="-shared" - V_SONAME_OPT="-Wl,-soname," diff --git a/rules/libpcap/patches/15_linker_script.diff b/rules/libpcap/patches/15_linker_script.diff deleted file mode 100644 index e5b703e..0000000 --- a/rules/libpcap/patches/15_linker_script.diff +++ /dev/null @@ -1,103 +0,0 @@ -Use a linker script. ---- - Makefile.in | 2 - - libpcap.lds | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 84 insertions(+), 1 deletion(-) - ---- a/Makefile.in -+++ b/Makefile.in -@@ -67,7 +67,7 @@ - - # Standard CFLAGS - CFLAGS = $(CCOPT) $(INCLS) $(DEFS) --CFLAGS_SHARED = -shared -Wl,-soname,$(SOLIBRARY).$(MAJ) -+CFLAGS_SHARED = -shared -Wl,-soname,$(SOLIBRARY).$(MAJ) -Wl,--version-script=libpcap.lds - - INSTALL = @INSTALL@ - INSTALL_PROGRAM = @INSTALL_PROGRAM@ ---- /dev/null -+++ b/libpcap.lds -@@ -0,0 +1,83 @@ -+{ -+ global: -+ bpf_dump; -+ bpf_filter; -+ bpf_image; -+ bpf_validate; -+ eproto_db; -+ pcap_breakloop; -+ pcap_can_set_rfmon; -+ pcap_close; -+ pcap_compile; -+ pcap_compile_nopcap; -+ pcap_datalink; -+ pcap_datalink_name_to_val; -+ pcap_datalink_val_to_description; -+ pcap_datalink_val_to_name; -+ pcap_dispatch; -+ pcap_dump; -+ pcap_dump_close; -+ pcap_dump_file; -+ pcap_dump_flush; -+ pcap_dump_fopen; -+ pcap_dump_ftell; -+ pcap_dump_open; -+ pcap_ether_aton; -+ pcap_ether_hostton; -+ pcap_file; -+ pcap_fileno; -+ pcap_findalldevs; -+ pcap_fopen_offline; -+ pcap_freealldevs; -+ pcap_freecode; -+ pcap_get_selectable_fd; -+ pcap_geterr; -+ pcap_getnonblock; -+ pcap_inject; -+ pcap_is_swapped; -+ pcap_lib_version; -+ pcap_list_datalinks; -+ pcap_lookupdev; -+ pcap_lookupnet; -+ pcap_loop; -+ pcap_major_version; -+ pcap_minor_version; -+ pcap_nametoaddr; -+ pcap_nametoaddrinfo; -+ pcap_nametoeproto; -+ pcap_nametollc; -+ pcap_nametonetaddr; -+ pcap_nametoport; -+ pcap_nametoportrange; -+ pcap_nametoproto; -+ pcap_next; -+ pcap_next_etherent; -+ pcap_next_ex; -+ pcap_open_dead; -+ pcap_open_live; -+ pcap_open_offline; -+ pcap_perror; -+ pcap_sendpacket; -+ pcap_set_datalink; -+ pcap_setdirection; -+ pcap_setfilter; -+ pcap_setnonblock; -+ pcap_snapshot; -+ pcap_stats; -+ pcap_statustostr; -+ pcap_strerror; -+ pcap_version; -+ /* introduced in pcap 1.0 */ -+ pcap_activate; -+ pcap_create; -+ pcap_datalink_ext; -+ pcap_free_datalinks; -+ pcap_offline_filter; -+ pcap_set_buffer_size; -+ pcap_set_promisc; -+ pcap_set_rfmon; -+ pcap_set_snaplen; -+ pcap_set_timeout; -+ local: -+ *; -+}; diff --git a/rules/libpcap/patches/30_man_fixes.diff b/rules/libpcap/patches/30_man_fixes.diff deleted file mode 100644 index d692882..0000000 --- a/rules/libpcap/patches/30_man_fixes.diff +++ /dev/null @@ -1,17 +0,0 @@ -Misc. fixes to the upstream man page. - ---- - pcap.3pcap.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/pcap.3pcap.in -+++ b/pcap.3pcap.in -@@ -363,7 +363,7 @@ - script or some other configuration script to check whether the libpcap - 1.0 APIs are available and use them only if they are. - .SH SEE ALSO --autoconf(1), tcpdump(1), tcpslice(1), pcap-filter(@MAN_MISC_INFO@), pfconfig(8), -+autoconf(1), tcpdump(8), tcpslice(1), pcap-filter(@MAN_MISC_INFO@), pfconfig(8), - usermod(1M) - .SH AUTHORS - The original authors of libpcap are: diff --git a/rules/libpcap/patches/40_fix_bus_usb_path.diff b/rules/libpcap/patches/40_fix_bus_usb_path.diff deleted file mode 100644 index bafce72..0000000 --- a/rules/libpcap/patches/40_fix_bus_usb_path.diff +++ /dev/null @@ -1,16 +0,0 @@ -Fix USB bus path; /proc/bus/usb is deprecated. ---- - pcap-usb-linux.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/pcap-usb-linux.c -+++ b/pcap-usb-linux.c -@@ -68,7 +68,7 @@ - #define USB_TEXT_DIR_OLD "/sys/kernel/debug/usbmon" - #define USB_TEXT_DIR "/sys/kernel/debug/usb/usbmon" - #define SYS_USB_BUS_DIR "/sys/bus/usb/devices" --#define PROC_USB_BUS_DIR "/proc/bus/usb" -+#define PROC_USB_BUS_DIR "/dev/bus/usb" - #define USB_LINE_LEN 4096 - - #if __BYTE_ORDER == __LITTLE_ENDIAN diff --git a/rules/libpcap/patches/50_kfreebsd.diff b/rules/libpcap/patches/50_kfreebsd.diff deleted file mode 100644 index 46893f9..0000000 --- a/rules/libpcap/patches/50_kfreebsd.diff +++ /dev/null @@ -1,147 +0,0 @@ -Support for GNU/kFreeBSD, by Aurelien Jarno and others. ---- - configure | 62 ++--------------------------------------------------------- - configure.in | 19 ++---------------- - 2 files changed, 6 insertions(+), 75 deletions(-) - ---- a/configure.in -+++ b/configure.in -@@ -104,6 +104,7 @@ - dnl - AC_CHECK_HEADERS(sys/ioccom.h sys/sockio.h limits.h paths.h) - AC_CHECK_HEADERS(net/pfvar.h, , , [#include -+#include - #include - #include ]) - if test "$ac_cv_header_net_pfvar_h" = yes; then -@@ -304,7 +305,7 @@ - # - V_PCAP=bpf - AC_DEFINE(HAVE_CLONING_BPF,1,[define if you have a cloning BPF device]) --elif test -r /dev/bpf0 ; then -+elif test -r /dev/bpf0 || test -r /usr/include/net/bpf.h ; then - V_PCAP=bpf - elif test -r /usr/include/net/pfilt.h ; then - V_PCAP=pf -@@ -464,20 +465,6 @@ - # - AC_CHECK_HEADERS(net/if_media.h) - -- AC_MSG_CHECKING(whether the system supports zerocopy BPF) -- AC_TRY_COMPILE( -- [#include -- #include -- #include -- #include ], -- [return (BIOCROTZBUF + BPF_BUFMODE_ZBUF);], -- [ -- AC_MSG_RESULT(yes) -- AC_DEFINE(HAVE_ZEROCOPY_BPF, 1, -- [define if the system supports zerocopy BPF]) -- ], -- AC_MSG_RESULT(no)) -- - # - # Check whether we have struct BPF_TIMEVAL. - # -@@ -1234,7 +1221,7 @@ - MAN_MISC_INFO=5 - ;; - --linux*|freebsd*|netbsd*|openbsd*|dragonfly*) -+linux*|freebsd*|netbsd*|openbsd*|dragonfly*|kfreebsd*) - DYEXT="so" - - # ---- a/configure -+++ b/configure -@@ -5440,6 +5440,7 @@ - cat >>conftest.$ac_ext <<_ACEOF - /* end confdefs.h. */ - #include -+#include - #include - #include - -@@ -6923,7 +6924,7 @@ - #define HAVE_CLONING_BPF 1 - _ACEOF - --elif test -r /dev/bpf0 ; then -+elif test -r /dev/bpf0 || test -r /usr/include/net/bpf.h ; then - V_PCAP=bpf - elif test -r /usr/include/net/pfilt.h ; then - V_PCAP=pf -@@ -7665,63 +7666,6 @@ - - done - -- -- { echo "$as_me:$LINENO: checking whether the system supports zerocopy BPF" >&5 --echo $ECHO_N "checking whether the system supports zerocopy BPF... $ECHO_C" >&6; } -- cat >conftest.$ac_ext <<_ACEOF --/* confdefs.h. */ --_ACEOF --cat confdefs.h >>conftest.$ac_ext --cat >>conftest.$ac_ext <<_ACEOF --/* end confdefs.h. */ --#include -- #include -- #include -- #include --int --main () --{ --return (BIOCROTZBUF + BPF_BUFMODE_ZBUF); -- ; -- return 0; --} --_ACEOF --rm -f conftest.$ac_objext --if { (ac_try="$ac_compile" --case "(($ac_try" in -- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; -- *) ac_try_echo=$ac_try;; --esac --eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 -- (eval "$ac_compile") 2>conftest.er1 -- ac_status=$? -- grep -v '^ *+' conftest.er1 >conftest.err -- rm -f conftest.er1 -- cat conftest.err >&5 -- echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } && { -- test -z "$ac_c_werror_flag" || -- test ! -s conftest.err -- } && test -s conftest.$ac_objext; then -- -- { echo "$as_me:$LINENO: result: yes" >&5 --echo "${ECHO_T}yes" >&6; } -- --cat >>confdefs.h <<\_ACEOF --#define HAVE_ZEROCOPY_BPF 1 --_ACEOF -- -- --else -- echo "$as_me: failed program was:" >&5 --sed 's/^/| /' conftest.$ac_ext >&5 -- -- { echo "$as_me:$LINENO: result: no" >&5 --echo "${ECHO_T}no" >&6; } --fi -- --rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -- - # - # Check whether we have struct BPF_TIMEVAL. - # -@@ -9607,7 +9551,7 @@ - MAN_MISC_INFO=5 - ;; - --linux*|freebsd*|netbsd*|openbsd*|dragonfly*) -+linux*|freebsd*|netbsd*|openbsd*|dragonfly*|kfreebsd*) - DYEXT="so" - - #