3
5
Fork 0
mirror of git://git.savannah.gnu.org/guix.git synced 2023-12-14 03:33:07 +01:00

gnu: hdf4: Add support for riscv64-linux.

* gnu/packages/maths.scm (hdf4)[arguments]: Rename custom phase
'add-more-aarch64-support to 'add-more-architecture-support and add
support for riscv64-linux.
* gnu/packages/patches/hdf4-architectures.patch: Refresh from upstream.
This commit is contained in:
Efraim Flashner 2023-06-07 09:30:52 +03:00
parent f8b1e50f30
commit a6e21911bf
Signed by untrusted user: efraim
GPG key ID: 41AAE7DCCA3D8351
2 changed files with 66 additions and 14 deletions

View file

@ -1314,13 +1314,12 @@ computations.")
#:phases
(modify-phases %standard-phases
;; This is inspired by two of Debian's patches.
(add-before 'configure 'add-more-aarch64-support
(add-before 'configure 'add-more-architecture-support
(lambda _
(substitute* '("mfhdf/ncgen/ncgen.l"
"mfhdf/ncgen/ncgenyy.c"
"mfhdf/libsrc/netcdf.h.in")
(("AIX5L64") "__aarch64__"))
#t))
(("AIX5L64") "__aarch64__ || ( __riscv && __riscv_xlen == 64)"))))
(add-before 'configure 'patchbuild
(lambda _
(substitute*

View file

@ -21,7 +21,7 @@ Author: Francesco Paolo Lovergine <frankie@debian.org>
#define DFMT_PC 0x4441
#define DFMT_APPLE 0x1111
#define DFMT_APPLE_INTEL 0x4441
@@ -75,6 +77,12 @@
@@ -75,6 +77,13 @@
#define DFMT_IA64 0x4441
#define DFMT_LINUX64 0x4441
#define DFMT_POWERPC64 0x1111
@ -29,12 +29,13 @@ Author: Francesco Paolo Lovergine <frankie@debian.org>
+#define DFMT_ARMV4L 0x4441
+#define DFMT_AARCH64 0x4441
+#define DFMT_X86_64 0x4441
+#define DFMT_SH 0x4441
+#define DFMT_SHEB 0x1111
+#define DFMT_SH 0x4441
+#define DFMT_SHEB 0x1111
+#define DFMT_RISCV64 0x4441
/* I/O library constants */
#define UNIXUNBUFIO 1
@@ -288,7 +296,7 @@ typedef int hdf_pint_t;
@@ -288,7 +297,7 @@ typedef int hdf_pint_t;
#endif /* IBM6000 */
@ -43,7 +44,7 @@ Author: Francesco Paolo Lovergine <frankie@debian.org>
#ifndef HP9000
#define HP9000
@@ -347,6 +355,10 @@ typedef int hdf_pint_t;
@@ -347,6 +356,10 @@ typedef int hdf_pint_t;
/* what each does */
#define JMEMSYS MEM_ANSI
@ -54,7 +55,7 @@ Author: Francesco Paolo Lovergine <frankie@debian.org>
#endif /* HP9000 */
@@ -666,6 +678,410 @@ typedef int hdf_pint_t;
@@ -670,6 +683,462 @@ typedef int hdf_pint_t;
#endif /* !(defined(__APPLE__)) */
/*-----------------------------------------------------*/
@ -461,11 +462,63 @@ Author: Francesco Paolo Lovergine <frankie@debian.org>
+#define INCLUDES_ARE_ANSI
+
+#endif /* Linux/aarch64 */
+
+#if defined (__linux__) && defined (__riscv) && (__riscv_xlen == 64)
+
+#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 1
+
+#include <fcntl.h>
+#include <sys/types.h> /* for unbuffered file I/O */
+#include <sys/stat.h>
+#include <unistd.h>
+#include <ctype.h> /* for character macros */
+
+#define DF_MT DFMT_RISCV64
+
+typedef void VOID;
+typedef void * VOIDP;
+typedef char * _fcd;
+typedef char char8;
+typedef unsigned char uchar8;
+typedef signed 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 float float32;
+typedef double float64;
+typedef int intf; /* size of INTEGERs in Fortran compiler */
+typedef long hdf_pint_t; /* an integer the same size as a pointer */
+#define FNAME_POST_UNDERSCORE
+#define _fcdtocp(desc) (desc)
+#define FILELIB UNIXBUFIO
+
+#ifndef BIG_LONGS
+#define BIG_LONGS
+#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
+#define HAVE_STDC
+#define INCLUDES_ARE_ANSI
+
+#endif /* Linux/riscv64 */
+
#if defined(NEXT) || defined(NeXT)
#ifndef NEXT
@@ -928,7 +1344,11 @@ Please check your Makefile.
@@ -932,7 +1401,11 @@ Please check your Makefile.
#include <sys/file.h> /* for unbuffered i/o stuff */
#include <sys/stat.h>
@ -478,7 +531,7 @@ Author: Francesco Paolo Lovergine <frankie@debian.org>
typedef void VOID;
typedef void *VOIDP;
typedef char *_fcd;
@@ -952,6 +1372,11 @@ typedef long hdf_pint_t;
@@ -956,6 +1429,11 @@ typedef long hdf_pint_t;
#define _fcdtocp(desc) (desc)
#define FILELIB UNIXBUFIO
@ -490,7 +543,7 @@ Author: Francesco Paolo Lovergine <frankie@debian.org>
/* JPEG #define's - Look in the JPEG docs before changing - (Q) */
/* Determine the memory manager we are going to use. Valid values are: */
@@ -1097,6 +1522,8 @@ typedef long hdf_pint_t;
@@ -1101,6 +1579,8 @@ typedef long hdf_pint_t;
#define _fcdtocp(desc) (desc)
#define FILELIB UNIXBUFIO
@ -499,7 +552,7 @@ Author: Francesco Paolo Lovergine <frankie@debian.org>
/* JPEG #define's - Look in the JPEG docs before changing - (Q) */
/* Determine the memory manager we are going to use. Valid values are: */
@@ -1111,6 +1538,66 @@ typedef long hdf_pint_t;
@@ -1115,6 +1595,66 @@ typedef long hdf_pint_t;
#endif /* IA64 */
@ -573,7 +626,7 @@ Author: Francesco Paolo Lovergine <frankie@debian.org>
/*****************************************************************************/
/* 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(__powerpc__) && defined(__LITTLE_ENDIAN__)) && !defined(__aarch64__) && !defined(__ARM_EABI__)
+#if !defined(INTEL86) && !defined(MIPSEL) && !defined(DEC_ALPHA) && !defined(I860) && !defined(SUN386) && !(defined(__ia64) && !(defined(hpux) || defined(__hpux))) && !defined(__x86_64__) && !(defined(__powerpc__) && defined(__LITTLE_ENDIAN__)) && !defined(__aarch64__) && !defined(__ARM_EABI__) && !defined(__riscv)
# define UI8_IN DFKnb1b /* Unsigned Integer, 8 bits */
# define UI8_OUT DFKnb1b
# define SI16_IN DFKnb2b /* S = Signed */