Fix build with gcc 6

This commit is contained in:
Orion Poplawski 2016-02-21 09:57:14 -07:00
parent 64a641d9d1
commit f932eb0a76
4 changed files with 66 additions and 1 deletions

27
octave-abs.patch Normal file
View File

@ -0,0 +1,27 @@
diff -up octave-4.0.0/libinterp/corefcn/pr-output.cc.abs octave-4.0.0/libinterp/corefcn/pr-output.cc
--- octave-4.0.0/libinterp/corefcn/pr-output.cc.abs 2015-05-23 08:21:53.000000000 -0600
+++ octave-4.0.0/libinterp/corefcn/pr-output.cc 2016-02-21 08:59:30.966291273 -0700
@@ -21,7 +21,7 @@ along with Octave; see the file COPYING.
*/
#ifdef HAVE_CONFIG_H
-#include <config.h>
+#include "config.h"
#endif
#include <cfloat>
@@ -3145,6 +3145,14 @@ PRINT_INT_SCALAR_INTERNAL (uint32_t)
PRINT_INT_SCALAR_INTERNAL (int64_t)
PRINT_INT_SCALAR_INTERNAL (uint64_t)
+inline unsigned int abs (unsigned int x) { return x; }
+inline long unsigned int abs (long unsigned int x) { return x; }
+inline long long unsigned int abs (long long unsigned int x) { return x; }
+inline short unsigned int abs (short unsigned int x) { return x; }
+inline unsigned char abs (unsigned char x) { return x; }
+inline signed char abs (signed char x) { return abs((int)x); }
+inline short int abs (short int x) { return abs((int)x); }
+
template <class T>
/* static */ inline void
octave_print_internal_template (std::ostream& os, const intNDArray<T>& nda,

11
octave-gnulib.patch Normal file
View File

@ -0,0 +1,11 @@
diff -up octave-4.0.0/liboctave/cruft/Faddeeva/Faddeeva.hh.gnulib octave-4.0.0/liboctave/cruft/Faddeeva/Faddeeva.hh
--- octave-4.0.0/liboctave/cruft/Faddeeva/Faddeeva.hh.gnulib 2015-05-23 08:21:53.000000000 -0600
+++ octave-4.0.0/liboctave/cruft/Faddeeva/Faddeeva.hh 2016-02-19 19:50:04.693811663 -0700
@@ -27,6 +27,7 @@
#ifndef FADDEEVA_HH
#define FADDEEVA_HH 1
+#include <math.h>
#include <complex>
namespace Faddeeva {

12
octave-signbit.patch Normal file
View File

@ -0,0 +1,12 @@
diff -up octave-4.0.0/libgnu/math.in.h.signbit octave-4.0.0/libgnu/math.in.h
--- octave-4.0.0/libgnu/math.in.h.signbit 2016-02-19 19:16:24.525856660 -0700
+++ octave-4.0.0/libgnu/math.in.h 2016-02-19 19:32:27.001262926 -0700
@@ -2205,7 +2205,7 @@ _GL_WARN_REAL_FLOATING_DECL (isnan);
#if @GNULIB_SIGNBIT@
-# if @REPLACE_SIGNBIT_USING_GCC@
+# if @REPLACE_SIGNBIT_USING_GCC@ && !defined(__cplusplus)
# undef signbit
/* GCC 4.0 and newer provides three built-ins for signbit. */
# define signbit(x) \

View File

@ -20,7 +20,7 @@
Name: octave
Epoch: 6
Version: 4.0.0
Release: 12%{?dist}
Release: 13%{?dist}
Summary: A high-level language for numerical computations
Group: Applications/Engineering
License: GPLv3+
@ -43,6 +43,13 @@ Patch1: octave-texinfo6-2ec049e50ed8.patch
# Remove project_group from appdata.xml file
# https://bugzilla.redhat.com/show_bug.cgi?id=1293561
Patch2: octave-appdata.patch
# Fix gnulib signbit for g++ 6
# https://bugzilla.redhat.com/show_bug.cgi?id=1276893
Patch3: octave-signbit.patch
# Add needed #include <math.h> to bring in gnulib
Patch4: octave-gnulib.patch
# Handle g++ 6 abs() change
Patch5: octave-abs.patch
Provides: octave(api) = %{octave_api}
Provides: bundled(gnulib)
@ -165,6 +172,11 @@ This package contains documentation for Octave.
rm doc/texinfo.tex
%endif
%patch2 -p1 -b .appdata
%patch3 -p1 -b .signbit
%patch4 -p1 -b .gnulib
%patch5 -p1 -b .abs
# Explicitly use gnulib headers
find -name \*.cc -o -name \*.h -o -name \*.yy | xargs sed -i -e 's/#include <c\(math\|stdlib\)>/#include <\1.h>/'
find -name \*.h -o -name \*.cc | xargs sed -i -e 's/<config.h>/"config.h"/' -e 's/<base-list.h>/"base-list.h"/'
# Check permissions
@ -398,6 +410,9 @@ fi
%{_pkgdocdir}/refcard*.pdf
%changelog
* Sun Feb 21 2016 Orion Poplawski <orion@cora.nwra.com> - 6:4.0.0-13
- Fix build with gcc 6
* Thu Feb 18 2016 Orion Poplawski <orion@cora.nwra.com> - 6:4.0.0-12
- Rebuild for glpk 4.58