347b180ba26b478230dbd4011d34e50336bf7bc7
[openwrt.git] / package / libs / libpcap / Makefile
1 #
2 # Copyright (C) 2006-2013 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=libpcap
11 PKG_VERSION:=1.5.3
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=http://www.tcpdump.org/release/
16 PKG_MD5SUM:=7e7321fb3aff2f2bb05c8229f3795d4a
17
18 PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
19
20 PKG_INSTALL:=1
21 PKG_BUILD_PARALLEL:=1
22
23 include $(INCLUDE_DIR)/package.mk
24 include $(INCLUDE_DIR)/kernel.mk
25
26 define Package/libpcap
27   SECTION:=libs
28   CATEGORY:=Libraries
29   TITLE:=Low-level packet capture library
30   URL:=http://www.tcpdump.org/
31   MENU:=1
32 endef
33
34 define Package/libpcap/description
35 This package contains a system-independent library for user-level network packet
36 capture.
37 endef
38
39 define Package/libpcap/config
40         source "$(SOURCE)/Config.in"
41 endef
42
43 TARGET_CFLAGS += \
44         -ffunction-sections \
45         -fdata-sections
46
47 CONFIGURE_VARS += \
48         ac_cv_linux_vers=$(LINUX_VERSION) \
49         ac_cv_header_libusb_1_0_libusb_h=no \
50         ac_cv_netfilter_can_compile=no
51
52
53 CONFIGURE_ARGS += \
54         --enable-shared \
55         --enable-static \
56         --disable-yydebug \
57         --with-build-cc="$(HOSTCC)" \
58         --with-pcap=linux \
59         --without-septel \
60         --without-dag \
61         --without-libnl \
62         --disable-can
63
64 ifeq ($(CONFIG_IPV6),y)
65 CONFIGURE_ARGS += \
66         --enable-ipv6
67 endif
68
69 MAKE_FLAGS += \
70         CCOPT="$(TARGET_CFLAGS) -I$(BUILD_DIR)/linux/include"
71
72 define Build/Configure
73         $(call Build/Configure/Default)
74         $(if $(CONFIG_PCAP_HAS_USB),,$(SED) '/^#define PCAP_SUPPORT_USB/D' $(PKG_BUILD_DIR)/config.h)
75         $(if $(CONFIG_PCAP_HAS_USB),,$(SED) 's/pcap-usb-linux.c *//' $(PKG_BUILD_DIR)/Makefile)
76         $(if $(CONFIG_PCAP_HAS_BT),,$(SED) '/^#define PCAP_SUPPORT_BT/D' $(PKG_BUILD_DIR)/config.h)
77         $(if $(CONFIG_PCAP_HAS_BT),,$(SED) 's/pcap-bt-linux.c *//' $(PKG_BUILD_DIR)/Makefile)
78 endef
79
80 define Build/InstallDev
81         $(INSTALL_DIR) $(1)/usr/include
82         $(CP) $(PKG_INSTALL_DIR)/usr/include/pcap* $(1)/usr/include/
83
84         $(INSTALL_DIR) $(1)/usr/lib
85         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpcap.{a,so*} $(1)/usr/lib/
86 endef
87
88 define Package/libpcap/install
89         $(INSTALL_DIR) $(1)/usr/lib
90         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpcap.so* $(1)/usr/lib/
91 endef
92
93 $(eval $(call BuildPackage,libpcap))