libgcrypt: update to version 1.4.4 and fix build with mipsel gcc 4.4.0
authorAndreas Oberritter <obi@opendreambox.org>
Sat, 11 Jul 2009 15:01:23 +0000 (17:01 +0200)
committerAndreas Oberritter <obi@opendreambox.org>
Sat, 11 Jul 2009 15:01:23 +0000 (17:01 +0200)
recipes/libgcrypt/files/mips-ppc-fix-gcc-4.4.0.patch [new file with mode: 0644]
recipes/libgcrypt/libgcrypt-1.4.4/add-pkgconfig-support.patch [new file with mode: 0644]
recipes/libgcrypt/libgcrypt.inc
recipes/libgcrypt/libgcrypt_1.4.4.bb [new file with mode: 0644]

diff --git a/recipes/libgcrypt/files/mips-ppc-fix-gcc-4.4.0.patch b/recipes/libgcrypt/files/mips-ppc-fix-gcc-4.4.0.patch
new file mode 100644 (file)
index 0000000..687424d
--- /dev/null
@@ -0,0 +1,119 @@
+diff -Naur libgcrypt-1.4.4.orig/mpi/longlong.h libgcrypt-1.4.4/mpi/longlong.h
+--- libgcrypt-1.4.4.orig/mpi/longlong.h        2008-08-19 17:20:03.000000000 +0200
++++ libgcrypt-1.4.4/mpi/longlong.h     2009-07-11 02:06:58.000000000 +0200
+@@ -33,6 +33,14 @@
+    on a 64 bit machine, UWtype should typically be UDItype.
+ */
++/* Test for gcc >= maj.min, as per __GNUC_PREREQ in glibc */
++#if defined (__GNUC__) && defined (__GNUC_MINOR__)
++#define __GCRY_GNUC_PREREQ(maj, min) \
++  ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
++#else
++#define __GCRY_GNUC_PREREQ(maj, min)  0
++#endif
++
+ #define __BITS4 (W_TYPE_SIZE / 4)
+ #define __ll_B ((UWtype) 1 << (W_TYPE_SIZE / 2))
+ #define __ll_lowpart(t) ((UWtype) (t) & (__ll_B - 1))
+@@ -714,14 +722,23 @@
+  **************  MIPS  *****************
+  ***************************************/
+ #if defined (__mips__) && W_TYPE_SIZE == 32
+-#if __GNUC__ > 2 || __GNUC_MINOR__ >= 7
++#if __GCRY_GNUC_PREREQ (4,4)
++#define umul_ppmm(w1, w0, u, v) \
++  do {                                                                        \
++    UDItype __ll = (UDItype)(u) * (v);                                        \
++    w1 = __ll >> 32;                                                  \
++    w0 = __ll;                                                                \
++  } while (0)
++#endif
++#if !defined (umul_ppmm) && __GCRY_GNUC_PREREQ (2,7)
+ #define umul_ppmm(w1, w0, u, v) \
+   __asm__ ("multu %2,%3"                                                \
+          : "=l" ((USItype)(w0)),                                      \
+            "=h" ((USItype)(w1))                                       \
+          : "d" ((USItype)(u)),                                        \
+            "d" ((USItype)(v)))
+-#else
++#endif
++#if !defined (umul_ppmm)
+ #define umul_ppmm(w1, w0, u, v) \
+   __asm__ ("multu %2,%3 \n" \
+          "mflo %0 \n"     \
+@@ -739,14 +756,24 @@
+  **************  MIPS/64  **************
+  ***************************************/
+ #if (defined (__mips) && __mips >= 3) && W_TYPE_SIZE == 64
+-#if __GNUC__ > 2 || __GNUC_MINOR__ >= 7
++#if __GCRY_GNUC_PREREQ (4,4)
++#define umul_ppmm(w1, w0, u, v) \
++  do {                                                                        \
++    typedef unsigned int __ll_UTItype __attribute__((mode(TI)));      \
++    __ll_UTItype __ll = (__ll_UTItype)(u) * (v);                      \
++    w1 = __ll >> 64;                                                  \
++    w0 = __ll;                                                                \
++  } while (0)
++#endif
++#if !defined (umul_ppmm) && __GCRY_GNUC_PREREQ (2,7)
+ #define umul_ppmm(w1, w0, u, v) \
+   __asm__ ("dmultu %2,%3"                                               \
+          : "=l" ((UDItype)(w0)),                                      \
+            "=h" ((UDItype)(w1))                                       \
+          : "d" ((UDItype)(u)),                                        \
+            "d" ((UDItype)(v)))
+-#else
++#endif
++#if !defined (umul_ppmm)
+ #define umul_ppmm(w1, w0, u, v) \
+   __asm__ ("dmultu %2,%3 \n"    \
+          "mflo %0 \n"         \
+@@ -875,6 +902,15 @@
+          : "r" ((USItype)(x)))
+ #define COUNT_LEADING_ZEROS_0 32
+ #if defined (_ARCH_PPC)
++#if __GCRY_GNUC_PREREQ (4,4)
++#define umul_ppmm(w1, w0, u, v) \
++  do {                                                                        \
++    UDItype __ll = (UDItype)(u) * (v);                                        \
++    w1 = __ll >> 32;                                                  \
++    w0 = __ll;                                                                \
++  } while (0)
++#endif
++#if !defined (umul_ppmm)
+ #define umul_ppmm(ph, pl, m0, m1) \
+   do {                                                                        \
+     USItype __m0 = (m0), __m1 = (m1);                                 \
+@@ -884,6 +920,7 @@
+              "r" (__m1));                                             \
+     (pl) = __m0 * __m1;                                               \
+   } while (0)
++#endif
+ #define UMUL_TIME 15
+ #define smul_ppmm(ph, pl, m0, m1) \
+   do {                                                                        \
+@@ -964,12 +1001,23 @@
+ #define count_leading_zeros(count, x) \
+   __asm__ ("cntlzd %0,%1" : "=r" (count) : "r" (x))
+ #define COUNT_LEADING_ZEROS_0 64
++#if __GCRY_GNUC_PREREQ (4,4)
++#define umul_ppmm(w1, w0, u, v) \
++  do {                                                                        \
++    typedef unsigned int __ll_UTItype __attribute__((mode(TI)));      \
++    __ll_UTItype __ll = (__ll_UTItype)(u) * (v);                      \
++    w1 = __ll >> 64;                                                  \
++    w0 = __ll;                                                                \
++  } while (0)
++#endif
++#if !defined (umul_ppmm)
+ #define umul_ppmm(ph, pl, m0, m1) \
+   do {                                                                        \
+     UDItype __m0 = (m0), __m1 = (m1);                                 \
+     __asm__ ("mulhdu %0,%1,%2" : "=r" (ph) : "%r" (m0), "r" (m1));    \
+     (pl) = __m0 * __m1;                                                       \
+   } while (0)
++#endif
+ #define UMUL_TIME 15
+ #define smul_ppmm(ph, pl, m0, m1) \
+   do {                                                                        \
diff --git a/recipes/libgcrypt/libgcrypt-1.4.4/add-pkgconfig-support.patch b/recipes/libgcrypt/libgcrypt-1.4.4/add-pkgconfig-support.patch
new file mode 100644 (file)
index 0000000..f5df045
--- /dev/null
@@ -0,0 +1,61 @@
+diff -Naur libgcrypt-1.4.4.orig/configure.ac libgcrypt-1.4.4/configure.ac
+--- libgcrypt-1.4.4.orig/configure.ac  2009-01-22 19:14:35.000000000 +0100
++++ libgcrypt-1.4.4/configure.ac       2009-07-11 00:53:39.000000000 +0200
+@@ -1122,6 +1122,7 @@
+ src/Makefile
+ src/gcrypt.h
+ src/libgcrypt-config
++src/libgcrypt.pc
+ src/versioninfo.rc
+ tests/Makefile
+ ])
+diff -Naur libgcrypt-1.4.4.orig/src/libgcrypt.pc.in libgcrypt-1.4.4/src/libgcrypt.pc.in
+--- libgcrypt-1.4.4.orig/src/libgcrypt.pc.in   1970-01-01 01:00:00.000000000 +0100
++++ libgcrypt-1.4.4/src/libgcrypt.pc.in        2009-07-11 00:52:58.000000000 +0200
+@@ -0,0 +1,32 @@
++# Process this file with autoconf to produce a pkg-config metadata file.
++# Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation
++# Author: Simon Josefsson
++#
++# This file is free software; as a special exception the author gives
++# unlimited permission to copy and/or distribute it, with or without
++# modifications, as long as this notice is preserved.
++#
++# This file is distributed in the hope that it will be useful, but
++# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
++# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
++
++prefix=@prefix@
++exec_prefix=@exec_prefix@
++libdir=@libdir@
++includedir=@includedir@
++
++# API info
++api_version=@LIBGCRYPT_CONFIG_API_VERSION@
++
++# Misc information.
++symmetric_ciphers=@LIBGCRYPT_CIPHERS@
++asymmetric_ciphers=@LIBGCRYPT_PUBKEY_CIPHERS@
++digests=@LIBGCRYPT_DIGESTS@
++
++Name: libgcrypt
++Description: GNU crypto library
++URL: http://www.gnupg.org
++Version: @VERSION@
++Libs: -L${libdir} @LIBGCRYPT_CONFIG_LIBS@
++Libs.private: @GPG_ERROR_LIBS@
++Cflags: -I${includedir} @LIBGCRYPT_CONFIG_CFLAGS@ @GPG_ERROR_CFLAGS@
+diff -Naur libgcrypt-1.4.4.orig/src/Makefile.am libgcrypt-1.4.4/src/Makefile.am
+--- libgcrypt-1.4.4.orig/src/Makefile.am       2008-09-11 15:47:58.000000000 +0200
++++ libgcrypt-1.4.4/src/Makefile.am    2009-07-11 00:54:49.000000000 +0200
+@@ -34,6 +34,10 @@
+ bin_PROGRAMS += getrandom
+ endif USE_RANDOM_DAEMON
++# Pkg-config script.
++pkgconfigdir = $(libdir)/pkgconfig
++pkgconfig_DATA = libgcrypt.pc
++DISTCLEANFILES = $(pkgconfig_DATA)
+ if HAVE_LD_VERSION_SCRIPT
+   libgcrypt_version_script_cmd = -Wl,--version-script=$(srcdir)/libgcrypt.vers
index 691f4fe..099c7f1 100644 (file)
@@ -5,7 +5,8 @@ LICENSE = "GPL LGPL FDL"
 DEPENDS = "libgpg-error"
 
 SRC_URI = "ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-${PV}.tar.gz \
-           file://add-pkgconfig-support.patch;patch=1"
+           file://add-pkgconfig-support.patch;patch=1 \
+           file://mips-ppc-fix-gcc-4.4.0.patch;patch=1"
 
 inherit autotools binconfig pkgconfig lib_package
 
diff --git a/recipes/libgcrypt/libgcrypt_1.4.4.bb b/recipes/libgcrypt/libgcrypt_1.4.4.bb
new file mode 100644 (file)
index 0000000..19a4b24
--- /dev/null
@@ -0,0 +1 @@
+require libgcrypt.inc