summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-12-20 23:19:31 +0100
committerLudovic Courtès <ludo@gnu.org>2017-12-20 23:19:31 +0100
commit8d6cd08573dd226c4ef874bf3786210eee9cf771 (patch)
tree09a046f38bb2e6300987701740303a9f60cfd855
parent066ccc2c69390f630237eadac1f69c03df22b87a (diff)
downloadguix-8d6cd08573dd226c4ef874bf3786210eee9cf771.tar.gz
gnu: diffutils: Fix Gnulib/getopt cross-compilation issue.
Previously cross-compilation would fail:

     CC       xvasprintf.o
   xstrtol-error.c:50:16: warning: 'struct rpl_option' declared inside parameter list
		   int exit_status)
		   ^
   xstrtol-error.c: In function 'xstrtol_error':
   xstrtol-error.c:84:5: error: invalid use of undefined type 'struct rpl_option'

* gnu/packages/patches/diffutils-getopt.patch: New file.
* gnu/packages/base.scm (diffutils)[source]: Use it.
* gnu/local.mk (dist_patch_DATA): Add it.
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/base.scm3
-rw-r--r--gnu/packages/patches/diffutils-getopt.patch44
3 files changed, 47 insertions, 1 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 62812b3f99..84d6df771f 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -603,6 +603,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/deja-dup-use-ref-keyword-for-iter.patch	\
   %D%/packages/patches/dfu-programmer-fix-libusb.patch		\
   %D%/packages/patches/diffutils-gets-undeclared.patch		\
+  %D%/packages/patches/diffutils-getopt.patch			\
   %D%/packages/patches/doc++-include-directives.patch		\
   %D%/packages/patches/doc++-segfault-fix.patch			\
   %D%/packages/patches/doxygen-test.patch			\
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index b7680d554a..022ee00758 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -238,7 +238,8 @@ differences.")
                                 version ".tar.xz"))
             (sha256
              (base32
-              "1mivg0fy3a6fcn535ln8nkgfj6vxh5hsxxs5h6692wxmsjyyh8fn"))))
+              "1mivg0fy3a6fcn535ln8nkgfj6vxh5hsxxs5h6692wxmsjyyh8fn"))
+            (patches (search-patches "diffutils-getopt.patch"))))
    (build-system gnu-build-system)
    (synopsis "Comparing and merging files")
    (description
diff --git a/gnu/packages/patches/diffutils-getopt.patch b/gnu/packages/patches/diffutils-getopt.patch
new file mode 100644
index 0000000000..05c2504adf
--- /dev/null
+++ b/gnu/packages/patches/diffutils-getopt.patch
@@ -0,0 +1,44 @@
+commit e3461d1c21a99bcef1b8826f710434e0ffb5adea
+Author: Paul Eggert <eggert@cs.ucla.edu>
+Date:   Sun Jun 11 15:53:09 2017 -0700
+
+    getopt-posix: port to glibc 2.25.90
+    
+    Problem reported by Daniel P. Berrange in:
+    http://lists.gnu.org/archive/html/bug-gnulib/2017-06/msg00003.html
+    * lib/getopt-pfx-core.h (_GETOPT_CORE_H):
+    * lib/getopt-pfx-ext.h (_GETOPT_EXT_H):
+    #undef if __GETOPT_PREFIX is defined.
+
+diff --git a/lib/getopt-pfx-core.h b/lib/getopt-pfx-core.h
+index 155c11612..6ad0da683 100644
+--- a/lib/getopt-pfx-core.h
++++ b/lib/getopt-pfx-core.h
+@@ -47,6 +47,11 @@
+ # define opterr __GETOPT_ID (opterr)
+ # define optind __GETOPT_ID (optind)
+ # define optopt __GETOPT_ID (optopt)
++
++/* The system's getopt.h may have already included getopt-core.h to
++   declare the unprefixed identifiers.  Undef _GETOPT_CORE_H so that
++   getopt-core.h declares them with prefixes.  */
++# undef _GETOPT_CORE_H
+ #endif
+ 
+ #include <getopt-core.h>
+diff --git a/lib/getopt-pfx-ext.h b/lib/getopt-pfx-ext.h
+index d960bb34e..c5ac52202 100644
+--- a/lib/getopt-pfx-ext.h
++++ b/lib/getopt-pfx-ext.h
+@@ -45,6 +45,11 @@
+ # define getopt_long_only __GETOPT_ID (getopt_long_only)
+ # define option __GETOPT_ID (option)
+ # define _getopt_internal __GETOPT_ID (getopt_internal)
++
++/* The system's getopt.h may have already included getopt-ext.h to
++   declare the unprefixed identifiers.  Undef _GETOPT_EXT_H so that
++   getopt-ext.h declares them with prefixes.  */
++# undef _GETOPT_EXT_H
+ #endif
+ 
+ /* Standalone applications get correct prototypes for getopt_long and