1ea3b4b4f176fc26790041b75c995621c268ab40
[openwrt/openwrt.git] / openwrt / package / openswan / 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 include $(INCLUDE_DIR)/kernel.mk
11
12 PKG_NAME:=openswan
13 PKG_VERSION:=2.4.6
14 PKG_RELEASE:=1
15
16 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
17 PKG_SOURCE_URL:=http://www.openswan.org/download
18 PKG_MD5SUM:=b34d71ca49dedad017879b0e912d40dd
19 PKG_CAT:=zcat
20
21 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
22
23 PKG_INIT_PRIO:=60
24
25 include $(INCLUDE_DIR)/package.mk
26
27 define Package/openswan/Default
28 TITLE:=Openswan
29 DESCRIPTION:=\
30 Openswan is an IPsec implementation for Linux.
31 URL:=http://www.openswan.org/
32 endef
33
34 define Package/openswan
35 $(call Package/openswan/Default)
36 SECTION:=net
37 CATEGORY:=Network
38 DEPENDS:=+kmod-openswan +libgmp
39 TITLE+= (daemon)
40 DESCRIPTION+=\\\
41 \\\
42 This package contains the Openswan user-land daemon.
43 URL:=http://www.openswan.org/
44 endef
45
46 define Package/kmod-openswan
47 $(call Package/openswan/Default)
48 SECTION:=kernel
49 CATEGORY:=Kernel drivers
50 TITLE+= (kernel module)
51 DESCRIPTION+=\\\
52 \\\
53 This package contains the Openswan kernel module.
54 VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE)
55 endef
56
57 PKG_MAKE_OPTS:= \
58 LINUX_RELEASE="$(LINUX_RELEASE)" \
59 KERNELSRC="$(LINUX_DIR)" \
60 ARCH="$(LINUX_KARCH)" \
61 CROSS_COMPILE="$(TARGET_CROSS)" \
62 USERCOMPILE="$(TARGET_CFLAGS) -I./linux/include -I$(STAGING_DIR)/usr/include -L$(STAGING_DIR)/usr/lib" \
63 IPSECDIR="/usr/lib/ipsec" \
64 INC_USRLOCAL="/usr" \
65
66 define Build/Compile
67 $(MAKE) -C $(PKG_BUILD_DIR) \
68 $(TARGET_CONFIGURE_OPTS) \
69 $(PKG_MAKE_OPTS) \
70 module
71 $(MAKE) -C $(PKG_BUILD_DIR) \
72 $(TARGET_CONFIGURE_OPTS) \
73 $(PKG_MAKE_OPTS) \
74 LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \
75 programs
76 endef
77
78 define Package/openswan/install
79 $(MAKE) -C $(PKG_BUILD_DIR) \
80 $(TARGET_CONFIGURE_OPTS) \
81 $(PKG_MAKE_OPTS) \
82 DESTDIR="$(1)" \
83 install
84 install -d -m0755 $(1)/etc/init.d
85 $(CP) $(1)/etc/rc.d/init.d/ipsec $(1)/etc/init.d/S$(PKG_INIT_PRIO)ipsec
86 rm -rf $(1)/usr/share
87 rm -rf $(1)/usr/man
88 rm -rf $(1)/var
89 rm -rf $(1)/etc/rc.d
90 find $(1) -name \*.old | xargs rm -rf
91 endef
92
93 define Package/kmod-openswan/install
94 mkdir -p $(1)/lib/modules/$(LINUX_VERSION)
95 $(CP) $(PKG_BUILD_DIR)/modobj*/ipsec.$(LINUX_KMOD_SUFFIX) \
96 $(1)/lib/modules/$(LINUX_VERSION)/
97 endef
98
99 $(eval $(call BuildPackage,openswan))
100 $(eval $(call BuildPackage,kmod-openswan))