$ git diff --patch-with-stat --summary 35dc8f34de97e9917e2d614274e1141d87a31409..4f75336d8fe8ad2264bacdf7c6a394902e9bb345
.abf.yml | 2 +-
check-update.sh | 3 ++
gnutls-3.6.7-no-now-guile.patch | 11 ------
gnutls-3.8.0-clang.patch | 84 +++++++++++++++++++++++++++++++++++++++++
gnutls.spec | 61 ++++++++++++++++++++++++------
5 files changed, 137 insertions(+), 24 deletions(-)
create mode 100755 check-update.sh
delete mode 100644 gnutls-3.6.7-no-now-guile.patch
create mode 100644 gnutls-3.8.0-clang.patch
diff --git a/.abf.yml b/.abf.yml
index ea8c671..678bea6 100644
--- a/.abf.yml
+++ b/.abf.yml
@@ -1,2 +1,2 @@
sources:
- gnutls-3.7.8.tar.xz: 52642746e7fa8c7e91776ca1676e36550613ddde
+ gnutls-3.8.0.tar.xz: b7be709fefed484fc9044081961eb096e4c17d99
diff --git a/check-update.sh b/check-update.sh
new file mode 100755
index 0000000..289ac87
--- /dev/null
+++ b/check-update.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+MAJOR=$(curl https://www.gnupg.org/ftp/gcrypt/gnutls/ 2>/dev/null |grep -E -- '>v[0-9\.]*<' |sed -E 's,(.*)>v([0-9\.]*)<.*,\2,' |sort -V |tail -n1)
+curl https://www.gnupg.org/ftp/gcrypt/gnutls/v${MAJOR}/ 2>/dev/null |grep .tar.xz |sed -e 's,\.tar\.xz.*,,;s,.*gnutls-,,' |sort -V |tail -n1
diff --git a/gnutls-3.6.7-no-now-guile.patch b/gnutls-3.6.7-no-now-guile.patch
deleted file mode 100644
index d14e8df..0000000
--- a/gnutls-3.6.7-no-now-guile.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/guile/src/Makefile.in 2019-03-27 11:51:55.984398001 +0100
-+++ b/guile/src/Makefile.in 2019-03-27 11:52:27.259626076 +0100
-@@ -1472,7 +1472,7 @@
- # Use '-module' to build a "dlopenable module", in Libtool terms.
- # Use '-undefined' to placate Libtool on Windows; see
- # <https://lists.gnutls.org/pipermail/gnutls-devel/2014-December/007294.html>.
--guile_gnutls_v_2_la_LDFLAGS = -module -no-undefined
-+guile_gnutls_v_2_la_LDFLAGS = -module -no-undefined -Wl,-z,lazy
-
- # Linking against GnuTLS.
- GNUTLS_CORE_LIBS = $(top_builddir)/lib/libgnutls.la
diff --git a/gnutls-3.8.0-clang.patch b/gnutls-3.8.0-clang.patch
new file mode 100644
index 0000000..4e4c5a8
--- /dev/null
+++ b/gnutls-3.8.0-clang.patch
@@ -0,0 +1,84 @@
+diff -up gnutls-3.8.0/config.h.in.2~ gnutls-3.8.0/config.h.in
+--- gnutls-3.8.0/config.h.in.2~ 2023-02-09 15:56:16.000000000 +0100
++++ gnutls-3.8.0/config.h.in 2023-02-11 18:40:50.379485967 +0100
+@@ -2317,7 +2317,7 @@
+ _GL_ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that
+ can be freed via 'free'; it can be used only after declaring 'free'. */
+ /* Applies to: functions. Cannot be used on inline functions. */
+-#if _GL_GNUC_PREREQ (11, 0)
++#if _GL_GNUC_PREREQ (11, 0) && !defined(__clang__)
+ # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
+ #else
+ # define _GL_ATTRIBUTE_DEALLOC(f, i)
+diff -up gnutls-3.8.0/gl/stdio.in.h.2~ gnutls-3.8.0/gl/stdio.in.h
+--- gnutls-3.8.0/gl/stdio.in.h.2~ 2023-02-09 15:54:17.000000000 +0100
++++ gnutls-3.8.0/gl/stdio.in.h 2023-02-11 18:30:39.001238462 +0100
+@@ -95,7 +95,7 @@
+ that can be freed by passing them as the Ith argument to the
+ function F. */
+ #ifndef _GL_ATTRIBUTE_DEALLOC
+-# if __GNUC__ >= 11
++# if __GNUC__ >= 11 && !defined(__clang__)
+ # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
+ # else
+ # define _GL_ATTRIBUTE_DEALLOC(f, i)
+diff -up gnutls-3.8.0/gl/string.in.h.2~ gnutls-3.8.0/gl/string.in.h
+--- gnutls-3.8.0/gl/string.in.h.2~ 2023-02-09 15:54:17.000000000 +0100
++++ gnutls-3.8.0/gl/string.in.h 2023-02-11 18:30:39.001238462 +0100
+@@ -71,7 +71,7 @@
+ that can be freed by passing them as the Ith argument to the
+ function F. */
+ #ifndef _GL_ATTRIBUTE_DEALLOC
+-# if __GNUC__ >= 11
++# if __GNUC__ >= 11 && !defined(__clang__)
+ # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
+ # else
+ # define _GL_ATTRIBUTE_DEALLOC(f, i)
+diff -up gnutls-3.8.0/gl/wchar.in.h.2~ gnutls-3.8.0/gl/wchar.in.h
+--- gnutls-3.8.0/gl/wchar.in.h.2~ 2023-02-09 15:54:17.000000000 +0100
++++ gnutls-3.8.0/gl/wchar.in.h 2023-02-11 18:30:39.001238462 +0100
+@@ -88,7 +88,7 @@
+ that can be freed by passing them as the Ith argument to the
+ function F. */
+ #ifndef _GL_ATTRIBUTE_DEALLOC
+-# if __GNUC__ >= 11
++# if __GNUC__ >= 11 && !defined(__clang__)
+ # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
+ # else
+ # define _GL_ATTRIBUTE_DEALLOC(f, i)
+diff -up gnutls-3.8.0/src/gl/string.in.h.2~ gnutls-3.8.0/src/gl/string.in.h
+--- gnutls-3.8.0/src/gl/string.in.h.2~ 2023-02-09 15:55:13.000000000 +0100
++++ gnutls-3.8.0/src/gl/string.in.h 2023-02-11 18:30:39.001238462 +0100
+@@ -71,7 +71,7 @@
+ that can be freed by passing them as the Ith argument to the
+ function F. */
+ #ifndef _GL_ATTRIBUTE_DEALLOC
+-# if __GNUC__ >= 11
++# if __GNUC__ >= 11 && !defined(__clang__)
+ # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
+ # else
+ # define _GL_ATTRIBUTE_DEALLOC(f, i)
+diff -up gnutls-3.8.0/src/gl/wchar.in.h.2~ gnutls-3.8.0/src/gl/wchar.in.h
+--- gnutls-3.8.0/src/gl/wchar.in.h.2~ 2023-02-09 15:55:15.000000000 +0100
++++ gnutls-3.8.0/src/gl/wchar.in.h 2023-02-11 18:30:39.002238764 +0100
+@@ -88,7 +88,7 @@
+ that can be freed by passing them as the Ith argument to the
+ function F. */
+ #ifndef _GL_ATTRIBUTE_DEALLOC
+-# if __GNUC__ >= 11
++# if __GNUC__ >= 11 && !defined(__clang__)
+ # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
+ # else
+ # define _GL_ATTRIBUTE_DEALLOC(f, i)
+diff -up gnutls-3.8.0/m4/gnulib-common.m4.omv~ gnutls-3.8.0/m4/gnulib-common.m4
+--- gnutls-3.8.0/m4/gnulib-common.m4.omv~ 2023-02-11 18:56:39.642181406 +0100
++++ gnutls-3.8.0/m4/gnulib-common.m4 2023-02-11 18:56:56.002047724 +0100
+@@ -182,7 +182,7 @@ AC_DEFUN([gl_COMMON_BODY], [
+ _GL_ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that
+ can be freed via 'free'; it can be used only after declaring 'free'. */
+ /* Applies to: functions. Cannot be used on inline functions. */
+-#if _GL_GNUC_PREREQ (11, 0)
++#if _GL_GNUC_PREREQ (11, 0) && !defined(__clang__)
+ # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
+ #else
+ # define _GL_ATTRIBUTE_DEALLOC(f, i)
diff --git a/gnutls.spec b/gnutls.spec
index b0cfe41..e4ec164 100644
--- a/gnutls.spec
+++ b/gnutls.spec
@@ -13,12 +13,16 @@
%define major 30
%define xxmajor %{major}
-%define libname %mklibname %{name} %{major}
-%define libnamexx %mklibname %{name}xx %{xxmajor}
+%define libname %mklibname %{name}
+%define oldlibname %mklibname %{name} 30
+%define libnamexx %mklibname %{name}xx
+%define oldlibnamexx %mklibname %{name}xx 30
%define devname %mklibname %{name} -d
%define sdevname %mklibname %{name} -d -s
-%define lib32name %mklib32name %{name} %{major}
-%define lib32namexx %mklib32name %{name}xx %{xxmajor}
+%define lib32name %mklib32name %{name}
+%define oldlib32name %mklibname %{name} 30
+%define lib32namexx %mklib32name %{name}xx
+%define oldlib32namexx %mklib32name %{name}xx 30
%define dev32name %mklib32name %{name} -d
%define sdev32name %mklib32name %{name} -d -s
@@ -31,14 +35,14 @@
Summary: Library providing a secure layer (SSL)
Name: gnutls
-Version: 3.7.8
-Release: 1
+Version: 3.8.0
+Release: 3
License: GPLv2+ and LGPLv2+
Group: System/Libraries
Url: http://www.gnutls.org
Source0: https://www.gnupg.org/ftp/gcrypt/gnutls/v%{url_ver}/%{name}-%{version}.tar.xz
Patch0: https://src.fedoraproject.org/rpms/gnutls/raw/master/f/gnutls-3.2.7-rpath.patch
-Patch1: https://src.fedoraproject.org/rpms/gnutls/raw/master/f/gnutls-3.6.7-no-now-guile.patch
+Patch1: gnutls-3.8.0-clang.patch
BuildRequires: bison
BuildRequires: byacc
BuildRequires: pkgconfig(libunistring)
@@ -85,8 +89,8 @@ Suggests: %{name}-locales = %{version}-%{release}
%if "%{_lib}" == "lib64"
Conflicts: lib%{name}%{major} < %{version}
%endif
-Obsoletes: %{mklibname %{name}-openssl 27} < 3.6.5
Requires: %{name}-config = %{EVRD}
+%rename %{oldlibname}
%description -n %{libname}
This package contains a shared library for %{name}.
@@ -94,7 +98,7 @@ This package contains a shared library for %{name}.
%package -n %{libnamexx}
Summary: Library providing a secure layer (SSL)
Group: System/Libraries
-Conflicts: %{_lib}gnutls28 < 3.1.9.1-3
+%rename %{oldlibnamexx}
%description -n %{libnamexx}
This package contains a shared library for %{name}.
@@ -125,7 +129,6 @@ programs/libraries that use %{name} and link them statically.
Summary: Locale files for GnuTLS
Group: System/Internationalization
BuildArch: noarch
-Conflicts: %{mklibname gnutls 28} <= 3.1.9.1-1
%description locales
Locale files for GnuTLS main library.
@@ -144,6 +147,7 @@ Summary: Library providing a secure layer (SSL) (32-bit)
Group: System/Libraries
Suggests: %{name}-locales = %{version}-%{release}
Requires: %{name}-config = %{EVRD}
+%rename %{oldlib32name}
%description -n %{lib32name}
This package contains a shared library for %{name}.
@@ -151,6 +155,7 @@ This package contains a shared library for %{name}.
%package -n %{lib32namexx}
Summary: Library providing a secure layer (SSL) (32-bit)
Group: System/Libraries
+%rename %{oldlib32namexx}
%description -n %{lib32namexx}
This package contains a shared library for %{name}.
@@ -283,6 +288,36 @@ EOF
%find_lang %{name}
+# (tpg) strip LTO from "LLVM IR bitcode" files
+check_convert_bitcode() {
+ printf '%s\n' "Checking for LLVM IR bitcode"
+ llvm_file_name=$(realpath ${1})
+ llvm_file_type=$(file ${llvm_file_name})
+
+ if printf '%s\n' "${llvm_file_type}" | grep -q "LLVM IR bitcode"; then
+# recompile without LTO
+ clang %{optflags} -fno-lto -Wno-unused-command-line-argument -x ir ${llvm_file_name} -c -o ${llvm_file_name}
+ elif printf '%s\n' "${llvm_file_type}" | grep -q "current ar archive"; then
+ printf '%s\n' "Unpacking ar archive ${llvm_file_name} to check for LLVM bitcode components."
+# create archive stage for objects
+ archive_stage=$(mktemp -d)
+ archive=${llvm_file_name}
+ cd ${archive_stage}
+ ar x ${archive}
+ for archived_file in $(find -not -type d); do
+ check_convert_bitcode ${archived_file}
+ printf '%s\n' "Repacking ${archived_file} into ${archive}."
+ ar r ${archive} ${archived_file}
+ done
+ ranlib ${archive}
+ cd ..
+ fi
+}
+
+for i in $(find %{buildroot} -type f -name "*.[ao]"); do
+ check_convert_bitcode ${i}
+done
+
%files
%doc %{_docdir}/%{name}
%{_bindir}/[cgs]*
@@ -300,12 +335,13 @@ EOF
%files -n %{libname}
%{_libdir}/libgnutls.so.%{major}*
+%{_libdir}/libgnutls.so
%files -n %{libnamexx}
%{_libdir}/libgnutlsxx.so.%{xxmajor}*
+%{_libdir}/libgnutlsxx.so
%files -n %{devname}
-%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc
%{_includedir}/gnutls
@@ -315,12 +351,13 @@ EOF
%if %{with compat32}
%files -n %{lib32name}
%{_prefix}/lib/libgnutls.so.%{major}*
+%{_prefix}/lib/libgnutls.so
%files -n %{lib32namexx}
%{_prefix}/lib/libgnutlsxx.so.%{xxmajor}*
+%{_prefix}/lib/libgnutlsxx.so
%files -n %{dev32name}
-%{_prefix}/lib/*.so
%{_prefix}/lib/pkgconfig/*.pc
%files -n %{sdev32name}