9fea67f70f30cef7eb98b2dda7c583db716caec0
[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_LICENSE:=BSD-3-Clause
21 PKG_LICENSE_FILES:=LICENSE
22
23 PKG_INSTALL:=1
24 PKG_BUILD_PARALLEL:=1
25 PKG_LICENSE:=BSD-3-Clause
26
27 include $(INCLUDE_DIR)/package.mk
28 include $(INCLUDE_DIR)/kernel.mk
29
30 define Package/libpcap
31   SECTION:=libs
32   CATEGORY:=Libraries
33   TITLE:=Low-level packet capture library
34   URL:=http://www.tcpdump.org/
35   MENU:=1
36 endef
37
38 define Package/libpcap/description
39 This package contains a system-independent library for user-level network packet
40 capture.
41 endef
42
43 define Package/libpcap/config
44         source "$(SOURCE)/Config.in"
45 endef
46
47 TARGET_CFLAGS += \
48         -ffunction-sections \
49         -fdata-sections
50
51 CONFIGURE_VARS += \
52         ac_cv_linux_vers=$(LINUX_VERSION) \
53         ac_cv_header_libusb_1_0_libusb_h=no \
54         ac_cv_netfilter_can_compile=no
55
56
57 CONFIGURE_ARGS += \
58         --enable-shared \
59         --enable-static \
60         --disable-yydebug \
61         --with-build-cc="$(HOSTCC)" \
62         --with-pcap=linux \
63         --without-septel \
64         --without-dag \
65         --without-libnl \
66         --without-snf \
67         --disable-can \
68         --disable-canusb \
69         --disable-dbus \
70         --disable-bluetooth
71
72 ifeq ($(CONFIG_IPV6),y)
73 CONFIGURE_ARGS += \
74         --enable-ipv6
75 endif
76
77 MAKE_FLAGS += \
78         CCOPT="$(TARGET_CFLAGS) -I$(BUILD_DIR)/linux/include"
79
80 define Build/Configure
81         $(call Build/Configure/Default)
82         $(if $(CONFIG_PCAP_HAS_USB),,$(SED) '/^#define PCAP_SUPPORT_USB/D' $(PKG_BUILD_DIR)/config.h)
83         $(if $(CONFIG_PCAP_HAS_USB),,$(SED) 's/pcap-usb-linux.c *//' $(PKG_BUILD_DIR)/Makefile)
84         $(if $(CONFIG_PCAP_HAS_BT),,$(SED) '/^#define PCAP_SUPPORT_BT/D' $(PKG_BUILD_DIR)/config.h)
85         $(if $(CONFIG_PCAP_HAS_BT),,$(SED) 's/pcap-bt-linux.c *//' $(PKG_BUILD_DIR)/Makefile)
86 endef
87
88 define Build/InstallDev
89         $(INSTALL_DIR) $(1)/usr/include
90         $(CP) $(PKG_INSTALL_DIR)/usr/include/pcap* $(1)/usr/include/
91
92         $(INSTALL_DIR) $(1)/usr/lib
93         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpcap.{a,so*} $(1)/usr/lib/
94 endef
95
96 define Package/libpcap/install
97         $(INSTALL_DIR) $(1)/usr/lib
98         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpcap.so* $(1)/usr/lib/
99 endef
100
101 $(eval $(call BuildPackage,libpcap))