provide KERNEL_BITS
[buildroot.git] / package / ipsec-tools / ipsec-tools.mk
blobaa1a0cecc9ce5598e30562b1925f77049e69c440
1 #############################################################
3 # ipsec-tools
5 #############################################################
7 IPSEC_TOOLS_VERSION:=0.6.7
8 IPSEC_TOOLS_SOURCE:=ipsec-tools-$(IPSEC_TOOLS_VERSION).tar.bz2
9 IPSEC_TOOLS_CAT:=$(BZCAT)
10 IPSEC_TOOLS_DIR:=$(BUILD_DIR)/ipsec-tools-$(IPSEC_TOOLS_VERSION)
12 IPSEC_TOOLS_BINARY_SETKEY:=src/setkey/setkey
13 IPSEC_TOOLS_BINARY_RACOON:=src/racoon/racoon
14 IPSEC_TOOLS_BINARY_RACOONCTL:=src/racoon/racoonctl
16 IPSEC_TOOLS_TARGET_BINARY_SETKEY:=usr/sbin/setkey
17 IPSEC_TOOLS_TARGET_BINARY_RACOON:=usr/sbin/racoon
18 IPSEC_TOOLS_TARGET_BINARY_RACOONCTL:=usr/sbin/racoonctl
19 IPSEC_TOOLS_SITE=http://$(BR2_SOURCEFORGE_MIRROR).dl.sourceforge.net/sourceforge/ipsec-tools/
21 ifeq ($(strip $(BR2_PACKAGE_IPSEC_TOOLS_ADMINPORT)), y)
22 IPSEC_TOOLS_CONFIG_FLAGS+= --enable-adminport
23 else
24 IPSEC_TOOLS_CONFIG_FLAGS+= --disable-adminport
25 endif
27 ifeq ($(strip $(BR2_PACKAGE_IPSEC_TOOLS_NATT)), y)
28 IPSEC_TOOLS_CONFIG_FLAGS+= --enable-natt
29 else
30 IPSEC_TOOLS_CONFIG_FLAGS+= --disable-natt
31 endif
33 ifeq ($(strip $(BR2_PACKAGE_IPSEC_TOOLS_FRAG)), y)
34 IPSEC_TOOLS_CONFIG_FLAGS+= --enable-frag
35 else
36 IPSEC_TOOLS_CONFIG_FLAGS+= --disable-frag
37 endif
39 ifeq ($(strip $(BR2_PACKAGE_IPSEC_TOOLS_STATS)), y)
40 IPSEC_TOOLS_CONFIG_FLAGS+= --enable-stats
41 else
42 IPSEC_TOOLS_CONFIG_FLAGS+= --disable-stats
43 endif
45 ifeq ($(BR2_INET_IPV6),y)
47 ifeq ($(strip $(BR2_PACKAGE_IPSEC_TOOLS_IPV6)), y)
48 IPSEC_TOOLS_CONFIG_FLAGS+= --enable-ipv6
49 else
50 IPSEC_TOOLS_CONFIG_FLAGS+= $(DISABLE_IPV6)
51 endif
53 else # ignore user's choice if it doesn't
54 IPSEC_TOOLS_CONFIG_FLAGS+= $(DISABLE_IPV6)
55 endif
57 ifneq ($(strip $(BR2_PACKAGE_IPSEC_TOOLS_READLINE)), y)
58 IPSEC_TOOLS_CONFIG_FLAGS+= --without-readline
59 endif
61 $(DL_DIR)/$(IPSEC_TOOLS_SOURCE):
62 $(WGET) -P $(DL_DIR) $(IPSEC_TOOLS_SITE)/$(IPSEC_TOOLS_SOURCE)
64 $(IPSEC_TOOLS_DIR)/.patched: $(DL_DIR)/$(IPSEC_TOOLS_SOURCE)
65 $(IPSEC_TOOLS_CAT) $(DL_DIR)/$(IPSEC_TOOLS_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
66 toolchain/patch-kernel.sh $(IPSEC_TOOLS_DIR) package/ipsec-tools ipsec-tools-$(IPSEC_TOOLS_VERSION)\*.patch
67 $(CONFIG_UPDATE) $(IPSEC_TOOLS_DIR)
68 touch $@
70 $(IPSEC_TOOLS_DIR)/.configured: $(IPSEC_TOOLS_DIR)/.patched
71 ( cd $(IPSEC_TOOLS_DIR); rm -rf config.cache; \
72 $(TARGET_CONFIGURE_OPTS) \
73 $(TARGET_CONFIGURE_ARGS) \
74 ./configure \
75 --target=$(GNU_TARGET_NAME) \
76 --host=$(GNU_TARGET_NAME) \
77 --build=$(GNU_HOST_NAME) \
78 --prefix=/usr \
79 --sysconfdir=/etc \
80 --disable-hybrid \
81 --without-libpam \
82 --disable-gssapi \
83 --with-kernel-headers=$(STAGING_DIR)/usr/include \
84 $(IPSEC_TOOLS_CONFIG_FLAGS) \
86 # simpler than patching that cruft..
87 (echo '#undef bzero'; \
88 echo '#define bzero(a, b) memset((a), 0, (b))'; \
89 echo '#undef bcopy'; \
90 echo '#define bcopy(src, dest, len) memmove(dest, src, len)'; \
91 echo '#undef index'; \
92 echo '#define index(a, b) strchr(a, b)'; \
93 ) >> $(IPSEC_TOOLS_DIR)/config.h
94 touch $@
96 $(IPSEC_TOOLS_DIR)/$(IPSEC_TOOLS_BINARY_SETKEY) \
97 $(IPSEC_TOOLS_DIR)/$(IPSEC_TOOLS_BINARY_RACOON) \
98 $(IPSEC_TOOLS_DIR)/$(IPSEC_TOOLS_BINARY_RACOONCTL): \
99 $(IPSEC_TOOLS_DIR)/.configured
100 $(MAKE) CC=$(TARGET_CC) -C $(IPSEC_TOOLS_DIR)
102 $(TARGET_DIR)/$(IPSEC_TOOLS_TARGET_BINARY_SETKEY) \
103 $(TARGET_DIR)/$(IPSEC_TOOLS_TARGET_BINARY_RACOON) \
104 $(TARGET_DIR)/$(IPSEC_TOOLS_TARGET_BINARY_RACOONCTL): \
105 $(IPSEC_TOOLS_DIR)/$(IPSEC_TOOLS_BINARY_SETKEY) \
106 $(IPSEC_TOOLS_DIR)/$(IPSEC_TOOLS_BINARY_RACOON) \
107 $(IPSEC_TOOLS_DIR)/$(IPSEC_TOOLS_BINARY_RACOONCTL)
108 $(MAKE) -C $(IPSEC_TOOLS_DIR) DESTDIR=$(TARGET_DIR) install
109 $(STRIPCMD) $(STRIP_STRIP_UNNEEDED) $(REMOVE_SECTION_COMMENT) \
110 $(REMOVE_SECTION_NOTE) \
111 $(TARGET_DIR)/$(IPSEC_TOOLS_TARGET_BINARY_SETKEY) \
112 $(TARGET_DIR)/$(IPSEC_TOOLS_TARGET_BINARY_RACOON) \
113 $(TARGET_DIR)/$(IPSEC_TOOLS_TARGET_BINARY_RACOONCTL)
114 ifneq ($(BR2_HAVE_MANPAGES),y)
115 rm -f $(addprefix $(TARGET_DIR)/usr/man/, \
116 man3/ipsec_strerror.3 man3/ipsec_set_policy.3 \
117 man5/racoon.conf.5 \
118 man8/racoonctl.8 man8/racoon.8 \
119 man8/plainrsa-gen.8 man8/setkey.8)
120 endif
121 ifeq ($(strip $(BR2_PACKAGE_IPSEC_TOOLS_LIBS)), y)
122 install -D $(addprefix $(IPSEC_TOOLS_DIR)/src/, \
123 libipsec/.libs/libipsec.a libipsec/.libs/libipsec.la \
124 racoon/.libs/libracoon.a racoon/.libs/libracoon.la) \
125 $(STAGING_DIR)/lib
126 endif
127 ifneq ($(strip $(BR2_PACKAGE_IPSEC_TOOLS_ADMINPORT)), y)
128 rm -f $(TARGET_DIR)/$(IPSEC_TOOLS_TARGET_BINARY_RACOONCTL)
129 endif
131 IPSEC_TOOLS_PROGS= $(TARGET_DIR)/$(IPSEC_TOOLS_TARGET_BINARY_SETKEY) \
132 $(TARGET_DIR)/$(IPSEC_TOOLS_TARGET_BINARY_RACOON)
134 ifeq ($(strip $(BR2_PACKAGE_IPSEC_TOOLS_ADMINPORT)), y)
135 IPSEC_TOOLS_PROGS+= $(TARGET_DIR)/$(IPSEC_TOOLS_TARGET_BINARY_RACOONCTL)
136 endif
138 ipsec-tools: uclibc openssl $(IPSEC_TOOLS_PROGS)
140 ipsec-tools-source: $(DL_DIR)/$(IPSEC_TOOLS_SOURCE)
142 ipsec-tools-uninstall:
144 ipsec-tools-clean:
145 $(MAKE) -C $(IPSEC_TOOLS_DIR) DESTDIR=$(TARGET_DIR) uninstall
146 -$(MAKE) -C $(IPSEC_TOOLS_DIR) clean
147 ifeq ($(BR2_PACKAGE_IPSEC_TOOLS_LIBS),y)
148 rm -f $(addprefix $(STAGING_DIR)/lib/, \
149 libipsec.a libipsec.la libracoon.a libracoon.la)
150 endif
151 rm -f $(IPSEC_TOOLS_DIR)/.configured
153 ipsec-tools-dirclean:
154 @echo $(LINUX_DIR)
155 rm -rf $(IPSEC_TOOLS_DIR)
157 ifeq ($(strip $(BR2_PACKAGE_IPSEC_TOOLS)), y)
158 TARGETS+=ipsec-tools
159 endif