c2a010a6568a03dc957cbf9b2429b7896383dd2b
[packages.git] / libs / gnutls / Makefile
1 #
2 # Copyright (C) 2005-2010 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=gnutls
11 PKG_VERSION:=3.2.14
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
15 PKG_SOURCE_URL:=ftp://ftp.gnutls.org/gcrypt/gnutls/v3.2
16 PKG_MD5SUM:=807bbf14a5b6c81a9249fffab5c3982b
17 PKG_MAINTAINER:=Nikos Mavrogiannopoulos <nmav@gnutls.org>
18
19 PKG_INSTALL:=1
20 PKG_LIBTOOL_PATHS:=. lib
21
22 include $(INCLUDE_DIR)/package.mk
23
24
25 define Package/gnutls/Default
26   SUBMENU:=SSL
27   SECTION:=libs
28   CATEGORY:=Libraries
29   TITLE:=GNU TLS
30   URL:=http://www.gnutls.org/
31 endef
32
33 define Package/gnutls/Default/description
34  GnuTLS is a secure communications library implementing the SSL, TLS
35  and DTLS protocols and technologies around them. It provides a simple
36  C language application programming interface (API) to access the secure
37  communications protocols as well as APIs to parse and write X.509, PKCS12,
38  OpenPGP and other required structures. It is aimed to be portable and
39  efficient with focus on security and interoperability.
40 endef
41
42
43 define Package/certtool
44 $(call Package/gnutls/Default)
45   SECTION:=utils
46   CATEGORY:=Utilities
47   TITLE+= (certool utility)
48   DEPENDS+= +libgnutls
49 endef
50
51 define Package/certtool/description
52 $(call Package/gnutls/Default/description)
53  This package contains the GnuTLS certtool utility.
54 endef
55
56
57 define Package/gnutls-utils
58 $(call Package/gnutls/Default)
59   SECTION:=utils
60   CATEGORY:=Utilities
61   TITLE+= (utilities)
62   DEPENDS+= +libgnutls
63 endef
64
65 define Package/gnutls-utils/description
66 $(call Package/gnutls/Default/description)
67  This package contains the GnuTLS gnutls-cli, gnutls-serv, psktool,
68  and srptool utilities.
69 endef
70
71 define Package/libgnutls/config
72         source "$(SOURCE)/Config.in"
73 endef
74
75 define Package/libgnutls
76 $(call Package/gnutls/Default)
77   TITLE+= (library)
78   DEPENDS+= +libnettle
79 endef
80
81 define Package/libgnutls/description
82 $(call Package/gnutls/Default/description)
83  This package contains the GnuTLS shared library, needed by other programs.
84 endef
85
86
87 define Package/libgnutls-openssl
88 $(call Package/gnutls/Default)
89   TITLE+= (OpenSSL compat library)
90   DEPENDS+= +libgnutls
91 endef
92
93 define Package/libgnutls-openssl/description
94 $(call Package/gnutls/Default/description)
95  This package contains the GnuTLS OpenSSL compatibility layer shared library.
96 endef
97
98 CONFIGURE_ARGS+= \
99         --enable-shared \
100         --enable-static \
101         --disable-libdane \
102         --disable-guile \
103         --disable-nls \
104         --without-zlib \
105         --with-included-libtasn1 \
106         --enable-local-libopts \
107         --disable-doc \
108         --disable-tests \
109         --disable-rsa-export \
110         --disable-crywrap \
111         --without-p11-kit
112
113 ifneq ($(CONFIG_GNUTLS_DTLS_SRTP),y)
114 CONFIGURE_ARGS += --disable-dtls-srtp-support
115 endif
116
117 ifneq ($(CONFIG_GNUTLS_ALPN),y)
118 CONFIGURE_ARGS += --disable-alpn-support
119 endif
120
121 ifneq ($(CONFIG_GNUTLS_HEARTBEAT),y)
122 CONFIGURE_ARGS += --disable-heartbeat-support
123 endif
124
125 ifneq ($(CONFIG_GNUTLS_SRP),y)
126 CONFIGURE_ARGS += --disable-srp-authentication
127 endif
128
129 ifneq ($(CONFIG_GNUTLS_PSK),y)
130 CONFIGURE_ARGS += --disable-psk-authentication
131 endif
132
133 ifneq ($(CONFIG_GNUTLS_OPENPGP),y)
134 CONFIGURE_ARGS += --disable-openpgp-authentication
135 endif
136
137 ifneq ($(CONFIG_GNUTLS_ANON),y)
138 CONFIGURE_ARGS += --disable-anon-authentication
139 endif
140
141 ifneq ($(CONFIG_GNUTLS_OCSP),y)
142 CONFIGURE_ARGS += --disable-ocsp
143 endif
144
145 ifeq ($(CONFIG_GNUTLS_CRYPTODEV),y)
146 CONFIGURE_ARGS += --enable-cryptodev
147 endif
148
149 # XXX: AM_CFLAGS duplicates with CFLAGS
150 MAKE_FLAGS:= \
151         AM_CFLAGS="" \
152
153 TARGET_CFLAGS += $(FPIC)
154 TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib
155
156 define Build/Configure
157         $(SED) 's,-I$$$${includedir},,g' $(PKG_BUILD_DIR)/configure
158         $(SED) 's,-L$$$${libdir},,g' $(PKG_BUILD_DIR)/configure
159         $(call Build/Configure/Default)
160 endef
161
162 define Build/InstallDev
163         $(INSTALL_DIR) $(1)/usr/include $(1)/usr/lib/pkgconfig
164         $(CP) \
165                 $(PKG_INSTALL_DIR)/usr/include/gnutls \
166                 $(1)/usr/include/
167         $(CP) \
168                 $(PKG_INSTALL_DIR)/usr/lib/libgnutls{,-openssl}.{a,so*} \
169                 $(1)/usr/lib/
170         $(CP) \
171                 $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/gnutls.pc \
172                 $(1)/usr/lib/pkgconfig/
173 endef
174
175 define Package/certtool/conffiles
176 /etc/gnutls/certtool.cfg
177 endef
178
179 define Package/certtool/install
180         $(INSTALL_DIR) $(1)/etc/gnutls
181         $(INSTALL_CONF) $(PKG_BUILD_DIR)/doc/certtool.cfg $(1)/etc/gnutls/
182         $(INSTALL_DIR) $(1)/usr/bin
183         $(CP) $(PKG_INSTALL_DIR)/usr/bin/certtool $(1)/usr/bin/
184 endef
185
186
187 define Package/gnutls-utils/install
188         $(INSTALL_DIR) $(1)/usr/bin
189         $(CP) \
190                 $(PKG_INSTALL_DIR)/usr/bin/gnutls-{cli,serv} \
191                 $(1)/usr/bin/
192 ifeq ($(CONFIG_GNUTLS_OCSP),y)
193         $(CP) \
194                 $(PKG_INSTALL_DIR)/usr/bin/ocsptool \
195                 $(1)/usr/bin/
196 endif
197 ifeq ($(CONFIG_GNUTLS_SRP),y)
198         $(CP) \
199                 $(PKG_INSTALL_DIR)/usr/bin/srptool \
200                 $(1)/usr/bin/
201 endif
202 ifeq ($(CONFIG_GNUTLS_PSK),y)
203         $(CP) \
204                 $(PKG_INSTALL_DIR)/usr/bin/psktool \
205                 $(1)/usr/bin/
206 endif
207 endef
208
209
210 define Package/libgnutls/install
211         $(INSTALL_DIR) $(1)/usr/lib
212         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgnutls.so.* $(1)/usr/lib/
213 endef
214
215
216 define Package/libgnutls-openssl/install
217         $(INSTALL_DIR) $(1)/usr/lib
218         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgnutls-openssl.so.* $(1)/usr/lib/
219 endef
220
221
222 $(eval $(call BuildPackage,certtool))
223 $(eval $(call BuildPackage,gnutls-utils))
224 $(eval $(call BuildPackage,libgnutls))
225 $(eval $(call BuildPackage,libgnutls-openssl))