sci-libs/netcdf: fix big endian build/tests

Closes: https://bugs.gentoo.org/772863
Package-Manager: Portage-3.0.15, Repoman-3.0.2
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Sam James
2021-02-25 08:55:47 +00:00
parent 8ae2854183
commit 9cc8bb6014
3 changed files with 84 additions and 1 deletions
@@ -0,0 +1,63 @@
https://github.com/DennisHeimbigner/netcdf-c/commit/6f86660da86f279cad1f2804cf3242767de27630.patch
https://github.com/Unidata/netcdf-c/issues/1687
https://bugs.gentoo.org/772863
From 6f86660da86f279cad1f2804cf3242767de27630 Mon Sep 17 00:00:00 2001
From: Dennis Heimbigner <dmh@ucar.edu>
Date: Fri, 3 Apr 2020 20:15:34 -0600
Subject: [PATCH] Fix missing forward declarations
re: issue https://github.com/Unidata/netcdf-c/issues/1687
static functions are being used before decl and it causes
errors. Only occurs when BIG_ENDIAN is defined.
Solution is to add the forward declarations.
---
libdispatch/dfilter.c | 4 ++++
nc_test4/tst_filterparser.c | 5 +++++
plugins/H5Zutil.c | 1 +
3 files changed, 10 insertions(+)
diff --git a/libdispatch/dfilter.c b/libdispatch/dfilter.c
index 893846457..0e490a3d6 100644
--- a/libdispatch/dfilter.c
+++ b/libdispatch/dfilter.c
@@ -40,6 +40,10 @@ Unified filter related code
/* Forward */
static int gettype(const int q0, const int q1, int* unsignedp);
+#ifdef WORDS_BIGENDIAN
+static void byteswap8(unsigned char* mem);
+static void byteswap4(unsigned char* mem);
+#endif
const struct LegalFormat {
const char* tag;
diff --git a/nc_test4/tst_filterparser.c b/nc_test4/tst_filterparser.c
index 7d02f2bc7..b32094a25 100644
--- a/nc_test4/tst_filterparser.c
+++ b/nc_test4/tst_filterparser.c
@@ -122,6 +122,11 @@ static const char* spectype[] = {"i", "b", "ub", "s", "us", "i", "ui", "i", "i",
static int nerrs = 0;
+#ifdef WORDS_BIGENDIAN
+static void byteswap8(unsigned char* mem);
+static void byteswap4(unsigned char* mem);
+#endif
+
static void
mismatch(size_t i, unsigned int *params, const char* tag)
{
diff --git a/plugins/H5Zutil.c b/plugins/H5Zutil.c
index cb36dc96c..86dfb0cfa 100644
--- a/plugins/H5Zutil.c
+++ b/plugins/H5Zutil.c
@@ -4,6 +4,7 @@
*/
+#include "config.h"
#include <hdf5.h>
/*
@@ -0,0 +1,16 @@
Fixes ncdump_tst_netcdf4 test failure on big endian.
https://github.com/Unidata/netcdf-c/issues/1896
diff --git a/ncdump/tst_special_atts.c b/ncdump/tst_special_atts.c
index 9655b86..e71cb7e 100644
--- a/ncdump/tst_special_atts.c
+++ b/ncdump/tst_special_atts.c
@@ -145,6 +145,10 @@ main(int argc, char **argv)
/* Set _Storage as compact */
if (nc_def_var_chunking(ncid, var6id, NC_COMPACT, NULL)) ERR;
if (nc_def_var_chunking(ncid, var7id, NC_COMPACT, NULL)) ERR;
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+ if (nc_def_var_endian(ncid, var6id, NC_ENDIAN_LITTLE)) ERR;
+ if (nc_def_var_endian(ncid, var7id, NC_ENDIAN_LITTLE)) ERR;
+#endif
if (nc_enddef(ncid)) ERR;
+5 -1
View File
@@ -8,6 +8,7 @@ inherit cmake
DESCRIPTION="Scientific library and interface for array oriented data access"
HOMEPAGE="https://www.unidata.ucar.edu/software/netcdf/"
SRC_URI="https://github.com/Unidata/netcdf-c/archive/v${PV}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/${PN}-c-${PV}"
LICENSE="UCAR-Unidata"
SLOT="0/18"
@@ -33,7 +34,10 @@ REQUIRED_USE="
szip? ( hdf5 )
mpi? ( hdf5 )"
S="${WORKDIR}/${PN}-c-${PV}"
PATCHES=(
"${FILESDIR}/${PN}-4.7.4-big-endian-build.patch"
"${FILESDIR}/${PN}-4.7.4-big-endian-test.patch"
)
src_prepare() {
# skip test that requires network