eef5ff06403ada72c3f7ad9140c4b93578bbdc47
[openwrt/svn-archive/archive.git] / package / libpcap / Makefile
1 #
2 # Copyright (C) 2006 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.0.0
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:=9ad1358c5dec48456405eac197a46d3d
17
18 include $(INCLUDE_DIR)/package.mk
19
20 define Package/libpcap
21 SECTION:=libs
22 CATEGORY:=Libraries
23 TITLE:=Low-level packet capture library
24 URL:=http://www.tcpdump.org/
25 endef
26
27 define Package/libpcap/description
28 This package contains a system-independent library for user-level network
29 packet capture.
30 endef
31
32 define Package/libpcap/config
33 config PCAP_HAS_USB
34 bool "Include USB support"
35 depends PACKAGE_libpcap
36 depends PACKAGE_kmod-usb-core
37 default n
38
39 config PCAP_HAS_BT
40 bool "Include bluetooth support"
41 depends PACKAGE_libpcap
42 depends PACKAGE_kmod-bluetooth
43 depends BROKEN
44 default n
45
46 endef
47
48 TARGET_CFLAGS += \
49 -ffunction-sections -fdata-sections
50
51 CONFIGURE_ARGS += \
52 --enable-shared \
53 --enable-static \
54 --disable-yydebug \
55 --enable-ipv6 \
56 --with-build-cc="$(HOSTCC)" \
57 --with-pcap=linux \
58 --without-septel \
59 --without-dag
60
61 define Build/Compile
62 rm -rf $(PKG_INSTALL_DIR)
63 $(if $(CONFIG_PCAP_HAS_USB),,$(SED) '/^#define PCAP_SUPPORT_USB/D' $(PKG_BUILD_DIR)/config.h)
64 $(if $(CONFIG_PCAP_HAS_USB),,$(SED) 's/pcap-usb-linux.c *//' $(PKG_BUILD_DIR)/Makefile)
65 $(if $(CONFIG_PCAP_HAS_BT),,$(SED) '/^#define PCAP_SUPPORT_BT/D' $(PKG_BUILD_DIR)/config.h)
66 $(if $(CONFIG_PCAP_HAS_BT),,$(SED) 's/pcap-bt-linux.c *//' $(PKG_BUILD_DIR)/Makefile)
67 $(MAKE) -C $(PKG_BUILD_DIR) \
68 CCOPT="$(TARGET_CFLAGS) -I$(BUILD_DIR)/linux/include" \
69 DESTDIR="$(PKG_INSTALL_DIR)" \
70 all install
71 endef
72
73 define Build/InstallDev
74 mkdir -p $(1)/usr/include $(1)/usr/lib
75 $(CP) \
76 $(PKG_INSTALL_DIR)/usr/include/pcap* \
77 $(1)/usr/include/
78 $(CP) \
79 $(PKG_INSTALL_DIR)/usr/lib/libpcap.{a,so*} \
80 $(1)/usr/lib/
81 endef
82
83 define Package/libpcap/install
84 $(INSTALL_DIR) $(1)/usr/lib
85 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpcap.so.* $(1)/usr/lib/
86 endef
87
88 $(eval $(call BuildPackage,libpcap))