gpg2: correct build issues 82/26982/1
authorKévin THIERRY <kevin.thierry@open.eurogiciel.org>
Tue, 2 Sep 2014 14:31:44 +0000 (16:31 +0200)
committerKévin THIERRY <kevin.thierry@open.eurogiciel.org>
Tue, 2 Sep 2014 14:31:44 +0000 (16:31 +0200)
* Update autoconf macros and add pkgconfig calls (patch 1).
* Remove obsolete functions in code (only needed whith older gcrypt
  versions) (patches 2,3).

Change-Id: Iadadb4b1d88d11543df6fa74c0d84a61d5cd02c2
Signed-off-by: Kévin THIERRY <kevin.thierry@open.eurogiciel.org>
recipes-tizen/gpg2/gpg2-extraconf.inc
recipes-tizen/gpg2/gpg2/0001-Update-autoconf-macros.patch [new file with mode: 0644]
recipes-tizen/gpg2/gpg2/0002-Do-not-set-gcrypt-thread-callback.patch [new file with mode: 0644]
recipes-tizen/gpg2/gpg2/0003-Remove-obsolete-function-gcry_md_start_debug.patch [new file with mode: 0644]

index e69de29..c51480b 100644 (file)
@@ -0,0 +1,12 @@
+SRC_URI += " file://0001-Update-autoconf-macros.patch "
+SRC_URI += " file://0002-Do-not-set-gcrypt-thread-callback.patch "
+SRC_URI += " file://0003-Remove-obsolete-function-gcry_md_start_debug.patch "
+
+gpg2_files += "/usr/lib/gpg2keys_kdns"
+gpg2_files += "/usr/lib/gpg-protect-tool"
+gpg2_files += "/usr/lib/gpg-check-pattern"
+gpg2_files += "/usr/lib/gpg2keys_finger"
+gpg2_files += "/usr/lib/gnupg-pcsc-wrapper"
+gpg2_files += "/usr/lib/gpg2keys_hkp"
+gpg2_files += "/usr/lib/gpg2keys_curl"
+gpg2_files += "/usr/lib/gpg-preset-passphrase"
diff --git a/recipes-tizen/gpg2/gpg2/0001-Update-autoconf-macros.patch b/recipes-tizen/gpg2/gpg2/0001-Update-autoconf-macros.patch
new file mode 100644 (file)
index 0000000..e54b6b5
--- /dev/null
@@ -0,0 +1,599 @@
+From f0c66acf9dd638463c05c88c1068b4b902a4404f Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?K=C3=A9vin=20THIERRY?= <kevin.thierry@open.eurogiciel.org>
+Date: Tue, 2 Sep 2014 14:15:27 +0200
+Subject: [PATCH] Update autoconf macros
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+* libpth
+* libgpg-error
+* libksba
+* libassuan
+* libgcrypt
+
+Signed-off-by: Kévin THIERRY <kevin.thierry@open.eurogiciel.org>
+---
+ m4/gnupg-pth.m4 |  55 ++++---------------------
+ m4/gpg-error.m4 |  58 ++++++++------------------
+ m4/ksba.m4      |  72 ++++++++------------------------
+ m4/libassuan.m4 | 124 ++++++++++----------------------------------------------
+ m4/libgcrypt.m4 |  73 +++++++++------------------------
+ 5 files changed, 86 insertions(+), 296 deletions(-)
+
+diff --git a/m4/gnupg-pth.m4 b/m4/gnupg-pth.m4
+index 6dc9e0e..374bc87 100644
+--- a/m4/gnupg-pth.m4
++++ b/m4/gnupg-pth.m4
+@@ -11,39 +11,15 @@ dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ # GNUPG_PTH_VERSION_CHECK(REQUIRED)
+-# 
++#
+ # If the version is sufficient, HAVE_PTH will be set to yes.
+ #
+ # Taken and modified from the m4 macros which come with Pth.
+ AC_DEFUN([GNUPG_PTH_VERSION_CHECK],
+   [
+-    _pth_version=`$PTH_CONFIG --version | awk 'NR==1 {print [$]3}'`
+     _req_version="ifelse([$1],,1.2.0,$1)"
++    PKG_CHECK_MODULES(PTH, [pth >= $_req_version], [have_pth=yes], [have_pth=no])
+-    AC_MSG_CHECKING(for PTH - version >= $_req_version)
+-    for _var in _pth_version _req_version; do
+-        eval "_val=\"\$${_var}\""
+-        _major=`echo $_val | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\([[ab.]]\)\([[0-9]]*\)/\1/'`
+-        _minor=`echo $_val | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\([[ab.]]\)\([[0-9]]*\)/\2/'`
+-        _rtype=`echo $_val | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\([[ab.]]\)\([[0-9]]*\)/\3/'`
+-        _micro=`echo $_val | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\([[ab.]]\)\([[0-9]]*\)/\4/'`
+-        case $_rtype in
+-            "a" ) _rtype=0 ;;
+-            "b" ) _rtype=1 ;;
+-            "." ) _rtype=2 ;;
+-        esac
+-        _hex=`echo dummy | awk '{ printf("%d%02d%1d%02d", major, minor, rtype, micro); }' \
+-              "major=$_major" "minor=$_minor" "rtype=$_rtype" "micro=$_micro"`
+-        eval "${_var}_hex=\"\$_hex\""
+-    done
+-    have_pth=no
+-    if test ".$_pth_version_hex" != .; then
+-        if test ".$_req_version_hex" != .; then
+-            if test $_pth_version_hex -ge $_req_version_hex; then
+-                have_pth=yes
+-            fi
+-        fi
+-    fi
+     if test $have_pth = yes; then
+        AC_MSG_RESULT(yes)
+        AC_MSG_CHECKING([whether PTH installation is sane])
+@@ -51,9 +27,9 @@ AC_DEFUN([GNUPG_PTH_VERSION_CHECK],
+          _gnupg_pth_save_cflags=$CFLAGS
+          _gnupg_pth_save_ldflags=$LDFLAGS
+          _gnupg_pth_save_libs=$LIBS
+-         CFLAGS="$CFLAGS `$PTH_CONFIG --cflags`"
+-         LDFLAGS="$LDFLAGS `$PTH_CONFIG --ldflags`"
+-         LIBS="$LIBS `$PTH_CONFIG --libs --all`"
++         CFLAGS="$CFLAGS $PTH_CFLAGS"
++         LDFLAGS="$LDFLAGS $PTH_LDFLAGS"
++         LIBS="$LIBS $PTH_LIBS"
+          AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pth.h>
+                                          ],
+                                          [[ pth_init ();]])],
+@@ -69,7 +45,7 @@ AC_DEFUN([GNUPG_PTH_VERSION_CHECK],
+        AC_MSG_RESULT($gnupg_cv_pth_is_sane)
+     else
+        AC_MSG_RESULT(no)
+-    fi    
++    fi
+   ])
+@@ -80,26 +56,13 @@ AC_DEFUN([GNUPG_PTH_VERSION_CHECK],
+ # PTH_CLFAGS and PTH_LIBS are AS_SUBST.
+ #
+ AC_DEFUN([GNUPG_PATH_PTH],
+-[ AC_ARG_WITH(pth-prefix,
+-             AC_HELP_STRING([--with-pth-prefix=PFX],
+-                           [prefix where GNU Pth is installed (optional)]),
+-     pth_config_prefix="$withval", pth_config_prefix="")
+-  if test x$pth_config_prefix != x ; then
+-     PTH_CONFIG="$pth_config_prefix/bin/pth-config"
+-  fi
+-  AC_PATH_PROG(PTH_CONFIG, pth-config, no)
++[
+   tmp=ifelse([$1], ,1.3.7,$1)
+-  if test "$PTH_CONFIG" != "no"; then
+-    GNUPG_PTH_VERSION_CHECK($tmp)
+-    if test $have_pth = yes; then      
+-       PTH_CFLAGS=`$PTH_CONFIG --cflags`
+-       PTH_LIBS=`$PTH_CONFIG --ldflags`
+-       PTH_LIBS="$PTH_LIBS `$PTH_CONFIG --libs --all`"
++  GNUPG_PTH_VERSION_CHECK($tmp)
++  if test $have_pth = yes; then
+        AC_DEFINE(HAVE_PTH, 1,
+                 [Defined if the GNU Pth is available])
+-    fi
+   fi
+   AC_SUBST(PTH_CFLAGS)
+   AC_SUBST(PTH_LIBS)
+ ])
+-
+diff --git a/m4/gpg-error.m4 b/m4/gpg-error.m4
+index 9d96d16..0ec6f13 100644
+--- a/m4/gpg-error.m4
++++ b/m4/gpg-error.m4
+@@ -1,5 +1,5 @@
+ # gpg-error.m4 - autoconf macro to detect libgpg-error.
+-# Copyright (C) 2002, 2003, 2004 g10 Code GmbH
++# Copyright (C) 2002, 2003, 2004, 2011 g10 Code GmbH
+ #
+ # This file is free software; as a special exception the author gives
+ # unlimited permission to copy and/or distribute it, with or without
+@@ -14,52 +14,30 @@ dnl                   [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
+ dnl Test for libgpg-error and define GPG_ERROR_CFLAGS and GPG_ERROR_LIBS
+ dnl
+ AC_DEFUN([AM_PATH_GPG_ERROR],
+-[ AC_ARG_WITH(gpg-error-prefix,
+-            AC_HELP_STRING([--with-gpg-error-prefix=PFX],
+-                           [prefix where GPG Error is installed (optional)]),
+-     gpg_error_config_prefix="$withval", gpg_error_config_prefix="")
+-  if test x$gpg_error_config_prefix != x ; then
+-     if test x${GPG_ERROR_CONFIG+set} != xset ; then
+-        GPG_ERROR_CONFIG=$gpg_error_config_prefix/bin/gpg-error-config
+-     fi
+-  fi
++[ AC_REQUIRE([AC_CANONICAL_HOST])
+-  AC_PATH_PROG(GPG_ERROR_CONFIG, gpg-error-config, no)
+   min_gpg_error_version=ifelse([$1], ,0.0,$1)
+-  AC_MSG_CHECKING(for GPG Error - version >= $min_gpg_error_version)
+-  ok=no
+-  if test "$GPG_ERROR_CONFIG" != "no" ; then
+-    req_major=`echo $min_gpg_error_version | \
+-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
+-    req_minor=`echo $min_gpg_error_version | \
+-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
+-    gpg_error_config_version=`$GPG_ERROR_CONFIG $gpg_error_config_args --version`
+-    major=`echo $gpg_error_config_version | \
+-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
+-    minor=`echo $gpg_error_config_version | \
+-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
+-    if test "$major" -gt "$req_major"; then
+-        ok=yes
+-    else 
+-        if test "$major" -eq "$req_major"; then
+-            if test "$minor" -ge "$req_minor"; then
+-               ok=yes
+-            fi
+-        fi
+-    fi
+-  fi
++
++  PKG_CHECK_MODULES(GPG_ERROR, [gpg-error >= $min_gpg_error_version], [ok=yes], [ok=no])
++
+   if test $ok = yes; then
+-    GPG_ERROR_CFLAGS=`$GPG_ERROR_CONFIG $gpg_error_config_args --cflags`
+-    GPG_ERROR_LIBS=`$GPG_ERROR_CONFIG $gpg_error_config_args --libs`
+-    AC_MSG_RESULT([yes ($gpg_error_config_version)])
+     ifelse([$2], , :, [$2])
++    gpg_error_config_host=`$PKG_CONFIG --variable=host gpg-error`
++    if test x"$gpg_error_config_host" != xnone ; then
++      if test x"$gpg_error_config_host" != x"$host" ; then
++  AC_MSG_WARN([[
++***
++*** The config script $GPG_ERROR_CONFIG was
++*** built for $gpg_error_config_host and thus may not match the
++*** used host $host.
++*** You may want to use the configure option --with-gpg-error-prefix
++*** to specify a matching config script.
++***]])
++      fi
++    fi
+   else
+-    GPG_ERROR_CFLAGS=""
+-    GPG_ERROR_LIBS=""
+-    AC_MSG_RESULT(no)
+     ifelse([$3], , :, [$3])
+   fi
+   AC_SUBST(GPG_ERROR_CFLAGS)
+   AC_SUBST(GPG_ERROR_LIBS)
+ ])
+-
+diff --git a/m4/ksba.m4 b/m4/ksba.m4
+index 1100387..b65c4ba 100644
+--- a/m4/ksba.m4
++++ b/m4/ksba.m4
+@@ -15,24 +15,14 @@ dnl              [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
+ dnl Test for libksba and define KSBA_CFLAGS and KSBA_LIBS
+ dnl MINIMUN-VERSION is a string with the version number optionalliy prefixed
+ dnl with the API version to also check the API compatibility. Example:
+-dnl a MINIMUN-VERSION of 1:1.0.7 won't pass the test unless the installed 
++dnl a MINIMUN-VERSION of 1:1.0.7 won't pass the test unless the installed
+ dnl version of libksba is at least 1.0.7 *and* the API number is 1.  Using
+ dnl this features allows to prevent build against newer versions of libksba
+ dnl with a changed API.
+ dnl
+ AC_DEFUN([AM_PATH_KSBA],
+-[ AC_ARG_WITH(ksba-prefix,
+-            AC_HELP_STRING([--with-ksba-prefix=PFX],
+-                           [prefix where KSBA is installed (optional)]),
+-     ksba_config_prefix="$withval", ksba_config_prefix="")
+-  if test x$ksba_config_prefix != x ; then
+-     ksba_config_args="$ksba_config_args --prefix=$ksba_config_prefix"
+-     if test x${KSBA_CONFIG+set} != xset ; then
+-        KSBA_CONFIG=$ksba_config_prefix/bin/ksba-config
+-     fi
+-  fi
++[AC_REQUIRE([AC_CANONICAL_HOST])
+-  AC_PATH_PROG(KSBA_CONFIG, ksba-config, no)
+   tmp=ifelse([$1], ,1:1.0.0,$1)
+   if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
+      req_ksba_api=`echo "$tmp"     | sed 's/\(.*\):\(.*\)/\1/'`
+@@ -42,48 +32,13 @@ AC_DEFUN([AM_PATH_KSBA],
+      min_ksba_version="$tmp"
+   fi
+-  AC_MSG_CHECKING(for KSBA - version >= $min_ksba_version)
+-  ok=no
+-  if test "$KSBA_CONFIG" != "no" ; then
+-    req_major=`echo $min_ksba_version | \
+-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
+-    req_minor=`echo $min_ksba_version | \
+-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
+-    req_micro=`echo $min_ksba_version | \
+-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
+-    ksba_config_version=`$KSBA_CONFIG $ksba_config_args --version`
+-    major=`echo $ksba_config_version | \
+-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
+-    minor=`echo $ksba_config_version | \
+-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
+-    micro=`echo $ksba_config_version | \
+-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
+-    if test "$major" -gt "$req_major"; then
+-        ok=yes
+-    else 
+-        if test "$major" -eq "$req_major"; then
+-            if test "$minor" -gt "$req_minor"; then
+-               ok=yes
+-            else
+-               if test "$minor" -eq "$req_minor"; then
+-                   if test "$micro" -ge "$req_micro"; then
+-                     ok=yes
+-                   fi
+-               fi
+-            fi
+-        fi
+-    fi
+-  fi
+-  if test $ok = yes; then
+-    AC_MSG_RESULT([yes ($ksba_config_version)])
+-  else
+-    AC_MSG_RESULT(no)
+-  fi
++  PKG_CHECK_MODULES(KSBA, [ksba >= $min_ksba_version], [ok=yes], [ok=no])
++
+   if test $ok = yes; then
+      # Even if we have a recent libksba, we should check that the
+      # API is compatible.
+      if test "$req_ksba_api" -gt 0 ; then
+-        tmp=`$KSBA_CONFIG --api-version 2>/dev/null || echo 0`
++        tmp=`$PKG_CONFIG --variable=api_version ksba`
+         if test "$tmp" -gt 0 ; then
+            AC_MSG_CHECKING([KSBA API version])
+            if test "$req_ksba_api" -eq "$tmp" ; then
+@@ -96,12 +51,21 @@ AC_DEFUN([AM_PATH_KSBA],
+      fi
+   fi
+   if test $ok = yes; then
+-    KSBA_CFLAGS=`$KSBA_CONFIG $ksba_config_args --cflags`
+-    KSBA_LIBS=`$KSBA_CONFIG $ksba_config_args --libs`
+     ifelse([$2], , :, [$2])
++    libksba_config_host=`$PKG_CONFIG --variable=host ksba`
++    if test x"$libksba_config_host" != xnone ; then
++      if test x"$libksba_config_host" != x"$host" ; then
++  AC_MSG_WARN([[
++***
++*** The config script $LIBKSBA_CONFIG was
++*** built for $libksba_config_host and thus may not match the
++*** used host $host.
++*** You may want to use the configure option --with-libksba-prefix
++*** to specify a matching config script.
++***]])
++      fi
++    fi
+   else
+-    KSBA_CFLAGS=""
+-    KSBA_LIBS=""
+     ifelse([$3], , :, [$3])
+   fi
+   AC_SUBST(KSBA_CFLAGS)
+diff --git a/m4/libassuan.m4 b/m4/libassuan.m4
+index 004eee3..2bde244 100644
+--- a/m4/libassuan.m4
++++ b/m4/libassuan.m4
+@@ -1,5 +1,5 @@
+ dnl Autoconf macros for libassuan
+-dnl       Copyright (C) 2002, 2003 Free Software Foundation, Inc.
++dnl Copyright (C) 2002, 2003, 2011 Free Software Foundation, Inc.
+ dnl
+ dnl This file is free software; as a special exception the author gives
+ dnl unlimited permission to copy and/or distribute it, with or without
+@@ -14,17 +14,7 @@ dnl Common code used for libassuan detection [internal]
+ dnl Returns ok set to yes or no.
+ dnl
+ AC_DEFUN([_AM_PATH_LIBASSUAN_COMMON],
+-[ AC_ARG_WITH(libassuan-prefix,
+-              AC_HELP_STRING([--with-libassuan-prefix=PFX],
+-                             [prefix where LIBASSUAN is installed (optional)]),
+-     libassuan_config_prefix="$withval", libassuan_config_prefix="")
+-  if test x$libassuan_config_prefix != x ; then
+-    libassuan_config_args="$libassuan_config_args --prefix=$libassuan_config_prefix"
+-    if test x${LIBASSUAN_CONFIG+set} != xset ; then
+-      LIBASSUAN_CONFIG=$libassuan_config_prefix/bin/libassuan-config
+-    fi
+-  fi
+-  AC_PATH_PROG(LIBASSUAN_CONFIG, libassuan-config, no)
++[ AC_REQUIRE([AC_CANONICAL_HOST])
+   tmp=ifelse([$1], ,1:0.9.2,$1)
+   if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
+@@ -35,55 +25,14 @@ AC_DEFUN([_AM_PATH_LIBASSUAN_COMMON],
+     min_libassuan_version="$tmp"
+   fi
+-  if test "$LIBASSUAN_CONFIG" != "no" ; then
+-    libassuan_version=`$LIBASSUAN_CONFIG --version`
+-  fi
+-  libassuan_version_major=`echo $libassuan_version | \
+-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
+-  libassuan_version_minor=`echo $libassuan_version | \
+-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
+-  libassuan_version_micro=`echo $libassuan_version | \
+-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
+-
+-  AC_MSG_CHECKING(for LIBASSUAN ifelse([$2], ,,[$2 ])- version >= $min_libassuan_version)
+-  ok=no
+-  if test "$LIBASSUAN_CONFIG" != "no" ; then
+-    ifelse([$2], ,,[if `$LIBASSUAN_CONFIG --thread=$2 2> /dev/null` ; then])
+-    req_major=`echo $min_libassuan_version | \
+-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
+-    req_minor=`echo $min_libassuan_version | \
+-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
+-    req_micro=`echo $min_libassuan_version | \
+-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
+-    if test "$libassuan_version_major" -gt "$req_major"; then
+-        ok=yes
+-    else 
+-        if test "$libassuan_version_major" -eq "$req_major"; then
+-            if test "$libassuan_version_minor" -gt "$req_minor"; then
+-               ok=yes
+-            else
+-               if test "$libassuan_version_minor" -eq "$req_minor"; then
+-                   if test "$libassuan_version_micro" -ge "$req_micro"; then
+-                     ok=yes
+-                   fi
+-               fi
+-            fi
+-        fi
+-    fi
+-    ifelse([$2], ,,[fi])
+-  fi
+-
+-  if test $ok = yes; then
+-    AC_MSG_RESULT([yes ($libassuan_version)])
+-  else
+-    AC_MSG_RESULT(no)
+-  fi
++  PKG_CHECK_MODULES(LIBASSUAN, [libassuan >= $min_libassuan_version], [ok=yes], [ok=no])
+   if test $ok = yes; then
+     if test "$req_libassuan_api" -gt 0 ; then
+       tmp=`$LIBASSUAN_CONFIG --api-version 2>/dev/null || echo 0`
++      tmp=`$PKG_CONFIG --variable=api_version libassuan`
+       if test "$tmp" -gt 0 ; then
+-        AC_MSG_CHECKING([LIBASSUAN ifelse([$2], ,,[$2 ])API version])
++        AC_MSG_CHECKING([LIBASSUAN API version])
+         if test "$req_libassuan_api" -eq "$tmp" ; then
+           AC_MSG_RESULT(okay)
+         else
+@@ -94,6 +43,23 @@ AC_DEFUN([_AM_PATH_LIBASSUAN_COMMON],
+     fi
+   fi
++  if test $ok = yes; then
++    if test x"$host" != x ; then
++      libassuan_config_host=`$PKG_CONFIG --variable=host libassuan`
++      if test x"$libassuan_config_host" != xnone ; then
++        if test x"$libassuan_config_host" != x"$host" ; then
++  AC_MSG_WARN([[
++***
++*** The config script $LIBASSUAN_CONFIG was
++*** built for $libassuan_config_host and thus may not match the
++*** used host $host.
++*** You may want to use the configure option --with-libassuan-prefix
++*** to specify a matching config script.
++***]])
++        fi
++      fi
++    fi
++  fi
+ ])
+ dnl AM_CHECK_LIBASSUAN([MINIMUM-VERSION,
+@@ -120,56 +86,10 @@ dnl
+ AC_DEFUN([AM_PATH_LIBASSUAN],
+ [ _AM_PATH_LIBASSUAN_COMMON($1)
+   if test $ok = yes; then
+-    LIBASSUAN_CFLAGS=`$LIBASSUAN_CONFIG $libassuan_config_args --cflags`
+-    LIBASSUAN_LIBS=`$LIBASSUAN_CONFIG $libassuan_config_args --libs`
+     ifelse([$2], , :, [$2])
+   else
+-    LIBASSUAN_CFLAGS=""
+-    LIBASSUAN_LIBS=""
+     ifelse([$3], , :, [$3])
+   fi
+   AC_SUBST(LIBASSUAN_CFLAGS)
+   AC_SUBST(LIBASSUAN_LIBS)
+ ])
+-
+-
+-dnl AM_PATH_LIBASSUAN_PTH([MINIMUM-VERSION,
+-dnl                      [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
+-dnl Test for libassuan and define LIBASSUAN_PTH_CFLAGS and LIBASSUAN_PTH_LIBS
+-dnl
+-AC_DEFUN([AM_PATH_LIBASSUAN_PTH],
+-[ _AM_PATH_LIBASSUAN_COMMON($1,pth)
+-  if test $ok = yes; then
+-    LIBASSUAN_PTH_CFLAGS=`$LIBASSUAN_CONFIG $libassuan_config_args --thread=pth --cflags`
+-    LIBASSUAN_PTH_LIBS=`$LIBASSUAN_CONFIG $libassuan_config_args --thread=pth --libs`
+-    ifelse([$2], , :, [$2])
+-  else
+-    LIBASSUAN_PTH_CFLAGS=""
+-    LIBASSUAN_PTH_LIBS=""
+-    ifelse([$3], , :, [$3])
+-  fi
+-  AC_SUBST(LIBASSUAN_PTH_CFLAGS)
+-  AC_SUBST(LIBASSUAN_PTH_LIBS)
+-])
+-
+-
+-dnl AM_PATH_LIBASSUAN_PTHREAD([MINIMUM-VERSION,
+-dnl                           [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
+-dnl Test for libassuan and define LIBASSUAN_PTHREAD_CFLAGS 
+-dnl                           and LIBASSUAN_PTHREAD_LIBS
+-dnl
+-AC_DEFUN([AM_PATH_LIBASSUAN_PTHREAD],
+-[ _AM_PATH_LIBASSUAN_COMMON($1,pthread)
+-  if test $ok = yes; then
+-    LIBASSUAN_PTHREAD_CFLAGS=`$LIBASSUAN_CONFIG $libassuan_config_args --thread=pthread --cflags`
+-    LIBASSUAN_PTHREAD_LIBS=`$LIBASSUAN_CONFIG $libassuan_config_args --thread=pthread --libs`
+-    ifelse([$2], , :, [$2])
+-  else
+-    LIBASSUAN_PTHREAD_CFLAGS=""
+-    LIBASSUAN_PTHREAD_LIBS=""
+-    ifelse([$3], , :, [$3])
+-  fi
+-  AC_SUBST(LIBASSUAN_PTHREAD_CFLAGS)
+-  AC_SUBST(LIBASSUAN_PTHREAD_LIBS)
+-])
+-
+diff --git a/m4/libgcrypt.m4 b/m4/libgcrypt.m4
+index 854eaaa..38d9a82 100644
+--- a/m4/libgcrypt.m4
++++ b/m4/libgcrypt.m4
+@@ -1,5 +1,5 @@
+ dnl Autoconf macros for libgcrypt
+-dnl       Copyright (C) 2002, 2004 Free Software Foundation, Inc.
++dnl       Copyright (C) 2002, 2004, 2011 Free Software Foundation, Inc.
+ dnl
+ dnl This file is free software; as a special exception the author gives
+ dnl unlimited permission to copy and/or distribute it, with or without
+@@ -15,23 +15,14 @@ dnl                   [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
+ dnl Test for libgcrypt and define LIBGCRYPT_CFLAGS and LIBGCRYPT_LIBS.
+ dnl MINIMUN-VERSION is a string with the version number optionalliy prefixed
+ dnl with the API version to also check the API compatibility. Example:
+-dnl a MINIMUN-VERSION of 1:1.2.5 won't pass the test unless the installed 
++dnl a MINIMUN-VERSION of 1:1.2.5 won't pass the test unless the installed
+ dnl version of libgcrypt is at least 1.2.5 *and* the API number is 1.  Using
+ dnl this features allows to prevent build against newer versions of libgcrypt
+ dnl with a changed API.
+ dnl
+ AC_DEFUN([AM_PATH_LIBGCRYPT],
+-[ AC_ARG_WITH(libgcrypt-prefix,
+-            AC_HELP_STRING([--with-libgcrypt-prefix=PFX],
+-                           [prefix where LIBGCRYPT is installed (optional)]),
+-     libgcrypt_config_prefix="$withval", libgcrypt_config_prefix="")
+-  if test x$libgcrypt_config_prefix != x ; then
+-     if test x${LIBGCRYPT_CONFIG+set} != xset ; then
+-        LIBGCRYPT_CONFIG=$libgcrypt_config_prefix/bin/libgcrypt-config
+-     fi
+-  fi
++[ AC_REQUIRE([AC_CANONICAL_HOST])
+-  AC_PATH_PROG(LIBGCRYPT_CONFIG, libgcrypt-config, no)
+   tmp=ifelse([$1], ,1:1.2.0,$1)
+   if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
+      req_libgcrypt_api=`echo "$tmp"     | sed 's/\(.*\):\(.*\)/\1/'`
+@@ -41,48 +32,13 @@ AC_DEFUN([AM_PATH_LIBGCRYPT],
+      min_libgcrypt_version="$tmp"
+   fi
+-  AC_MSG_CHECKING(for LIBGCRYPT - version >= $min_libgcrypt_version)
+-  ok=no
+-  if test "$LIBGCRYPT_CONFIG" != "no" ; then
+-    req_major=`echo $min_libgcrypt_version | \
+-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
+-    req_minor=`echo $min_libgcrypt_version | \
+-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
+-    req_micro=`echo $min_libgcrypt_version | \
+-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
+-    libgcrypt_config_version=`$LIBGCRYPT_CONFIG --version`
+-    major=`echo $libgcrypt_config_version | \
+-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
+-    minor=`echo $libgcrypt_config_version | \
+-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
+-    micro=`echo $libgcrypt_config_version | \
+-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
+-    if test "$major" -gt "$req_major"; then
+-        ok=yes
+-    else 
+-        if test "$major" -eq "$req_major"; then
+-            if test "$minor" -gt "$req_minor"; then
+-               ok=yes
+-            else
+-               if test "$minor" -eq "$req_minor"; then
+-                   if test "$micro" -ge "$req_micro"; then
+-                     ok=yes
+-                   fi
+-               fi
+-            fi
+-        fi
+-    fi
+-  fi
+-  if test $ok = yes; then
+-    AC_MSG_RESULT([yes ($libgcrypt_config_version)])
+-  else
+-    AC_MSG_RESULT(no)
+-  fi
++  PKG_CHECK_MODULES(LIBGCRYPT, [libgcrypt >= $min_libgcrypt_version], [ok=yes], [ok=no])
++
+   if test $ok = yes; then
+      # If we have a recent libgcrypt, we should also check that the
+      # API is compatible
+      if test "$req_libgcrypt_api" -gt 0 ; then
+-        tmp=`$LIBGCRYPT_CONFIG --api-version 2>/dev/null || echo 0`
++        tmp=`$PKG_CONFIG --variable=api_version libgcrypt`
+         if test "$tmp" -gt 0 ; then
+            AC_MSG_CHECKING([LIBGCRYPT API version])
+            if test "$req_libgcrypt_api" -eq "$tmp" ; then
+@@ -95,12 +51,21 @@ AC_DEFUN([AM_PATH_LIBGCRYPT],
+      fi
+   fi
+   if test $ok = yes; then
+-    LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG --cflags`
+-    LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG --libs`
+     ifelse([$2], , :, [$2])
++    libgcrypt_config_host=`$PKG_CONFIG --variable=host libgcrypt`
++    if test x"$libgcrypt_config_host" != xnone ; then
++      if test x"$libgcrypt_config_host" != x"$host" ; then
++  AC_MSG_WARN([[
++***
++*** The config script $LIBGCRYPT_CONFIG was
++*** built for $libgcrypt_config_host and thus may not match the
++*** used host $host.
++*** You may want to use the configure option --with-libgcrypt-prefix
++*** to specify a matching config script.
++***]])
++      fi
++    fi
+   else
+-    LIBGCRYPT_CFLAGS=""
+-    LIBGCRYPT_LIBS=""
+     ifelse([$3], , :, [$3])
+   fi
+   AC_SUBST(LIBGCRYPT_CFLAGS)
+-- 
+1.8.1.4
+
diff --git a/recipes-tizen/gpg2/gpg2/0002-Do-not-set-gcrypt-thread-callback.patch b/recipes-tizen/gpg2/gpg2/0002-Do-not-set-gcrypt-thread-callback.patch
new file mode 100644 (file)
index 0000000..9c12dba
--- /dev/null
@@ -0,0 +1,92 @@
+From 398602cad11b96025552e981f210f93c6ce03218 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?K=C3=A9vin=20THIERRY?= <kevin.thierry@open.eurogiciel.org>
+Date: Tue, 2 Sep 2014 16:04:25 +0200
+Subject: [PATCH] Do not set gcrypt thread callback
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Setting gcrypt thread callback is only for older versions of gcrypt
+which is not our case.
+
+Related patch on gnupg project:
+https://gitorious.org/gnupg/mainline/commit/a2d9e48fcca6cfc2dfadef6dbd3579a30314676b
+
+Signed-off-by: Kévin THIERRY <kevin.thierry@open.eurogiciel.org>
+---
+ agent/gpg-agent.c | 17 -----------------
+ scd/scdaemon.c    | 16 ----------------
+ 2 files changed, 33 deletions(-)
+
+diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c
+index b00d899..2634016 100644
+--- a/agent/gpg-agent.c
++++ b/agent/gpg-agent.c
+@@ -277,12 +277,6 @@ static int check_for_running_agent (int silent, int mode);
+ /* Pth wrapper function definitions. */
+ ASSUAN_SYSTEM_PTH_IMPL;
+-GCRY_THREAD_OPTION_PTH_IMPL;
+-static int fixed_gcry_pth_init (void)
+-{
+-  return pth_self ()? 0 : (pth_init () == FALSE) ? errno : 0;
+-}
+-
+ #ifndef PTH_HAVE_PTH_THREAD_ID
+ static unsigned long pth_thread_id (void)
+@@ -592,17 +586,6 @@ main (int argc, char **argv )
+   init_common_subsystems ();
+-  /* Libgcrypt requires us to register the threading model first.
+-     Note that this will also do the pth_init. */
+-  gcry_threads_pth.init = fixed_gcry_pth_init;
+-  err = gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pth);
+-  if (err)
+-    {
+-      log_fatal ("can't register GNU Pth with Libgcrypt: %s\n",
+-                 gpg_strerror (err));
+-    }
+-
+-
+   /* Check that the libraries are suitable.  Do it here because
+      the option parsing may need services of the library. */
+   if (!gcry_check_version (NEED_LIBGCRYPT_VERSION) )
+diff --git a/scd/scdaemon.c b/scd/scdaemon.c
+index 064d342..320e2c7 100644
+--- a/scd/scdaemon.c
++++ b/scd/scdaemon.c
+@@ -205,12 +205,6 @@ static void handle_connections (int listen_fd);
+ /* Pth wrapper function definitions. */
+ ASSUAN_SYSTEM_PTH_IMPL;
+-GCRY_THREAD_OPTION_PTH_IMPL;
+-static int fixed_gcry_pth_init (void)
+-{
+-  return pth_self ()? 0 : (pth_init () == FALSE) ? errno : 0;
+-}
+-
\f
+ static char *
+@@ -407,16 +401,6 @@ main (int argc, char **argv )
+   init_common_subsystems ();
+-  /* Libgcrypt requires us to register the threading model first.
+-     Note that this will also do the pth_init. */
+-  gcry_threads_pth.init = fixed_gcry_pth_init;
+-  err = gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pth);
+-  if (err)
+-    {
+-      log_fatal ("can't register GNU Pth with Libgcrypt: %s\n",
+-                 gpg_strerror (err));
+-    }
+-
+   /* Check that the libraries are suitable.  Do it here because
+      the option parsing may need services of the library */
+   if (!gcry_check_version (NEED_LIBGCRYPT_VERSION) )
+-- 
+1.8.1.4
+
diff --git a/recipes-tizen/gpg2/gpg2/0003-Remove-obsolete-function-gcry_md_start_debug.patch b/recipes-tizen/gpg2/gpg2/0003-Remove-obsolete-function-gcry_md_start_debug.patch
new file mode 100644 (file)
index 0000000..fb4eb60
--- /dev/null
@@ -0,0 +1,178 @@
+From 6e44dd396029ed403dceeca5a5e1a60bbb427f74 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?K=C3=A9vin=20THIERRY?= <kevin.thierry@open.eurogiciel.org>
+Date: Tue, 2 Sep 2014 16:20:16 +0200
+Subject: [PATCH] Remove obsolete function gcry_md_start_debug()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Kévin THIERRY <kevin.thierry@open.eurogiciel.org>
+---
+ g10/cipher.c    |  2 --
+ g10/encr-data.c |  2 --
+ g10/mainproc.c  | 10 ----------
+ g10/sign.c      |  6 ------
+ sm/certcheck.c  |  2 --
+ sm/certreqgen.c |  2 --
+ sm/sign.c       |  4 ----
+ sm/verify.c     |  4 ----
+ 8 files changed, 32 deletions(-)
+
+diff --git a/g10/cipher.c b/g10/cipher.c
+index f0dc577..2bbacb5 100644
+--- a/g10/cipher.c
++++ b/g10/cipher.c
+@@ -60,8 +60,6 @@ write_header( cipher_filter_context_t *cfx, IOBUF a )
+     if( cfx->dek->use_mdc ) {
+       ed.mdc_method = DIGEST_ALGO_SHA1;
+       gcry_md_open (&cfx->mdc_hash, DIGEST_ALGO_SHA1, 0);
+-      if ( DBG_HASHING )
+-          gcry_md_start_debug (cfx->mdc_hash, "creatmdc");
+     }
+     {
+diff --git a/g10/encr-data.c b/g10/encr-data.c
+index 602ae55..2f0fac1 100644
+--- a/g10/encr-data.c
++++ b/g10/encr-data.c
+@@ -118,8 +118,6 @@ decrypt_data( void *procctx, PKT_encrypted *ed, DEK *dek )
+     {
+       if (gcry_md_open (&dfx->mdc_hash, ed->mdc_method, 0 ))
+         BUG ();
+-      if ( DBG_HASHING )
+-        gcry_md_start_debug (dfx->mdc_hash, "checkmdc");
+     }
+   rc = openpgp_cipher_open (&dfx->cipher_hd, dek->algo,
+diff --git a/g10/mainproc.c b/g10/mainproc.c
+index c7df113..9679d8f 100644
+--- a/g10/mainproc.c
++++ b/g10/mainproc.c
+@@ -698,11 +698,6 @@ proc_plaintext( CTX c, PACKET *pkt )
+       if ( gcry_md_open (&c->mfx.md2, DIGEST_ALGO_MD5, 0) )
+         BUG ();
+     }
+-    if ( DBG_HASHING ) {
+-      gcry_md_start_debug ( c->mfx.md, "verify" );
+-      if ( c->mfx.md2  )
+-          gcry_md_start_debug ( c->mfx.md2, "verify2" );
+-    }
+     rc=0;
+@@ -2137,11 +2132,6 @@ proc_tree( CTX c, KBNODE node )
+            */
+                   /*  c->mfx.md2? 0 :(sig->sig_class == 0x01) */
+ #endif
+-            if ( DBG_HASHING ) {
+-                gcry_md_start_debug( c->mfx.md, "verify" );
+-                if ( c->mfx.md2  )
+-                    gcry_md_start_debug( c->mfx.md2, "verify2" );
+-            }
+           if( c->sigs_only ) {
+                 if (c->signed_data.used && c->signed_data.data_fd != -1)
+                     rc = hash_datafile_by_fd (c->mfx.md, c->mfx.md2,
+diff --git a/g10/sign.c b/g10/sign.c
+index 8d280ed..163cbb5 100644
+--- a/g10/sign.c
++++ b/g10/sign.c
+@@ -816,8 +816,6 @@ sign_file( strlist_t filenames, int detached, strlist_t locusr,
+     if ( gcry_md_open (&mfx.md, 0, 0) )
+       BUG ();
+-    if (DBG_HASHING)
+-      gcry_md_start_debug (mfx.md, "sign");
+     /* If we're encrypting and signing, it is reasonable to pick the
+        hash algorithm to use out of the recepient key prefs.  This is
+@@ -1165,8 +1163,6 @@ clearsign_file( const char *fname, strlist_t locusr, const char *outfile )
+       PKT_secret_key *sk = sk_rover->sk;
+       gcry_md_enable (textmd, hash_for(sk));
+     }
+-    if ( DBG_HASHING )
+-      gcry_md_start_debug ( textmd, "clearsign" );
+     copy_clearsig_text( out, inp, textmd, !opt.not_dash_escaped,
+                       opt.escape_from, (old_style && only_md5) );
+@@ -1287,8 +1283,6 @@ sign_symencrypt_file (const char *fname, strlist_t locusr)
+       iobuf_push_filter (inp, text_filter, &tfx);
+     if ( gcry_md_open (&mfx.md, 0, 0) )
+       BUG ();
+-    if ( DBG_HASHING )
+-      gcry_md_start_debug (mfx.md, "symc-sign");
+     for (sk_rover = sk_list; sk_rover; sk_rover = sk_rover->next) {
+       PKT_secret_key *sk = sk_rover->sk;
+diff --git a/sm/certcheck.c b/sm/certcheck.c
+index 51a809b..8477a06 100644
+--- a/sm/certcheck.c
++++ b/sm/certcheck.c
+@@ -250,8 +250,6 @@ gpgsm_check_cert_sig (ksba_cert_t issuer_cert, ksba_cert_t cert)
+       log_error ("md_open failed: %s\n", gpg_strerror (rc));
+       return rc;
+     }
+-  if (DBG_HASHING)
+-    gcry_md_start_debug (md, "hash.cert");
+   rc = ksba_cert_hash (cert, 1, HASH_FNC, md);
+   if (rc)
+diff --git a/sm/certreqgen.c b/sm/certreqgen.c
+index 49b2b92..067f0f7 100644
+--- a/sm/certreqgen.c
++++ b/sm/certreqgen.c
+@@ -617,8 +617,6 @@ create_request (ctrl_t ctrl,
+       log_error ("md_open failed: %s\n", gpg_strerror (rc));
+       goto leave;
+     }
+-  if (DBG_HASHING)
+-    gcry_md_start_debug (md, "cr.cri");
+   ksba_certreq_set_hash_function (cr, HASH_FNC, md);
+   ksba_certreq_set_writer (cr, outctrl->writer);
+diff --git a/sm/sign.c b/sm/sign.c
+index fd7c4ff..8f7a469 100644
+--- a/sm/sign.c
++++ b/sm/sign.c
+@@ -534,8 +534,6 @@ gpgsm_sign (ctrl_t ctrl, certlist_t signerlist,
+       log_error ("md_open failed: %s\n", gpg_strerror (rc));
+       goto leave;
+     }
+-  if (DBG_HASHING)
+-    gcry_md_start_debug (data_md, "sign.data");
+   for (i=0; (algoid=ksba_cms_get_digest_algo_list (cms, i)); i++)
+     {
+@@ -668,8 +666,6 @@ gpgsm_sign (ctrl_t ctrl, certlist_t signerlist,
+               log_error ("md_open failed: %s\n", gpg_strerror (rc));
+               goto leave;
+             }
+-          if (DBG_HASHING)
+-            gcry_md_start_debug (md, "sign.attr");
+           ksba_cms_set_hash_function (cms, HASH_FNC, md);
+           for (cl=signerlist,signer=0; cl; cl = cl->next, signer++)
+             {
+diff --git a/sm/verify.c b/sm/verify.c
+index c8663e3..f444faa 100644
+--- a/sm/verify.c
++++ b/sm/verify.c
+@@ -159,8 +159,6 @@ gpgsm_verify (ctrl_t ctrl, int in_fd, int data_fd, FILE *out_fp)
+       log_error ("md_open failed: %s\n", gpg_strerror (rc));
+       goto leave;
+     }
+-  if (DBG_HASHING)
+-    gcry_md_start_debug (data_md, "vrfy.data");
+   audit_log (ctrl->audit, AUDIT_SETUP_READY);
+@@ -495,8 +493,6 @@ gpgsm_verify (ctrl_t ctrl, int in_fd, int data_fd, FILE *out_fp)
+               audit_log_s (ctrl->audit, AUDIT_SIG_STATUS, "error");
+               goto next_signer;
+             }
+-          if (DBG_HASHING)
+-            gcry_md_start_debug (md, "vrfy.attr");
+           ksba_cms_set_hash_function (cms, HASH_FNC, md);
+           rc = ksba_cms_hash_signed_attrs (cms, signer);
+-- 
+1.8.1.4
+