build: prefer HTTPS if available (for packages)
[openwrt/staging/nbd.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:=https://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 PKG_CONFIG_DEPENDS := CONFIG_PACKAGE_rpcapd
25
26 include $(INCLUDE_DIR)/package.mk
27 include $(INCLUDE_DIR)/cmake.mk
28
29 define Package/libpcap
30 SECTION:=libs
31 CATEGORY:=Libraries
32 TITLE:=Low-level packet capture library
33 URL:=http://www.tcpdump.org/
34 MENU:=1
35 ABI_VERSION:=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 define Package/rpcapd
48 SECTION:=net
49 CATEGORY:=Network
50 TITLE:=Capture daemon to be controlled by a remote libpcap application
51 URL:=http://www.tcpdump.org/
52 DEPENDS+= +libpcap
53 endef
54
55 ifdef CONFIG_PACKAGE_rpcapd
56 CMAKE_OPTIONS += \
57 -DENABLE_REMOTE=ON
58 endif
59
60 CMAKE_OPTIONS += \
61 -DBUILD_SHARED_LIBS=ON \
62 -DBUILD_WITH_LIBNL=OFF \
63 -DINET6=O$(if $(CONFIG_IPV6),N,FF) \
64 -DPCAP_SUPPORT_NETFILTER=O$(if $(CONFIG_PCAP_HAS_NETFILTER),N,FF)
65
66 # grep 'option(DISABLE_' CMakeLists.txt | cut -f2 -d'(' | cut -f1 -d' ' | sort --unique
67 CMAKE_OPTIONS += \
68 -DDISABLE_BLUETOOTH=O$(if $(CONFIG_PCAP_HAS_BT),FF,N) \
69 -DDISABLE_DAG=ON \
70 -DDISABLE_DBUS=ON \
71 -DDISABLE_DPDK=ON \
72 -DDISABLE_LINUX_USBMON=O$(if $(CONFIG_PCAP_HAS_USB),FF,N) \
73 -DDISABLE_NETMAP=ON \
74 -DDISABLE_RDMA=ON \
75 -DDISABLE_SEPTEL=ON \
76 -DDISABLE_SNF=ON \
77 -DDISABLE_TC=ON \
78
79 # Debugging options
80 CMAKE_OPTIONS += \
81 -DBDEBUG=OFF \
82 -DYYDEBUG=OFF \
83
84 define Build/InstallDev
85 $(call Build/InstallDev/cmake,$(1))
86 $(SED) \
87 's,^\(prefix\|exec_prefix\)=.*,\1=$(STAGING_DIR)/usr,g' \
88 $(1)/usr/bin/pcap-config
89 $(INSTALL_DIR) $(2)/bin
90 $(LN) ../../usr/bin/pcap-config $(2)/bin/pcap-config
91 endef
92
93 define Package/libpcap/install
94 $(INSTALL_DIR) $(1)/usr/lib
95 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpcap.so.* $(1)/usr/lib/
96 endef
97
98 define Package/rpcapd/install
99 $(INSTALL_DIR) $(1)/usr/sbin
100 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/rpcapd $(1)/usr/sbin/
101 endef
102
103 $(eval $(call BuildPackage,libpcap))
104 $(eval $(call BuildPackage,rpcapd))