2e5fc0783173084681169a5c7325119bd459e6cc
[openwrt/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.10.1
12 PKG_RELEASE:=$(AUTORELEASE)
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=http://www.tcpdump.org/release/
16 PKG_HASH:=ed285f4accaf05344f90975757b3dbfe772ba41d1c401c2648b7fa45b711bdd4
17
18 PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
19 PKG_LICENSE:=BSD-3-Clause
20 PKG_LICENSE_FILES:=LICENSE
21
22 PKG_ASLR_PIE_REGULAR:=1
23
24 include $(INCLUDE_DIR)/package.mk
25 include $(INCLUDE_DIR)/cmake.mk
26
27 define Package/libpcap
28 SECTION:=libs
29 CATEGORY:=Libraries
30 TITLE:=Low-level packet capture library
31 URL:=http://www.tcpdump.org/
32 MENU:=1
33 ABI_VERSION:=1
34 endef
35
36 define Package/libpcap/description
37 This package contains a system-independent library for user-level network packet
38 capture.
39 endef
40
41 define Package/libpcap/config
42 source "$(SOURCE)/Config.in"
43 endef
44
45 define Package/rpcapd
46 SECTION:=net
47 CATEGORY:=Network
48 TITLE:=Capture daemon to be controlled by a remote libpcap application
49 URL:=http://www.tcpdump.org/
50 DEPENDS+= +libpcap
51 endef
52
53 ifdef CONFIG_PACKAGE_rpcapd
54 CMAKE_OPTIONS += \
55 -DENABLE_REMOTE=ON
56 endif
57
58 CMAKE_OPTIONS += \
59 -DBUILD_SHARED_LIBS=ON \
60 -DBUILD_WITH_LIBNL=OFF \
61 -DINET6=O$(if $(CONFIG_IPV6),N,FF) \
62 -DPCAP_SUPPORT_NETFILTER=O$(if $(CONFIG_PCAP_HAS_NETFILTER),N,FF)
63
64 # grep 'option(DISABLE_' CMakeLists.txt | cut -f2 -d'(' | cut -f1 -d' ' | sort --unique
65 CMAKE_OPTIONS += \
66 -DDISABLE_BLUETOOTH=O$(if $(CONFIG_PCAP_HAS_BT),FF,N) \
67 -DDISABLE_DAG=ON \
68 -DDISABLE_DBUS=ON \
69 -DDISABLE_DPDK=ON \
70 -DDISABLE_LINUX_USBMON=O$(if $(CONFIG_PCAP_HAS_USB),FF,N) \
71 -DDISABLE_NETMAP=ON \
72 -DDISABLE_RDMA=ON \
73 -DDISABLE_SEPTEL=ON \
74 -DDISABLE_SNF=ON \
75 -DDISABLE_TC=ON \
76
77 # Debugging options
78 CMAKE_OPTIONS += \
79 -DBDEBUG=OFF \
80 -DYYDEBUG=OFF \
81
82 define Build/InstallDev
83 $(call Build/InstallDev/cmake,$(1))
84 $(SED) \
85 's,^\(prefix\|exec_prefix\)=.*,\1=$(STAGING_DIR)/usr,g' \
86 $(1)/usr/bin/pcap-config
87 $(INSTALL_DIR) $(2)/bin
88 $(LN) ../../usr/bin/pcap-config $(2)/bin/pcap-config
89 endef
90
91 define Package/libpcap/install
92 $(INSTALL_DIR) $(1)/usr/lib
93 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpcap.so.* $(1)/usr/lib/
94 endef
95
96 define Package/rpcapd/install
97 $(INSTALL_DIR) $(1)/usr/sbin
98 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/rpcapd $(1)/usr/sbin/
99 endef
100
101 $(eval $(call BuildPackage,libpcap))
102 $(eval $(call BuildPackage,rpcapd))