summaryrefslogtreecommitdiffstats
path: root/obsolete-buildroot/make/libpcap.mk
blob: c63d08f97e43cff16b3d77638fc4e58a5853af56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
## libpcap

LIBPCAP_VERSION:=0.8.3
LIBPCAP_RELEASE:=1

LIBPCAP_SOURCE:=libpcap-$(LIBPCAP_VERSION).tar.gz
LIBPCAP_SITE:=http://www.tcpdump.org/release/
LIBPCAP_DIR:=$(BUILD_DIR)/libpcap-$(LIBPCAP_VERSION)
LIBPCAP_CAT:=zcat

LIBPCAP_PATCH_DIR := $(SOURCE_DIR)/openwrt/patches/libpcap

LIBPCAP_BUILD_DIR := $(BUILD_DIR)/libpcap_$(LIBPCAP_VERSION)-$(LIBPCAP_RELEASE)
LIBPCAP_IPK_DIR := $(OPENWRT_IPK_DIR)/libpcap
LIBPCAP_IPK := $(LIBPCAP_BUILD_DIR)_$(ARCH).ipk


$(DL_DIR)/$(LIBPCAP_SOURCE):
	 $(WGET) -P $(DL_DIR) $(LIBPCAP_SITE)/$(LIBPCAP_SOURCE)


$(LIBPCAP_DIR)/.stamp-unpacked: $(DL_DIR)/$(LIBPCAP_SOURCE)
	$(LIBPCAP_CAT) $(DL_DIR)/$(LIBPCAP_SOURCE) | tar -C $(BUILD_DIR) -xvf -

	touch $(LIBPCAP_DIR)/.stamp-unpacked


$(LIBPCAP_DIR)/.stamp-patched: $(LIBPCAP_DIR)/.stamp-unpacked
	$(SOURCE_DIR)/patch-kernel.sh $(LIBPCAP_DIR) $(LIBPCAP_PATCH_DIR)
	$(SOURCE_DIR)/patch-kernel.sh $(LIBPCAP_DIR) $(LIBPCAP_DIR)/debian/patches *patch

	touch $(LIBPCAP_DIR)/.stamp-patched


$(LIBPCAP_DIR)/.stamp-configured: $(LIBPCAP_DIR)/.stamp-patched
	cd $(LIBPCAP_DIR) ; \
	rm -rf config.cache ; \
	$(TARGET_CONFIGURE_OPTS) \
	CFLAGS="$(TARGET_CFLAGS)" \
	ac_cv_linux_vers="2" \
	./configure \
	  --target=$(GNU_TARGET_NAME) \
	  --host=$(GNU_TARGET_NAME) \
	  --build=$(GNU_HOST_NAME) \
	  --prefix=/usr \
	  --exec-prefix=/usr \
	  --bindir=/usr/bin \
	  --sbindir=/usr/sbin \
	  --libexecdir=/usr/lib/locate \
	  --sysconfdir=/etc \
	  --datadir=/usr/share \
	  --localstatedir=/var/lib \
	  --mandir=/usr/share/man \
	  --infodir=/usr/share/info \
	  --includedir=/usr/include \
	  --libdir=/usr/lib \
	  $(DISABLE_NLS) \
	  --enable-shared \
	  --disable-static \
	  --with-pcap=linux \

	touch $(LIBPCAP_DIR)/.stamp-configured


$(LIBPCAP_DIR)/.stamp-built: $(LIBPCAP_DIR)/.stamp-configured
	cd $(LIBPCAP_DIR) ; \
	$(MAKE) \
	  CC=$(TARGET_CC) \
	  CCOPT="$(TARGET_OPTIMIZATION)" \

	touch $(LIBPCAP_DIR)/.stamp-built


$(LIBPCAP_DIR)/.stamp-installed: $(LIBPCAP_DIR)/.stamp-built
	mkdir -p $(LIBPCAP_BUILD_DIR)
	cd $(LIBPCAP_DIR) ; \
	$(MAKE) \
	  DESTDIR="$(LIBPCAP_BUILD_DIR)" \
	 install \
	 
	install -m0644 $(LIBPCAP_BUILD_DIR)/usr/include/pcap*.h $(STAGING_DIR)/include/
	install -m0644 $(LIBPCAP_BUILD_DIR)/usr/lib/libpcap.a $(STAGING_DIR)/lib/
	install -m0755 $(LIBPCAP_BUILD_DIR)/usr/lib/libpcap.so* $(STAGING_DIR)/lib/

	rm -rf $(LIBPCAP_BUILD_DIR)/usr/share
	rm -rf $(LIBPCAP_BUILD_DIR)/usr/include
	rm -rf $(LIBPCAP_BUILD_DIR)/usr/lib/*.a
	rm -rf $(LIBPCAP_BUILD_DIR)/usr/lib/*.so

	$(STRIP) $(LIBPCAP_BUILD_DIR)/usr/lib/libpcap.so.*
	
	touch $(LIBPCAP_DIR)/.stamp-installed


$(LIBPCAP_IPK): $(LIBPCAP_DIR)/.stamp-installed
	cp -a $(LIBPCAP_IPK_DIR)/CONTROL $(LIBPCAP_BUILD_DIR)/
	perl -pi -e "s/^Vers.*:.*$$/Version: $(LIBPCAP_VERSION)-$(LIBPCAP_RELEASE)/" $(LIBPCAP_BUILD_DIR)/CONTROL/control
	perl -pi -e "s/^Arch.*:.*$$/Architecture: $(ARCH)/" $(LIBPCAP_BUILD_DIR)/CONTROL/control
	cd $(BUILD_DIR); $(IPKG_BUILD) $(LIBPCAP_BUILD_DIR)


libpcap-source: $(DL_DIR)/$(LIBPCAP_SOURCE)

libpcap-ipk: ipkg-utils $(LIBPCAP_IPK)

libpcap-clean:
	$(MAKE) -C $(LIBPCAP_DIR) clean

libpcap-clean-all:
	rm -rf $(LIBPCAP_DIR)
	rm -rf $(LIBPCAP_BUILD_DIR)
	rm -rf $(LIBPCAP_IPK)
	rm -rf $(STAGING_DIR)/include/pcap*.h
	rm -rf $(STAGING_DIR)/lib/libpcap.a
	rm -rf $(STAGING_DIR)/lib/libpcap.so*