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