1#
2# Copyright (C) 2005-2009 OpenWrt.org
3#
4# This is free software, licensed under the GNU General Public License v2.
5# See /LICENSE for more information.
6#
7
8include $(TOPDIR)/rules.mk
9
10PKG_NAME:=libgcrypt
11PKG_VERSION:=1.5.0
12PKG_RELEASE:=1
13
14PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
15PKG_SOURCE_URL:=ftp://ftp.gnupg.org/gcrypt/libgcrypt/
16PKG_MD5SUM:=693f9c64d50c908bc4d6e01da3ff76d8
17
18#PKG_FIXUP:=libtool
19
20include $(INCLUDE_DIR)/package.mk
21
22define Package/libgcrypt
23  SECTION:=libs
24  CATEGORY:=Libraries
25  DEPENDS:=+libgpg-error
26  TITLE:=GNU crypto library
27  URL:=http://directory.fsf.org/security/libgcrypt.html
28endef
29
30define Package/libgcrypt/description
31 This is a general purpose cryptographic library based on the code from 
32 GnuPG. It provides functions for all cryptograhic building blocks: 
33 symmetric ciphers (AES, DES, Arcfour), hash algorithms (MD5, SHA-1,
34 RIPE-MD160, SHA-224/256, SHA-384/512), MACs (HMAC for all hash
35 algorithms), public key algorithms (RSA, DSA), large integer functions,
36 random numbers and a lot of supporting functions. Some algorithms have
37 been disabled to reduce size (Blowfish, CAST5, Twofish, Serpent,
38 RC2, SEED, Camellia, CRC, MD4, TIGER-192, Whirlpool, ElGamal, ECC).
39endef
40
41TARGET_CFLAGS += $(FPIC)
42
43CONFIGURE_ARGS+= \
44	--enable-shared \
45	--enable-static \
46	--disable-asm \
47	--with-gpg-error-prefix="$(STAGING_DIR)/usr" \
48	--enable-digests="md5 rmd160 sha1 sha256 sha512" \
49	--enable-ciphers="arcfour des aes cast5" \
50	--enable-pubkey-ciphers="rsa dsa" \
51
52define Build/Compile
53	$(MAKE) -C $(PKG_BUILD_DIR) \
54		DESTDIR="$(PKG_INSTALL_DIR)" \
55		all install
56endef
57
58define Build/InstallDev
59	mkdir -p $(1)/usr/bin $(2)/bin $(1)/usr/include $(1)/usr/lib $(1)/usr/share/aclocal
60	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/libgcrypt-config $(1)/usr/bin/
61	$(CP) $(PKG_INSTALL_DIR)/usr/include/gcrypt*.h $(1)/usr/include/
62	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libgcrypt.{la,a,so*} $(1)/usr/lib/
63	$(CP) $(PKG_INSTALL_DIR)/usr/share/aclocal/libgcrypt.m4 $(1)/usr/share/aclocal/
64	echo "SED=$(SED)"
65	$(SED) 's,^libdir=\"$$$${exec_prefix}/lib,libdir=\"$(STAGING_DIR)/usr/lib,g' $(1)/usr/bin/libgcrypt-config
66	$(SED) 's,^includedir=\"$$$${prefix}/include/,includedir=\"$(STAGING_DIR)/usr/include/,g' $(1)/usr/bin/libgcrypt-config
67	$(SED) 's,^libs=\"-lgcrypt,libs=\"$(STAGING_DIR)/usr/lib/libgcrypt.so,g' $(1)/usr/bin/libgcrypt-config
68	ln -sf $(STAGING_DIR)/usr/bin/libgcrypt-config $(2)/bin/
69endef
70
71define Package/libgcrypt/install
72	$(INSTALL_DIR) $(1)/usr/lib
73	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libgcrypt.so.* $(1)/usr/lib/
74endef
75
76$(eval $(call BuildPackage,libgcrypt))
77