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