[package] openswan: fix build for 64-bits targets
[openwrt/svn-archive/archive.git] / net / openswan / Makefile
1 #
2 # Copyright (C) 2006-2012 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 include $(INCLUDE_DIR)/kernel.mk
10
11 PKG_NAME:=openswan
12 PKG_VERSION:=2.6.38
13 PKG_RELEASE:=1
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:=http://www.openswan.org/download
17 PKG_MD5SUM:=13073eb5314b83a31be88e4117e8bbcd
18
19 PKG_BUILD_PARALLEL:=1
20 PKG_INSTALL:=1
21
22 include $(INCLUDE_DIR)/package.mk
23
24 define Package/openswan/Default
25 TITLE:=Openswan
26 URL:=http://www.openswan.org/
27 endef
28
29 define Package/openswan/Default/description
30 Openswan is an IPsec implementation for Linux.
31 endef
32
33 define Package/openswan
34 $(call Package/openswan/Default)
35 SUBMENU:=VPN
36 SECTION:=net
37 CATEGORY:=Network
38 TITLE+= (daemon)
39 DEPENDS+= +libgmp +ip
40 endef
41
42 define Package/openswan/description
43 $(call Package/openswan/Default/description)
44 This package contains the Openswan user-land daemon.
45 endef
46
47 define KernelPackage/openswan
48 $(call Package/openswan/Default)
49 SUBMENU:=Network Support
50 TITLE+= (kernel module)
51 DEPENDS+=+IPV6:kmod-ipv6
52 FILES:=$(PKG_BUILD_DIR)/modobj*/ipsec.$(LINUX_KMOD_SUFFIX)
53 endef
54
55 define KernelPackage/openswan/description
56 $(call Package/openswan/Default/description)
57 This package contains the Openswan kernel module.
58 endef
59
60 TARGET_CPPFLAGS += -I$(LINUX_DIR)/include -D__EXPORTED_HEADERS__
61
62 OPENSWAN_MAKEFLAGS:= \
63 -C $(PKG_BUILD_DIR) \
64 $(TARGET_CONFIGURE_OPTS) \
65 LINUX_RELEASE="$(LINUX_RELEASE)" \
66 KERNELSRC="$(LINUX_DIR)" \
67 ARCH="$(LINUX_KARCH)" \
68 CROSS_COMPILE="$(TARGET_CROSS)" \
69 USERCOMPILE="$(TARGET_CFLAGS) -I$(PKG_BUILD_DIR)/ports/linux/include -I$(PKG_BUILD_DIR)/linux/include -I$(PKG_BUILD_DIR)/include $(TARGET_CPPFLAGS) $(TARGET_LDFLAGS)" \
70 IPSECDIR="/usr/lib/ipsec" \
71 INC_USRLOCAL="/usr" \
72 INC_RCDEFAULT="/etc/init.d" \
73 MODPROBE="/sbin/insmod" \
74 DESTDIR="$(PKG_INSTALL_DIR)"
75
76 define Build/Compile
77 $(MAKE) $(PKG_JOBS) $(OPENSWAN_MAKEFLAGS) programs
78 $(MAKE) $(PKG_JOBS) $(OPENSWAN_MAKEFLAGS) module
79 endef
80
81 define Build/Install
82 $(MAKE) $(OPENSWAN_MAKEFLAGS) install
83 endef
84
85 define Package/openswan/conffiles
86 /etc/ipsec.conf
87 /etc/ipsec.secrets
88 /etc/config/ipsec
89 endef
90
91 define Package/openswan/install
92 $(CP) $(PKG_INSTALL_DIR)/* $(1)
93 $(INSTALL_DIR) $(1)/etc/init.d
94 $(CP) ./files/ipsec.init $(1)/etc/init.d/ipsec
95 $(CP) ./files/ipsec.conf $(1)/etc/ipsec.conf
96 $(CP) ./files/ipsec.secrets $(1)/etc/ipsec.secrets
97 $(INSTALL_DIR) $(1)/etc/config
98 $(INSTALL_CONF) ./files/ipsec.config $(1)/etc/config/ipsec
99 rm -rf $(1)/usr/share
100 rm -rf $(1)/usr/man
101 rm -rf $(1)/var
102 rm -rf $(1)/etc/rc.d
103 find $(1) -name \*.old | xargs rm -rf
104 $(INSTALL_DIR) $(1)/lib/upgrade/keep.d
105 $(INSTALL_DATA) files/ipsec.upgrade $(1)/lib/upgrade/keep.d/ipsec
106 endef
107
108 $(eval $(call BuildPackage,openswan))
109 $(eval $(call KernelPackage,openswan))