pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/security/gnutls Fix compilation of gnutls with compile...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/d6e727c74403
branches:  trunk
changeset: 339821:d6e727c74403
user:      nros <nros%pkgsrc.org@localhost>
date:      Mon Sep 16 17:01:46 2019 +0000

description:
Fix compilation of gnutls with compilers missing __get_cpuid_count

Fix compilation of gnutls with compilers missing __get_cpuid_count.
Taken from upstream and fixed in version 3.6.10 .
Fixes compilation on NetBSD 8 without setting GCC_REQD.

diffstat:

 security/gnutls/distinfo                                       |   6 +-
 security/gnutls/patches/patch-config.h.in                      |  15 +
 security/gnutls/patches/patch-configure                        |  95 ++++++++++
 security/gnutls/patches/patch-lib_accelerated_x86_x86-common.c |  50 ++++-
 4 files changed, 161 insertions(+), 5 deletions(-)

diffs (198 lines):

diff -r f95ac0f0904e -r d6e727c74403 security/gnutls/distinfo
--- a/security/gnutls/distinfo  Mon Sep 16 15:09:49 2019 +0000
+++ b/security/gnutls/distinfo  Mon Sep 16 17:01:46 2019 +0000
@@ -1,11 +1,13 @@
-$NetBSD: distinfo,v 1.137 2019/09/16 00:28:48 nia Exp $
+$NetBSD: distinfo,v 1.138 2019/09/16 17:01:46 nros Exp $
 
 SHA1 (gnutls-3.6.9.tar.xz) = 4a12757b129562ae92a01ca890ed282050595296
 RMD160 (gnutls-3.6.9.tar.xz) = 2771adabb5342b24fbebcb69b324924ee2b56513
 SHA512 (gnutls-3.6.9.tar.xz) = a9fd0f4edae4c081d5c539ba2e5574a4d7294bc00c5c73ea25ce26cb7fd126299c2842a282d45ef5cf0544108f27066e587df28776bc7915143d190d7d5b9d07
 Size (gnutls-3.6.9.tar.xz) = 5773928 bytes
+SHA1 (patch-config.h.in) = 9f403bd91ddb90d970ba56f91a56e0339848c026
+SHA1 (patch-configure) = 0fcfa9255f15a43aced7262bc2c5084945910aec
 SHA1 (patch-lib_Makefile.in) = c9a6bbe6238ccd9de41c708012e36b202d2a86e7
-SHA1 (patch-lib_accelerated_x86_x86-common.c) = eaf3c473b1ca83c5b15be26f8c06a82d7961420c
+SHA1 (patch-lib_accelerated_x86_x86-common.c) = ccbf4e01f5bcb01b998e80294ecae2f0413680b8
 SHA1 (patch-lib_system_certs.c) = fba74b2834a36d66bddcd7d3405d0c91c1b14efc
 SHA1 (patch-src_libopts_autoopts_options.h) = 9202c55314fe8764ac82c95bbfabfa1b031e9ba4
 SHA1 (patch-src_libopts_compat_compat.h) = 240fbfc0ba20af35e0634ba873fe9e34bfbcc921
diff -r f95ac0f0904e -r d6e727c74403 security/gnutls/patches/patch-config.h.in
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/security/gnutls/patches/patch-config.h.in Mon Sep 16 17:01:46 2019 +0000
@@ -0,0 +1,15 @@
+$NetBSD: patch-config.h.in,v 1.1 2019/09/16 17:01:46 nros Exp $
+Fix compilation on gcc and clang versions missing __get_cpuid_count
+taken from upstream:
+https://gitlab.com/gnutls/gnutls/commit/ef80617d1e17e0878a909baad62a75ba265c0e00
+This is fixed in 3.6.10 so remove this if updating to 3.6.10 or above
+--- config.h.in.orig   2019-07-25 18:39:21.000000000 +0000
++++ config.h.in
+@@ -1,5 +1,7 @@
+ /* config.h.in.  Generated from configure.ac by autoheader.  */
+ 
++#undef HAVE_GET_CPUID_COUNT
++
+ /* Define if building universal (internal helper macro) */
+ #undef AC_APPLE_UNIVERSAL_BUILD
+ 
diff -r f95ac0f0904e -r d6e727c74403 security/gnutls/patches/patch-configure
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/security/gnutls/patches/patch-configure   Mon Sep 16 17:01:46 2019 +0000
@@ -0,0 +1,95 @@
+$NetBSD: patch-configure,v 1.3 2019/09/16 17:01:46 nros Exp $
+Fix compilation on gcc and clang versions missing __get_cpuid_count
+taken from upstream:
+https://gitlab.com/gnutls/gnutls/commit/ef80617d1e17e0878a909baad62a75ba265c0e00
+This is fixed in 3.6.10 so remove this if updating to 3.6.10 or above
+--- configure.orig     2019-09-16 16:20:13.879358983 +0000
++++ configure
+@@ -2036,7 +2036,6 @@ infodir
+ docdir
+ oldincludedir
+ includedir
+-runstatedir
+ localstatedir
+ sharedstatedir
+ sysconfdir
+@@ -2226,7 +2225,6 @@ datadir='${datarootdir}'
+ sysconfdir='${prefix}/etc'
+ sharedstatedir='${prefix}/com'
+ localstatedir='${prefix}/var'
+-runstatedir='${localstatedir}/run'
+ includedir='${prefix}/include'
+ oldincludedir='/usr/include'
+ docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+@@ -2479,15 +2477,6 @@ do
+   | -silent | --silent | --silen | --sile | --sil)
+     silent=yes ;;
+ 
+-  -runstatedir | --runstatedir | --runstatedi | --runstated \
+-  | --runstate | --runstat | --runsta | --runst | --runs \
+-  | --run | --ru | --r)
+-    ac_prev=runstatedir ;;
+-  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+-  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+-  | --run=* | --ru=* | --r=*)
+-    runstatedir=$ac_optarg ;;
+-
+   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+     ac_prev=sbindir ;;
+   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+@@ -2625,7 +2614,7 @@ fi
+ for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
+               datadir sysconfdir sharedstatedir localstatedir includedir \
+               oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+-              libdir localedir mandir runstatedir
++              libdir localedir mandir
+ do
+   eval ac_val=\$$ac_var
+   # Remove trailing slashes.
+@@ -2778,7 +2767,6 @@ Fine tuning of the installation director
+   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
+   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
+   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+-  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
+   --libdir=DIR            object code libraries [EPREFIX/lib]
+   --includedir=DIR        C header files [PREFIX/include]
+   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
+@@ -9782,6 +9770,29 @@ done
+   ;;
+ esac
+ 
++# check for gcc's __get_cpuid_count functionality
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __get_cpuid_count" >&5
++$as_echo_n "checking for __get_cpuid_count... " >&6; }
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++
++    #include <cpuid.h>
++    int main(void) { unsigned t1; return __get_cpuid_count(7, 0, &t1, &t1, &t1,&t1); }
++
++_ACEOF
++if ac_fn_c_try_link "$LINENO"; then :
++
++$as_echo "#define HAVE_GET_CPUID_COUNT 1" >>confdefs.h
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
++else
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++
++fi
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
++
+ fi
+ 
+ # Check whether --enable-tls13-interop was given.
+@@ -18074,6 +18085,8 @@ else
+ # ifdef _MSC_VER
+ #  include <malloc.h>
+ #  define alloca _alloca
++# elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__OpenBSD__)
++#   include <stdlib.h>
+ # else
+ #  ifdef HAVE_ALLOCA_H
+ #   include <alloca.h>
diff -r f95ac0f0904e -r d6e727c74403 security/gnutls/patches/patch-lib_accelerated_x86_x86-common.c
--- a/security/gnutls/patches/patch-lib_accelerated_x86_x86-common.c    Mon Sep 16 15:09:49 2019 +0000
+++ b/security/gnutls/patches/patch-lib_accelerated_x86_x86-common.c    Mon Sep 16 17:01:46 2019 +0000
@@ -1,10 +1,54 @@
-$NetBSD: patch-lib_accelerated_x86_x86-common.c,v 1.2 2018/07/06 16:15:28 prlw1 Exp $
+$NetBSD: patch-lib_accelerated_x86_x86-common.c,v 1.3 2019/09/16 17:01:46 nros Exp $
+
+Fix compilation on gcc and clang versions missing __get_cpuid_count.
+taken from upstream:
+https://gitlab.com/gnutls/gnutls/commit/ef80617d1e17e0878a909baad62a75ba265c0e00
+This is fixed in 3.6.10 so remove the things related to cpuid 
+when updating to 3.6.10 or above.
 
 Avoid unsupported xgetbv instruction on older Darwin assemblers.
 
---- lib/accelerated/x86/x86-common.c.orig      2018-02-12 07:06:04.000000000 +0000
+--- lib/accelerated/x86/x86-common.c.orig      2019-06-28 19:06:07.000000000 +0000
 +++ lib/accelerated/x86/x86-common.c
-@@ -101,6 +101,8 @@ static unsigned check_4th_gen_intel_feat
+@@ -106,17 +106,33 @@ unsigned int _gnutls_x86_cpuid_s[4];
+ #define VIA_PADLOCK_PHE (1<<21)
+ #define VIA_PADLOCK_PHE_SHA512 (1<<22)
+ 
++#ifndef HAVE_GET_CPUID_COUNT
++static inline void
++get_cpuid_level7(unsigned int *eax, unsigned int *ebx,
++                unsigned int *ecx, unsigned int *edx)
++{
++       /* we avoid using __get_cpuid_count, because it is not available with gcc 4.8 */
++       if (__get_cpuid_max(7, 0) < 7)
++               return;
++
++       __cpuid_count(7, 0, *eax, *ebx, *ecx, *edx);
++       return;
++}
++#else
++# define get_cpuid_level7(a,b,c,d) __get_cpuid_count(7, 0, a, b, c, d)
++#endif
++
+ static unsigned read_cpuid_vals(unsigned int vals[4])
+ {
+       unsigned t1, t2, t3;
+-      if (!__get_cpuid(1, &t1, &vals[0],
+-                       &vals[1], &t2))
++        vals[0] = vals[1] = vals[2] = vals[3] = 0;
++
++        if (!__get_cpuid(1, &t1, &vals[0], &vals[1], &t2))
+               return 0;
+       /* suppress AVX512; it works conditionally on certain CPUs on the original code */
+       vals[1] &= 0xfffff7ff;
+ 
+-      if (!__get_cpuid_count(7, 0, &t1, &vals[2], &t2, &t3))
+-              return 0;
++        get_cpuid_level7(&t1, &vals[2], &t2, &t3);
+ 
+       return 1;
+ }
+@@ -134,6 +150,8 @@ static unsigned check_4th_gen_intel_feat
  
  #if defined(_MSC_VER) && !defined(__clang__)
        xcr0 = _xgetbv(0);



Home | Main Index | Thread Index | Old Index