Make libpcap shared
[openwrt.git] / openwrt / package / libpcap / Makefile
1 # $Id$
2
3 include $(TOPDIR)/rules.mk
4
5 PKG_NAME := libpcap
6 PKG_VERSION := 0.8.3
7 PKG_RELEASE := 1
8 PKG_MD5SUM := 56a9d4615d8354fcfe8cff8c8443c77b
9
10 PKG_SOURCE_SITE := http://www.tcpdump.org/release
11 PKG_SOURCE_FILE := $(PKG_NAME)-$(PKG_VERSION).tar.gz
12 PKG_SOURCE_CAT := zcat
13 PKG_SOURCE_DIR := $(PKG_NAME)-$(PKG_VERSION)
14 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_SOURCE_DIR)
15 PKG_IPK := $(PACKAGE_DIR)/$(PKG_NAME)_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
16 PKG_IPK_DIR:=$(PKG_BUILD_DIR)/ipkg
17
18 $(DL_DIR)/$(PKG_SOURCE_FILE):
19 mkdir -p $(DL_DIR)
20 $(SCRIPT_DIR)/download.pl $(DL_DIR) $(PKG_SOURCE_FILE) $(PKG_MD5SUM) $(PKG_SOURCE_SITE)
21
22 $(PKG_BUILD_DIR)/.patched: $(DL_DIR)/$(PKG_SOURCE_FILE)
23 mkdir -p $(TOOL_BUILD_DIR)
24 $(PKG_SOURCE_CAT) $(DL_DIR)/$(PKG_SOURCE_FILE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
25 $(PATCH) $(PKG_BUILD_DIR) ./patches
26 touch $(PKG_BUILD_DIR)/.patched
27
28 $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.patched
29 (cd $(PKG_BUILD_DIR); rm -rf config.cache; \
30 ac_cv_linux_vers=$(BR2_DEFAULT_KERNEL_HEADERS) \
31 BUILD_CC=$(TARGET_CC) HOSTCC=$(HOSTCC) \
32 $(TARGET_CONFIGURE_OPTS) \
33 CFLAGS="$(TARGET_CFLAGS)" \
34 ./configure \
35 --target=$(GNU_TARGET_NAME) \
36 --host=$(GNU_TARGET_NAME) \
37 --build=$(GNU_HOST_NAME) \
38 --program-prefix="" \
39 --program-suffix="" \
40 --prefix=/usr \
41 --exec-prefix=/usr \
42 --bindir=/usr/bin \
43 --datadir=/usr/share \
44 --includedir=/usr/include \
45 --infodir=/usr/share/info \
46 --libdir=/usr/lib \
47 --libexecdir=/usr/lib \
48 --localstatedir=/var \
49 --mandir=/usr/share/man \
50 --sbindir=/usr/sbin \
51 --sysconfdir=/etc \
52 --enable-shared \
53 --enable-static \
54 --disable-yydebug \
55 --with-build-cc=$(HOSTCC) \
56 --with-pcap=linux \
57 );
58 touch $(PKG_BUILD_DIR)/.configured
59
60 $(PKG_BUILD_DIR)/libpcap.a: $(PKG_BUILD_DIR)/.configured
61 $(MAKE) -C $(PKG_BUILD_DIR) \
62 $(TARGET_CONFIGURE_OPTS) \
63 CCOPT="$(TARGET_CFLAGS)" \
64
65 $(STAGING_DIR)/usr/lib/libpcap.a: $(PKG_BUILD_DIR)/libpcap.a
66 $(MAKE) -C $(PKG_BUILD_DIR) \
67 DESTDIR="$(STAGING_DIR)" \
68 install
69
70 $(PKG_IPK): $(STAGING_DIR)/usr/lib/libpcap.a
71 $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_IPK_DIR) ./ipkg/$(PKG_NAME).control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
72 mkdir -p $(PKG_IPK_DIR)/usr/lib
73 cp -fpR $(STAGING_DIR)/usr/lib/libpcap.so.* $(PKG_IPK_DIR)/usr/lib/
74 $(STRIP) $(PKG_IPK_DIR)/usr/lib/*
75 mkdir -p $(PACKAGE_DIR)
76 $(IPKG_BUILD) $(PKG_IPK_DIR) $(PACKAGE_DIR)
77
78 $(IPKG_STATE_DIR)/info/$(PKG_NAME).list: $(PKG_IPK)
79 $(IPKG) install $(PKG_IPK)
80
81 source: $(DL_DIR)/$(PKG_SOURCE_FILE)
82 prepare: $(PKG_BUILD_DIR)/.patched
83 compile: $(STAGING_DIR)/lib/libpcap.a
84 install: $(IPKG_STATE_DIR)/info/$(PKG_NAME).list
85
86 clean:
87 -$(MAKE) -C $(PKG_BUILD_DIR) \
88 DESTDIR="$(STAGING_DIR)" \
89 uninstall clean
90 rm -rf $(PKG_BUILD_DIR)
91 rm -f $(PKG_IPK)
This page took 0.049157 seconds and 5 git commands to generate.