libpcap: build with cmake
[oweals/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.9.1
12 PKG_RELEASE:=2
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=http://www.us.tcpdump.org/release/ \
16         http://www.tcpdump.org/release/
17 PKG_HASH:=635237637c5b619bcceba91900666b64d56ecb7be63f298f601ec786ce087094
18
19 PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
20
21 CMAKE_INSTALL:=1
22 PKG_BUILD_PARALLEL:=1
23
24 PKG_LICENSE:=BSD-3-Clause
25 PKG_LICENSE_FILES:=LICENSE
26
27 include $(INCLUDE_DIR)/package.mk
28 include $(INCLUDE_DIR)/cmake.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   ABI_VERSION:=1
37 endef
38
39 define Package/libpcap/description
40 This package contains a system-independent library for user-level network packet
41 capture.
42 endef
43
44 define Package/libpcap/config
45         source "$(SOURCE)/Config.in"
46 endef
47
48 CMAKE_OPTIONS += \
49         -DBUILD_SHARED_LIBS=ON \
50         -DBUILD_WITH_LIBNL=OFF \
51
52 # grep 'option(DISABLE_' CMakeLists.txt | cut -f2 -d'(' | cut -f1 -d' ' | sort --unique
53 CMAKE_OPTIONS += \
54         -DDISABLE_DAG=ON \
55         -DDISABLE_DBUS=ON \
56         -DDISABLE_NETMAP=ON \
57         -DDISABLE_RDMA=ON \
58         -DDISABLE_SEPTEL=ON \
59         -DDISABLE_SNF=ON \
60         -DDISABLE_TC=ON \
61
62 # Debugging options
63 CMAKE_OPTIONS += \
64         -DBDEBUG=OFF \
65         -DYYDEBUG=OFF \
66
67 CMAKE_OPTIONS += $(if $(CONFIG_PCAP_HAS_USB)       ,,-DDISABLE_USB=ON)
68 CMAKE_OPTIONS += $(if $(CONFIG_PCAP_HAS_BT)        ,,-DDISABLE_BLUETOOTH=ON)
69 CMAKE_OPTIONS += $(if $(CONFIG_PCAP_HAS_NETFILTER) ,,-DPCAP_SUPPORT_NETFILTER=OFF)
70
71 CMAKE_OPTIONS += $(if $(CONFIG_IPV6),-DINET6=ON,-DINET6=OFF)
72
73 define Package/libpcap/install
74         $(INSTALL_DIR) $(1)/usr/lib
75         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpcap.so.* $(1)/usr/lib/
76 endef
77
78 $(eval $(call BuildPackage,libpcap))