Subject: [PATCH v2] testing/hdf4: new aport

From: Edd Salkield <[email-masked]>
Date: Sat, 2 Apr 2022 18:22:25 +0100

https://www.hdfgroup.org/solutions/hdf4/
HDF4 is a data model, library, and file format for storing and managing data
---
 testing/hdf4/10-hdf-ppc.patch         | 189 +++++++++++++++
 testing/hdf4/20-hdf-4.2.4-sparc.patch |  78 +++++++
 testing/hdf4/30-hdf-s390.patch        | 317 ++++++++++++++++++++++++++
 testing/hdf4/40-hdf-arm.patch         |  81 +++++++
 testing/hdf4/50-hdf-aarch64.patch     | 289 +++++++++++++++++++++++
 testing/hdf4/60-hdf-ppc64le.patch     |  83 +++++++
 testing/hdf4/APKBUILD                 | 117 ++++++++++
 7 files changed, 1154 insertions(+)
 create mode 100644 testing/hdf4/10-hdf-ppc.patch
 create mode 100644 testing/hdf4/20-hdf-4.2.4-sparc.patch
 create mode 100644 testing/hdf4/30-hdf-s390.patch
 create mode 100644 testing/hdf4/40-hdf-arm.patch
 create mode 100644 testing/hdf4/50-hdf-aarch64.patch
 create mode 100644 testing/hdf4/60-hdf-ppc64le.patch
 create mode 100644 testing/hdf4/APKBUILD

diff --git a/testing/hdf4/10-hdf-ppc.patch b/testing/hdf4/10-hdf-ppc.patch
new file mode 100644
index 0000000000..039f876ff0
--- /dev/null
+++ b/testing/hdf4/10-hdf-ppc.patch
@@ -0,0 +1,189 @@
+diff -up hdf-4.2.15/hdf/src/hdfi.h.ppc hdf-4.2.15/hdf/src/hdfi.h
+--- hdf-4.2.15/hdf/src/hdfi.h.ppc	2020-03-03 10:40:50.000000000 -0700
++++ hdf-4.2.15/hdf/src/hdfi.h	2020-04-30 21:04:01.529561298 -0600
+@@ -75,6 +75,7 @@
+ #define     DFMT_IA64           0x4441
+ #define     DFMT_LINUX64        0x4441
+ #define     DFMT_POWERPC64      0x1111
++#define     DFMT_LINUXPPC       0x1111
+ 
+ /* I/O library constants */
+ #define UNIXUNBUFIO 1
+@@ -1017,6 +1018,57 @@ typedef long              hdf_pint_t;
+ 
+ #endif /*Linux 64 */
+ 
++/* Linux PPC */
++#if defined __powerpc__ && !defined __powerpc64__
++
++#ifdef GOT_MACHINE
++If you get an error on this line more than one machine type has been defined.
++Please check your Makefile.
++#endif
++#define GOT_MACHINE
++
++#include <sys/file.h>               /* for unbuffered i/o stuff */
++#include <sys/stat.h>
++#define DF_MT             DFMT_LINUXPPC
++typedef void              VOID;
++typedef void              *VOIDP;
++typedef char              *_fcd;
++typedef char              char8;
++typedef unsigned char     uchar8;
++typedef char              int8;
++typedef unsigned char     uint8;
++typedef short int         int16;
++typedef unsigned short int uint16;
++typedef int               int32;
++typedef unsigned int      uint32;
++typedef int               intn;
++typedef unsigned int      uintn;
++typedef int               intf;     /* size of INTEGERs in Fortran compiler */
++typedef float             float32;
++typedef double            float64;
++typedef long              hdf_pint_t;   /* an integer the same size as a pointer */
++#define FNAME_POST_UNDERSCORE
++#define _fcdtocp(desc) (desc)
++#ifdef  HAVE_FMPOOL
++#define FILELIB PAGEBUFIO  /* enable page buffering */
++#else
++#define FILELIB UNIXBUFIO
++#endif
++
++/* JPEG #define's - Look in the JPEG docs before changing - (Q) */
++
++/* Determine the memory manager we are going to use. Valid values are: */
++/*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
++/*  what each does */
++#define JMEMSYS         MEM_ANSI
++
++#ifdef __GNUC__
++#define HAVE_STDC
++#define INCLUDES_ARE_ANSI
++#endif
++
++#endif /*Linux PPC */
++
+ /*-----------------------------------------------------*/
+ /* 64-bit Free BSD */
+ 
+diff -up hdf-4.2.15/mfhdf/fortran/jackets.c.in.ppc hdf-4.2.15/mfhdf/fortran/jackets.c.in
+--- hdf-4.2.15/mfhdf/fortran/jackets.c.in.ppc	2020-03-03 10:40:50.000000000 -0700
++++ hdf-4.2.15/mfhdf/fortran/jackets.c.in	2020-04-30 21:06:39.500403641 -0600
+@@ -34,7 +34,7 @@
+ 
+ struct ncfils {            /* This will be a common block from Fortran */
+     double dd;
+-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__
++#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__
+     int ll;
+ #else
+     long ll;
+@@ -65,7 +65,7 @@ struct ncfils {            /* This will
+ 
+ struct ncfils {            /* This will be a common block from Fortran */
+     double dd;
+-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__
++#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__
+     int ll;
+ #else
+     long ll;
+@@ -420,7 +420,7 @@ stoig(shorts, ints, dims, basis, ndims)
+ }
+ #endif /* FORTRAN_HAS_NO_SHORT */
+ 
+-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__
++#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__
+ /*
+  * Convert multi-dimensional array of NCLONGs stored in ints to packed
+  * array of longs, in malloc'ed space.  Returns pointer to longs or NULL
+@@ -908,7 +908,7 @@ nncvpt1(cdfid, varid, indices, value, rc
+     return;
+     }                /* else */
+ #endif                /* FORTRAN_HAS_NO_SHORT */
+-#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__
++#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__
+ #ifdef HDF
+     if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+     long          longs = *(int *)value;
+@@ -1022,7 +1022,7 @@ nncvpt(cdfid, varid, start, count, value
+     return;
+     }                /* else */
+ #endif                /* FORTRAN_HAS_NO_SHORT */
+-#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__
++#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__
+ #ifdef HDF
+     if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+     long *longs = itol (value, ncount, ndims);
+@@ -1133,7 +1133,7 @@ nncvptg(cdfid, varid, start, count, stri
+     tmpbasis    = nctypelen(NC_LONG);
+     else
+ #endif
+-#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__
++#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__
+     if (datatype == NC_LONG)
+     tmpbasis    = sizeof(int);
+     else
+@@ -1190,7 +1190,7 @@ nncvptg(cdfid, varid, start, count, stri
+     return;
+     }                /* else */
+ #endif                /* FORTRAN_HAS_NO_SHORT */
+-#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__
++#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__
+ #ifdef HDF
+     if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+     long *longs = itolg (value, ncount, nbasis, ndims);
+@@ -1326,7 +1326,7 @@ nncvgt1(cdfid, varid, indices, value, rc
+     return;
+     }                /* else */
+ #endif                /* FORTRAN_HAS_NO_SHORT */
+-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__
++#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__
+ #ifdef HDF
+     if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+     long          longs;
+@@ -1468,7 +1468,7 @@ nncvgt(cdfid, varid, start, count, value
+     return;
+     }                /* else */
+ #endif                /* FORTRAN_HAS_NO_SHORT */
+-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__
++#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__
+ #ifdef HDF
+     if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+     long iocount = dimprod (ncount, ndims);    /* product of dimensions */
+@@ -1606,7 +1606,7 @@ nncvgtg(cdfid, varid, start, count, stri
+     tmpbasis    = nctypelen(NC_LONG);
+     else
+ #endif
+-#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__
++#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__
+     if (datatype == NC_LONG)
+     tmpbasis    = sizeof(int);
+     else
+@@ -1677,7 +1677,7 @@ nncvgtg(cdfid, varid, start, count, stri
+     return;
+     }                /* else */
+ #endif                /* FORTRAN_HAS_NO_SHORT */
+-#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__
++#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__
+ #ifdef HDF
+     if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+     long iocount = dimprod (ncount, ndims);    /* product of dimensions */
+@@ -1843,7 +1843,7 @@ nncapt(cdfid, varid, attname, datatype,
+     return;
+     }                /* else */
+ #endif                /* FORTRAN_HAS_NO_SHORT */
+-#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__
++#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__
+ #ifdef HDF
+     if ((nc_type) *datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+     long *longs = itol (value, attlen, 1);
+@@ -2008,7 +2008,7 @@ nncagt(cdfid, varid, attname, value, rco
+     return;
+     }                /* else */
+ #endif                /* FORTRAN_HAS_NO_SHORT */
+-#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__
++#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__
+ #ifdef HDF
+     if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+ /* EIP  We need to use int buffer to read data in on the platforms where long is 8 bytes
diff --git a/testing/hdf4/20-hdf-4.2.4-sparc.patch b/testing/hdf4/20-hdf-4.2.4-sparc.patch
new file mode 100644
index 0000000000..38d4fd4ee0
--- /dev/null
+++ b/testing/hdf4/20-hdf-4.2.4-sparc.patch
@@ -0,0 +1,78 @@
+diff -up hdf-4.2.4-snap8/hdf/src/hdfi.h.sparc hdf-4.2.4-snap8/hdf/src/hdfi.h
+--- hdf-4.2.4-snap8/hdf/src/hdfi.h.sparc	2010-02-01 13:28:25.361387271 -0700
++++ hdf-4.2.4-snap8/hdf/src/hdfi.h	2010-02-01 13:31:46.343387138 -0700
+@@ -77,6 +77,7 @@
+ #define     DFMT_LINUX64        0x4441
+ #define     DFMT_POWERPC64      0x1111
+ #define     DFMT_LINUXPPC       0x1111
++#define     DFMT_LINUXSPARC     0x1111
+ 
+ /* I/O library constants */
+ #define UNIXUNBUFIO 1
+@@ -1392,6 +1393,66 @@ typedef long              hdf_pint_t;   
+ 
+ #endif /*Linux PPC */
+ 
++/* Linux Sparc32/64 */
++#if defined __sparc__ || defined __sparc64__
++
++#ifdef GOT_MACHINE
++If you get an error on this line more than one machine type has been defined.
++Please check your Makefile.
++#endif
++#define GOT_MACHINE
++
++#include <sys/file.h>               /* for unbuffered i/o stuff */
++#include <sys/stat.h>
++#define DF_MT             DFMT_LINUXPPC
++typedef void              VOID;
++typedef void              *VOIDP;
++typedef char              *_fcd;
++typedef char              char8;
++typedef unsigned char     uchar8;
++typedef char              int8;
++typedef unsigned char     uint8;
++typedef short int         int16;
++typedef unsigned short int uint16;
++#ifdef _LP64 /* 64-bit environment */
++typedef int               int32;
++typedef unsigned int      uint32;
++#else /* 32-bit environment */
++typedef long int          int32;
++typedef unsigned long int uint32;
++#endif
++typedef int               intn;
++typedef unsigned int      uintn;
++typedef int               intf;     /* size of INTEGERs in Fortran compiler */
++typedef float             float32;
++typedef double            float64;
++#ifdef _LP64 /* 64-bit environment */
++typedef long              hdf_pint_t;   /* an integer the same size as a pointer */
++#else /* 32-bit environment */
++typedef int               hdf_pint_t;   /* an integer the same size as a pointer */
++#endif
++#define FNAME_POST_UNDERSCORE
++#define _fcdtocp(desc) (desc)
++#ifdef  HAVE_FMPOOL
++#define FILELIB PAGEBUFIO  /* enable page buffering */
++#else
++#define FILELIB UNIXBUFIO
++#endif
++
++/* JPEG #define's - Look in the JPEG docs before changing - (Q) */
++
++/* Determine the memory manager we are going to use. Valid values are: */
++/*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
++/*  what each does */
++#define JMEMSYS         MEM_ANSI
++
++#ifdef __GNUC__
++#define HAVE_STDC
++#define INCLUDES_ARE_ANSI
++#endif
++
++#endif /* Linux Sparc32/64 */
++
+ /*-----------------------------------------------------*/
+ /* 64-bit Free BSD */
+ 
diff --git a/testing/hdf4/30-hdf-s390.patch b/testing/hdf4/30-hdf-s390.patch
new file mode 100644
index 0000000000..ea21e03704
--- /dev/null
+++ b/testing/hdf4/30-hdf-s390.patch
@@ -0,0 +1,317 @@
+diff -up hdf-4.2.15/hdf/src/hdfi.h.s390 hdf-4.2.15/hdf/src/hdfi.h
+--- hdf-4.2.15/hdf/src/hdfi.h.s390	2020-04-30 21:07:16.946922845 -0600
++++ hdf-4.2.15/hdf/src/hdfi.h	2020-04-30 21:07:16.950922901 -0600
+@@ -77,6 +77,7 @@
+ #define     DFMT_POWERPC64      0x1111
+ #define     DFMT_LINUXPPC       0x1111
+ #define     DFMT_LINUXSPARC     0x1111
++#define     DFMT_LINUX390       0x1111
+ 
+ /* I/O library constants */
+ #define UNIXUNBUFIO 1
+@@ -1130,6 +1131,66 @@ typedef int               hdf_pint_t;
+ 
+ #endif /* Linux Sparc32/64 */
+ 
++/* Linux s390/s390x */
++#if defined __s390__ || defined __s390x__
++
++#ifdef GOT_MACHINE
++If you get an error on this line more than one machine type has been defined.
++Please check your Makefile.
++#endif
++#define GOT_MACHINE
++
++#include <sys/file.h>               /* for unbuffered i/o stuff */
++#include <sys/stat.h>
++#define DF_MT             DFMT_LINUX390
++typedef void              VOID;
++typedef void              *VOIDP;
++typedef char              *_fcd;
++typedef char              char8;
++typedef unsigned char     uchar8;
++typedef char              int8;
++typedef unsigned char     uint8;
++typedef short int         int16;
++typedef unsigned short int uint16;
++#ifdef __s390x__ /* 64-bit environment */
++typedef int               int32;
++typedef unsigned int      uint32;
++#else /* 32-bit environment */
++typedef long int          int32;
++typedef unsigned long int uint32;
++#endif
++typedef int               intn;
++typedef unsigned int      uintn;
++typedef int               intf;     /* size of INTEGERs in Fortran compiler */
++typedef float             float32;
++typedef double            float64;
++#ifdef __s390x__ /* 64-bit environment */
++typedef long              hdf_pint_t;   /* an integer the same size as a pointer */
++#else /* 32-bit environment */
++typedef int               hdf_pint_t;   /* an integer the same size as a pointer */
++#endif
++#define FNAME_POST_UNDERSCORE
++#define _fcdtocp(desc) (desc)
++#ifdef  HAVE_FMPOOL
++#define FILELIB PAGEBUFIO  /* enable page buffering */
++#else
++#define FILELIB UNIXBUFIO
++#endif
++
++/* JPEG #define's - Look in the JPEG docs before changing - (Q) */
++
++/* Determine the memory manager we are going to use. Valid values are: */
++/*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
++/*  what each does */
++#define JMEMSYS         MEM_ANSI
++
++#ifdef __GNUC__
++#define HAVE_STDC
++#define INCLUDES_ARE_ANSI
++#endif
++
++#endif /* Linux s390/s390x */
++
+ /*-----------------------------------------------------*/
+ /* 64-bit Free BSD */
+ 
+diff -up hdf-4.2.15/mfhdf/fortran/jackets.c.in.s390 hdf-4.2.15/mfhdf/fortran/jackets.c.in
+--- hdf-4.2.15/mfhdf/fortran/jackets.c.in.s390	2020-04-30 21:07:16.942922790 -0600
++++ hdf-4.2.15/mfhdf/fortran/jackets.c.in	2020-04-30 21:10:30.030640644 -0600
+@@ -34,7 +34,7 @@
+ 
+ struct ncfils {            /* This will be a common block from Fortran */
+     double dd;
+-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__
++#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__
+     int ll;
+ #else
+     long ll;
+@@ -65,7 +65,7 @@ struct ncfils {            /* This will
+ 
+ struct ncfils {            /* This will be a common block from Fortran */
+     double dd;
+-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__
++#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__
+     int ll;
+ #else
+     long ll;
+@@ -420,7 +420,7 @@ stoig(shorts, ints, dims, basis, ndims)
+ }
+ #endif /* FORTRAN_HAS_NO_SHORT */
+ 
+-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__
++#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__
+ /*
+  * Convert multi-dimensional array of NCLONGs stored in ints to packed
+  * array of longs, in malloc'ed space.  Returns pointer to longs or NULL
+@@ -908,7 +908,7 @@ nncvpt1(cdfid, varid, indices, value, rc
+     return;
+     }                /* else */
+ #endif                /* FORTRAN_HAS_NO_SHORT */
+-#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__
++#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__
+ #ifdef HDF
+     if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+     long          longs = *(int *)value;
+@@ -1022,7 +1022,7 @@ nncvpt(cdfid, varid, start, count, value
+     return;
+     }                /* else */
+ #endif                /* FORTRAN_HAS_NO_SHORT */
+-#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__
++#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__
+ #ifdef HDF
+     if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+     long *longs = itol (value, ncount, ndims);
+@@ -1133,7 +1133,7 @@ nncvptg(cdfid, varid, start, count, stri
+     tmpbasis    = nctypelen(NC_LONG);
+     else
+ #endif
+-#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__
++#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__
+     if (datatype == NC_LONG)
+     tmpbasis    = sizeof(int);
+     else
+@@ -1190,7 +1190,7 @@ nncvptg(cdfid, varid, start, count, stri
+     return;
+     }                /* else */
+ #endif                /* FORTRAN_HAS_NO_SHORT */
+-#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__
++#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__
+ #ifdef HDF
+     if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+     long *longs = itolg (value, ncount, nbasis, ndims);
+@@ -1326,7 +1326,7 @@ nncvgt1(cdfid, varid, indices, value, rc
+     return;
+     }                /* else */
+ #endif                /* FORTRAN_HAS_NO_SHORT */
+-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__
++#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__
+ #ifdef HDF
+     if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+     long          longs;
+@@ -1468,7 +1468,7 @@ nncvgt(cdfid, varid, start, count, value
+     return;
+     }                /* else */
+ #endif                /* FORTRAN_HAS_NO_SHORT */
+-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__
++#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__
+ #ifdef HDF
+     if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+     long iocount = dimprod (ncount, ndims);    /* product of dimensions */
+@@ -1606,7 +1606,7 @@ nncvgtg(cdfid, varid, start, count, stri
+     tmpbasis    = nctypelen(NC_LONG);
+     else
+ #endif
+-#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__
++#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__
+     if (datatype == NC_LONG)
+     tmpbasis    = sizeof(int);
+     else
+@@ -1677,7 +1677,7 @@ nncvgtg(cdfid, varid, start, count, stri
+     return;
+     }                /* else */
+ #endif                /* FORTRAN_HAS_NO_SHORT */
+-#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__
++#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__
+ #ifdef HDF
+     if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+     long iocount = dimprod (ncount, ndims);    /* product of dimensions */
+@@ -1843,7 +1843,7 @@ nncapt(cdfid, varid, attname, datatype,
+     return;
+     }                /* else */
+ #endif                /* FORTRAN_HAS_NO_SHORT */
+-#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__
++#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__
+ #ifdef HDF
+     if ((nc_type) *datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+     long *longs = itol (value, attlen, 1);
+@@ -2008,7 +2008,7 @@ nncagt(cdfid, varid, attname, value, rco
+     return;
+     }                /* else */
+ #endif                /* FORTRAN_HAS_NO_SHORT */
+-#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__
++#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__
+ #ifdef HDF
+     if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+ /* EIP  We need to use int buffer to read data in on the platforms where long is 8 bytes
+diff -up hdf-4.2.15/mfhdf/libsrc/array.c.s390 hdf-4.2.15/mfhdf/libsrc/array.c
+diff -up hdf-4.2.15/mfhdf/libsrc/cdf.c.s390 hdf-4.2.15/mfhdf/libsrc/cdf.c
+diff -up hdf-4.2.15/mfhdf/libsrc/netcdf.h.in.s390 hdf-4.2.15/mfhdf/libsrc/netcdf.h.in
+--- hdf-4.2.15/mfhdf/libsrc/netcdf.h.in.s390	2020-04-30 21:07:16.957922998 -0600
++++ hdf-4.2.15/mfhdf/libsrc/netcdf.h.in	2020-04-30 21:15:23.731467288 -0600
+@@ -293,7 +293,7 @@ typedef double        ncdouble;
+ /*
+  * Variables/attributes of type NC_LONG should use the C type 'nclong'
+  */
+-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__
++#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__
+ /*
+  * LP64 (also known as 4/8/8) denotes long and pointer as 64 bit types.
+  * http://www.unix.org/version2/whatsnew/lp64_wp.html
+diff -up hdf-4.2.15/mfhdf/libsrc/putget.c.s390 hdf-4.2.15/mfhdf/libsrc/putget.c
+--- hdf-4.2.15/mfhdf/libsrc/putget.c.s390	2020-04-30 21:07:16.959923025 -0600
++++ hdf-4.2.15/mfhdf/libsrc/putget.c	2020-04-30 21:12:13.612268179 -0600
+@@ -665,7 +665,7 @@ Void *values ;
+     case NC_SHORT :
+         return( xdr_NCvshort(xdrs, (unsigned)rem/2, (short *)values) ) ;
+     case NC_LONG :
+-#if (_MIPS_SZLONG == 64) || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ 
++#if (_MIPS_SZLONG == 64) || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__
+         return( xdr_int(xdrs, (nclong *)values) ) ;
+ #else
+         return( xdr_long(xdrs, (nclong *)values) ) ;
+diff -up hdf-4.2.15/mfhdf/libsrc/xdrposix.c.s390 hdf-4.2.15/mfhdf/libsrc/xdrposix.c
+--- hdf-4.2.15/mfhdf/libsrc/xdrposix.c.s390	2020-03-03 10:40:50.000000000 -0700
++++ hdf-4.2.15/mfhdf/libsrc/xdrposix.c	2020-04-30 21:14:47.574557550 -0600
+@@ -262,7 +262,7 @@ int nbytes;
+ 
+ static bool_t   xdrposix_getlong();
+ static bool_t   xdrposix_putlong();
+-#if (_MIPS_SZLONG == 64) || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__
++#if (_MIPS_SZLONG == 64) || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__
+ static bool_t   xdrposix_getint();
+ static bool_t   xdrposix_putint();
+ #endif
+@@ -276,7 +276,7 @@ static long *    xdrposix_inline();
+ #if (defined __sun && defined _LP64)
+ static rpc_inline_t *    xdrposix_inline();
+ #else
+-#if ((defined __x86_64__ ) && !(defined __sun && defined _LP64)) || defined __powerpc64__
++#if ((defined __x86_64__ ) && !(defined __sun && defined _LP64)) || defined __powerpc64__ || defined __s390x__
+ static int32_t *    xdrposix_inline();
+ #else
+ static netlong *    xdrposix_inline();
+@@ -302,9 +302,9 @@ static struct xdr_ops   xdrposix_ops = {
+     xdrposix_getpos,    /* get offset in the stream */
+     xdrposix_setpos,    /* set offset in the stream */
+     xdrposix_inline,    /* prime stream for inline macros */
+-#if (defined __sun && defined _LP64) || defined __x86_64__ || defined __powerpc64__
++#if (defined __sun && defined _LP64) || defined __x86_64__ || defined __powerpc64__ || defined __s390x__
+     xdrposix_destroy,   /* destroy stream */
+-#if !(defined __x86_64__) && !(defined __powerpc64__) || (defined  __sun && defined _LP64) /* i.e. we are on SUN/Intel in 64-bit mode */
++#if !(defined __x86_64__) && !(defined __powerpc64__) && !(defined __s390x__) || (defined  __sun && defined _LP64) /* i.e. we are on SUN/Intel in 64-bit mode */
+     NULL,               /* no xdr_control function defined */
+ #endif
+     /* Solaris 64-bit (arch=v9 and arch=amd64) has 64 bits long and 32 bits int. */
+@@ -442,7 +442,7 @@ xdrposix_getlong(xdrs, lp)
+     long *lp;
+ {
+     unsigned char *up = (unsigned char *)lp ;
+-#if (defined AIX5L64 || defined __powerpc64__ || (defined __hpux && __LP64__))
++#if (defined AIX5L64 || defined __powerpc64__ || defined __s390x__ || (defined __hpux && __LP64__))
+     *lp = 0 ;
+     up += (sizeof(long) - 4) ;
+ #endif
+@@ -465,7 +465,7 @@ xdrposix_putlong(xdrs, lp)
+     netlong mycopy = htonl(*lp);
+     up = (unsigned char *)&mycopy;
+ #endif
+-#if (defined AIX5L64  || defined __powerpc64__ || (defined __hpux && __LP64__))
++#if (defined AIX5L64  || defined __powerpc64__ || defined __s390x__ || (defined __hpux && __LP64__))
+     up += (sizeof(long) - 4) ;
+ #endif
+ 
+@@ -560,7 +560,7 @@ static long *
+ #if (defined __sun && defined _LP64)
+ static rpc_inline_t *
+ #else
+-#if ((defined  __x86_64__) && !(defined __sun && defined _LP64)) || defined __powerpc64__
++#if ((defined  __x86_64__) && !(defined __sun && defined _LP64)) || defined __powerpc64__ || defined __s390x__
+ static int32_t *
+ #else
+ static netlong *
+@@ -581,7 +581,7 @@ xdrposix_inline(xdrs, len)
+     return (NULL);
+ }
+ 
+-#if (_MIPS_SZLONG == 64) || (defined __sun && defined _LP64) || defined AIX5L64  || defined __x86_64__ || defined __powerpc64__
++#if (_MIPS_SZLONG == 64) || (defined __sun && defined _LP64) || defined AIX5L64  || defined __x86_64__ || defined __powerpc64__ || defined __s390x__
+ 
+ static bool_t
+ xdrposix_getint(xdrs, lp)
+diff -up hdf-4.2.15/mfhdf/ncgen/ncgen.l.s390 hdf-4.2.15/mfhdf/ncgen/ncgen.l
+--- hdf-4.2.15/mfhdf/ncgen/ncgen.l.s390	2020-04-30 21:07:16.961923053 -0600
++++ hdf-4.2.15/mfhdf/ncgen/ncgen.l	2020-04-30 21:08:10.175628593 -0600
+@@ -113,7 +113,7 @@ FloatInf|Infinity|Inf    {    /* float m
+             yyerror(errstr);
+         }
+ 
+-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || __powerpc64__
++#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || __powerpc64__ || defined __s390x__
+         if (dd < INT_MIN  ||  dd > INT_MAX)
+ #else
+         if (dd < LONG_MIN  ||  dd > LONG_MAX)
+diff -up hdf-4.2.15/mfhdf/ncgen/ncgenyy.c.s390 hdf-4.2.15/mfhdf/ncgen/ncgenyy.c
+--- hdf-4.2.15/mfhdf/ncgen/ncgenyy.c.s390	2020-04-30 21:07:16.963923081 -0600
++++ hdf-4.2.15/mfhdf/ncgen/ncgenyy.c	2020-04-30 21:08:53.818030313 -0600
+@@ -991,7 +991,7 @@ YY_RULE_SETUP
+             yyerror(errstr);
+         }
+ 
+-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || __powerpc64__
++#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || __powerpc64__ || __s390x__
+         if (dd < INT_MIN  ||  dd > INT_MAX)
+ #else
+         if (dd < LONG_MIN  ||  dd > LONG_MAX)
diff --git a/testing/hdf4/40-hdf-arm.patch b/testing/hdf4/40-hdf-arm.patch
new file mode 100644
index 0000000000..2e63af1cb1
--- /dev/null
+++ b/testing/hdf4/40-hdf-arm.patch
@@ -0,0 +1,81 @@
+diff -up hdf-4.2.10/hdf/src/hconv.h.arm hdf-4.2.10/hdf/src/hconv.h
+--- hdf-4.2.10/hdf/src/hconv.h.arm	2014-02-14 09:28:56.692514796 -0700
++++ hdf-4.2.10/hdf/src/hconv.h	2014-02-14 09:30:03.882212944 -0700
+@@ -59,7 +59,7 @@
+ /* CONSTANT DEFINITIONS                                                      */
+ /*****************************************************************************/
+ /* Generally Big-Endian machines */
+-#if !defined(INTEL86) && !defined(MIPSEL) && !defined(DEC_ALPHA) && !defined(I860) && !defined(SUN386) && !(defined(__ia64) && !(defined(hpux) || defined(__hpux))) && !defined(__x86_64__)
++#if !defined(INTEL86) && !defined(MIPSEL) && !defined(DEC_ALPHA) && !defined(I860) && !defined(SUN386) && !(defined(__ia64) && !(defined(hpux) || defined(__hpux))) && !defined(__x86_64__) && !defined(__arm__)
+ #       define UI8_IN     DFKnb1b   /* Unsigned Integer, 8 bits */
+ #       define UI8_OUT    DFKnb1b
+ #       define SI16_IN    DFKnb2b   /* S = Signed */
+diff -up hdf-4.2.10/hdf/src/hdfi.h.arm hdf-4.2.10/hdf/src/hdfi.h
+--- hdf-4.2.10/hdf/src/hdfi.h.arm	2014-02-14 09:28:56.685514824 -0700
++++ hdf-4.2.10/hdf/src/hdfi.h	2014-02-14 09:28:56.693514792 -0700
+@@ -78,6 +78,7 @@
+ #define     DFMT_LINUXPPC       0x1111
+ #define     DFMT_LINUXSPARC     0x1111
+ #define     DFMT_LINUX390       0x1111
++#define     DFMT_LINUXARM       0x4441
+ 
+ /* I/O library constants */
+ #define UNIXUNBUFIO 1
+@@ -1187,6 +1188,57 @@ typedef int               hdf_pint_t;
+ 
+ #endif /* Linux s390/s390x */
+ 
++/* Linux ARM */
++#if defined __arm__
++
++#ifdef GOT_MACHINE
++If you get an error on this line more than one machine type has been defined.
++Please check your Makefile.
++#endif
++#define GOT_MACHINE
++
++#include <sys/file.h>               /* for unbuffered i/o stuff */
++#include <sys/stat.h>
++#define DF_MT             DFMT_LINUXARM
++typedef void              VOID;
++typedef void              *VOIDP;
++typedef char              *_fcd;
++typedef char              char8;
++typedef unsigned char     uchar8;
++typedef char              int8;
++typedef unsigned char     uint8;
++typedef short int         int16;
++typedef unsigned short int uint16;
++typedef long int          int32;
++typedef unsigned long int uint32;
++typedef int               intn;
++typedef unsigned int      uintn;
++typedef int               intf;     /* size of INTEGERs in Fortran compiler */
++typedef float             float32;
++typedef double            float64;
++typedef int               hdf_pint_t;   /* an integer the same size as a pointer */
++#define FNAME_POST_UNDERSCORE
++#define _fcdtocp(desc) (desc)
++#ifdef  HAVE_FMPOOL
++#define FILELIB PAGEBUFIO  /* enable page buffering */
++#else
++#define FILELIB UNIXBUFIO
++#endif
++
++/* JPEG #define's - Look in the JPEG docs before changing - (Q) */
++
++/* Determine the memory manager we are going to use. Valid values are: */
++/*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
++/*  what each does */
++#define JMEMSYS         MEM_ANSI
++
++#ifdef __GNUC__
++#define HAVE_STDC
++#define INCLUDES_ARE_ANSI
++#endif
++
++#endif /* Linux ARM */
++
+ /*-----------------------------------------------------*/
+ /* 64-bit Free BSD */
+ 
diff --git a/testing/hdf4/50-hdf-aarch64.patch b/testing/hdf4/50-hdf-aarch64.patch
new file mode 100644
index 0000000000..1865e72b3a
--- /dev/null
+++ b/testing/hdf4/50-hdf-aarch64.patch
@@ -0,0 +1,289 @@
+diff -up hdf-4.2.15/hdf/src/hconv.h.aarch64 hdf-4.2.15/hdf/src/hconv.h
+--- hdf-4.2.15/hdf/src/hconv.h.aarch64	2020-04-30 21:16:25.325499508 -0600
++++ hdf-4.2.15/hdf/src/hconv.h	2020-04-30 21:16:25.338499580 -0600
+@@ -59,7 +59,7 @@
+ /* CONSTANT DEFINITIONS                                                      */
+ /*****************************************************************************/
+ /* Generally Big-Endian machines */
+-#if !defined(INTEL86) && !defined(MIPSEL) && !defined(DEC_ALPHA) && !defined(I860) && !defined(SUN386) && !(defined(__ia64) && !(defined(hpux) || defined(__hpux))) && !defined(__x86_64__) && !defined(__arm__)
++#if !defined(INTEL86) && !defined(MIPSEL) && !defined(DEC_ALPHA) && !defined(I860) && !defined(SUN386) && !(defined(__ia64) && !(defined(hpux) || defined(__hpux))) && !defined(__x86_64__) && !defined(__arm__) && !defined(__AARCH64EL__)
+ #       define UI8_IN     DFKnb1b   /* Unsigned Integer, 8 bits */
+ #       define UI8_OUT    DFKnb1b
+ #       define SI16_IN    DFKnb2b   /* S = Signed */
+diff -up hdf-4.2.15/hdf/src/hdfi.h.aarch64 hdf-4.2.15/hdf/src/hdfi.h
+--- hdf-4.2.15/hdf/src/hdfi.h.aarch64	2020-04-30 21:16:25.326499514 -0600
++++ hdf-4.2.15/hdf/src/hdfi.h	2020-04-30 21:16:25.340499591 -0600
+@@ -79,6 +79,7 @@
+ #define     DFMT_LINUXSPARC     0x1111
+ #define     DFMT_LINUX390       0x1111
+ #define     DFMT_LINUXARM       0x4441
++#define     DFMT_LINUXAARCH64   0x4441
+ 
+ /* I/O library constants */
+ #define UNIXUNBUFIO 1
+@@ -1341,6 +1342,44 @@ typedef long              hdf_pint_t;
+ 
+ #endif /* IA64 */
+ 
++/* Linux AArch64 */
++#if defined __aarch64__
++
++#ifdef GOT_MACHINE
++If you get an error on this line more than one machine type has been defined.
++Please check your Makefile.
++#endif
++#define GOT_MACHINE
++
++#include <sys/file.h>               /* for unbuffered i/o stuff */
++#include <sys/stat.h>
++#define DF_MT             DFMT_LINUXAARCH64
++typedef void              VOID;
++typedef void              *VOIDP;
++typedef char              *_fcd;
++typedef char              char8;
++typedef unsigned char     uchar8;
++typedef char              int8;
++typedef unsigned char     uint8;
++typedef short int         int16;
++typedef unsigned short int uint16;
++typedef int               int32;
++typedef unsigned int      uint32;
++typedef int               intn;
++typedef unsigned int      uintn;
++typedef int               intf;     /* size of INTEGERs in Fortran compiler */
++typedef float             float32;
++typedef double            float64;
++typedef long              hdf_pint_t;   /* an integer the same size as a pointer */
++#define FNAME_POST_UNDERSCORE
++#define _fcdtocp(desc) (desc)
++#ifdef  HAVE_FMPOOL
++#define FILELIB PAGEBUFIO  /* enable page buffering */
++#else
++#define FILELIB UNIXBUFIO
++#endif
++#endif /* Linux AArch64 */
++
+ #ifndef GOT_MACHINE
+ No machine type has been defined.  Your Makefile needs to have someing like
+ -DSUN or -DUNICOS in order for the HDF internal structures to be defined
+diff -up hdf-4.2.15/mfhdf/fortran/jackets.c.in.aarch64 hdf-4.2.15/mfhdf/fortran/jackets.c.in
+--- hdf-4.2.15/mfhdf/fortran/jackets.c.in.aarch64	2020-04-30 21:16:25.318499470 -0600
++++ hdf-4.2.15/mfhdf/fortran/jackets.c.in	2020-04-30 21:20:28.346831868 -0600
+@@ -34,7 +34,7 @@
+ 
+ struct ncfils {            /* This will be a common block from Fortran */
+     double dd;
+-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__
++#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__
+     int ll;
+ #else
+     long ll;
+@@ -65,7 +65,7 @@ struct ncfils {            /* This will
+ 
+ struct ncfils {            /* This will be a common block from Fortran */
+     double dd;
+-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__
++#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__
+     int ll;
+ #else
+     long ll;
+@@ -420,7 +420,7 @@ stoig(shorts, ints, dims, basis, ndims)
+ }
+ #endif /* FORTRAN_HAS_NO_SHORT */
+ 
+-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__
++#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__
+ /*
+  * Convert multi-dimensional array of NCLONGs stored in ints to packed
+  * array of longs, in malloc'ed space.  Returns pointer to longs or NULL
+@@ -908,7 +908,7 @@ nncvpt1(cdfid, varid, indices, value, rc
+     return;
+     }                /* else */
+ #endif                /* FORTRAN_HAS_NO_SHORT */
+-#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__
++#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__
+ #ifdef HDF
+     if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+     long          longs = *(int *)value;
+@@ -1022,7 +1022,7 @@ nncvpt(cdfid, varid, start, count, value
+     return;
+     }                /* else */
+ #endif                /* FORTRAN_HAS_NO_SHORT */
+-#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__
++#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__
+ #ifdef HDF
+     if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+     long *longs = itol (value, ncount, ndims);
+@@ -1133,7 +1133,7 @@ nncvptg(cdfid, varid, start, count, stri
+     tmpbasis    = nctypelen(NC_LONG);
+     else
+ #endif
+-#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__
++#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__
+     if (datatype == NC_LONG)
+     tmpbasis    = sizeof(int);
+     else
+@@ -1190,7 +1190,7 @@ nncvptg(cdfid, varid, start, count, stri
+     return;
+     }                /* else */
+ #endif                /* FORTRAN_HAS_NO_SHORT */
+-#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__
++#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__
+ #ifdef HDF
+     if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+     long *longs = itolg (value, ncount, nbasis, ndims);
+@@ -1326,7 +1326,7 @@ nncvgt1(cdfid, varid, indices, value, rc
+     return;
+     }                /* else */
+ #endif                /* FORTRAN_HAS_NO_SHORT */
+-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__
++#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__
+ #ifdef HDF
+     if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+     long          longs;
+@@ -1468,7 +1468,7 @@ nncvgt(cdfid, varid, start, count, value
+     return;
+     }                /* else */
+ #endif                /* FORTRAN_HAS_NO_SHORT */
+-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__
++#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__
+ #ifdef HDF
+     if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+     long iocount = dimprod (ncount, ndims);    /* product of dimensions */
+@@ -1606,7 +1606,7 @@ nncvgtg(cdfid, varid, start, count, stri
+     tmpbasis    = nctypelen(NC_LONG);
+     else
+ #endif
+-#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__
++#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__
+     if (datatype == NC_LONG)
+     tmpbasis    = sizeof(int);
+     else
+@@ -1677,7 +1677,7 @@ nncvgtg(cdfid, varid, start, count, stri
+     return;
+     }                /* else */
+ #endif                /* FORTRAN_HAS_NO_SHORT */
+-#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__
++#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__
+ #ifdef HDF
+     if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+     long iocount = dimprod (ncount, ndims);    /* product of dimensions */
+@@ -1843,7 +1843,7 @@ nncapt(cdfid, varid, attname, datatype,
+     return;
+     }                /* else */
+ #endif                /* FORTRAN_HAS_NO_SHORT */
+-#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__
++#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__
+ #ifdef HDF
+     if ((nc_type) *datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+     long *longs = itol (value, attlen, 1);
+@@ -2008,7 +2008,7 @@ nncagt(cdfid, varid, attname, value, rco
+     return;
+     }                /* else */
+ #endif                /* FORTRAN_HAS_NO_SHORT */
+-#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__
++#if  defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__
+ #ifdef HDF
+     if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+ /* EIP  We need to use int buffer to read data in on the platforms where long is 8 bytes
+diff -up hdf-4.2.15/mfhdf/libsrc/array.c.aarch64 hdf-4.2.15/mfhdf/libsrc/array.c
+diff -up hdf-4.2.15/mfhdf/libsrc/cdf.c.aarch64 hdf-4.2.15/mfhdf/libsrc/cdf.c
+diff -up hdf-4.2.15/mfhdf/libsrc/netcdf.h.in.aarch64 hdf-4.2.15/mfhdf/libsrc/netcdf.h.in
+--- hdf-4.2.15/mfhdf/libsrc/netcdf.h.in.aarch64	2020-04-30 21:16:25.347499629 -0600
++++ hdf-4.2.15/mfhdf/libsrc/netcdf.h.in	2020-04-30 21:24:11.366838259 -0600
+@@ -293,7 +293,7 @@ typedef double        ncdouble;
+ /*
+  * Variables/attributes of type NC_LONG should use the C type 'nclong'
+  */
+-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__
++#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__
+ /*
+  * LP64 (also known as 4/8/8) denotes long and pointer as 64 bit types.
+  * http://www.unix.org/version2/whatsnew/lp64_wp.html
+diff -up hdf-4.2.15/mfhdf/libsrc/putget.c.aarch64 hdf-4.2.15/mfhdf/libsrc/putget.c
+--- hdf-4.2.15/mfhdf/libsrc/putget.c.aarch64	2020-04-30 21:16:25.349499640 -0600
++++ hdf-4.2.15/mfhdf/libsrc/putget.c	2020-04-30 21:21:11.344052951 -0600
+@@ -665,7 +665,7 @@ Void *values ;
+     case NC_SHORT :
+         return( xdr_NCvshort(xdrs, (unsigned)rem/2, (short *)values) ) ;
+     case NC_LONG :
+-#if (_MIPS_SZLONG == 64) || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__
++#if (_MIPS_SZLONG == 64) || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__
+         return( xdr_int(xdrs, (nclong *)values) ) ;
+ #else
+         return( xdr_long(xdrs, (nclong *)values) ) ;
+diff -up hdf-4.2.15/mfhdf/libsrc/xdrposix.c.aarch64 hdf-4.2.15/mfhdf/libsrc/xdrposix.c
+--- hdf-4.2.15/mfhdf/libsrc/xdrposix.c.aarch64	2020-04-30 21:16:25.321499486 -0600
++++ hdf-4.2.15/mfhdf/libsrc/xdrposix.c	2020-04-30 21:23:48.397752506 -0600
+@@ -262,7 +262,7 @@ int nbytes;
+ 
+ static bool_t   xdrposix_getlong();
+ static bool_t   xdrposix_putlong();
+-#if (_MIPS_SZLONG == 64) || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__
++#if (_MIPS_SZLONG == 64) || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__
+ static bool_t   xdrposix_getint();
+ static bool_t   xdrposix_putint();
+ #endif
+@@ -276,7 +276,7 @@ static long *    xdrposix_inline();
+ #if (defined __sun && defined _LP64)
+ static rpc_inline_t *    xdrposix_inline();
+ #else
+-#if ((defined __x86_64__ ) && !(defined __sun && defined _LP64)) || defined __powerpc64__ || defined __s390x__
++#if ((defined __x86_64__ ) && !(defined __sun && defined _LP64)) || defined __powerpc64__ || defined __s390x__ || defined __aarch64__
+ static int32_t *    xdrposix_inline();
+ #else
+ static netlong *    xdrposix_inline();
+@@ -302,9 +302,9 @@ static struct xdr_ops   xdrposix_ops = {
+     xdrposix_getpos,    /* get offset in the stream */
+     xdrposix_setpos,    /* set offset in the stream */
+     xdrposix_inline,    /* prime stream for inline macros */
+-#if (defined __sun && defined _LP64) || defined __x86_64__ || defined __powerpc64__ || defined __s390x__
++#if (defined __sun && defined _LP64) || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__
+     xdrposix_destroy,   /* destroy stream */
+-#if !(defined __x86_64__) && !(defined __powerpc64__) && !(defined __s390x__) || (defined  __sun && defined _LP64) /* i.e. we are on SUN/Intel in 64-bit mode */
++#if !(defined __x86_64__) && !(defined __powerpc64__) && !(defined __s390x__) && !(defined __aarch64__) || (defined  __sun && defined _LP64) /* i.e. we are on SUN/Intel in 64-bit mode */
+     NULL,               /* no xdr_control function defined */
+ #endif
+     /* Solaris 64-bit (arch=v9 and arch=amd64) has 64 bits long and 32 bits int. */
+@@ -560,7 +560,7 @@ static long *
+ #if (defined __sun && defined _LP64)
+ static rpc_inline_t *
+ #else
+-#if ((defined  __x86_64__) && !(defined __sun && defined _LP64)) || defined __powerpc64__ || defined __s390x__
++#if ((defined  __x86_64__) && !(defined __sun && defined _LP64)) || defined __powerpc64__ || defined __s390x__ || defined __aarch64__
+ static int32_t *
+ #else
+ static netlong *
+@@ -581,7 +581,7 @@ xdrposix_inline(xdrs, len)
+     return (NULL);
+ }
+ 
+-#if (_MIPS_SZLONG == 64) || (defined __sun && defined _LP64) || defined AIX5L64  || defined __x86_64__ || defined __powerpc64__ || defined __s390x__
++#if (_MIPS_SZLONG == 64) || (defined __sun && defined _LP64) || defined AIX5L64  || defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __aarch64__
+ 
+ static bool_t
+ xdrposix_getint(xdrs, lp)
+diff -up hdf-4.2.15/mfhdf/ncgen/ncgen.l.aarch64 hdf-4.2.15/mfhdf/ncgen/ncgen.l
+--- hdf-4.2.15/mfhdf/ncgen/ncgen.l.aarch64	2020-04-30 21:16:25.376499789 -0600
++++ hdf-4.2.15/mfhdf/ncgen/ncgen.l	2020-04-30 21:17:29.876854089 -0600
+@@ -113,7 +113,7 @@ FloatInf|Infinity|Inf    {    /* float m
+             yyerror(errstr);
+         }
+ 
+-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || __powerpc64__ || defined __s390x__
++#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || __powerpc64__ || defined __s390x__ || defined __aarch64__
+         if (dd < INT_MIN  ||  dd > INT_MAX)
+ #else
+         if (dd < LONG_MIN  ||  dd > LONG_MAX)
+diff -up hdf-4.2.15/mfhdf/ncgen/ncgenyy.c.aarch64 hdf-4.2.15/mfhdf/ncgen/ncgenyy.c
+--- hdf-4.2.15/mfhdf/ncgen/ncgenyy.c.aarch64	2020-04-30 21:16:25.382499822 -0600
++++ hdf-4.2.15/mfhdf/ncgen/ncgenyy.c	2020-04-30 21:18:12.880090311 -0600
+@@ -991,7 +991,7 @@ YY_RULE_SETUP
+             yyerror(errstr);
+         }
+ 
+-#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || __powerpc64__ || __s390x__
++#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || __powerpc64__ || __s390x__ || defined __aarch64__
+         if (dd < INT_MIN  ||  dd > INT_MAX)
+ #else
+         if (dd < LONG_MIN  ||  dd > LONG_MAX)
diff --git a/testing/hdf4/60-hdf-ppc64le.patch b/testing/hdf4/60-hdf-ppc64le.patch
new file mode 100644
index 0000000000..e199a55824
--- /dev/null
+++ b/testing/hdf4/60-hdf-ppc64le.patch
@@ -0,0 +1,83 @@
+diff -up hdf-4.2.15/hdf/src/hconv.h.ppc64le hdf-4.2.15/hdf/src/hconv.h
+--- hdf-4.2.15/hdf/src/hconv.h.ppc64le	2020-04-30 21:25:25.183973672 -0600
++++ hdf-4.2.15/hdf/src/hconv.h	2020-04-30 21:25:25.191973677 -0600
+@@ -59,7 +59,7 @@
+ /* CONSTANT DEFINITIONS                                                      */
+ /*****************************************************************************/
+ /* Generally Big-Endian machines */
+-#if !defined(INTEL86) && !defined(MIPSEL) && !defined(DEC_ALPHA) && !defined(I860) && !defined(SUN386) && !(defined(__ia64) && !(defined(hpux) || defined(__hpux))) && !defined(__x86_64__) && !defined(__arm__) && !defined(__AARCH64EL__)
++#if !defined(INTEL86) && !defined(MIPSEL) && !defined(DEC_ALPHA) && !defined(I860) && !defined(SUN386) && !(defined(__ia64) && !(defined(hpux) || defined(__hpux))) && !defined(__x86_64__) && !defined(__arm__) && !defined(__AARCH64EL__) && !defined(__LITTLE_ENDIAN__)
+ #       define UI8_IN     DFKnb1b   /* Unsigned Integer, 8 bits */
+ #       define UI8_OUT    DFKnb1b
+ #       define SI16_IN    DFKnb2b   /* S = Signed */
+diff -up hdf-4.2.15/hdf/src/hdfi.h.ppc64le hdf-4.2.15/hdf/src/hdfi.h
+--- hdf-4.2.15/hdf/src/hdfi.h.ppc64le	2020-04-30 21:25:25.183973672 -0600
++++ hdf-4.2.15/hdf/src/hdfi.h	2020-04-30 21:25:25.192973677 -0600
+@@ -75,6 +75,7 @@
+ #define     DFMT_IA64           0x4441
+ #define     DFMT_LINUX64        0x4441
+ #define     DFMT_POWERPC64      0x1111
++#define     DFMT_POWERPC64LE    0x4441
+ #define     DFMT_LINUXPPC       0x1111
+ #define     DFMT_LINUXSPARC     0x1111
+ #define     DFMT_LINUX390       0x1111
+@@ -926,18 +927,24 @@ typedef int               hdf_pint_t;
+ 
+ 
+ /*-----------------------------------------------------*/
+-/* Power PC 5 64 */
+ #if defined __powerpc64__
+-
++/* powerpc 64 bits */
+ #ifdef GOT_MACHINE
+ If you get an error on this line more than one machine type has been defined.
+ Please check your Makefile.
+ #endif
+ #define GOT_MACHINE
+ 
++#ifdef __LITTLE_ENDIAN__
++/* Power PC 8 64 little endian */
++#define DF_MT             DFMT_POWERPC64LE
++#else
++/* Power PC 5 64 */
++#define DF_MT             DFMT_POWERPC64
++#endif
++
+ #include <sys/file.h>               /* for unbuffered i/o stuff */
+ #include <sys/stat.h>
+-#define DF_MT             DFMT_POWERPC64
+ typedef void              VOID;
+ typedef void              *VOIDP;
+ typedef char              *_fcd;
+@@ -973,8 +980,9 @@ typedef long              hdf_pint_t;
+ #define INCLUDES_ARE_ANSI
+ #endif
+ 
++#endif /* powerpc 64 bits */
++
+ /*-----------------------------------------------------*/
+-#endif /*power PC 5 64 */
+ /* Linux 64 */
+ #if defined(__linux__) && defined __x86_64__  && !(defined  SUN)  /* i.e. 64-bit Linux  but not SunOS on Intel */
+ 
+diff -up hdf-4.2.15/mfhdf/libsrc/xdrposix.c.ppc64le hdf-4.2.15/mfhdf/libsrc/xdrposix.c
+--- hdf-4.2.15/mfhdf/libsrc/xdrposix.c.ppc64le	2020-04-30 21:25:25.186973674 -0600
++++ hdf-4.2.15/mfhdf/libsrc/xdrposix.c	2020-04-30 21:26:18.190001127 -0600
+@@ -442,7 +442,7 @@ xdrposix_getlong(xdrs, lp)
+     long *lp;
+ {
+     unsigned char *up = (unsigned char *)lp ;
+-#if (defined AIX5L64 || defined __powerpc64__ || defined __s390x__ || (defined __hpux && __LP64__))
++#if (defined AIX5L64 || (defined __powerpc64__ && !defined __LITTLE_ENDIAN__) || defined __s390x__ || (defined __hpux && __LP64__))
+     *lp = 0 ;
+     up += (sizeof(long) - 4) ;
+ #endif
+@@ -465,7 +465,7 @@ xdrposix_putlong(xdrs, lp)
+     netlong mycopy = htonl(*lp);
+     up = (unsigned char *)&mycopy;
+ #endif
+-#if (defined AIX5L64  || defined __powerpc64__ || defined __s390x__ || (defined __hpux && __LP64__))
++#if (defined AIX5L64  || (defined __powerpc64__ && !defined __LITTLE_ENDIAN__) || defined __s390x__ || (defined __hpux && __LP64__))
+     up += (sizeof(long) - 4) ;
+ #endif
+ 
diff --git a/testing/hdf4/APKBUILD b/testing/hdf4/APKBUILD
new file mode 100644
index 0000000000..098e4b2a9a
--- /dev/null
+++ b/testing/hdf4/APKBUILD
@@ -0,0 +1,117 @@
+# Contributor: Edd Salkield <[email-masked]>
+# Maintainer: Edd Salkield <[email-masked]>
+pkgname=hdf4
+pkgver=4.2.15
+pkgrel=0
+pkgdesc="Data model, library, and file format for storing and managing data"
+url="https://www.hdfgroup.org/solutions/hdf4/"
+arch="all"
+license="custom"
+options="!check" # Upstream tests appear broken
+depends_dev="zlib-dev jpeg-dev portablexdr-dev"
+makedepends="$depends_dev bison flex libaec-dev chrpath"
+checkdepends="diffutils" # Flags not supported by busybox diff are used
+subpackages="$pkgname-dev $pkgname-doc $pkgname-tools"
+# Patches from Fedora:  https://src.fedoraproject.org/rpms/hdf/tree/rawhide
+# NB: Some of these patches depend on each other in the given order
+source="https://support.hdfgroup.org/ftp/HDF/releases/HDF$pkgver/src/hdf-$pkgver.tar.bz2
+	10-hdf-ppc.patch
+	20-hdf-4.2.4-sparc.patch
+	30-hdf-s390.patch
+	40-hdf-arm.patch
+	50-hdf-aarch64.patch
+	60-hdf-ppc64le.patch"
+builddir="$srcdir"/hdf-"$pkgver"
+
+prepare() {
+	default_prepare
+	update_config_sub
+	update_config_guess
+}
+
+build() {
+	# This flag would required to treat Fortran argument mismatch as a warning,
+	# not an error.
+	# This got fixed in master https://github.com/HDFGroup/hdf4/issues/1
+	# but isn't fixed yet in the latest release.
+	# > export FFLAGS="$FFLAGS -fallow-argument-mismatch"
+	# However, --enable-shared currently requires that fortran is disabled, so
+	# it doesn't matter anyway
+	export LIBS="$LIBS -lportablexdr"
+
+	# We disable netcdf since it's provided by the netcdf-* packages
+	./configure \
+		--enable-shared \
+		--disable-static \
+		--disable-fortran \
+		--disable-netcdf \
+		--with-szlib \
+		--prefix=/usr \
+		--build=$CBUILD \
+		--host=$CHOST
+	make
+}
+
+check() {
+	make check
+}
+
+package() {
+	make DESTDIR="$pkgdir" install-recursive
+	install -Dm644 COPYING "$pkgdir"/usr/share/licenses/"$pkgname"/COPYING
+	chrpath -d \
+		"$pkgdir"/usr/lib/libmfhdf.so.0.0.0 \
+		"$pkgdir"/usr/lib/libdf.so.0.0.0 \
+		"$pkgdir"/usr/bin/gif2hdf \
+		"$pkgdir"/usr/bin/hdf24to8 \
+		"$pkgdir"/usr/bin/hdf8to24 \
+		"$pkgdir"/usr/bin/hdfimport \
+		"$pkgdir"/usr/bin/hdftopal \
+		"$pkgdir"/usr/bin/hdiff \
+		"$pkgdir"/usr/bin/jpeg2hdf \
+		"$pkgdir"/usr/bin/paltohdf \
+		"$pkgdir"/usr/bin/vmake \
+		"$pkgdir"/usr/bin/hdf2gif \
+		"$pkgdir"/usr/bin/hdfcomp \
+		"$pkgdir"/usr/bin/hdfls \
+		"$pkgdir"/usr/bin/hdftor8 \
+		"$pkgdir"/usr/bin/hdp \
+		"$pkgdir"/usr/bin/ncdump \
+		"$pkgdir"/usr/bin/r8tohdf \
+		"$pkgdir"/usr/bin/vshow \
+		"$pkgdir"/usr/bin/hdf2jpeg \
+		"$pkgdir"/usr/bin/hdfed \
+		"$pkgdir"/usr/bin/hdfpack \
+		"$pkgdir"/usr/bin/hdfunpac \
+		"$pkgdir"/usr/bin/hrepack \
+		"$pkgdir"/usr/bin/ncgen \
+		"$pkgdir"/usr/bin/ristosds
+}
+
+dev() {
+	default_dev
+	mv "$pkgdir"/usr/lib/libhdf4.settings "$subpkgdir"/usr/lib/libhdf4.settings
+}
+
+doc() {
+	default_doc
+	# Remove conflicts with netcdf-doc
+	rm "$subpkgdir"/usr/share/man/man1/ncdump.1.gz "$subpkgdir"/usr/share/man/man1/ncgen.1.gz
+}
+
+tools() {
+	mkdir -p "$subpkgdir"/usr
+	mv "$pkgdir"/usr/bin "$subpkgdir"/usr/
+	# Remove conflicts with netcdf-utils
+	rm "$subpkgdir"/usr/bin/ncgen "$subpkgdir"/usr/bin/ncdump
+}
+
+sha512sums="
+7d4037800ef8950ed74f225355ef5458444bed26fc189fbbd2ce7d36009998013ac1f6ba5d4e60834acf8f6f73550357238745acc35e162679919400a48191e9  hdf-4.2.15.tar.bz2
+c3098bf0c937c406ed133ea94c7b4bb7fb7b78aa37e1fae0402f74e3aed8db79a13a5d0baf6b0cb78835984794e795a51d54b690115a390baf9b89292fd587ad  10-hdf-ppc.patch
+751ef4c537f4a7d50dae95eb3c9879848eada5c1ae80b9906b62b26b77496b42dfe7dd6ffb8359a986e2c0630b46ca59d797864fe93645ddb2923d65f6ca9bcc  20-hdf-4.2.4-sparc.patch
+2b3c04bfa20f1067852538a6593de2659ee480b3f40dc51931989a175b99394ae67f1d3445f697486801d7a9d19a4e10cf10413fb6ee28126cebf0e1379f1447  30-hdf-s390.patch
+b9ea7c626fcf1bfbf75e05459794fc577a28602749464f2eea029fc4d729ceeb96f93273cc9ea8988878444632532888970047370b787b9c4bdea0b0077ff1b3  40-hdf-arm.patch
+fac62b5ab9ceaf9ddd9cc4831994cdf5cc4e0b2f85ee9f943f7311b0acc2b78d18f49e194a31b7ddd0c17dc87a14ec55d6af73258fbc2f0f2e2b86b7f9048f25  50-hdf-aarch64.patch
+824be68ce54c43ea8e556cd9836b8d18162e3a214d532ce40ca7de600693da89dcbc364aae5995c2cd455126550d88606889c5e1c956c4cb9f1928566c705121  60-hdf-ppc64le.patch
+"
-- 
2.35.1