There was a build failure of mingw-libgpg-error during the mass
rebuild: https://koji.fedoraproject.org/koji/taskinfo?taskID=12844070

I looked at this package, but it is quite old (1.12) relative to the
current libgpg-error package (1.21).  However updating to 1.21 is not
straightforward, so I would appreciate some review of the attached
patch from someone that knows what they're doing.

It builds for me on Rawhide.

I'm particularly suspicious of the renamed .dll file.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html
>From 2edf5db44bb3b25fc96f1f0869a1a044860cf314 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjo...@redhat.com>
Date: Fri, 5 Feb 2016 16:09:18 +0000
Subject: [PATCH] Update to 1.21, same as libgpg-error package.

- Remove Group line, not needed by modern RPM.
- Remove libtool workaround, fixed upstream.
- Remove libtoolize.
- The 64 bit library is now called libgpg-error6-0.dll.
- Delete info and man files.
---
 .gitignore                       |   2 +
 libgpg-error-1.20-multilib.patch | 122 +++++++++++++++++++++++++++++++++++++++
 mingw-libgpg-error.spec          |  46 +++++++--------
 sources                          |   3 +-
 4 files changed, 146 insertions(+), 27 deletions(-)
 create mode 100644 libgpg-error-1.20-multilib.patch

diff --git a/.gitignore b/.gitignore
index b8f754a..871d7a2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,5 @@ libgpg-error-1.6.tar.bz2
 /libgpg-error-1.10.tar.bz2
 /libgpg-error-1.11.tar.bz2
 /libgpg-error-1.12.tar.bz2
+/libgpg-error-1.21.tar.bz2
+/libgpg-error-1.21.tar.bz2.sig
diff --git a/libgpg-error-1.20-multilib.patch b/libgpg-error-1.20-multilib.patch
new file mode 100644
index 0000000..ab22248
--- /dev/null
+++ b/libgpg-error-1.20-multilib.patch
@@ -0,0 +1,122 @@
+diff -up libgpg-error-1.20/configure.ac.multilib libgpg-error-1.20/configure.ac
+--- libgpg-error-1.20/configure.ac.multilib    2015-08-26 08:50:34.000000000 
+0200
++++ libgpg-error-1.20/configure.ac     2015-09-01 17:34:30.948996640 +0200
+@@ -186,13 +186,13 @@ AC_CHECK_SIZEOF(long)
+ AC_CHECK_SIZEOF(long long)
+ 
+ # Find a 64 bit integer type to be used instead of off_t.  We prefer
+-# the standard integer types over int64_t and finally try long long.
+-if test "$ac_cv_sizeof_int" = "8"; then
++# int64_t and finally try long long.
++if test "$ac_cv_header_stdint_h" = yes; then
++   replacement_for_off_t="int64_t"
++elif test "$ac_cv_sizeof_int" = "8"; then
+    replacement_for_off_t="int"
+ elif test "$ac_cv_sizeof_long" = "8"; then
+    replacement_for_off_t="long"
+-elif test "$ac_cv_header_stdint_h" = yes; then
+-   replacement_for_off_t="int64_t"
+ elif test "$ac_cv_sizeof_long_long" = "8"; then
+    replacement_for_off_t="long long"
+ else
+diff -up libgpg-error-1.20/configure.multilib libgpg-error-1.20/configure
+--- libgpg-error-1.20/configure.multilib       2015-08-26 08:59:12.000000000 
+0200
++++ libgpg-error-1.20/configure        2015-09-01 17:34:30.950996687 +0200
+@@ -11275,7 +11275,7 @@ shlibpath_var=
+ shlibpath_overrides_runpath=unknown
+ version_type=none
+ dynamic_linker="$host_os ld.so"
+-sys_lib_dlsearch_path_spec="/lib /usr/lib"
++sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib64 /usr/lib64"
+ need_lib_prefix=unknown
+ hardcode_into_libs=no
+ 
+@@ -11749,7 +11749,7 @@ fi
+   # Append ld.so.conf contents to the search path
+   if test -f /etc/ld.so.conf; then
+     lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 
2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < 
/etc/ld.so.conf | $SED -e 's/#.*//;/^[     ]*hwcap[        ]/d;s/[:,      ]/ 
/g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+-    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
++    sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib64 /usr/lib64 
$lt_ld_extra"
+   fi
+ 
+   # We used to test for /lib/ld.so.1 and disable shared libraries on
+@@ -15440,12 +15440,12 @@ _ACEOF
+ 
+ # Find a 64 bit integer type to be used instead of off_t.  We prefer
+ # the standard integer types over int64_t and finally try long long.
+-if test "$ac_cv_sizeof_int" = "8"; then
++if test "$ac_cv_header_stdint_h" = yes; then
++   replacement_for_off_t="int64_t"
++elif test "$ac_cv_sizeof_int" = "8"; then
+    replacement_for_off_t="int"
+ elif test "$ac_cv_sizeof_long" = "8"; then
+    replacement_for_off_t="long"
+-elif test "$ac_cv_header_stdint_h" = yes; then
+-   replacement_for_off_t="int64_t"
+ elif test "$ac_cv_sizeof_long_long" = "8"; then
+    replacement_for_off_t="long long"
+ else
+diff -up libgpg-error-1.20/src/gen-posix-lock-obj.c.multilib 
libgpg-error-1.20/src/gen-posix-lock-obj.c
+--- libgpg-error-1.20/src/gen-posix-lock-obj.c.multilib        2015-09-01 
17:34:30.950996687 +0200
++++ libgpg-error-1.20/src/gen-posix-lock-obj.c 2015-09-01 17:45:01.009835073 
+0200
+@@ -64,6 +64,7 @@ main (void)
+ #ifdef USE_POSIX_THREADS
+   unsigned char *p;
+   int i;
++  int initidx = 0;
+ #endif
+   struct {
+     long vers;
+@@ -103,11 +104,12 @@ main (void)
+ 
+   /* To force a probably suitable alignment of the structure we use a
+      union and include a long and a pointer to a long.  */
+-  printf ("typedef struct\n"
++  printf ("#include <pthread.h>\n"
++          "typedef struct\n"
+           "{\n"
+           "  long _vers;\n"
+           "  union {\n"
+-          "    volatile char _priv[%d];\n"
++          "    volatile char _priv[sizeof(pthread_mutex_t)];\n"
+           "%s"
+           "    long _x_align;\n"
+           "    long *_xp_align;\n"
+@@ -115,7 +117,6 @@ main (void)
+           "} gpgrt_lock_t;\n"
+           "\n"
+           "#define GPGRT_LOCK_INITIALIZER {%d,{{",
+-          SIZEOF_PTHREAD_MUTEX_T,
+ # if USE_16BYTE_ALIGNMENT
+           "    int _x16_align __attribute__ ((aligned (16)));\n",
+ # else
+@@ -125,10 +126,16 @@ main (void)
+   p = (unsigned char *)&mtx;
+   for (i=0; i < sizeof mtx; i++)
+     {
++      if (p[i] != 0)
++        initidx = i;
++    }
++
++  for (i=0; i <= initidx; i++)
++    {
+       if (i && !(i % 8))
+         printf (" \\\n%*s", 36, "");
+       printf ("%u", p[i]);
+-      if (i < sizeof mtx - 1)
++      if (i < initidx)
+         putchar (',');
+     }
+   fputs ("}}}\n", stdout);
+diff -up libgpg-error-1.20/src/gpg-error.h.in.multilib 
libgpg-error-1.20/src/gpg-error.h.in
+--- libgpg-error-1.20/src/gpg-error.h.in.multilib      2015-09-01 
17:34:30.951996711 +0200
++++ libgpg-error-1.20/src/gpg-error.h.in       2015-09-01 17:46:43.468248050 
+0200
+@@ -16,7 +16,7 @@
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this program; if not, see 
<http://www.gnu.org/licenses/>.
+  *
+- * @configure_input@
++ * Do not edit.  Generated from gpg-error.h.in.
+  */
+ 
+ #ifndef GPG_ERROR_H
diff --git a/mingw-libgpg-error.spec b/mingw-libgpg-error.spec
index d363ede..f400d57 100644
--- a/mingw-libgpg-error.spec
+++ b/mingw-libgpg-error.spec
@@ -1,18 +1,19 @@
 %?mingw_package_header
 
 Name:           mingw-libgpg-error
-Version:        1.12
-Release:        4%{?dist}
+Version:        1.21
+Release:        1%{?dist}
 Summary:        MinGW Windows GnuPGP error library
 
 License:        LGPLv2+
-Group:          Development/Libraries
 URL:            ftp://ftp.gnupg.org/gcrypt/libgpg-error/
 Source0:        
ftp://ftp.gnupg.org/gcrypt/libgpg-error/libgpg-error-%{version}.tar.bz2
 Source1:        
ftp://ftp.gnupg.org/gcrypt/libgpg-error/libgpg-error-%{version}.tar.bz2.sig
 Source2:        w...@g10code.com
 BuildArch:      noarch
 
+Patch1:         libgpg-error-1.20-multilib.patch
+
 BuildRequires:  mingw32-filesystem >= 95
 BuildRequires:  mingw32-gcc
 BuildRequires:  mingw32-binutils
@@ -27,9 +28,6 @@ BuildRequires:  mingw64-gettext
 
 BuildRequires:  gettext
 
-# See comment in %%prep for details
-BuildRequires:  libtool
-
 
 %description
 MinGW Windows GnuPGP error library.
@@ -67,29 +65,11 @@ Static library for mingw64-libgpg-error development.
 
 %prep
 %setup -q -n libgpg-error-%{version}
-
-# Upstream has applied a libtool hack in libgpg-error 1.12
-# which automatically gives the libgpg-error library a
-# different filename for the win64 target so that
-# the libgpg-error DLL's for both the win32 and win64
-# targets can be installed in the same folder.
-#
-# As installing both win32 and win64 libraries in the same
-# folder is bad practice and breaks earlier behavior undo
-# this libtool hack here by re-running libtoolize
-libtoolize --copy --force
+%patch1 -p1 -b .multilib
 
 
 %build
 %mingw_configure --enable-shared --enable-static
-
-# Workaround a bug in libtool: http://savannah.gnu.org/support/?107959
-make -C build_win32/src gpg-error.def
-sed -i '/^$/d' build_win32/src/gpg-error.def
-
-make -C build_win64/src gpg-error.def
-sed -i '/^$/d' build_win64/src/gpg-error.def
-
 %mingw_make %{?_smp_mflags}
 
 
@@ -99,6 +79,12 @@ sed -i '/^$/d' build_win64/src/gpg-error.def
 # Drop all .la files
 find $RPM_BUILD_ROOT -name "*.la" -delete
 
+# Delete info and man pages.
+rm -r $RPM_BUILD_ROOT%{mingw32_datadir}/info
+rm -r $RPM_BUILD_ROOT%{mingw32_mandir}/man1
+rm -r $RPM_BUILD_ROOT%{mingw64_datadir}/info
+rm -r $RPM_BUILD_ROOT%{mingw64_mandir}/man1
+
 %mingw_find_lang libgpg-error
 
 
@@ -117,7 +103,7 @@ find $RPM_BUILD_ROOT -name "*.la" -delete
 %files -n mingw64-libgpg-error -f mingw64-libgpg-error.lang
 %{mingw64_bindir}/gpg-error-config
 %{mingw64_bindir}/gpg-error.exe
-%{mingw64_bindir}/libgpg-error-0.dll
+%{mingw64_bindir}/libgpg-error6-0.dll
 %{mingw64_libdir}/libgpg-error.dll.a
 %{mingw64_includedir}/gpg-error.h
 %{mingw64_datadir}/aclocal/gpg-error.m4
@@ -128,6 +114,14 @@ find $RPM_BUILD_ROOT -name "*.la" -delete
 
 
 %changelog
+* Fri Feb 05 2016 Richard W.M. Jones <rjo...@redhat.com> - 1.21-1
+- Update to 1.21, same as libgpg-error package.
+- Remove Group line, not needed by modern RPM.
+- Remove libtool workaround, fixed upstream.
+- Remove libtoolize.
+- The 64 bit library is now called libgpg-error6-0.dll.
+- Delete info and man files.
+
 * Thu Feb 04 2016 Fedora Release Engineering <rel...@fedoraproject.org> - 
1.12-4
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
 
diff --git a/sources b/sources
index 7dbf02b..5cce137 100644
--- a/sources
+++ b/sources
@@ -1 +1,2 @@
-8f0eb41a344d19ac2aa9bd101dfb9ce6  libgpg-error-1.12.tar.bz2
+ab0b5aba6d0a185b41d07bda804fd8b2  libgpg-error-1.21.tar.bz2
+dcb6665f0fd2dec1b47f1c60dd3a3617  libgpg-error-1.21.tar.bz2.sig
-- 
2.7.0

_______________________________________________
mingw mailing list
mingw@lists.fedoraproject.org
http://lists.fedoraproject.org/admin/lists/mingw@lists.fedoraproject.org

Reply via email to