Bug#978099: Please add support for riscv64

Logan Rosen logan at ubuntu.com
Fri Dec 25 22:17:40 GMT 2020


Source: libhdf4
Version: 4.2.14-1
Severity: normal
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu hirsute ubuntu-patch
X-Debbugs-Cc: logan at ubuntu.com

Dear Maintainer,

libhdf4 currently FTBFS on riscv64. William Grant applied a patch in
Ubuntu to add support for the architecture.

Thanks for considering the patch.

Logan

-- System Information:
Debian Release: bullseye/sid
  APT prefers groovy-updates
  APT policy: (500, 'groovy-updates'), (500, 'groovy-security'), (500, 'groovy'), (100, 'groovy-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.8.0-33-generic (SMP w/8 CPU threads)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
-------------- next part --------------
diff -Nru libhdf4-4.2.14/debian/patches/64bit libhdf4-4.2.14/debian/patches/64bit
--- libhdf4-4.2.14/debian/patches/64bit	2019-03-16 04:35:30.000000000 -0400
+++ libhdf4-4.2.14/debian/patches/64bit	2020-04-10 00:44:28.000000000 -0400
@@ -1,14 +1,16 @@
 Description: Additional 64bit architectures.
 Author: Francesco Paolo Lovergine <frankie at debian.org>
 
---- a/mfhdf/libsrc/netcdf.h.in
-+++ b/mfhdf/libsrc/netcdf.h.in
+Index: libhdf4-4.2.14/mfhdf/libsrc/netcdf.h.in
+===================================================================
+--- libhdf4-4.2.14.orig/mfhdf/libsrc/netcdf.h.in
++++ libhdf4-4.2.14/mfhdf/libsrc/netcdf.h.in
 @@ -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 __sparc__ && defined __arch64__) || defined __s390x__ || defined __aarch64__
++#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ || (defined __sparc__ && defined __arch64__) || defined __s390x__ || defined __aarch64__ || (defined __riscv && __riscv_xlen == 64)
  /*
   * 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 -Nru libhdf4-4.2.14/debian/patches/hdfi.h libhdf4-4.2.14/debian/patches/hdfi.h
--- libhdf4-4.2.14/debian/patches/hdfi.h	2019-03-16 04:35:31.000000000 -0400
+++ libhdf4-4.2.14/debian/patches/hdfi.h	2020-04-10 00:44:28.000000000 -0400
@@ -32,7 +32,7 @@
  
  /* I/O library constants */
  #define UNIXUNBUFIO 1
-@@ -288,7 +296,7 @@ typedef int               hdf_pint_t;
+@@ -288,7 +296,7 @@
  
  #endif /* IBM6000 */
  
@@ -41,7 +41,7 @@
  
  #ifndef HP9000
  #define HP9000
-@@ -347,6 +355,10 @@ typedef int               hdf_pint_t;
+@@ -347,6 +355,10 @@
  /*  what each does */
  #define JMEMSYS         MEM_ANSI
  
@@ -52,7 +52,7 @@
  #endif /* HP9000 */
  
  
-@@ -666,6 +678,410 @@ typedef int               hdf_pint_t;
+@@ -666,6 +678,410 @@
  #endif /* !(defined(__APPLE__)) */
  
  /*-----------------------------------------------------*/
@@ -463,7 +463,7 @@
  #if defined(NEXT) || defined(NeXT)
  
  #ifndef NEXT
-@@ -928,7 +1344,11 @@ Please check your Makefile.
+@@ -928,7 +1344,11 @@
  
  #include <sys/file.h>               /* for unbuffered i/o stuff */
  #include <sys/stat.h>
@@ -476,7 +476,7 @@
  typedef void              VOID;
  typedef void              *VOIDP;
  typedef char              *_fcd;
-@@ -952,6 +1372,11 @@ typedef long              hdf_pint_t;
+@@ -952,6 +1372,11 @@
  #define _fcdtocp(desc) (desc)
  #define FILELIB UNIXBUFIO
  
@@ -488,7 +488,7 @@
  /* 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;
+@@ -1097,6 +1522,8 @@
  #define _fcdtocp(desc) (desc)
  #define FILELIB UNIXBUFIO
  
@@ -497,7 +497,7 @@
  /* 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;
+@@ -1111,6 +1538,66 @@
  
  #endif /* IA64 */
  
diff -Nru libhdf4-4.2.14/debian/patches/riscv64-support.patch libhdf4-4.2.14/debian/patches/riscv64-support.patch
--- libhdf4-4.2.14/debian/patches/riscv64-support.patch	1969-12-31 19:00:00.000000000 -0500
+++ libhdf4-4.2.14/debian/patches/riscv64-support.patch	2020-04-10 00:44:28.000000000 -0400
@@ -0,0 +1,84 @@
+Index: libhdf4-4.2.13/hdf/src/hdfi.h
+===================================================================
+--- libhdf4-4.2.13.orig/hdf/src/hdfi.h
++++ libhdf4-4.2.13/hdf/src/hdfi.h
+@@ -83,6 +83,7 @@
+ #define     DFMT_X86_64         0x4441
+ #define     DFMT_SH		0x4441
+ #define     DFMT_SHEB		0x1111
++#define     DFMT_RISCV64	0x4441
+ 
+ /* I/O library constants */
+ #define UNIXUNBUFIO 1
+@@ -1082,6 +1083,58 @@ typedef long              hdf_pint_t;
+ 
+ #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
+Index: libhdf4-4.2.13/hdf/src/hconv.h
+===================================================================
+--- libhdf4-4.2.13.orig/hdf/src/hconv.h
++++ libhdf4-4.2.13/hdf/src/hconv.h
+@@ -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(__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 */
diff -Nru libhdf4-4.2.14/debian/patches/series libhdf4-4.2.14/debian/patches/series
--- libhdf4-4.2.14/debian/patches/series	2018-07-29 04:56:58.000000000 -0400
+++ libhdf4-4.2.14/debian/patches/series	2020-04-10 00:44:28.000000000 -0400
@@ -15,3 +15,4 @@
 spelling-errors.patch
 manpage-has-errors-from-man.patch
 reproducible-builds.patch
+riscv64-support.patch
diff -Nru libhdf4-4.2.14/debian/rules libhdf4-4.2.14/debian/rules
--- libhdf4-4.2.14/debian/rules	2018-12-11 14:43:50.000000000 -0500
+++ libhdf4-4.2.14/debian/rules	2020-04-10 00:44:28.000000000 -0400
@@ -35,7 +35,7 @@
    export DH_VERBOSE
 endif
 
-ifneq (,$(filter $(DEB_BUILD_ARCH),s390x sparc64))
+ifneq (,$(filter $(DEB_BUILD_ARCH),s390x sparc64 riscv64))
    DISABLE_TESTS=1
 else
    DISABLE_TESTS=0


More information about the Pkg-grass-devel mailing list