summaryrefslogtreecommitdiff
path: root/package/openswan/openswan.mk
blob: b25251b90635c5986210772ef66604e1826e039e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#############################################################
#
# openswan
#
# NOTE: Uses start-stop-daemon in init script, so be sure
# to enable that within busybox
#
#############################################################
OPENSWAN_VERSION:=2.4.7
OPENSWAN_SOURCE:=openswan-$(OPENSWAN_VERSION).tar.gz
OPENSWAN_SITE:=http://www.openswan.org/download/
OPENSWAN_DIR:=$(BUILD_DIR)/openswan-$(OPENSWAN_VERSION)
OPENSWAN_CAT:=$(ZCAT)
OPENSWAN_BINARY:=openswan
OPENSWAN_TARGET_BINARY:=usr/sbin/openswan

$(DL_DIR)/$(OPENSWAN_SOURCE):
	 $(WGET) -P $(DL_DIR) $(OPENSWAN_SITE)/$(OPENSWAN_SOURCE)

openswan-source: $(DL_DIR)/$(OPENSWAN_SOURCE)

$(OPENSWAN_DIR)/.unpacked: $(DL_DIR)/$(OPENSWAN_SOURCE)
	$(OPENSWAN_CAT) $(DL_DIR)/$(OPENSWAN_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
	toolchain/patch-kernel.sh $(OPENSWAN_DIR) package/openswan/ openswan\*.patch
	touch $(OPENSWAN_DIR)/.unpacked

$(OPENSWAN_DIR)/.configured: $(OPENSWAN_DIR)/.unpacked
	touch  $(OPENSWAN_DIR)/.configured

$(OPENSWAN_DIR)/$(OPENSWAN_BINARY): $(OPENSWAN_DIR)/.configured
	echo $(LINUX_KERNEL)
	$(TARGET_CONFIGURE_OPTS) \
	$(MAKE) -C $(OPENSWAN_DIR) \
		KERNELSRC=$(LINUX_DIR) DESTDIR=$(TARGET_DIR) \
		CC=$(TARGET_CC) USERCOMPILE="-UDEBUG -DNO_DEBUG -ULEAK_DETECTIVE $(TARGET_CFLAGS) -I$(TARGET_DIR)/usr/include" LD_LIBRARY_PATH=$(TARGET_DIR)/usr/lib programs

$(TARGET_DIR)/$(OPENSWAN_TARGET_BINARY): $(OPENSWAN_DIR)/$(OPENSWAN_BINARY)
	$(TARGET_CONFIGURE_OPTS) \
	$(MAKE) -C $(OPENSWAN_DIR) \
		KERNELSRC=$(LINUX_DIR) DESTDIR=$(TARGET_DIR) \
		CC=$(TARGET_CC) USERCOMPILE="-UDEBUG -DNO_DEBUG -ULEAK_DETECTIVE $(TARGET_CFLAGS) -I$(TARGET_DIR)/usr/include" LD_LIBRARY_PATH=$(TARGET_DIR)/usr/lib install
	rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \
		$(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc

openswan: uclibc libgmp kernel-headers $(TARGET_DIR)/$(OPENSWAN_TARGET_BINARY)

openswan-clean:
	$(MAKE) DESTDIR=$(TARGET_DIR) -C $(OPENSWAN_DIR) uninstall
	-$(MAKE) -C $(OPENSWAN_DIR) clean

openswan-dirclean:
	rm -rf $(OPENSWAN_DIR)

#############################################################
#
# Toplevel Makefile options
#
#############################################################
ifeq ($(strip $(BR2_PACKAGE_OPENSWAN)),y)
TARGETS+=openswan
endif