Use common rules and templates, uniformize package Makefile, move ipkg related files...
[openwrt.git] / openwrt / package / openswan / Makefile
1 # $Id$
2
3 include $(TOPDIR)/rules.mk
4
5 PKG_NAME:=openswan
6 PKG_VERSION:=2.3.1
7 PKG_RELEASE:=1
8 PKG_MD5SUM:=3dcf1cd7efcbe8db3148fc288d429db1
9
10 PKG_SOURCE_URL:=http://www.openswan.org/download
11 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
12 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
13 PKG_CAT:=zcat
14 PKG_IPK:=$(PACKAGE_DIR)/$(PKG_NAME)_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
15 PKG_IPK_DIR:=$(PKG_BUILD_DIR)/ipkg
16
17 $(DL_DIR)/$(PKG_SOURCE):
18 $(SCRIPT_DIR)/download.pl $(DL_DIR) $(PKG_SOURCE) $(PKG_MD5SUM) $(PKG_SOURCE_URL)
19
20 $(PKG_BUILD_DIR)/.patched: $(DL_DIR)/$(PKG_SOURCE)
21 $(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
22 $(PATCH) $(PKG_BUILD_DIR) ./patches
23 touch $(PKG_BUILD_DIR)/.patched
24
25 FLAGS := $(TARGET_CFLAGS) -I$(PKG_BUILD_DIR)/linux/include -L$(STAGING_DIR)/usr/lib -I$(STAGING_DIR)/usr/include
26
27 $(PKG_BUILD_DIR)/$(PKG_NAME): $(PKG_BUILD_DIR)/.patched
28 $(MAKE) -C $(PKG_BUILD_DIR) \
29 $(TARGET_CONFIGURE_OPTS) \
30 KERNELSRC="$(LINUX_DIR)" \
31 ARCH="mips" \
32 USERCOMPILE="$(FLAGS)" \
33 module
34 $(MAKE) -C $(PKG_BUILD_DIR) \
35 $(TARGET_CONFIGURE_OPTS) \
36 KERNELSRC="$(LINUX_DIR)" \
37 ARCH="mips" \
38 USERCOMPILE="$(FLAGS)" \
39 EXTRA_INCLUDE="-I$(STAGING_DIR)/usr/include" \
40 EXTRA_LIBS="-L$(STAGING_DIR)/usr/lib" \
41 IPSECDIR="/usr/lib/ipsec" \
42 INC_USRLOCAL="/usr" \
43 programs
44
45 $(PKG_IPK): $(PKG_BUILD_DIR)/$(PKG_NAME)
46 $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_IPK_DIR) $(PKG_NAME).control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
47 $(MAKE) -C $(PKG_BUILD_DIR) \
48 $(TARGET_CONFIGURE_OPTS) \
49 DESTDIR="$(PKG_IPK_DIR)" \
50 KERNELSRC="$(LINUX_DIR)" \
51 ARCH="mips" \
52 USERCOMPILE="$(FLAGS)" \
53 IPSECDIR="/usr/lib/ipsec" \
54 INC_USRLOCAL="/usr" \
55 install
56 -$(STRIP) $(PKG_IPK_DIR)/usr/lib/ipsec/*
57 -$(STRIP) $(PKG_IPK_DIR)/usr/libexec/ipsec/*
58 rm -rf $(PKG_IPK_DIR)/usr/share
59 rm -rf $(PKG_IPK_DIR)/usr/man
60 rm -rf $(PKG_IPK_DIR)/var
61 rm -rf $(PKG_IPK_DIR)/etc/rc.d/rc*.d
62 mkdir -p $(PKG_IPK_DIR)/etc/init.d
63 ln -sf ../rc.d/init.d/ipsec $(PKG_IPK_DIR)/etc/init.d/S60ipsec
64 mkdir -p $(PKG_IPK_DIR)/lib/modules/$(LINUX_VERSION)
65 cp $(PKG_BUILD_DIR)/modobj/ipsec.o $(PKG_IPK_DIR)/lib/modules/$(LINUX_VERSION)/
66 # $(TARGET_CROSS)strip --remove-section=.comment --remove-section=.note \
67 # $(PKG_IPK_DIR)/lib/modules/$(LINUX_VERSION)/ipsec.o
68 mkdir -p $(PACKAGE_DIR)
69 find $(PKG_BUILD_DIR) -name \*.old | xargs rm -rf
70 $(IPKG_BUILD) $(PKG_IPK_DIR) $(PACKAGE_DIR)
71
72 $(IPKG_STATE_DIR)/info/$(PKG_NAME).list: $(PKG_IPK)
73 $(IPKG) install $(PKG_IPK)
74
75 source: $(DL_DIR)/$(PKG_SOURCE)
76 prepare: $(PKG_BUILD_DIR)/.patched
77 compile: $(PKG_IPK)
78 install: $(IPKG_STATE_DIR)/info/$(PKG_NAME).list
79
80 clean:
81 rm -rf $(PKG_BUILD_DIR)
82 rm -f $(PKG_IPK)
This page took 0.042074 seconds and 5 git commands to generate.