5e21812b475258e9d8ed1324e97cbcb6f278a519
[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.1.2.1
13 PKG_RELEASE:=1
14
15 PKG_BUILD_DIR:=$(BUILD_DIR)/libnet
16 PKG_SOURCE:=$(PKG_NAME).tar.gz
17 PKG_SOURCE_URL:=http://www.packetfactory.net/libnet/dist/
18 PKG_MD5SUM:=be845c41170d72c7db524f3411b50256
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 ifeq ($(ARCH),armeb)
39 ENDIANESS:=big
40 endif
41 ifeq ($(ARCH),powerpc)
42 ENDIANESS:=big
43 endif
44
45 define Build/Configure
46 (cd $(PKG_BUILD_DIR); rm -rf config.cache; \
47 touch configure.in; \
48 touch include.m4; \
49 touch aclocal.m4; \
50 touch Makefile.in; \
51 touch configure; \
52 $(TARGET_CONFIGURE_OPTS) \
53 CFLAGS="$(TARGET_CFLAGS)" \
54 CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
55 LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \
56 ac_libnet_have_pf_packet=yes \
57 ac_cv_lbl_unaligned_fail=no \
58 ac_cv_libnet_endianess=$(ENDIANESS) \
59 ac_libnet_have_packet_socket=yes \
60 ./configure \
61 --target=$(GNU_TARGET_NAME) \
62 --host=$(GNU_TARGET_NAME) \
63 --build=$(GNU_HOST_NAME) \
64 --program-prefix="" \
65 --program-suffix="" \
66 --prefix=/usr \
67 --exec-prefix=/usr \
68 --bindir=/usr/bin \
69 --datadir=/usr/share \
70 --includedir=/usr/include \
71 --infodir=/usr/share/info \
72 --libdir=/usr/lib \
73 --libexecdir=/usr/lib \
74 --localstatedir=/var \
75 --mandir=/usr/share/man \
76 --sbindir=/usr/sbin \
77 --sysconfdir=/etc \
78 $(DISABLE_NLS) \
79 $(DISABLE_LARGEFILE) \
80 --enable-shared \
81 --enable-static \
82 --with-pf_packet=yes \
83 );
84 endef
85
86 define Build/Compile
87 rm -rf $(PKG_INSTALL_DIR)
88 mkdir -p $(PKG_INSTALL_DIR)
89 $(MAKE) -C $(PKG_BUILD_DIR) \
90 $(TARGET_CONFIGURE_OPTS) \
91 CFLAGS="$(TARGET_CFLAGS)" \
92 DESTDIR="$(PKG_INSTALL_DIR)" \
93 all install
94 endef
95
96 define Package/libnet/install
97 install -m0755 -d $(1)/usr/lib
98 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnet.so.* $(1)/usr/lib/
99 endef
100
101 define Build/InstallDev
102 mkdir -p $(STAGING_DIR)/usr/bin
103 $(CP) $(PKG_INSTALL_DIR)/usr/bin/libnet-config $(STAGING_DIR)/usr/bin/
104 mkdir -p $(STAGING_DIR)/usr/include
105 $(CP) $(PKG_INSTALL_DIR)/usr/include/libnet* $(STAGING_DIR)/usr/include/
106 mkdir -p $(STAGING_DIR)/usr/lib
107 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnet.{a,so*} $(STAGING_DIR)/usr/lib/
108 endef
109
110 define Build/UninstallDev
111 rm -rf \
112 $(STAGING_DIR)/usr/bin/libnet-config \
113 $(STAGING_DIR)/usr/include/libnet* \
114 $(STAGING_DIR)/usr/lib/libnet.{a,so*}
115 endef
116
117 $(eval $(call BuildPackage,libnet))