port libnet to buildroot-ng
[openwrt/svn-archive/archive.git] / libs / libnet / 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 # $Id$
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=libnet
12 PKG_VERSION:=1.0.2a
13 PKG_RELEASE:=7
14
15 PKG_BUILD_DIR:=$(BUILD_DIR)/Libnet-$(PKG_VERSION)
16 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
17 PKG_SOURCE_URL:=http://www.packetfactory.net/libnet/dist/deprecated/
18 PKG_MD5SUM:=ddf53f0f484184390e8c2a1bd0853667
19 PKG_CAT:=zcat
20
21 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
22
23 include $(INCLUDE_DIR)/package.mk
24
25 define Package/libnet
26 SECTION:=libs
27 CATEGORY:=Libraries
28 DEPENDS:=libpcap
29 TITLE:=Low-level packet creation library
30 DESCRIPTION:=Low-level packet creation library
31 URL:=http://www.packetfactory.net/libnet/
32 endef
33
34 ENDIANESS:=lil
35 ifeq ($(ARCH),mips)
36 ENDIANESS:=big
37 endif
38
39 define Build/Configure
40 (cd $(PKG_BUILD_DIR); rm -rf config.cache; \
41 touch configure.in; \
42 touch include.m4; \
43 touch aclocal.m4; \
44 touch Makefile.in; \
45 touch configure; \
46 $(TARGET_CONFIGURE_OPTS) \
47 CFLAGS="$(TARGET_CFLAGS)" \
48 CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
49 LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \
50 ac_libnet_have_pf_packet=yes \
51 ac_cv_lbl_unaligned_fail=no \
52 ac_cv_libnet_endianess=$(ENDIANESS) \
53 ./configure \
54 --target=$(GNU_TARGET_NAME) \
55 --host=$(GNU_TARGET_NAME) \
56 --build=$(GNU_HOST_NAME) \
57 --program-prefix="" \
58 --program-suffix="" \
59 --prefix=/usr \
60 --exec-prefix=/usr \
61 --bindir=/usr/bin \
62 --datadir=/usr/share \
63 --includedir=/usr/include \
64 --infodir=/usr/share/info \
65 --libdir=/usr/lib \
66 --libexecdir=/usr/lib \
67 --localstatedir=/var \
68 --mandir=/usr/share/man \
69 --sbindir=/usr/sbin \
70 --sysconfdir=/etc \
71 $(DISABLE_NLS) \
72 $(DISABLE_LARGEFILE) \
73 --enable-shared \
74 --enable-static \
75 --with-pf_packet=yes \
76 );
77 endef
78
79 define Build/Compile
80 rm -rf $(PKG_INSTALL_DIR)
81 mkdir -p $(PKG_INSTALL_DIR)
82 $(MAKE) -C $(PKG_BUILD_DIR) \
83 $(TARGET_CONFIGURE_OPTS) \
84 CFLAGS="$(TARGET_CFLAGS)" \
85 DESTDIR="$(PKG_INSTALL_DIR)" \
86 all install
87 endef
88
89 define Package/libnet/install
90 install -m0755 -d $(1)/usr/lib
91 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnet.so.* $(1)/usr/lib/
92 endef
93
94 define Build/InstallDev
95 mkdir -p $(STAGING_DIR)/usr/bin
96 $(CP) $(PKG_INSTALL_DIR)/usr/bin/libnet-config $(STAGING_DIR)/usr/bin/
97 mkdir -p $(STAGING_DIR)/usr/include
98 $(CP) $(PKG_INSTALL_DIR)/usr/include/libnet* $(STAGING_DIR)/usr/include/
99 mkdir -p $(STAGING_DIR)/usr/lib
100 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnet.{a,so*} $(STAGING_DIR)/usr/lib/
101 endef
102
103 define Build/UninstallDev
104 rm -rf \
105 $(STAGING_DIR)/usr/bin/libnet-config \
106 $(STAGING_DIR)/usr/include/libnet* \
107 $(STAGING_DIR)/usr/lib/libnet.{a,so*}
108 endef
109
110 $(eval $(call BuildPackage,libnet))