Use eccodes where available

Add patches to fix build
Use cmake3 for EPEL7 compat
This commit is contained in:
Orion Poplawski 2019-02-13 14:04:38 -07:00
parent 8ad36df861
commit dca5c8f3f4
3 changed files with 205 additions and 8 deletions

112
gdl-antlr-grammar.patch Normal file
View File

@ -0,0 +1,112 @@
diff --git a/src/gdlc.i.g b/src/gdlc.i.g
index e66902d..1c648c8 100644
--- a/src/gdlc.i.g
+++ b/src/gdlc.i.g
@@ -170,7 +170,7 @@ public:
static bool SearchCompilePro(const std::string& pro, bool searchForPro);
static int GetFunIx( ProgNodeP);
static int GetFunIx( const std::string& subName);
- static int GetProIx( ProgNodeP);//const std::string& subName);
+ static int GetProIx( ProgNodeP, bool throwImmediately=false);//const std::string& subName);
static int GetProIx( const std::string& subName);
DStructGDL* ObjectStruct( DObjGDL* self, ProgNodeP mp);
void SetRootR( ProgNodeP tt, DotAccessDescT* aD, BaseGDL* r, ArrayIndexListT* aL);
@@ -184,7 +184,7 @@ public:
private:
- static void SetProIx( ProgNodeP f); // triggers read/compile
+ static void SetProIx( ProgNodeP f, bool throwImmediately=false); // triggers read/compile
static void AdjustTypes( BaseGDL*&, BaseGDL*&);
@@ -979,18 +979,6 @@ interactive returns[ RetCode retCode]
)+
;
-// execute statement
-execute returns[ RetCode retCode]
-{
-// RetCode retCode;
- ValueGuard<bool> guard( interruptEnable);
- interruptEnable = false;
-
- return statement_list(_t);
-}
- : retCode=statement_list
- ;
-
// used to call functions
// same as statement list, but different behaviour for returncodes
call_fun returns[ BaseGDL* res]
@@ -1083,24 +1071,7 @@ call_pro
;
-// used on many occasions
-statement_list returns[ RetCode retCode]
-{
- for (; _t != NULL;) {
-
- retCode=statement(_t);
- _t = _retTree;
-
- if( retCode != RC_OK) break; // break out if non-regular
- }
- _retTree = _t;
- return retCode;
-}
- : (retCode=statement
- )+
- ;
-
-statement returns[ RetCode retCode]
+statement [bool throwImmediately=false] returns[ RetCode retCode]
{
// ProgNodeP& actPos = statement_AST_in;
assert( _t != NULL);
@@ -1121,7 +1092,7 @@ statement returns[ RetCode retCode]
// track actual line number
callStack.back()->SetLineNumber( last->getLine());
- retCode = last->Run(); // Run() sets _retTree
+ retCode = last->Run(throwImmediately); // Run() sets _retTree
}
while(
@@ -1456,6 +1427,35 @@ statement returns[ RetCode retCode]
} // catch [ GDLException& e]
+// used on many occasions
+statement_list [bool throwImmediately=false] returns[ RetCode retCode]
+{
+ for (; _t != NULL;) {
+
+ retCode=statement(_t, throwImmediately);
+ _t = _retTree;
+
+ if( retCode != RC_OK) break; // break out if non-regular
+ }
+ _retTree = _t;
+ return retCode;
+}
+ : (retCode=statement[throwImmediately]
+ )+
+ ;
+
+// execute statement
+execute [bool throwImmediately=false] returns[ RetCode retCode]
+{
+// RetCode retCode;
+ ValueGuard<bool> guard( interruptEnable);
+ interruptEnable = false;
+
+// return statement_list(_t, throwImmediately);
+}
+ : retCode=statement_list[throwImmediately]
+ ;
+

64
gdl-std.patch Normal file
View File

@ -0,0 +1,64 @@
diff -up gdl-0.9.9/src/dSFMT/dSFMT-common.h.std gdl-0.9.9/src/dSFMT/dSFMT-common.h
--- gdl-0.9.9/src/dSFMT/dSFMT-common.h.std 2018-12-01 07:19:52.000000000 -0700
+++ gdl-0.9.9/src/dSFMT/dSFMT-common.h 2019-02-12 21:32:20.568719598 -0700
@@ -44,25 +44,25 @@ static const union X128I_T sse2_param_ma
#if defined(HAVE_ALTIVEC)
inline static void do_recursion(w128_t *r, w128_t *a, w128_t * b,
w128_t *lung) {
- const vector unsigned char sl1 = ALTI_SL1;
- const vector unsigned char sl1_perm = ALTI_SL1_PERM;
- const vector unsigned int sl1_msk = ALTI_SL1_MSK;
- const vector unsigned char sr1 = ALTI_SR;
- const vector unsigned char sr1_perm = ALTI_SR_PERM;
- const vector unsigned int sr1_msk = ALTI_SR_MSK;
- const vector unsigned char perm = ALTI_PERM;
- const vector unsigned int msk1 = ALTI_MSK;
- vector unsigned int w, x, y, z;
+ const __vector unsigned char sl1 = ALTI_SL1;
+ const __vector unsigned char sl1_perm = ALTI_SL1_PERM;
+ const __vector unsigned int sl1_msk = ALTI_SL1_MSK;
+ const __vector unsigned char sr1 = ALTI_SR;
+ const __vector unsigned char sr1_perm = ALTI_SR_PERM;
+ const __vector unsigned int sr1_msk = ALTI_SR_MSK;
+ const __vector unsigned char perm = ALTI_PERM;
+ const __vector unsigned int msk1 = ALTI_MSK;
+ __vector unsigned int w, x, y, z;
z = a->s;
w = lung->s;
- x = vec_perm(w, (vector unsigned int)perm, perm);
- y = vec_perm(z, (vector unsigned int)sl1_perm, sl1_perm);
+ x = vec_perm(w, (__vector unsigned int)perm, perm);
+ y = vec_perm(z, (__vector unsigned int)sl1_perm, sl1_perm);
y = vec_sll(y, sl1);
y = vec_and(y, sl1_msk);
w = vec_xor(x, b->s);
w = vec_xor(w, y);
- x = vec_perm(w, (vector unsigned int)sr1_perm, sr1_perm);
+ x = vec_perm(w, (__vector unsigned int)sr1_perm, sr1_perm);
x = vec_srl(x, sr1);
x = vec_and(x, sr1_msk);
y = vec_and(w, msk1);
diff -up gdl-0.9.9/src/dSFMT/dSFMT.h.std gdl-0.9.9/src/dSFMT/dSFMT.h
--- gdl-0.9.9/src/dSFMT/dSFMT.h.std 2018-12-01 07:19:52.000000000 -0700
+++ gdl-0.9.9/src/dSFMT/dSFMT.h 2019-02-12 21:31:11.001860961 -0700
@@ -143,7 +143,7 @@ extern "C" {
/** 128-bit data structure */
union W128_T {
- vector unsigned int s;
+ __vector unsigned int s;
uint64_t u[2];
uint32_t u32[4];
double d[2];
diff -up gdl-0.9.9/src/randomgenerators.cpp.std gdl-0.9.9/src/randomgenerators.cpp
--- gdl-0.9.9/src/randomgenerators.cpp.std 2018-12-01 07:19:52.000000000 -0700
+++ gdl-0.9.9/src/randomgenerators.cpp 2019-02-12 21:31:11.002860973 -0700
@@ -35,7 +35,6 @@
namespace lib {
- using namespace std;
#ifdef USE_EIGEN
/* following are some modified codes taken from the GNU Scientific Library.
*

View File

@ -3,7 +3,7 @@
Name: gdl
Version: 0.9.9
Release: 3%{?dist}
Release: 4%{?dist}
Summary: GNU Data Language
License: GPLv2+
@ -16,8 +16,15 @@ Source4: xorg.conf
# Build with system antlr library. Request for upstream change here:
# https://sourceforge.net/tracker/index.php?func=detail&aid=2685215&group_id=97659&atid=618686
Patch1: gdl-antlr.patch
# Support python3
# https://github.com/gnudatalanguage/gdl/pull/468
Patch2: gdl-python3.patch
# Update ANTLR .g file to match upstream changes
# https://github.com/gnudatalanguage/gdl/pull/529
Patch3: gdl-antlr-grammar.patch
# Fix conflict with std::vector and ALTIVEC vector
# https://github.com/gnudatalanguage/gdl/pull/535
Patch4: gdl-std.patch
#RHEL5 doesn't have the needed antlr version/headers, has old plplot
%if 0%{?rhel} == 5
@ -45,14 +52,20 @@ BuildRequires: python2-devel, python2-numpy, python2-matplotlib
%endif
BuildRequires: fftw-devel, hdf-static
%if 0%{?fedora}
%if 0%{?fedora} >= 28
# eccodes not available on these arches
%ifnarch i686 ppc64 s390x armv7hl
BuildRequires: eccodes-devel
%else
BuildRequires: grib_api-devel
%endif
%else
# eccodes not available on these arches
%ifnarch i686 ppc64 s390x armv7hl aarch64
BuildRequires: eccodes-devel
%else
BuildRequires: grib_api-static
%endif
%endif
BuildRequires: eigen3-static
BuildRequires: libgeotiff-devel
BuildRequires: libtiff-devel
@ -67,7 +80,7 @@ BuildRequires: qhull-devel
%endif
BuildRequires: udunits2-devel
BuildRequires: wxGTK3-devel
BuildRequires: cmake
BuildRequires: cmake3
# For tests
BuildRequires: xorg-x11-drv-dummy
BuildRequires: metacity
@ -132,6 +145,8 @@ Provides: %{name}-runtime = %{version}-%{release}
rm -rf src/antlr
%patch1 -p1 -b .antlr
%patch2 -p1 -b .python3
%patch3 -p1 -b .antlr-grammar
%patch4 -p1 -b .std
pushd src
for f in *.g
@ -165,12 +180,12 @@ popd
mkdir build build-python
#Build the standalone executable
pushd build
%{cmake} %{cmake_opts} ..
%cmake3 %{cmake_opts} ..
make #{?_smp_mflags}
popd
#Build the python module
pushd build-python
%{cmake} %{cmake_opts} -DPYTHON_MODULE=ON ..
%cmake3 %{cmake_opts} -DPYTHON_MODULE=ON ..
make #{?_smp_mflags}
popd
@ -218,6 +233,7 @@ sleep 2
# bytscl - https://github.com/gnudatalanguage/gdl/issues/159
# fft_leak - https://github.com/gnudatalanguage/gdl/issues/147
# file_delete - https://github.com/gnudatalanguage/gdl/issues/148
# file_test - https://github.com/gnudatalanguage/gdl/issues/534
# fix - https://github.com/gnudatalanguage/gdl/issues/149
# formats - https://github.com/gnudatalanguage/gdl/issues/144
# n_tags - https://github.com/gnudatalanguage/gdl/issues/150
@ -225,7 +241,7 @@ sleep 2
# resolve_routine - https://github.com/gnudatalanguage/gdl/issues/146
# rounding - https://github.com/gnudatalanguage/gdl/issues/154
# total - https://github.com/gnudatalanguage/gdl/issues/155
failing_tests='test_(bytscl|fft_leak|file_delete|finite|fix|formats|idlneturl|make_dll|n_tags|parse_url|resolve_routine|rounding|total)'
failing_tests='test_(bytscl|fft_leak|file_(delete|test)|finite|fix|formats|idlneturl|make_dll|n_tags|parse_url|resolve_routine|rounding|total)'
%ifarch aarch64 ppc %{power64}
# test_fix fails currently on arm
# https://sourceforge.net/p/gnudatalanguage/bugs/622/
@ -251,10 +267,10 @@ failing_tests="$failing_tests|test_(file_lines|indgen|list|save_restore|wait|win
%endif
%ifarch ppc64le
# ppc64le - test_file_lines https://github.com/gnudatalanguage/gdl/issues/373
failing_tests="$failing_tests|test_(file_lines|indgen|list)"
failing_tests="$failing_tests|test_(angles|container|file_lines|hist_2d|indgen|list|random)"
%endif
%ifarch s390x
failing_tests="$failing_tests|test_(file_lines|indgen|list|save_restore|window_background)"
failing_tests="$failing_tests|test_(bug_635|file_lines|indgen|list|save_restore|window_background)"
%endif
make check VERBOSE=1 ARGS="-V -E '$failing_tests'"
%ifnarch ppc64 s390x
@ -284,6 +300,11 @@ cat xorg.log
%changelog
* Wed Feb 13 2019 Orion Poplawski <orion@nwra.com> - 0.9.9-4
- Use eccodes where available
- Add patches to fix build
- Use cmake3 for EPEL7 compat
* Wed Feb 13 2019 Orion Poplawski <orion@nwra.com> - 0.9.9-3
- Rebuild for plplot 5.14