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