pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

libgcrypt-32: compat32 package for libgcrypt



Module Name:	pkgsrc-wip
Committed By:	Naveen Narayanan <zerous@nocebo.space>
Pushed By:	zerous
Date:		Thu Jul 11 18:58:00 2019 +0200
Changeset:	699c04915ca04f28e974810730dbe11be89a3695

Added Files:
	libgcrypt-32/DESCR
	libgcrypt-32/Makefile
	libgcrypt-32/PLIST
	libgcrypt-32/buildlink3.mk
	libgcrypt-32/distinfo
	libgcrypt-32/hacks.mk
	libgcrypt-32/options.mk
	libgcrypt-32/patches/patch-aa
	libgcrypt-32/patches/patch-cipher_camellia-aarch64.S
	libgcrypt-32/patches/patch-cipher_rijndael-arm.S
	libgcrypt-32/patches/patch-random_jitterentropy-base.c
	libgcrypt-32/patches/patch-src_visibility.h

Log Message:
libgcrypt-32: compat32 package for libgcrypt

This is a general purpose cryptographic library based on the code from GnuPG.
It provides functions for all cryptograhic building blocks: symmetric ciphers
(AES, DES, Blowfish, CAST5, Twofish, Arcfour), hash algorithms (MD4, MD5,
RIPE-MD160, SHA-1, TIGER-192), MACs (HMAC for all hash algorithms), public key
algorithms (RSA, ElGamal, DSA), large integer functions, random numbers and a
lot of supporting functions.

Note: This package is intended to crosscompile libgcrypt for i386

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=699c04915ca04f28e974810730dbe11be89a3695

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 libgcrypt-32/DESCR                                 |  6 ++
 libgcrypt-32/Makefile                              | 80 ++++++++++++++++++++++
 libgcrypt-32/PLIST                                 |  6 ++
 libgcrypt-32/buildlink3.mk                         | 16 +++++
 libgcrypt-32/distinfo                              | 11 +++
 libgcrypt-32/hacks.mk                              | 12 ++++
 libgcrypt-32/options.mk                            | 26 +++++++
 libgcrypt-32/patches/patch-aa                      | 15 ++++
 .../patches/patch-cipher_camellia-aarch64.S        | 16 +++++
 libgcrypt-32/patches/patch-cipher_rijndael-arm.S   | 15 ++++
 .../patches/patch-random_jitterentropy-base.c      | 26 +++++++
 libgcrypt-32/patches/patch-src_visibility.h        | 28 ++++++++
 12 files changed, 257 insertions(+)

diffs:
diff --git a/libgcrypt-32/DESCR b/libgcrypt-32/DESCR
new file mode 100644
index 0000000000..db98ce8fa5
--- /dev/null
+++ b/libgcrypt-32/DESCR
@@ -0,0 +1,6 @@
+This is a general purpose cryptographic library based on the code from GnuPG.
+It provides functions for all cryptograhic building blocks: symmetric ciphers
+(AES, DES, Blowfish, CAST5, Twofish, Arcfour), hash algorithms (MD4, MD5,
+RIPE-MD160, SHA-1, TIGER-192), MACs (HMAC for all hash algorithms), public key
+algorithms (RSA, ElGamal, DSA), large integer functions, random numbers and a
+lot of supporting functions.
diff --git a/libgcrypt-32/Makefile b/libgcrypt-32/Makefile
new file mode 100644
index 0000000000..066b830e16
--- /dev/null
+++ b/libgcrypt-32/Makefile
@@ -0,0 +1,80 @@
+# $NetBSD: Makefile,v 1.96 2018/11/02 23:08:29 adam Exp $
+
+DISTNAME=	libgcrypt-1.8.4
+CATEGORIES=	security
+MASTER_SITES=	ftp://ftp.gnupg.org/gcrypt/libgcrypt/
+EXTRACT_SUFX=	.tar.bz2
+ABI=		32
+LIBABISUFFIX?=          /32
+CONFIGURE_ARGS+=        --libdir=${PREFIX}/lib${LIBABISUFFIX}
+CFLAGS+=                -m32
+
+PKGNAME=	compat${ABI}_${DISTNAME}
+
+MAINTAINER=	pkgsrc-users%NetBSD.org@localhost
+HOMEPAGE=	https://www.gnu.org/software/libgcrypt/
+COMMENT=	GNU cryptographic library
+LICENSE=	gnu-gpl-v2 AND gnu-lgpl-v2.1
+
+USE_LIBTOOL=		yes
+GNU_CONFIGURE=		yes
+
+TEST_TARGET=		check
+
+TEXINFO_REQD=		4.0
+INFO_FILES=		yes
+
+.include "../../mk/bsd.prefs.mk"
+.include "../../mk/compiler.mk"
+
+.if empty(MACHINE_PLATFORM:MNetBSD-*-i386) && \
+    empty(MACHINE_PLATFORM:MNetBSD-*-alpha) && \
+    empty(MACHINE_PLATFORM:MNetBSD-*-sparc) && \
+    empty(MACHINE_PLATFORM:M*-*-hppa)
+CONFIGURE_ARGS+=	--disable-asm
+.endif
+CONFIGURE_ARGS+=	--disable-aesni-support
+
+.if !empty(MACHINE_PLATFORM:MLinux-*-i386) || \
+    !empty(MACHINE_PLATFORM:MSunOS-*-i386)
+CONFIGURE_ARGS+=	--disable-pclmul-support
+.endif
+
+# SCO OpenServer 5.0.7/3.2 has no socklen_t, but it is defined in pthread.h
+# from builtin GNU pth.
+.if ${OS_VARIANT} == "SCOOSR5"
+CONFIGURE_ENV+=		ac_cv_type_socklen_t=yes
+CONFIGURE_ENV+=		gl_cv_socklen_t_equiv=int
+.endif
+
+.if !empty(PKGSRC_COMPILER:Mclang)
+CFLAGS+=		-fheinous-gnu-extensions
+.endif
+
+.if (${MACHINE_ARCH} == "x86_64")
+.  if !empty(CC_VERSION:Mgcc-4.[45].*)
+CONFIGURE_ARGS+=	--disable-avx2-support
+CONFIGURE_ARGS+=	--disable-avx-support
+CONFIGURE_ENV+=		gcry_cv_gcc_inline_asm_avx=no
+.  endif
+.endif
+
+SUBST_CLASSES+=		rpath
+SUBST_FILES.rpath=	src/libgcrypt-config.in
+SUBST_STAGE.rpath=	pre-configure
+SUBST_MESSAGE.rpath=	Fixing rpath flags
+SUBST_VARS.rpath=	COMPILER_RPATH_FLAG
+
+.include "options.mk"
+
+BUILDLINK_API_DEPENDS.libgpg-error+=	libgpg-error>=1.13
+
+remove-non-libraries:
+	echo "Removing non-compat lib package content"
+	find ${DESTDIR}${PREFIX} -path ${DESTDIR}${PREFIX}/lib${LIBABISUFFIX} -prune -or -type f -exec ${RM} {} +
+
+post-install: remove-non-libraries
+
+.include "../../wip/libgpg-error-32/buildlink3.mk"
+.include "../../mk/pthread.buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/libgcrypt-32/PLIST b/libgcrypt-32/PLIST
new file mode 100644
index 0000000000..9e820fca7b
--- /dev/null
+++ b/libgcrypt-32/PLIST
@@ -0,0 +1,6 @@
+@comment $NetBSD$
+lib/32/libgcrypt.la
+@pkgdir share/aclocal
+@pkgdir man/man1
+@pkgdir include
+@pkgdir bin
diff --git a/libgcrypt-32/buildlink3.mk b/libgcrypt-32/buildlink3.mk
new file mode 100644
index 0000000000..af8191f5b9
--- /dev/null
+++ b/libgcrypt-32/buildlink3.mk
@@ -0,0 +1,16 @@
+# $NetBSD: buildlink3.mk,v 1.18 2016/08/17 23:13:11 maya Exp $
+
+BUILDLINK_TREE+=	compat32_libgcrypt
+
+.if !defined(COMPAT32_LIBGCRYPT_BUILDLINK3_MK)
+COMPAT32_LIBGCRYPT_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.compat32_libgcrypt+=	compat32_libgcrypt>=1.2.0
+BUILDLINK_ABI_DEPENDS.compat32_libgcrypt+=	compat32_libgcrypt>=1.6.0
+BUILDLINK_PKGSRCDIR.compat32_libgcrypt?=	../../wip/libgcrypt-32
+BUILDLINK_LIBDIRS.compat32_libgcrypt?=		lib/32
+
+.include "../../security/libgpg-error/buildlink3.mk"
+.endif # COMPAT32_LIBGCRYPT_BUILDLINK3_MK
+
+BUILDLINK_TREE+=	-compat32_libgcrypt
diff --git a/libgcrypt-32/distinfo b/libgcrypt-32/distinfo
new file mode 100644
index 0000000000..3c7f005c94
--- /dev/null
+++ b/libgcrypt-32/distinfo
@@ -0,0 +1,11 @@
+$NetBSD: distinfo,v 1.81 2019/01/09 14:19:26 martin Exp $
+
+SHA1 (libgcrypt-1.8.4.tar.bz2) = 4a8ef9db6922f3a31992aca5640b4198a69b58fc
+RMD160 (libgcrypt-1.8.4.tar.bz2) = 57a23952989b6a852d0654218206876c4a878087
+SHA512 (libgcrypt-1.8.4.tar.bz2) = b831fc337eb14806897e224b0d1e78d1f8e9db91dffa818a015a4aa104144e2d971e5a855904907ee2bb9990a9d526de32d6787e1cae98e28a65c3258b2b1ea1
+Size (libgcrypt-1.8.4.tar.bz2) = 2990108 bytes
+SHA1 (patch-aa) = 60b3f4453b217ed8879a2ffd8d485c0195ffb5f8
+SHA1 (patch-cipher_camellia-aarch64.S) = 3175085651b737e1339e34241b6107898e2cf4a7
+SHA1 (patch-cipher_rijndael-arm.S) = ef3cb7f481022440780eb48ae31cbfad0a3ec115
+SHA1 (patch-random_jitterentropy-base.c) = 5a14676aae7ad5d12f9f0bed366af5183aaf22ad
+SHA1 (patch-src_visibility.h) = 8cbbf6803ab34b4b7dda832aa8ee18247aa89518
diff --git a/libgcrypt-32/hacks.mk b/libgcrypt-32/hacks.mk
new file mode 100644
index 0000000000..4419a7bf18
--- /dev/null
+++ b/libgcrypt-32/hacks.mk
@@ -0,0 +1,12 @@
+# $NetBSD: hacks.mk,v 1.4 2008/03/26 20:09:43 tron Exp $
+
+# config.h #defines socklen_t if it is not defined, but libgcrypt does
+# not propogate this to the installed gcrypt.h, so packages using it
+# subsequently fail.
+#
+# hack around this by using the same #define (if present) in gcrypt.h.
+post-configure:
+	socklen=`${GREP} '^#define socklen_t' ${WRKSRC}/config.h || ${TRUE}`; \
+		${MV} ${WRKSRC}/src/gcrypt.h ${WRKSRC}/src/gcrypt.h.old; \
+		${SED} -e "s,^/\* socklen_t \*/,$$socklen," \
+			${WRKSRC}/src/gcrypt.h.old > ${WRKSRC}/src/gcrypt.h
diff --git a/libgcrypt-32/options.mk b/libgcrypt-32/options.mk
new file mode 100644
index 0000000000..bb7fb562cb
--- /dev/null
+++ b/libgcrypt-32/options.mk
@@ -0,0 +1,26 @@
+# $NetBSD: options.mk,v 1.8 2013/04/21 14:44:53 wiz Exp $
+
+PKG_OPTIONS_VAR=	PKG_OPTIONS.libgcrypt
+PKG_SUPPORTED_OPTIONS=
+
+.include "../../mk/bsd.prefs.mk"
+
+.if ${MACHINE_ARCH} == "i386" && ${OPSYS} != "Darwin"
+.  include "../../mk/compiler.mk"
+# GCC 3.x (at least 3.3.3 on NetBSD) fails to compile asm() call in
+# cipher/rijndael.c:do_padlock()
+.  if empty(CC_VERSION:Mgcc-3.*)
+PKG_SUPPORTED_OPTIONS+=	via-padlock
+# With GCC 4.1.3 on NetBSD, do_padlock() crashes with signal 11
+.    if ${OPSYS} != "NetBSD"
+PKG_SUGGESTED_OPTIONS+=	via-padlock
+.    endif
+.  endif
+.endif
+
+.include "../../mk/bsd.options.mk"
+
+.if empty(PKG_OPTIONS:Mvia-padlock)
+# Disable VIA Padlock support.
+CONFIGURE_ARGS+=	--disable-padlock-support
+.endif
diff --git a/libgcrypt-32/patches/patch-aa b/libgcrypt-32/patches/patch-aa
new file mode 100644
index 0000000000..f810a3ad23
--- /dev/null
+++ b/libgcrypt-32/patches/patch-aa
@@ -0,0 +1,15 @@
+$NetBSD: patch-aa,v 1.9 2016/09/01 10:19:30 fhajny Exp $
+
+Add rpath to configure script.
+
+--- src/libgcrypt-config.in.orig	2008-08-19 17:20:04.000000000 +0200
++++ src/libgcrypt-config.in
+@@ -155,7 +155,7 @@ if test "$echo_libs" = "yes"; then
+ 
+     # Set up `libdirs'.
+     if test "x$libdir" != "x/usr/lib" -a "x$libdir" != "x/lib"; then
+-	libdirs="-L$libdir"
++	libdirs="-L$libdir @COMPILER_RPATH_FLAG@@libdir@"
+     fi
+ 
+     # Set up `libs_final'.
diff --git a/libgcrypt-32/patches/patch-cipher_camellia-aarch64.S b/libgcrypt-32/patches/patch-cipher_camellia-aarch64.S
new file mode 100644
index 0000000000..37b0724b99
--- /dev/null
+++ b/libgcrypt-32/patches/patch-cipher_camellia-aarch64.S
@@ -0,0 +1,16 @@
+$NetBSD: patch-cipher_camellia-aarch64.S,v 1.2 2019/01/09 14:19:26 martin Exp $
+
+Do not make _gcry_camellia_arm_tables global, to allow the assembler to
+resolve the symbol locally (avoids relocations that break the build).
+
+--- cipher/camellia-aarch64.S.orig	2017-11-23 19:16:58.000000000 +0100
++++ cipher/camellia-aarch64.S	2019-01-09 14:27:16.928019986 +0100
+@@ -284,7 +284,7 @@
+ .size _gcry_camellia_arm_decrypt_block,.-_gcry_camellia_arm_decrypt_block;
+ 
+ /* Encryption/Decryption tables */
+-.globl _gcry_camellia_arm_tables
++#  .globl _gcry_camellia_arm_tables
+ .type  _gcry_camellia_arm_tables,@object;
+ .balign 32
+ _gcry_camellia_arm_tables:
diff --git a/libgcrypt-32/patches/patch-cipher_rijndael-arm.S b/libgcrypt-32/patches/patch-cipher_rijndael-arm.S
new file mode 100644
index 0000000000..eb5999f2a0
--- /dev/null
+++ b/libgcrypt-32/patches/patch-cipher_rijndael-arm.S
@@ -0,0 +1,15 @@
+$NetBSD: patch-cipher_rijndael-arm.S,v 1.1 2016/07/02 13:24:17 wiz Exp $
+
+Fix ARM unaligned access problem.
+https://lists.gnupg.org/pipermail/gcrypt-devel/2016-June/003904.html
+
+--- cipher/rijndael-arm.S.orig	2016-03-23 11:59:34.000000000 +0000
++++ cipher/rijndael-arm.S
+@@ -19,6 +19,7 @@
+  */
+ 
+ #include <config.h>
++#undef __ARM_FEATURE_UNALIGNED
+ 
+ #if defined(__ARMEL__)
+ #ifdef HAVE_COMPATIBLE_GCC_ARM_PLATFORM_AS
diff --git a/libgcrypt-32/patches/patch-random_jitterentropy-base.c b/libgcrypt-32/patches/patch-random_jitterentropy-base.c
new file mode 100644
index 0000000000..fb8b99e4f2
--- /dev/null
+++ b/libgcrypt-32/patches/patch-random_jitterentropy-base.c
@@ -0,0 +1,26 @@
+$NetBSD: patch-random_jitterentropy-base.c,v 1.1 2018/05/11 19:20:11 kamil Exp $
+
+Port to Clang.
+
+--- random/jitterentropy-base.c.orig	2017-11-23 18:16:58.000000000 +0000
++++ random/jitterentropy-base.c
+@@ -50,13 +50,18 @@
+  */
+ 
+ #undef _FORTIFY_SOURCE
++
++#ifdef __clang__
++#pragma clang optimize off
++#else
+ #pragma GCC optimize ("O0")
++#endif
+ 
+ #include "jitterentropy.h"
+ 
+ #ifndef CONFIG_CRYPTO_CPU_JITTERENTROPY_STAT
+  /* only check optimization in a compilation for real work */
+- #ifdef __OPTIMIZE__
++ #if defined(__OPTIMIZE__) && !defined(__clang__)
+   #error "The CPU Jitter random number generator must not be compiled with optimizations. See documentation. Use the compiler switch -O0 for compiling jitterentropy-base.c."
+  #endif
+ #endif
diff --git a/libgcrypt-32/patches/patch-src_visibility.h b/libgcrypt-32/patches/patch-src_visibility.h
new file mode 100644
index 0000000000..5e3a4de4bc
--- /dev/null
+++ b/libgcrypt-32/patches/patch-src_visibility.h
@@ -0,0 +1,28 @@
+$NetBSD: patch-src_visibility.h,v 1.2 2014/08/21 19:55:26 wiz Exp $
+
+GCC on SCO OpenServer 5.0.7/3.2 does not support visibility.
+
+https://bugs.g10code.com/gnupg/issue1704
+
+--- src/visibility.h.orig	2014-01-29 09:48:38.000000000 +0000
++++ src/visibility.h
+@@ -26,7 +26,9 @@
+ 
+ /* Include the main header here so that public symbols are mapped to
+    the internal underscored ones.  */
+-#ifdef _GCRY_INCLUDED_BY_VISIBILITY_C
++/* All available GCC for SCO OpenServer 5.0.7/3.2 does not support
++   visibility. */
++#if defined(_GCRY_INCLUDED_BY_VISIBILITY_C) || defined(_SCO_DS)
+   /* We need to redeclare the deprecated functions without the
+      deprecated attribute.  */
+ # define GCRYPT_NO_DEPRECATED
+@@ -48,7 +50,7 @@ gcry_err_code_t gcry_md_get (gcry_md_hd_
+    NOTE: When adding new functions, please make sure to add them to
+          libgcrypt.vers and libgcrypt.def as well.  */
+ 
+-#ifdef _GCRY_INCLUDED_BY_VISIBILITY_C
++#if defined(_GCRY_INCLUDED_BY_VISIBILITY_C) || defined(_SCO_DS)
+ 
+ /* A macro to flag a function as visible.  */
+ #ifdef GCRY_USE_VISIBILITY


Home | Main Index | Thread Index | Old Index