Package: gkrellm
Version: 2.3.5-5
Severity: normal
Tags: patch

Hello,
please change the package's build-dependency from libgnutls-dev to
libgnutls-openssl-dev. The latter is a virtual package provided by
libgnutls-dev in sid and libgnutls28-dev in experimental. Having the
reverse dependencies change should allow us to transition to the newer
version. (See #726828.)

Find attached a patch that
a) changes the build-depency
b) stops the unnecessary linkage against gcrypt.

I have test-built the patched package against both libgnutls-dev/sid
and libgnutls28-dev/experimental to verify that continues to build
against GnuTLS 3.x.

Thanks, cu Andreas
-- 
`What a good friend you are to him, Dr. Maturin. His other friends are
so grateful to you.'
`I sew his ears on from time to time, sure'
diff -Nru gkrellm-2.3.5/debian/changelog gkrellm-2.3.5/debian/changelog
--- gkrellm-2.3.5/debian/changelog	2013-06-29 23:50:21.000000000 +0200
+++ gkrellm-2.3.5/debian/changelog	2013-12-07 15:10:54.000000000 +0100
@@ -1,3 +1,14 @@
+gkrellm (2.3.5-5.1) UNRELEASED; urgency=low
+
+  * Non-maintainer upload.
+  * Pull 11_Only-use-Libgcrypt-for-GnuTLS-2.12.patch and
+    12_Do-not-include-gcrypt.h-for-newer-GnuTLS-versions.patch from upstream
+    GIT to stop unnecessary linkage against libgcrypt. Closes: #638646
+  * Build-Depend on libgnutls-openssl-dev instead of libgnutls-dev to allow
+    transitioning to newer GnuTLS.
+
+ -- Andreas Metzler <[email protected]>  Fri, 06 Dec 2013 19:27:09 +0100
+
 gkrellm (2.3.5-5) unstable; urgency=low
 
   * Upload to unstable
diff -Nru gkrellm-2.3.5/debian/control gkrellm-2.3.5/debian/control
--- gkrellm-2.3.5/debian/control	2013-06-29 23:50:21.000000000 +0200
+++ gkrellm-2.3.5/debian/control	2013-12-06 19:27:46.000000000 +0100
@@ -3,7 +3,7 @@
 Priority: optional
 Maintainer: Sandro Tosi <[email protected]>
 Standards-Version: 3.9.4
-Build-Depends: libglib2.0-dev, libgtk2.0-dev, debhelper (>= 9), libsm-dev, x11proto-core-dev, gettext, libgnutls-dev, libntlm0-dev, libsensors4-dev
+Build-Depends: libglib2.0-dev, libgtk2.0-dev, debhelper (>= 9), libsm-dev, x11proto-core-dev, gettext, libgnutls-openssl-dev, libntlm0-dev, libsensors4-dev
 Vcs-Git: git://anonscm.debian.org/collab-maint/gkrellm.git
 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/gkrellm.git
 Homepage: http://gkrellm.net/
diff -Nru gkrellm-2.3.5/debian/patches/11_Only-use-Libgcrypt-for-GnuTLS-2.12.patch gkrellm-2.3.5/debian/patches/11_Only-use-Libgcrypt-for-GnuTLS-2.12.patch
--- gkrellm-2.3.5/debian/patches/11_Only-use-Libgcrypt-for-GnuTLS-2.12.patch	1970-01-01 01:00:00.000000000 +0100
+++ gkrellm-2.3.5/debian/patches/11_Only-use-Libgcrypt-for-GnuTLS-2.12.patch	2013-12-07 15:11:49.000000000 +0100
@@ -0,0 +1,72 @@
+From 752e5965b197d70a9125dc3319a8c5e5673a8f8b Mon Sep 17 00:00:00 2001
+From: Stefan Gehn <[email protected]>
+Date: Sat, 27 Aug 2011 16:32:31 +0200
+Subject: [PATCH 1/3] Only use Libgcrypt for GnuTLS < 2.12
+
+Only initialize Libgcrypt threading functions on GnuTLS < 2.12 which
+does not do this automatically. Also drop explicit linking against
+Libgcrypt on newer GnuTLS version.
+
+This should allow GKrellM to work with a GnuTLS that uses Nettle instead
+of Libgcrypt as its cryptographic backend.
+---
+ Changelog     |    3 +++
+ src/configure |    7 ++++++-
+ src/mail.c    |    8 ++++++++
+ 3 files changed, 17 insertions(+), 1 deletion(-)
+
+diff --git a/src/configure b/src/configure
+index bfe29c6..620f1e9 100755
+--- a/src/configure
++++ b/src/configure
+@@ -96,7 +96,12 @@ echo -n "Checking for gnutls... "
+ echo "Checking for gnutls... " 1>& 5
+ 
+ GNUTLS_INCLUDE="$(pkg-config gnutls --cflags 2>& 5 || true)"
+-GNUTLS_LIBS="$(pkg-config gnutls --libs 2>& 5 || true) -lgnutls-openssl -lgcrypt"
++GNUTLS_LIBS="$(pkg-config gnutls --libs 2>& 5 || true) -lgnutls-openssl"
++
++# GnuTLS >= 2.12 does not need explicit gcrypt linking anymore
++if $(pkg-config --max-version=2.11.99 gnutls 2>& 5 || false); then
++	GNUTLS_LIBS="$GNUTLS_LIBS -lgcrypt"
++fi
+ 
+ cat << EOF > test.c
+ #include <gnutls/openssl.h>
+diff --git a/src/mail.c b/src/mail.c
+index a4e04bf..3ae5227 100644
+--- a/src/mail.c
++++ b/src/mail.c
+@@ -51,6 +51,9 @@
+ #define MD5Update	MD5_Update
+ #define MD5Final	MD5_Final
+ 
++#if GNUTLS_VERSION_NUMBER <= 0x020b00
++/* gcrypt mutex setup is only needed for GnuTLS < 2.12 */
++
+ static int gk_gcry_glib_mutex_init (void **priv) {
+     GMutex *lock = g_mutex_new();
+     if (!lock)
+@@ -90,6 +93,8 @@ static struct gcry_thread_cbs gk_gcry_threads_glib = {
+   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
+ };
+ 
++#endif
++
+ #else
+ 
+ #if defined(HAVE_SSL)
+@@ -4340,7 +4345,10 @@ gkrellm_init_mail_monitor(void)
+ 	_GK.decal_mail_delay = 1;
+ 
+ #ifdef HAVE_GNUTLS
++#if GNUTLS_VERSION_NUMBER <= 0x020b00
++	/* gcrypt mutex setup, only needed for GnuTLS < 2.12 */
+ 	gcry_control (GCRYCTL_SET_THREAD_CBS, &gk_gcry_threads_glib);
++#endif
+ 	gnutls_global_init();
+ 	SSL_load_error_strings();
+ 	SSL_library_init();
+-- 
+1.7.10.4
+
diff -Nru gkrellm-2.3.5/debian/patches/12_Do-not-include-gcrypt.h-for-newer-GnuTLS-versions.patch gkrellm-2.3.5/debian/patches/12_Do-not-include-gcrypt.h-for-newer-GnuTLS-versions.patch
--- gkrellm-2.3.5/debian/patches/12_Do-not-include-gcrypt.h-for-newer-GnuTLS-versions.patch	1970-01-01 01:00:00.000000000 +0100
+++ gkrellm-2.3.5/debian/patches/12_Do-not-include-gcrypt.h-for-newer-GnuTLS-versions.patch	2013-12-07 15:10:47.000000000 +0100
@@ -0,0 +1,56 @@
+From fdc17315b719320aae7e77a5f482b4865cd2f4d9 Mon Sep 17 00:00:00 2001
+From: Stefan Gehn <[email protected]>
+Date: Sat, 26 Nov 2011 20:00:53 +0100
+Subject: [PATCH 2/3] Do not include gcrypt.h for newer GnuTLS versions
+
+Not linking against Libgcrypt is not enough, we also should not try to
+include headers. This fixes GnuTLS >= 2.12 detection when Libgcrypt
+headers are not installed/found.
+---
+ src/configure |    4 +++-
+ src/mail.c    |    3 ++-
+ 2 files changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/src/configure b/src/configure
+index 620f1e9..1be1c27 100755
+--- a/src/configure
++++ b/src/configure
+@@ -99,13 +99,15 @@ GNUTLS_INCLUDE="$(pkg-config gnutls --cflags 2>& 5 || true)"
+ GNUTLS_LIBS="$(pkg-config gnutls --libs 2>& 5 || true) -lgnutls-openssl"
+ 
+ # GnuTLS >= 2.12 does not need explicit gcrypt linking anymore
++gcrypt_h=""
+ if $(pkg-config --max-version=2.11.99 gnutls 2>& 5 || false); then
+ 	GNUTLS_LIBS="$GNUTLS_LIBS -lgcrypt"
++	gcrypt_h="#include <gcrypt.h>"
+ fi
+ 
+ cat << EOF > test.c
+ #include <gnutls/openssl.h>
+-#include <gcrypt.h>
++$gcrypt_h
+ #include <errno.h>
+ 
+ int main()
+diff --git a/src/mail.c b/src/mail.c
+index 3ae5227..fa410a2 100644
+--- a/src/mail.c
++++ b/src/mail.c
+@@ -46,12 +46,13 @@
+ 
+ #if defined(HAVE_GNUTLS)
+ #include <gnutls/openssl.h>
+-#include <gcrypt.h>
++
+ #define MD5Init		MD5_Init
+ #define MD5Update	MD5_Update
+ #define MD5Final	MD5_Final
+ 
+ #if GNUTLS_VERSION_NUMBER <= 0x020b00
++#include <gcrypt.h>
+ /* gcrypt mutex setup is only needed for GnuTLS < 2.12 */
+ 
+ static int gk_gcry_glib_mutex_init (void **priv) {
+-- 
+1.7.10.4
+
diff -Nru gkrellm-2.3.5/debian/patches/series gkrellm-2.3.5/debian/patches/series
--- gkrellm-2.3.5/debian/patches/series	2013-06-29 23:50:21.000000000 +0200
+++ gkrellm-2.3.5/debian/patches/series	2013-12-07 15:10:47.000000000 +0100
@@ -3,3 +3,5 @@
 05_bts437033_fix_strip.patch
 06_bts646262_add_format_string_to_syslog_call.patch
 10_fix_glib_underlinkage.patch
+11_Only-use-Libgcrypt-for-GnuTLS-2.12.patch
+12_Do-not-include-gcrypt.h-for-newer-GnuTLS-versions.patch

Reply via email to