code:
Copied from Debian.

Description: Support additional architectures.
Author: Francesco Paolo Lovergine <frankie@debian.org>

--- a/hdf/src/hdfi.h
+++ b/hdf/src/hdfi.h
@@ -48,6 +48,7 @@
 /*      8 - Cray IEEE                                                       */
 /*          (i.e. Big-Endian, all 64-bit architecture w/IEEE Floats)        */
 /*--------------------------------------------------------------------------*/
+#define     DFMT_S390           0x1111
 #define     DFMT_SUN            0x1111
 #define     DFMT_SUN_INTEL      0x4441
 #define     DFMT_ALLIANT        0x1111
@@ -62,6 +63,7 @@
 #define     DFMT_CTSS           0x3331
 #define     DFMT_VAX            0x2221
 #define     DFMT_MIPSEL         0x4441
+#define     DFMT_MIPSEB         0x1111
 #define     DFMT_PC             0x4441
 #define     DFMT_APPLE          0x1111
 #define     DFMT_APPLE_INTEL    0x4441
@@ -75,6 +77,12 @@
 #define     DFMT_IA64           0x4441
 #define     DFMT_LINUX64        0x4441
 #define     DFMT_POWERPC64      0x1111
+#define     DFMT_POWERPC64LE    0x4441
+#define     DFMT_ARMV4L         0x4441
+#define     DFMT_AARCH64        0x4441
+#define     DFMT_X86_64         0x4441
+#define     DFMT_SH		0x4441
+#define     DFMT_SHEB		0x1111

 /* I/O library constants */
 #define UNIXUNBUFIO 1
@@ -288,7 +296,7 @@ typedef int               hdf_pint_t;

 #endif /* IBM6000 */

-#if defined(HP9000) || (!defined(__convexc__) && (defined(hpux) || defined(__hpux)))
+#if defined(HP9000) || (!defined(__convexc__) && (defined(hpux) || defined(__hpux) || defined(__hppa__)))

 #ifndef HP9000
 #define HP9000
@@ -347,6 +355,10 @@ typedef int               hdf_pint_t;
 /*  what each does */
 #define JMEMSYS         MEM_ANSI

+#ifdef __linux__
+#define FNAME_POST_UNDERSCORE
+#endif
+
 #endif /* HP9000 */

@@ -666,6 +678,410 @@ typedef int               hdf_pint_t;
 #endif /* !(defined(__APPLE__)) */

 /*-----------------------------------------------------*/
+#if defined (__linux__) && defined (__mc68000__)
+
+#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_MOTOROLA
+
+#ifndef VOID    /* The stupid windows.h header file uses a #define instead of a typedef */
+typedef void              VOID;
+#endif  /* end 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 float             float32;
+typedef double            float64;
+typedef long              intf;     /* size of INTEGERs in Fortran compiler */
+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
+#define HAVE_STDC
+#define INCLUDES_ARE_ANSI
+
+#endif /* Linux/m68k */
+
+#if defined (__linux__) && defined (__sparc__)
+
+#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_SUN
+
+#ifndef VOID    /* The stupid windows.h header file uses a #define instead of a typedef */
+typedef void              VOID;
+#endif  /* end 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 float             float32;
+typedef double            float64;
+typedef long              intf;     /* size of INTEGERs in Fortran compiler */
+#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
+#define HAVE_STDC
+#define INCLUDES_ARE_ANSI
+
+#endif /* Linux/Sparc */
+
+#if defined (__linux__) && 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 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_MOTOROLA
+
+#ifndef VOID    /* The stupid windows.h header file uses a #define instead of a typedef */
+typedef void              VOID;
+#endif  /* end 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 long int          int32;
+typedef unsigned long int uint32;
+typedef int               intn;
+typedef unsigned int      uintn;
+typedef float             float32;
+typedef double            float64;
+typedef long              intf;     /* size of INTEGERs in Fortran compiler */
+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
+#define HAVE_STDC
+#define INCLUDES_ARE_ANSI
+
+#endif /* Linux/powerpc */
+
+#if defined (__linux__) && defined (__s390__)
+
+#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_S390
+
+#ifndef VOID    /* The stupid windows.h header file uses a #define instead of a typedef */
+typedef void              VOID;
+#endif  /* end 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;
+#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 float             float32;
+typedef double            float64;
+typedef long              intf;     /* size of INTEGERs in Fortran compiler */
+#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
+#define HAVE_STDC
+#define INCLUDES_ARE_ANSI
+
+#endif /* Linux/s390 */
+
+#if defined (__linux__) && (defined (__MIPSEB__) || defined(__MIPSEL__))
+
+#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 */
+
+#if defined (__MIPSEB__)
+#define DF_MT             DFMT_MIPSEB
+#elif defined(__MIPSEL__)
+#define DF_MT		  DFMT_MIPSEL
+#endif
+
+#ifndef VOID    /* The stupid windows.h header file uses a #define instead of a typedef */
+typedef void              VOID;
+#endif  /* end 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 long              intf;     /* size of INTEGERs in Fortran compiler */
+typedef long 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
+#define HAVE_STDC
+#define INCLUDES_ARE_ANSI
+
+#endif /* Linux/mips */
+
+#if defined (__linux__) && 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 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_ARMV4L
+
+#ifndef VOID    /* The stupid windows.h header file uses a #define instead of a typedef */
+typedef void              VOID;
+#endif  /* end 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 long              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)
+
+#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
+#define HAVE_STDC
+#define INCLUDES_ARE_ANSI
+
+#endif /* Linux/arm */
+
+#if defined (__linux__) && 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 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_AARCH64
+
+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/aarch64 */
+
 #if defined(NEXT) || defined(NeXT)

 #ifndef NEXT
@@ -928,7 +1344,11 @@ Please check your Makefile.

 #include <sys/file.h>               /* for unbuffered i/o stuff */
 #include <sys/stat.h>
-#define DF_MT             DFMT_POWERPC64
+#ifdef __LITTLE_ENDIAN__
+#define DF_MT DFMT_POWERPC64LE
+#else
+#define DF_MT DFMT_POWERPC64
+#endif
 typedef void              VOID;
 typedef void              *VOIDP;
 typedef char              *_fcd;
@@ -952,6 +1372,11 @@ typedef long              hdf_pint_t;
 #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: */
@@ -1097,6 +1522,8 @@ typedef long              hdf_pint_t;
 #define _fcdtocp(desc) (desc)
 #define FILELIB UNIXBUFIO

+#define BIG_LONGS
+
 /* 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;

 #endif /* IA64 */

+/* Renesas SuperH SH3(little/big)/SH4(little/big) */
+#if defined (__linux__) && defined(__sh__)
+
+#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 */
+
+#if defined (__LITTLE_ENDIAN__)
+#define DF_MT             DFMT_SH
+#elif defined(__BIG_ENDIAN__)
+#define DF_MT		  DFMT_SHEB
+#endif
+
+#ifndef VOID /* The stupid windows.h header file uses a #define instead of a typedef */
+typedef void              VOID;
+#endif  /* end 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 long int          int32;
+typedef unsigned long int uint32;
+typedef int               intn;
+typedef unsigned int      uintn;
+typedef float             float32;
+typedef double            float64;
+typedef long              intf;
+typedef int               hdf_pint_t;
+#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
+#define HAVE_STDC
+#define INCLUDES_ARE_ANSI
+
+#endif /* Linux/sh */
+
 #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
--- a/hdf/src/hconv.h
+++ b/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__)
+#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__)
 #       define UI8_IN     DFKnb1b   /* Unsigned Integer, 8 bits */
 #       define UI8_OUT    DFKnb1b
 #       define SI16_IN    DFKnb2b   /* S = Signed */


code:
Remove/patch unreproducible config data.

diff --git a/configure b/configure
index eb9f346..ebab94d 100755
--- a/configure
+++ b/configure
@@ -23163,7 +23163,7 @@ H4_VERSION="`cut -d' ' -f3 $srcdir/README.txt | head -1`"

 ## Configuration date
- CONFIG_DATE="`date`"
+CONFIG_DATE=`date -u -d "@$SOURCE_DATE_EPOCH"`

 ## User doing the configuration
  CONFIG_USER="`whoami`@`hostname`"
diff --git a/libhdf4.settings.in b/libhdf4.settings.in
index 1d9bbb9..4180d72 100644
--- a/libhdf4.settings.in
+++ b/libhdf4.settings.in
@@ -5,10 +5,10 @@ General Information:
 -------------------
 		   HDF4 Version: @H4_VERSION@
 		  Configured on: @CONFIG_DATE@
-		  Configured by: @CONFIG_USER@
+		  Configured by: guix
 		 Configure mode: @CONFIG_MODE@
-		    Host system: @host_cpu@-@host_vendor@-@host_os@
-              Uname information: @UNAME_INFO@
+		    Host system: guix
+              Uname information: guix
 		      Libraries: @STATIC_SHARED@
 	     Installation point: @prefix@

--
2.10.0

license: mit


code:
Allow building a shared library with Fortran.
---
 configure | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/configure b/configure
index f37d2fa..eb9f346 100755
--- a/configure
+++ b/configure
@@ -6141,12 +6141,6 @@ if test "X${enable_shared}" != "Xyes"; then
     enable_shared="no"
 fi

-if test "X${enable_shared}" = "Xyes"; then
-    if test "X${BUILD_FORTRAN}" = "Xyes"; then
-        as_fn_error $? "Cannot build shared fortran libraries. Please configure with --disable-fortran flag." "$LINENO" 5
-    fi
-fi
-

 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
 $as_echo_n "checking whether ln -s works... " >&6; }
--
2.10.0


code:
Honor SOURCE_DATE_EPOCH when exporting configuration date.
Autoconf-level patch submitted upstream on Wed Apr 13 17:03:23 UTC 2016

--- a/configure
+++ b/configure
@@ -27737,7 +28573,14 @@

 ## Configuration date
- CONFIG_DATE="`date`"
+ CONFIG_DATE="`date -u`"
+if test -n "$SOURCE_DATE_EPOCH"; then
+  CONFIG_DATE=`date -u -d "@$SOURCE_DATE_EPOCH" 2>/dev/null \
+               || date -u -r "$SOURCE_DATE_EPOCH" 2>/dev/null`
+  if test -z "$CONFIG_DATE"; then
+    as_fn_error $? "malformed SOURCE_DATE_EPOCH" "$LINENO" 5
+  fi
+fi

 ## User doing the configuration
  CONFIG_USER="`whoami`@`hostname`"


code:
Remove -march=native from build flags.

--- a/higan/GNUmakefile
+++ b/higan/GNUmakefile
@@ -26,7 +26,6 @@
   flags += -fopenmp
   link += -fopenmp
   ifeq ($(binary),application)
-    flags += -march=native
     link += -Wl,-export-dynamic
     link += -lX11 -lXext
   else ifeq ($(binary),library)


code:
Traverse the entities hash's keys in sorted order to ensure reproducibility.

--- libhubbub-0.3.3/build/make-entities.pl
+++ libhubbub-0.3.3/build/make-entities.pl
@@ -86,7 +86,7 @@

 my $trie;

-foreach my $key (keys %entities) {
+foreach my $key (sort keys %entities) {
    $trie = insert_node($trie, $key, $entities{$key});
 }


code:
From ef0399bad41e60cb30d5073129abeb206076394a Mon Sep 17 00:00:00 2001
From: Manolis Ragkousis <manolis837@gmail.com>
Date: Sat, 8 Apr 2017 16:44:52 +0300
Subject: [PATCH] eth-multiplexer: Fix iohelp missing dependency.

* eth-multiplexer/Makefile (HURDLIBS): Add iohelp.
---
 eth-multiplexer/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eth-multiplexer/Makefile b/eth-multiplexer/Makefile
index 07f909e7..cefa0abd 100644
--- a/eth-multiplexer/Makefile
+++ b/eth-multiplexer/Makefile
@@ -26,7 +26,7 @@ MIGSFLAGS = -imacros $(srcdir)/mig-mutate.h
 device-MIGSFLAGS="-DMACH_PAYLOAD_TO_PORT=ports_payload_get_name"
 OBJS = $(SRCS:.c=.o) $(MIGSTUBS)
 LCLHDRS = ethernet.h util.h vdev.h netfs_impl.h
-HURDLIBS = ports ihash fshelp shouldbeinlibc netfs bpf
+HURDLIBS = ports ihash iohelp fshelp shouldbeinlibc netfs bpf
 LDLIBS = -lpthread

 CFLAGS += -I$(top_srcdir)/libbpf
--
2.12.2


code:
--- hydra-20150407.4c0e3e4/tests/evaluation-tests.pl	2015-04-15 12:00:19.000000000 -0500
+++ hydra-20150407.4c0e3e4/tests/evaluation-tests.pl	2015-04-17 08:53:04.940301471 -0500
@@ -7,7 +7,7 @@

 my $db = Hydra::Model::DB->new;

-use Test::Simple tests => 72;
+use Test::Simple tests => 68;

 hydra_setup($db);

@@ -103,13 +103,6 @@
         uri => "$jobsBaseUri/hg-repo",
         update => getcwd . "/jobs/hg-update.sh"
     },
-    {
-        name => "darcs",
-        nixexpr => "darcs-input.nix",
-        type => "darcs",
-        uri => "$jobsBaseUri/darcs-repo",
-        update => getcwd . "/jobs/darcs-update.sh"
-    }
 );

 foreach my $scm ( @scminputs ) {


code:
Based on upstream changeset:
  https://hg.mozilla.org/releases/mozilla-esr60/rev/300efdbc9fe1
but with the git binary patch and related test changes omitted,
and adapted to apply cleanly to GNU IceCat.

# HG changeset patch
# User David Keeler <dkeeler@mozilla.com>
# Date 1531860660 25200
# Node ID 300efdbc9fe1f9165428c7934861033935b5abfa
# Parent  80a4a7ef281374dbb2afda8edac54665b14b9ef8
Bug 1475775 - Clean up old NSS DB file after upgrade if necessary. r=franziskus, r=mattn, a=RyanVM

Reviewers: franziskus, mattn

Bug #: 1475775

Differential Revision: https://phabricator.services.mozilla.com/D2202

diff --git a/security/manager/ssl/nsNSSComponent.cpp b/security/manager/ssl/nsNSSComponent.cpp
--- a/security/manager/ssl/nsNSSComponent.cpp
+++ b/security/manager/ssl/nsNSSComponent.cpp
@@ -1935,16 +1935,61 @@ AttemptToRenameBothPKCS11ModuleDBVersion
   NS_NAMED_LITERAL_CSTRING(sqlModuleDBFilename, "pkcs11.txt");
   nsresult rv = AttemptToRenamePKCS11ModuleDB(profilePath,
                                               legacyModuleDBFilename);
   if (NS_FAILED(rv)) {
     return rv;
   }
   return AttemptToRenamePKCS11ModuleDB(profilePath, sqlModuleDBFilename);
 }
+
+// When we changed from the old dbm database format to the newer sqlite
+// implementation, the upgrade process left behind the existing files. Suppose a
+// user had not set a password for the old key3.db (which is about 99% of
+// users). After upgrading, both the old database and the new database are
+// unprotected. If the user then sets a password for the new database, the old
+// one will not be protected. In this scenario, we should probably just remove
+// the old database (it would only be relevant if the user downgraded to a
+// version of IceCat before 58, but we have to trade this off against the
+// user's old private keys being unexpectedly unprotected after setting a
+// password).
+// This was never an issue on Android because we always used the new
+// implementation.
+static void
+MaybeCleanUpOldNSSFiles(const nsACString& profilePath)
+{
+  UniquePK11SlotInfo slot(PK11_GetInternalKeySlot());
+  if (!slot) {
+    return;
+  }
+  // Unfortunately we can't now tell the difference between "there already was a
+  // password when the upgrade happened" and "there was not a password but then
+  // the user added one after upgrading".
+  bool hasPassword = PK11_NeedLogin(slot.get()) &&
+                     !PK11_NeedUserInit(slot.get());
+  if (!hasPassword) {
+    return;
+  }
+  nsCOMPtr<nsIFile> dbFile = do_CreateInstance("@mozilla.org/file/local;1");
+  if (!dbFile) {
+    return;
+  }
+  nsresult rv = dbFile->InitWithNativePath(profilePath);
+  if (NS_FAILED(rv)) {
+    return;
+  }
+  NS_NAMED_LITERAL_CSTRING(keyDBFilename, "key3.db");
+  rv = dbFile->AppendNative(keyDBFilename);
+  if (NS_FAILED(rv)) {
+    return;
+  }
+  // Since this isn't a directory, the `recursive` argument to `Remove` is
+  // irrelevant.
+  Unused << dbFile->Remove(false);
+}
 #endif // ifndef ANDROID

 // Given a profile directory, attempt to initialize NSS. If nocertdb is true,
 // (or if we don't have a profile directory) simply initialize NSS in no DB mode
 // and return. Otherwise, first attempt to initialize in read/write mode, and
 // then read-only mode if that fails. If both attempts fail, we may be failing
 // to initialize an NSS DB collection that has FIPS mode enabled. Attempt to
 // ascertain if this is the case, and if so, rename the offending PKCS#11 module
@@ -1966,16 +2011,19 @@ InitializeNSSWithFallbacks(const nsACStr

   // Try read/write mode. If we're in safeMode, we won't load PKCS#11 modules.
 #ifndef ANDROID
   PRErrorCode savedPRErrorCode1;
 #endif // ifndef ANDROID
   SECStatus srv = ::mozilla::psm::InitializeNSS(profilePath, false, !safeMode);
   if (srv == SECSuccess) {
     MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("initialized NSS in r/w mode"));
+#ifndef ANDROID
+    MaybeCleanUpOldNSSFiles(profilePath);
+#endif // ifndef ANDROID
     return NS_OK;
   }
 #ifndef ANDROID
   savedPRErrorCode1 = PR_GetError();
   PRErrorCode savedPRErrorCode2;
 #endif // ifndef ANDROID
   // That failed. Try read-only mode.
   srv = ::mozilla::psm::InitializeNSS(profilePath, true, !safeMode);


code:
Fixes needed when avoiding bundled libraries.

--- icecat-60.2.0/xpcom/build/moz.build.orig	2018-09-13 17:46:49.000000000 -0400
+++ icecat-60.2.0/xpcom/build/moz.build	2018-09-22 04:26:50.659564554 -0400
@@ -99,10 +99,5 @@
     '/docshell/base',
 ]

-if CONFIG['MOZ_VPX']:
-    LOCAL_INCLUDES += [
-        '/media/libvpx',
-    ]
-
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
     CXXFLAGS += CONFIG['TK_CFLAGS']
--- icecat-60.2.0/storage/moz.build.orig	2018-09-13 17:51:11.000000000 -0400
+++ icecat-60.2.0/storage/moz.build	2018-09-22 04:26:50.659564554 -0400
@@ -117,7 +117,6 @@
     DEFINES['MOZ_MEMORY_TEMP_STORE_PRAGMA'] = True

 LOCAL_INCLUDES += [
-    '/db/sqlite3/src',
     '/dom/base',
 ]

--- icecat-60.2.0/dom/indexedDB/moz.build.orig	2018-09-13 17:49:42.000000000 -0400
+++ icecat-60.2.0/dom/indexedDB/moz.build	2018-09-22 04:26:50.663564574 -0400
@@ -102,7 +102,6 @@
     CXXFLAGS += ['-Wno-error=shadow']

 LOCAL_INCLUDES += [
-    '/db/sqlite3/src',
     '/dom/base',
     '/dom/storage',
     '/ipc/glue',
--- icecat-60.2.0/media/webrtc/trunk/webrtc/base/rtc_task_queue_gn/moz.build.orig	2018-09-13 17:40:54.000000000 -0400
+++ icecat-60.2.0/media/webrtc/trunk/webrtc/base/rtc_task_queue_gn/moz.build	2018-09-23 21:33:12.319975105 -0400
@@ -130,11 +130,6 @@
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"

-    LOCAL_INCLUDES += [
-        "/ipc/chromium/src/third_party/libevent/include/",
-        "/ipc/chromium/src/third_party/libevent/linux/"
-    ]
-
     UNIFIED_SOURCES += [
         "/media/webrtc/trunk/webrtc/base/task_queue_libevent.cc",
         "/media/webrtc/trunk/webrtc/base/task_queue_posix.cc"


code:
Allow building against system-wide graphite2/harfbuzz.
See <https://bugzilla.mozilla.org/show_bug.cgi?id=847568>
Based on:
  https://svnweb.freebsd.org/ports/head/www/firefox-esr/files/patch-bug847568?revision=472833&view=co
Modified for use with patch -p1, and to apply cleanly to GNU IceCat.

--- icecat-60.2.0/config/system-headers.mozbuild
+++ icecat-60.2.0/config/system-headers.mozbuild
@@ -1311,6 +1311,19 @@
         'pixman.h',
     ]

+if CONFIG['MOZ_SYSTEM_GRAPHITE2']:
+    system_headers += [
+        'graphite2/Font.h',
+        'graphite2/Segment.h',
+    ]
+
+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+    system_headers += [
+        'harfbuzz/hb-glib.h',
+        'harfbuzz/hb-ot.h',
+        'harfbuzz/hb.h',
+    ]
+
 if CONFIG['MOZ_SYSTEM_LIBVPX']:
     system_headers += [
         'vpx_mem/vpx_mem.h',
--- icecat-60.2.0/dom/base/moz.build
+++ icecat-60.2.0/dom/base/moz.build
@@ -474,6 +474,9 @@
 if CONFIG['MOZ_X11']:
     CXXFLAGS += CONFIG['TK_CFLAGS']

+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
+
 GENERATED_FILES += [
     'PropertyUseCounterMap.inc',
     'UseCounterList.h',
--- icecat-60.2.0/gfx/graphite2/moz-gr-update.sh
+++ icecat-60.2.0/gfx/graphite2/moz-gr-update.sh
@@ -1,6 +1,7 @@
 #!/bin/bash

 # Script used to update the Graphite2 library in the mozilla source tree
+# and bump version for --with-system-graphite2

 # This script lives in gfx/graphite2, along with the library source,
 # but must be run from the top level of the mozilla-central tree.
@@ -37,12 +38,16 @@ echo "See" $0 "for update procedure." >> gfx/graphite2/README.mozilla
 #find gfx/graphite2/ -name "*.cpp" -exec perl -p -i -e "s/<cstdio>/<stdio.h>/;s/Windows.h/windows.h/;" {} \;
 #find gfx/graphite2/ -name "*.h" -exec perl -p -i -e "s/<cstdio>/<stdio.h>/;s/Windows.h/windows.h/;" {} \;

+# chase version for --with-system-graphite2
+perl -p -i -e "s/[0-9]+\,[0-9]+\,[0-9]+/$RELEASE/ and tr/./,/ \
+  if /GR2_VERSION_REQUIRE/" old-configure.in
+
 # summarize what's been touched
 echo Updated to $RELEASE.
 echo Here is what changed in the gfx/graphite2 directory:
 echo

-hg stat gfx/graphite2
+hg stat old-configure.in gfx/graphite2

 echo
 echo If gfx/graphite2/src/files.mk has changed, please make corresponding
--- icecat-60.2.0/gfx/moz.build
+++ icecat-60.2.0/gfx/moz.build
@@ -10,6 +10,12 @@ with Files('**'):
 if CONFIG['MOZ_TREE_CAIRO']:
     DIRS += ['cairo']

+if not CONFIG['MOZ_SYSTEM_GRAPHITE2']:
+    DIRS += ['graphite2/src' ]
+
+if not CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+    DIRS += ['harfbuzz/src']
+
 DIRS += [
     '2d',
     'ycbcr',
@@ -18,8 +24,6 @@ DIRS += [
     'qcms',
     'gl',
     'layers',
-    'graphite2/src',
-    'harfbuzz/src',
     'ots/src',
     'thebes',
     'ipc',
--- icecat-60.2.0/gfx/skia/generate_mozbuild.py
+++ icecat-60.2.0/gfx/skia/generate_mozbuild.py
@@ -148,6 +148,9 @@
         '-Wno-unused-private-field',
     ]

+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
+
 if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk3', 'android'):
     CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
     CXXFLAGS += CONFIG['CAIRO_FT_CFLAGS']
--- icecat-60.2.0/gfx/skia/moz.build
+++ icecat-60.2.0/gfx/skia/moz.build
@@ -822,6 +822,9 @@
         '-Wno-unused-private-field',
     ]

+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
+
 if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk3', 'android'):
     CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
     CXXFLAGS += CONFIG['CAIRO_FT_CFLAGS']
--- icecat-60.2.0/gfx/thebes/moz.build
+++ icecat-60.2.0/gfx/thebes/moz.build
@@ -272,7 +272,13 @@

 LOCAL_INCLUDES += CONFIG['SKIA_INCLUDES']

-DEFINES['GRAPHITE2_STATIC'] = True
+if CONFIG['MOZ_SYSTEM_GRAPHITE2']:
+    CXXFLAGS += CONFIG['MOZ_GRAPHITE2_CFLAGS']
+else:
+    DEFINES['GRAPHITE2_STATIC'] = True
+
+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']

 if CONFIG['CC_TYPE'] == 'clang':
     # Suppress warnings from Skia header files.
--- icecat-60.2.0/intl/unicharutil/util/moz.build
+++ icecat-60.2.0/intl/unicharutil/util/moz.build
@@ -25,4 +25,7 @@ UNIFIED_SOURCES += [
     'nsUnicodeProperties.cpp',
 ]

+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
+
 FINAL_LIBRARY = 'xul'
--- icecat-60.2.0/netwerk/dns/moz.build
+++ icecat-60.2.0/netwerk/dns/moz.build
@@ -76,3 +76,6 @@

 if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
     CXXFLAGS += ['-Wno-error=shadow']
+
+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
--- icecat-60.2.0/old-configure.in
+++ icecat-60.2.0/old-configure.in
@@ -3995,6 +3995,27 @@
 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)

 dnl ========================================================
+dnl Check for graphite2
+dnl ========================================================
+if test -n "$MOZ_SYSTEM_GRAPHITE2"; then
+    dnl graphite2.pc has bogus version, check manually
+    _SAVE_CFLAGS=$CFLAGS
+    CFLAGS="$CFLAGS $MOZ_GRAPHITE2_CFLAGS"
+    AC_TRY_COMPILE([ #include <graphite2/Font.h>
+                     #define GR2_VERSION_REQUIRE(major,minor,bugfix)  \
+                             ( GR2_VERSION_MAJOR * 10000 + GR2_VERSION_MINOR \
+                               * 100 + GR2_VERSION_BUGFIX >= \
+                               (major) * 10000 + (minor) * 100 + (bugfix) )
+                   ], [
+                     #if !GR2_VERSION_REQUIRE(1,3,10)
+                     #error "Insufficient graphite2 version."
+                     #endif
+                   ], [],
+                   [AC_MSG_ERROR([--with-system-graphite2 requested but no working libgraphite2 found])])
+    CFLAGS=$_SAVE_CFLAGS
+fi
+
+dnl ========================================================
 dnl Check for pixman and cairo
 dnl ========================================================

--- icecat-60.2.0/toolkit/library/moz.build
+++ icecat-60.2.0/toolkit/library/moz.build
@@ -235,6 +235,12 @@
 if CONFIG['MOZ_SYSTEM_PNG']:
     OS_LIBS += CONFIG['MOZ_PNG_LIBS']

+if CONFIG['MOZ_SYSTEM_GRAPHITE2']:
+    OS_LIBS += CONFIG['MOZ_GRAPHITE2_LIBS']
+
+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+    OS_LIBS += CONFIG['MOZ_HARFBUZZ_LIBS']
+
 if CONFIG['MOZ_SYSTEM_HUNSPELL']:
     OS_LIBS += CONFIG['MOZ_HUNSPELL_LIBS']

--- icecat-60.2.0/toolkit/moz.configure
+++ icecat-60.2.0/toolkit/moz.configure
@@ -1051,6 +1051,26 @@
 add_old_configure_assignment('FT2_CFLAGS',
                              ft2_info.cflags)

+# Graphite2
+# ==============================================================
+option('--with-system-graphite2',
+       help="Use system graphite2 (located with pkgconfig)")
+
+system_graphite2 = pkg_check_modules('MOZ_GRAPHITE2', 'graphite2',
+                                     when='--with-system-graphite2')
+
+set_config('MOZ_SYSTEM_GRAPHITE2', depends_if(system_graphite2)(lambda _: True))
+
+# HarfBuzz
+# ==============================================================
+option('--with-system-harfbuzz',
+       help="Use system harfbuzz (located with pkgconfig)")
+
+system_harfbuzz = pkg_check_modules('MOZ_HARFBUZZ', 'harfbuzz >= 1.7.4',
+                                    when='--with-system-harfbuzz')
+
+set_config('MOZ_SYSTEM_HARFBUZZ', depends_if(system_harfbuzz)(lambda _: True))
+
 # Mortar
 # ==============================================================
 option('--enable-mortar', help='Enable mortar extension')


code:
Support building with system media libraries.
See <https://bugzilla.mozilla.org/show_bug.cgi?id=517422>

Based on:
  https://svnweb.freebsd.org/ports/head/www/firefox-esr/files/patch-z-bug517422?revision=472833&view=markup

Changes to files within the bundled libraries are omitted, since those files
are removed from Guix sources.  Modified for use with patch -p1, and to apply
cleanly to GNU IceCat.

--- icecat-60.2.0/build/moz.configure/old.configure
+++ icecat-60.2.0/build/moz.configure/old.configure
@@ -273,7 +273,12 @@
     '--with-system-libvpx',
     '--with-system-nspr',
     '--with-system-nss',
+    '--with-system-ogg',
     '--with-system-png',
+    '--with-system-soundtouch',
+    '--with-system-theora',
+    '--with-system-tremor',
+    '--with-system-vorbis',
     '--with-system-zlib',
     '--with-thumb',
     '--with-thumb-interwork',
--- icecat-60.2.0/config/external/moz.build
+++ icecat-60.2.0/config/external/moz.build
@@ -23,12 +23,21 @@

 external_dirs += ['modules/xz-embedded']

-if CONFIG['MOZ_VORBIS']:
+if not CONFIG['MOZ_SYSTEM_OGG']:
+    external_dirs += ['media/libogg']
+
+if CONFIG['MOZ_VORBIS'] and not CONFIG['MOZ_SYSTEM_VORBIS']:
     external_dirs += ['media/libvorbis']

-if CONFIG['MOZ_TREMOR']:
+if CONFIG['MOZ_TREMOR'] and not CONFIG['MOZ_SYSTEM_TREMOR']:
     external_dirs += ['media/libtremor']

+if not CONFIG['MOZ_SYSTEM_THEORA']:
+    external_dirs += ['media/libtheora']
+
+if not CONFIG['MOZ_SYSTEM_SOUNDTOUCH']:
+    external_dirs += ['media/libsoundtouch']
+
 if CONFIG['MOZ_WEBM_ENCODER']:
     external_dirs += ['media/libmkv']

@@ -51,11 +60,8 @@
     'media/kiss_fft',
     'media/libcubeb',
     'media/libnestegg',
-    'media/libogg',
     'media/libopus',
-    'media/libtheora',
     'media/libspeex_resampler',
-    'media/libsoundtouch',
     'media/mp4parse-rust',
     'media/psshparser'
 ]
--- icecat-60.2.0/config/system-headers.mozbuild
+++ icecat-60.2.0/config/system-headers.mozbuild
@@ -1324,6 +1324,28 @@
         'harfbuzz/hb.h',
     ]

+if CONFIG['MOZ_SYSTEM_OGG']:
+    system_headers += [
+        'ogg/ogg.h',
+        'ogg/os_types.h',
+    ]
+
+if CONFIG['MOZ_SYSTEM_THEORA']:
+    system_headers += [
+        'theora/theoradec.h',
+    ]
+
+if CONFIG['MOZ_SYSTEM_VORBIS']:
+    system_headers += [
+        'vorbis/codec.h',
+        'vorbis/vorbisenc.h',
+    ]
+
+if CONFIG['MOZ_SYSTEM_TREMOR']:
+    system_headers += [
+        'tremor/ivorbiscodec.h',
+    ]
+
 if CONFIG['MOZ_SYSTEM_LIBVPX']:
     system_headers += [
         'vpx_mem/vpx_mem.h',
--- icecat-60.2.0/dom/media/AudioStream.cpp
+++ icecat-60.2.0/dom/media/AudioStream.cpp
@@ -121,7 +121,9 @@
   : mMonitor("AudioStream")
   , mChannels(0)
   , mOutChannels(0)
+#ifndef MOZ_SYSTEM_SOUNDTOUCH
   , mTimeStretcher(nullptr)
+#endif
   , mDumpFile(nullptr)
   , mState(INITIALIZED)
   , mDataSource(aSource)
@@ -142,9 +144,11 @@
   if (mDumpFile) {
     fclose(mDumpFile);
   }
+#ifndef MOZ_SYSTEM_SOUNDTOUCH
   if (mTimeStretcher) {
     soundtouch::destroySoundTouchObj(mTimeStretcher);
   }
+#endif
 #if defined(XP_WIN)
   if (XRE_IsContentProcess()) {
     audio::AudioNotificationReceiver::Unregister(this);
@@ -168,7 +172,11 @@
 {
   mMonitor.AssertCurrentThreadOwns();
   if (!mTimeStretcher) {
+#ifdef MOZ_SYSTEM_SOUNDTOUCH
+    mTimeStretcher = new soundtouch::SoundTouch();
+#else
     mTimeStretcher = soundtouch::createSoundTouchObj();
+#endif
     mTimeStretcher->setSampleRate(mAudioClock.GetInputRate());
     mTimeStretcher->setChannels(mOutChannels);
     mTimeStretcher->setPitch(1.0);
--- icecat-60.2.0/dom/media/AudioStream.h
+++ icecat-60.2.0/dom/media/AudioStream.h
@@ -15,7 +15,11 @@
 #include "mozilla/TimeStamp.h"
 #include "mozilla/UniquePtr.h"
 #include "CubebUtils.h"
+#ifdef MOZ_SYSTEM_SOUNDTOUCH
+#include "soundtouch/SoundTouch.h"
+#else
 #include "soundtouch/SoundTouchFactory.h"
+#endif

 #if defined(XP_WIN)
 #include "mozilla/audio/AudioNotificationReceiver.h"
@@ -297,7 +301,11 @@
   uint32_t mChannels;
   uint32_t mOutChannels;
   AudioClock mAudioClock;
+#ifdef MOZ_SYSTEM_SOUNDTOUCH
+  nsAutoPtr<soundtouch::SoundTouch> mTimeStretcher;
+#else
   soundtouch::SoundTouch* mTimeStretcher;
+#endif

   // Output file for dumping audio
   FILE* mDumpFile;
--- icecat-60.2.0/dom/media/moz.build
+++ icecat-60.2.0/dom/media/moz.build
@@ -327,6 +327,21 @@

 DEFINES['MOZILLA_INTERNAL_API'] = True

+if CONFIG['MOZ_SYSTEM_OGG']:
+    CXXFLAGS += CONFIG['MOZ_OGG_CFLAGS']
+
+if CONFIG['MOZ_SYSTEM_THEORA']:
+    CXXFLAGS += CONFIG['MOZ_THEORA_CFLAGS']
+
+if CONFIG['MOZ_SYSTEM_VORBIS']:
+    CXXFLAGS += CONFIG['MOZ_VORBIS_CFLAGS']
+
+if CONFIG['MOZ_SYSTEM_TREMOR']:
+    CXXFLAGS += CONFIG['MOZ_TREMOR_CFLAGS']
+
+if CONFIG['MOZ_SYSTEM_SOUNDTOUCH']:
+    CXXFLAGS += CONFIG['MOZ_SOUNDTOUCH_CFLAGS']
+
 if CONFIG['MOZ_ANDROID_HLS_SUPPORT']:
     DEFINES['MOZ_ANDROID_HLS_SUPPORT'] = True

--- icecat-60.2.0/dom/media/platforms/ffmpeg/ffvpx/FFVPXRuntimeLinker.cpp
+++ icecat-60.2.0/dom/media/platforms/ffmpeg/ffvpx/FFVPXRuntimeLinker.cpp
@@ -15,9 +15,13 @@
 #include <windows.h>
 #endif

+#ifdef MOZ_SYSTEM_SOUNDTOUCH
+#include "nsXPCOMPrivate.h" // for XUL_DLL
+#else
 // We use a known symbol located in lgpllibs to determine its location.
 // soundtouch happens to be always included in lgpllibs
 #include "soundtouch/SoundTouch.h"
+#endif

 namespace mozilla {

@@ -64,6 +68,12 @@

   sLinkStatus = LinkStatus_FAILED;

+#ifdef MOZ_SYSTEM_SOUNDTOUCH
+  // We retrieve the path of the XUL library as this is where mozavcodec and
+  // mozavutil libs are located.
+  char* path =
+    PR_GetLibraryFilePathname(XUL_DLL, (PRFuncPtr)&FFVPXRuntimeLinker::Init);
+#else
   // We retrieve the path of the lgpllibs library as this is where mozavcodec
   // and mozavutil libs are located.
   PathString lgpllibsname = GetLibraryName(nullptr, "lgpllibs");
@@ -73,6 +83,7 @@
   PathString path =
     GetLibraryFilePathname(lgpllibsname.get(),
                            (PRFuncPtr)&soundtouch::SoundTouch::getVersionId);
+#endif
   if (path.IsEmpty()) {
     return false;
   }
--- icecat-60.2.0/old-configure.in
+++ icecat-60.2.0/old-configure.in
@@ -2451,6 +2451,111 @@
 fi
 fi # COMPILE_ENVIRONMENT

+dnl ========================================================
+dnl Check for libogg
+dnl ========================================================
+
+MOZ_ARG_WITH_BOOL(system-ogg,
+[  --with-system-ogg       Use system libogg (located with pkgconfig)],
+MOZ_SYSTEM_OGG=1,
+MOZ_SYSTEM_OGG=)
+
+if test -n "$MOZ_SYSTEM_OGG"; then
+    PKG_CHECK_MODULES(MOZ_OGG, ogg >= 1.3.3)
+
+    _SAVE_LIBS=$LIBS
+    LIBS="$LIBS $MOZ_OGG_LIBS"
+    AC_CHECK_FUNC(ogg_set_mem_functions, [],
+      [AC_DEFINE(MOZ_OGG_NO_MEM_REPORTING)])
+    LIBS=$_SAVE_LIBS
+fi
+
+AC_SUBST(MOZ_SYSTEM_OGG)
+
+dnl ========================================================
+dnl Check for libvorbis
+dnl ========================================================
+
+MOZ_ARG_WITH_BOOL(system-vorbis,
+[  --with-system-vorbis    Use system libvorbis (located with pkgconfig)],
+MOZ_SYSTEM_VORBIS=1,
+MOZ_SYSTEM_VORBIS=)
+
+if test -n "$MOZ_SYSTEM_VORBIS"; then
+    PKG_CHECK_MODULES(MOZ_VORBIS, vorbis vorbisenc >= 1.3.6)
+fi
+
+AC_SUBST(MOZ_SYSTEM_VORBIS)
+
+dnl ========================================================
+dnl Check for integer-only libvorbis aka tremor
+dnl ========================================================
+
+MOZ_ARG_WITH_BOOL(system-tremor,
+[  --with-system-tremor    Use system libtremor (located with pkgconfig)],
+MOZ_SYSTEM_TREMOR=1,
+MOZ_SYSTEM_TREMOR=)
+
+if test -n "$MOZ_SYSTEM_TREMOR"; then
+    PKG_CHECK_MODULES(MOZ_TREMOR, vorbisidec >= 1.2.1)
+fi
+
+AC_SUBST(MOZ_SYSTEM_TREMOR)
+
+dnl ========================================================
+dnl Check for libtheora
+dnl ========================================================
+
+MOZ_ARG_WITH_BOOL(system-theora,
+[  --with-system-theora    Use system libtheora (located with pkgconfig)],
+MOZ_SYSTEM_THEORA=1,
+MOZ_SYSTEM_THEORA=)
+
+if test -n "$MOZ_SYSTEM_THEORA"; then
+    PKG_CHECK_MODULES(MOZ_THEORA, theora >= 1.2)
+fi
+
+AC_SUBST(MOZ_SYSTEM_THEORA)
+
+dnl ========================================================
+dnl Check for libSoundTouch
+dnl ========================================================
+
+MOZ_ARG_WITH_BOOL(system-soundtouch,
+[  --with-system-soundtouch Use system libSoundTouch (located with pkgconfig)],
+MOZ_SYSTEM_SOUNDTOUCH=1,
+MOZ_SYSTEM_SOUNDTOUCH=)
+
+if test -n "$MOZ_SYSTEM_SOUNDTOUCH"; then
+    PKG_CHECK_MODULES(MOZ_SOUNDTOUCH, soundtouch >= 1.9.0)
+
+    AC_LANG_SAVE
+    AC_LANG_CPLUSPLUS
+    _SAVE_CXXFLAGS=$CXXFLAGS
+    CXXFLAGS="$CXXFLAGS $MOZ_SOUNDTOUCH_CFLAGS"
+    AC_CACHE_CHECK(for soundtouch sample type,
+                   ac_cv_soundtouch_sample_type,
+                   [AC_TRY_COMPILE([#include <SoundTouch.h>
+                                    #ifndef SOUNDTOUCH_INTEGER_SAMPLES
+                                    #error soundtouch expects float samples
+                                    #endif],
+                                   [],
+                                   [ac_cv_soundtouch_sample_type=short],
+                                   [ac_cv_soundtouch_sample_type=float])])
+    CXXFLAGS=$_SAVE_CXXFLAGS
+    AC_LANG_RESTORE
+
+    if test \( -n "$MOZ_SAMPLE_TYPE_S16" -a "$ac_cv_soundtouch_sample_type" != short \) \
+         -o \( -n "$MOZ_SAMPLE_TYPE_FLOAT32" -a "$ac_cv_soundtouch_sample_type" != float \) ; then
+        AC_MSG_ERROR([SoundTouch library is built with incompatible sample type. Either rebuild the library with/without --enable-integer-samples, chase default Mozilla sample type or remove --with-system-soundtouch.])
+    fi
+fi
+
+if test -n "$MOZ_SYSTEM_SOUNDTOUCH"; then
+    AC_DEFINE(MOZ_SYSTEM_SOUNDTOUCH)
+fi
+AC_SUBST(MOZ_SYSTEM_SOUNDTOUCH)
+
 dnl system libvpx Support
 dnl ========================================================
 MOZ_ARG_WITH_BOOL(system-libvpx,
--- icecat-60.2.0/toolkit/library/moz.build
+++ icecat-60.2.0/toolkit/library/moz.build
@@ -244,6 +244,21 @@
 if CONFIG['MOZ_SYSTEM_HUNSPELL']:
     OS_LIBS += CONFIG['MOZ_HUNSPELL_LIBS']

+if CONFIG['MOZ_SYSTEM_OGG']:
+    OS_LIBS += CONFIG['MOZ_OGG_LIBS']
+
+if CONFIG['MOZ_SYSTEM_THEORA']:
+    OS_LIBS += CONFIG['MOZ_THEORA_LIBS']
+
+if CONFIG['MOZ_SYSTEM_VORBIS']:
+    OS_LIBS += CONFIG['MOZ_VORBIS_LIBS']
+
+if CONFIG['MOZ_SYSTEM_TREMOR']:
+    OS_LIBS += CONFIG['MOZ_TREMOR_LIBS']
+
+if CONFIG['MOZ_SYSTEM_SOUNDTOUCH']:
+    OS_LIBS += CONFIG['MOZ_SOUNDTOUCH_LIBS']
+
 if CONFIG['MOZ_SYSTEM_LIBEVENT']:
     OS_LIBS += CONFIG['MOZ_LIBEVENT_LIBS']

--- icecat-60.2.0/xpcom/build/XPCOMInit.cpp
+++ icecat-60.2.0/xpcom/build/XPCOMInit.cpp
@@ -138,7 +138,9 @@

 #include "mozilla/ipc/GeckoChildProcessHost.h"

+#ifndef MOZ_OGG_NO_MEM_REPORTING
 #include "ogg/ogg.h"
+#endif
 #if defined(MOZ_VPX) && !defined(MOZ_VPX_NO_MEM_REPORTING)
 #if defined(HAVE_STDINT_H)
 // mozilla-config.h defines HAVE_STDINT_H, and then it's defined *again* in
@@ -639,11 +641,13 @@
   // this oddness.
   mozilla::SetICUMemoryFunctions();

+#ifndef MOZ_OGG_NO_MEM_REPORTING
   // Do the same for libogg.
   ogg_set_mem_functions(OggReporter::CountingMalloc,
                         OggReporter::CountingCalloc,
                         OggReporter::CountingRealloc,
                         OggReporter::CountingFree);
+#endif

 #if defined(MOZ_VPX) && !defined(MOZ_VPX_NO_MEM_REPORTING)
   // And for VPX.


code:
# HG changeset patch
# User Gábor Boskovits <boskovits@gmail.com>
# Date 1530519413 -7200
#      Mon Jul 02 10:16:53 2018 +0200
# Node ID 77e5bc9e238a28d17e097647badc04ed67a6a452
# Parent  1ae05a34e052d1672b4a7894ddf5fc2f662eb861
Fix gcc segfault.

diff -r 1ae05a34e052 -r 77e5bc9e238a src/share/vm/opto/output.cpp
--- a/src/share/vm/opto/output.cpp	Sun Dec 25 23:52:13 2016 +0000
+++ b/src/share/vm/opto/output.cpp	Mon Jul 02 10:16:53 2018 +0200
@@ -1758,6 +1758,8 @@

 // Initializer for class Scheduling

+volatile const void *eePointer = Pipeline_Use::elaborated_elements;
+
 Scheduling::Scheduling(Arena *arena, Compile &compile)
   : _arena(arena),
     _cfg(compile.cfg()),
@@ -1802,8 +1804,8 @@

   // Clear the bundling information
   memcpy(_bundle_use_elements,
-    Pipeline_Use::elaborated_elements,
-    sizeof(Pipeline_Use::elaborated_elements));
+	 (void *)eePointer,
+    11*sizeof(Pipeline_Use_Element));

   // Get the last node
   Block *bb = _cfg->_blocks[_cfg->_blocks.size()-1];
@@ -1854,8 +1856,8 @@
   _bundle_use.reset();

   memcpy(_bundle_use_elements,
-    Pipeline_Use::elaborated_elements,
-    sizeof(Pipeline_Use::elaborated_elements));
+	 (void *)eePointer,
+    11*sizeof(Pipeline_Use_Element));
 }

 //------------------------------ScheduleAndBundle------------------------------


code:
From 2f0ef2c69e99e1096a2a72c7a29025a736b044b4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=A1bor=20Boskovits?= <boskovits@gmail.com>
Date: Mon, 2 Jul 2018 23:37:25 +0200
Subject: [PATCH] Fix gcc segfault.

---
 src/share/vm/opto/output.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/share/vm/opto/output.cpp b/src/share/vm/opto/output.cpp
index d46cb87..0eb9eda 100644
--- a/src/share/vm/opto/output.cpp
+++ b/src/share/vm/opto/output.cpp
@@ -1787,6 +1787,8 @@ uint Scheduling::_total_instructions_per_bundle[Pipeline::_max_instrs_per_cycle+

 // Initializer for class Scheduling

+volatile const void *eePointer = Pipeline_Use::elaborated_elements;
+
 Scheduling::Scheduling(Arena *arena, Compile &compile)
   : _arena(arena),
     _cfg(compile.cfg()),
@@ -1829,7 +1831,7 @@ Scheduling::Scheduling(Arena *arena, Compile &compile)
   memset(_current_latency,    0, node_max * sizeof(unsigned short));

   // Clear the bundling information
-  memcpy(_bundle_use_elements, Pipeline_Use::elaborated_elements, sizeof(Pipeline_Use::elaborated_elements));
+  memcpy(_bundle_use_elements, (void *)eePointer, 11*sizeof(Pipeline_Use_Element));

   // Get the last node
   Block* block = _cfg->get_block(_cfg->number_of_blocks() - 1);
@@ -1880,8 +1882,8 @@ void Scheduling::step_and_clear() {
   _bundle_use.reset();

   memcpy(_bundle_use_elements,
-    Pipeline_Use::elaborated_elements,
-    sizeof(Pipeline_Use::elaborated_elements));
+	 (void *)eePointer,
+    11*sizeof(Pipeline_Use_Element));
 }

 // Perform instruction scheduling and bundling over the sequence of
--
2.18.0


code:
This patch fixes an issues where temporary files were created in an insecure
way.

It was first intruduced in version 3.8.3-7 and fixes
http://bugs.debian.org/438540
--- a/src/tag_file.cpp
+++ b/src/tag_file.cpp
@@ -242,8 +242,8 @@
     strcpy(sTempFile, filename.c_str());
     strcat(sTempFile, sTmpSuffix.c_str());

-#if ((defined(__GNUC__) && __GNUC__ >= 3  ) || !defined(HAVE_MKSTEMP))
-    // This section is for Windows folk && gcc 3.x folk
+#if !defined(HAVE_MKSTEMP)
+    // This section is for Windows folk
     fstream tmpOut;
     createFile(sTempFile, tmpOut);

@@ -257,7 +257,7 @@
       tmpOut.write((char *)tmpBuffer, nBytes);
     }

-#else //((defined(__GNUC__) && __GNUC__ >= 3  ) || !defined(HAVE_MKSTEMP))
+#else //!defined(HAVE_MKSTEMP)

     // else we gotta make a temp file, copy the tag into it, copy the
     // rest of the old file after the tag, delete the old file, rename
@@ -270,7 +270,7 @@
       //ID3_THROW_DESC(ID3E_NoFile, "couldn't open temp file");
     }

-    ofstream tmpOut(fd);
+    ofstream tmpOut(sTempFile);
     if (!tmpOut)
     {
       tmpOut.close();
@@ -285,14 +285,14 @@
     uchar tmpBuffer[BUFSIZ];
     while (file)
     {
-      file.read(tmpBuffer, BUFSIZ);
+      file.read((char *)tmpBuffer, BUFSIZ);
       size_t nBytes = file.gcount();
-      tmpOut.write(tmpBuffer, nBytes);
+      tmpOut.write((char *)tmpBuffer, nBytes);
     }

     close(fd); //closes the file

-#endif ////((defined(__GNUC__) && __GNUC__ >= 3  ) || !defined(HAVE_MKSTEMP))
+#endif ////!defined(HAVE_MKSTEMP)

     tmpOut.close();
     file.close();


code:
Fix FTBFS on i686-linux due to rounding issue (see references).

Fixes Guix bug #22049 (see below).

Copied from Debian.

Source:
https://sources.debian.net/src/ilmbase/2.2.0-11/debian/patches/testBoxAlgo.patch/
https://sources.debian.net/src/ilmbase/2.2.0-11/debian/patches/testBox.patch/

References:
https://lists.nongnu.org/archive/html/openexr-devel/2015-12/msg00001.html
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=22049
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=815712
https://anonscm.debian.org/cgit/pkg-phototools/ilmbase.git/commit/?id=ab28bb45cdad8adc32e345b777ab8e692b1d9a9c

---

Subject: testBoxAlgo: allow fuzzy match of b12 == b2
From: Steven Chamberlain <steven@pyro.eu.org>
Date: Wed, 24 Feb 2016 01:04:11 +0000

Also fix a pre-existing typo.

Index: ilmbase/ImathTest/testBoxAlgo.cpp
===================================================================
--- ilmbase.orig/ImathTest/testBoxAlgo.cpp
+++ ilmbase/ImathTest/testBoxAlgo.cpp
@@ -886,10 +886,11 @@ boxMatrixTransform ()

     assert (approximatelyEqual (b2.min, b4.min, e));
     assert (approximatelyEqual (b2.max, b4.max, e));
-    assert (approximatelyEqual (b3.max, b4.max, e));
+    assert (approximatelyEqual (b3.min, b4.min, e));
     assert (approximatelyEqual (b3.max, b4.max, e));

-    assert (b21 == b2);
+    assert (approximatelyEqual (b2.min, b21.min, e));
+    assert (approximatelyEqual (b2.max, b21.max, e));
     assert (b31 == b3);

     M[0][3] = 1;

---

Subject: testBox: allow fuzzy comparison of floats, doubles
From: Steven Chamberlain <steven@pyro.eu.org>
Date: Wed, 24 Feb 2016 01:10:11 +0000

Allow for inexact values, as long as the error is smaller than the
epsilon of the data type.

On 32-bit x86, allow even greater discrepency at double
precision, due to possible double-rounding.  See
https://lists.nongnu.org/archive/html/openexr-devel/2015-12/msg00001.html

Index: ilmbase/ImathTest/testBox.cpp
===================================================================
--- ilmbase.orig/ImathTest/testBox.cpp
+++ ilmbase/ImathTest/testBox.cpp
@@ -47,6 +47,58 @@ using namespace IMATH_INTERNAL_NAMESPACE

 namespace {

+template <class T>
+bool
+approximatelyEqual (const T &p1, const T &p2)
+{
+	/* int and short should be exact */
+	return (p1 == p2);
+}
+
+bool
+approximatelyEqual (const Vec2<float> &p1, const Vec2<float> &p2)
+{
+    float e = limits<float>::epsilon();
+    float m = 0;
+
+    for (int i = 0; i < 2; ++i)
+    {
+	m = max (m, abs (p1[i]));
+	m = max (m, abs (p2[i]));
+    }
+
+    for (int i = 0; i < 2; ++i)
+	if (!equalWithAbsError (p1[i], p2[i], m * e))
+	    return false;
+
+    return true;
+}
+
+bool
+approximatelyEqual (const Vec2<double> &p1, const Vec2<double> &p2)
+{
+#if defined(__i386__) || defined(_M_IX86)
+    /* double-rounding on 32-bit x86 may cause larger error:
+       use epsilon of float rather than double */
+    double e = limits<float>::epsilon();
+#else
+    double e = limits<double>::epsilon();
+#endif
+    double m = 0;
+
+    for (int i = 0; i < 2; ++i)
+    {
+	m = max (m, abs (p1[i]));
+	m = max (m, abs (p2[i]));
+    }
+
+    for (int i = 0; i < 2; ++i)
+	if (!equalWithAbsError (p1[i], p2[i], m * e))
+	    return false;
+
+    return true;
+}
+
 //
 // Test case generation utility - create a vector of IMATH_INTERNAL_NAMESPACE::Vec{2,3,4}
 // with all permutations of integers 1..T::dimensions().
@@ -250,7 +302,8 @@ testExtendByPoint(const char *type)

         IMATH_INTERNAL_NAMESPACE::Box<T> b;
         b.extendBy(p);
-        assert(b.min == p && b.max == p);
+        assert (approximatelyEqual (b.min, p));
+        assert (approximatelyEqual (b.max, p));
     }

     //
@@ -283,7 +336,8 @@ testExtendByPoint(const char *type)

             b.extendBy(p);

-            assert(b.min == min && b.max == max);
+            assert (approximatelyEqual (b.min, min));
+            assert (approximatelyEqual (b.max, max));
         }
     }
 }
@@ -358,7 +412,8 @@ testExtendByBox(const char *type)
             }
             b.extendBy(IMATH_INTERNAL_NAMESPACE::Box<T>(p0, p1));

-            assert(b.min == min && b.max == max);
+            assert (approximatelyEqual (b.min, min));
+            assert (approximatelyEqual (b.max, max));
         }
     }
 }


code:
This patch fixes a regex parsing compatibility issue with Perl 5.26.0.
It manifests during the configure phase of at-spi2-core like this:

------
Unescaped left brace in regex is illegal here in regex; marked by <-- HERE in m/^(.*)\${ <-- HERE ?([A-Z_]+)}?(.*)$/ at /gnu/store/...-intltool-0.51.0/bin/intltool-update line 1065.
------

Copied from Gentoo and MSYS2:

https://gitweb.gentoo.org/repo/gentoo.git/tree/dev-util/intltool/files/intltool-0.51.0-perl-5.26.patch?id=1105187fc65d8bf643e682fcef39620dcfd9326a
https://github.com/Alexpux/MSYS2-packages/blob/0d3f442553ae4fc8798e32cbf44c4252fa8f3c07/intltool/perl-5.22-compatibility.patch

#diff -ruN intltool-0.51.0.orig/intltool-update.in intltool-0.51.0/intltool-update.in
#--- intltool-0.51.0.orig/intltool-update.in	2017-06-28 00:47:20.889269294 +0200
#+++ intltool-0.51.0/intltool-update.in	2017-06-28 00:48:14.592271529 +0200
#@@ -1068,7 +1068,7 @@
# 	my $untouched = $1;
# 	my $sub = "";
#         # Ignore recursive definitions of variables
#-        $sub = $varhash{$2} if defined $varhash{$2} and $varhash{$2} !~ /\${?$2}?/;
#+        $sub = $varhash{$2} if defined $varhash{$2} and $varhash{$2} !~ /\$\{?$2}?/;
#
# 	return SubstituteVariable ("$untouched$sub$rest");
#     }
--- intltool-0.51.0.orig/intltool-update.in	2015-03-09 02:39:54.000000000 +0100
+++ intltool-0.51.0.orig/intltool-update.in	2015-06-19 01:52:07.171228154 +0200
@@ -1062,7 +1062,7 @@
 	}
     }

-    if ($str =~ /^(.*)\${?([A-Z_]+)}?(.*)$/)
+    if ($str =~ /^(.*)\$\{?([A-Z_]+)}?(.*)$/)
     {
 	my $rest = $3;
 	my $untouched = $1;
@@ -1068,7 +1068,7 @@
 	my $untouched = $1;
 	my $sub = "";
         # Ignore recursive definitions of variables
-        $sub = $varhash{$2} if defined $varhash{$2} and $varhash{$2} !~ /\${?$2}?/;
+        $sub = $varhash{$2} if defined $varhash{$2} and $varhash{$2} !~ /\$\{?$2}?/;

 	return SubstituteVariable ("$untouched$sub$rest");
     }
@@ -1190,10 +1190,10 @@
 	$name    =~ s/\(+$//g;
 	$version =~ s/\(+$//g;

-	$varhash{"PACKAGE_NAME"} = $name if (not $name =~ /\${?AC_PACKAGE_NAME}?/);
-	$varhash{"PACKAGE"} = $name if (not $name =~ /\${?PACKAGE}?/);
-	$varhash{"PACKAGE_VERSION"} = $version if (not $name =~ /\${?AC_PACKAGE_VERSION}?/);
-	$varhash{"VERSION"} = $version if (not $name =~ /\${?VERSION}?/);
+	$varhash{"PACKAGE_NAME"} = $name if (not $name =~ /\$\{?AC_PACKAGE_NAME}?/);
+	$varhash{"PACKAGE"} = $name if (not $name =~ /\$\{?PACKAGE}?/);
+	$varhash{"PACKAGE_VERSION"} = $version if (not $name =~ /\$\{?AC_PACKAGE_VERSION}?/);
+	$varhash{"VERSION"} = $version if (not $name =~ /\$\{?VERSION}?/);
     }

     if ($conf_source =~ /^AC_INIT\(([^,\)]+),([^,\)]+)[,]?([^,\)]+)?/m)
@@ -1219,11 +1219,11 @@
 	$version =~ s/\(+$//g;
         $bugurl  =~ s/\(+$//g if (defined $bugurl);

-	$varhash{"PACKAGE_NAME"} = $name if (not $name =~ /\${?AC_PACKAGE_NAME}?/);
-	$varhash{"PACKAGE"} = $name if (not $name =~ /\${?PACKAGE}?/);
-	$varhash{"PACKAGE_VERSION"} = $version if (not $name =~ /\${?AC_PACKAGE_VERSION}?/);
-	$varhash{"VERSION"} = $version if (not $name =~ /\${?VERSION}?/);
-        $varhash{"PACKAGE_BUGREPORT"} = $bugurl if (defined $bugurl and not $bugurl =~ /\${?\w+}?/);
+	$varhash{"PACKAGE_NAME"} = $name if (not $name =~ /\$\{?AC_PACKAGE_NAME}?/);
+	$varhash{"PACKAGE"} = $name if (not $name =~ /\$\{?PACKAGE}?/);
+	$varhash{"PACKAGE_VERSION"} = $version if (not $name =~ /\$\{?AC_PACKAGE_VERSION}?/);
+	$varhash{"VERSION"} = $version if (not $name =~ /\$\{?VERSION}?/);
+        $varhash{"PACKAGE_BUGREPORT"} = $bugurl if (defined $bugurl and not $bugurl =~ /\$\{?\w+}?/);
     }

     # \s makes this not work, why?


code:
This patch is a combination of the two following patches with minor
changes to the install code
https://sources.debian.org/src/irrlicht/1.8.4+dfsg1-1/debian/patches/debian/link-against-needed-libs.diff/
https://sources.debian.org/src/irrlicht/1.8.4+dfsg1-1/debian/patches/debian/use-system-libs.diff/

---
 include/IrrCompileConfig.h                  | 26 +++++++++------------
 source/Irrlicht/CIrrDeviceLinux.h           |  2 +-
 source/Irrlicht/COpenGLExtensionHandler.h   |  8 +++----
 source/Irrlicht/COpenGLSLMaterialRenderer.h |  2 +-
 source/Irrlicht/Makefile                    | 15 ++++++------
 5 files changed, 25 insertions(+), 28 deletions(-)

diff --git a/include/IrrCompileConfig.h b/include/IrrCompileConfig.h
index 6bb0589..2216353 100644
--- a/include/IrrCompileConfig.h
+++ b/include/IrrCompileConfig.h
@@ -238,6 +238,17 @@ for Windows based systems. You also have to set #define UNICODE for this to comp
 #undef _IRR_WCHAR_FILESYSTEM
 #endif

+//! Define _IRR_COMPILE_WITH_ZLIB_ to enable compiling the engine using zlib.
+/** This enables the engine to read from compressed .zip archives. If you
+disable this feature, the engine can still read archives, but only uncompressed
+ones. */
+#define _IRR_COMPILE_WITH_ZLIB_
+
+//! Define _IRR_USE_NON_SYSTEM_ZLIB_ to let irrlicht use the zlib which comes with irrlicht.
+/** If this is commented out, Irrlicht will try to compile using the zlib installed in the system.
+	This is only used when _IRR_COMPILE_WITH_ZLIB_ is defined. */
+#undef _IRR_USE_NON_SYSTEM_ZLIB_
+
 //! Define _IRR_COMPILE_WITH_JPEGLIB_ to enable compiling the engine using libjpeg.
 /** This enables the engine to read jpeg images. If you comment this out,
 the engine will no longer read .jpeg images. */
@@ -249,10 +260,7 @@ the engine will no longer read .jpeg images. */
 //! Define _IRR_USE_NON_SYSTEM_JPEG_LIB_ to let irrlicht use the jpeglib which comes with irrlicht.
 /** If this is commented out, Irrlicht will try to compile using the jpeg lib installed in the system.
 	This is only used when _IRR_COMPILE_WITH_LIBJPEG_ is defined. */
-#define _IRR_USE_NON_SYSTEM_JPEG_LIB_
-#ifdef NO_IRR_USE_NON_SYSTEM_JPEG_LIB_
 #undef _IRR_USE_NON_SYSTEM_JPEG_LIB_
-#endif

 //! Define _IRR_COMPILE_WITH_LIBPNG_ to enable compiling the engine using libpng.
 /** This enables the engine to read png images. If you comment this out,
@@ -265,10 +273,7 @@ the engine will no longer read .png images. */
 //! Define _IRR_USE_NON_SYSTEM_LIBPNG_ to let irrlicht use the libpng which comes with irrlicht.
 /** If this is commented out, Irrlicht will try to compile using the libpng installed in the system.
 	This is only used when _IRR_COMPILE_WITH_LIBPNG_ is defined. */
-#define _IRR_USE_NON_SYSTEM_LIB_PNG_
-#ifdef NO_IRR_USE_NON_SYSTEM_LIB_PNG_
 #undef _IRR_USE_NON_SYSTEM_LIB_PNG_
-#endif

 //! Define _IRR_D3D_NO_SHADER_DEBUGGING to disable shader debugging in D3D9
 /** If _IRR_D3D_NO_SHADER_DEBUGGING is undefined in IrrCompileConfig.h,
@@ -602,10 +607,7 @@ ones. */
 /** If this is commented out, Irrlicht will try to compile using the zlib
 installed on the system. This is only used when _IRR_COMPILE_WITH_ZLIB_ is
 defined. */
-#define _IRR_USE_NON_SYSTEM_ZLIB_
-#ifdef NO_IRR_USE_NON_SYSTEM_ZLIB_
 #undef _IRR_USE_NON_SYSTEM_ZLIB_
-#endif
 //! Define _IRR_COMPILE_WITH_ZIP_ENCRYPTION_ if you want to read AES-encrypted ZIP archives
 #define _IRR_COMPILE_WITH_ZIP_ENCRYPTION_
 #ifdef NO_IRR_COMPILE_WITH_ZIP_ENCRYPTION_
@@ -623,18 +625,12 @@ library. */
 /** If this is commented out, Irrlicht will try to compile using the bzlib
 installed on the system. This is only used when _IRR_COMPILE_WITH_BZLIB_ is
 defined. */
-#define _IRR_USE_NON_SYSTEM_BZLIB_
-#ifdef NO_IRR_USE_NON_SYSTEM_BZLIB_
 #undef _IRR_USE_NON_SYSTEM_BZLIB_
-#endif
 //! Define _IRR_COMPILE_WITH_LZMA_ if you want to use LZMA compressed zip files.
 /** LZMA is a very efficient compression code, known from 7zip. Irrlicht
 currently only supports zip archives, though. */
-#define _IRR_COMPILE_WITH_LZMA_
-#ifdef NO_IRR_COMPILE_WITH_LZMA_
 #undef _IRR_COMPILE_WITH_LZMA_
 #endif
-#endif

 //! Define __IRR_COMPILE_WITH_MOUNT_ARCHIVE_LOADER_ if you want to mount folders as archives
 #define __IRR_COMPILE_WITH_MOUNT_ARCHIVE_LOADER_
diff --git a/source/Irrlicht/CIrrDeviceLinux.h b/source/Irrlicht/CIrrDeviceLinux.h
index 4d2a2c6..8cf24ba 100644
--- a/source/Irrlicht/CIrrDeviceLinux.h
+++ b/source/Irrlicht/CIrrDeviceLinux.h
@@ -22,7 +22,7 @@
 #define GLX_GLXEXT_LEGACY 1
 #include <GL/glx.h>
 #ifdef _IRR_OPENGL_USE_EXTPOINTER_
-#include "glxext.h"
+#include <GL/glxext.h>
 #endif
 #endif

diff --git a/source/Irrlicht/COpenGLExtensionHandler.h b/source/Irrlicht/COpenGLExtensionHandler.h
index 1b77bad..3886a0e 100644
--- a/source/Irrlicht/COpenGLExtensionHandler.h
+++ b/source/Irrlicht/COpenGLExtensionHandler.h
@@ -35,7 +35,7 @@
 	#endif
 	#include <OpenGL/gl.h>
 	#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
-		#include "glext.h"
+		#include <GL/glext.h>
 	#endif
 #elif defined(_IRR_COMPILE_WITH_SDL_DEVICE_) && !defined(_IRR_COMPILE_WITH_X11_DEVICE_)
 	#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
@@ -48,7 +48,7 @@
 	#define NO_SDL_GLEXT
 	#include <SDL/SDL_video.h>
 	#include <SDL/SDL_opengl.h>
-	#include "glext.h"
+	#include <GL/glext.h>
 #else
 	#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
 		#define GL_GLEXT_LEGACY 1
@@ -60,9 +60,9 @@
 	#include <GL/gl.h>
 	#include <GL/glx.h>
 	#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
-	#include "glext.h"
+	#include <GL/glext.h>
 	#undef GLX_ARB_get_proc_address // avoid problems with local glxext.h
-	#include "glxext.h"
+	#include <GL/glxext.h>
 	#endif
 #endif

diff --git a/source/Irrlicht/COpenGLSLMaterialRenderer.h b/source/Irrlicht/COpenGLSLMaterialRenderer.h
index ff71150..f8a6007 100644
--- a/source/Irrlicht/COpenGLSLMaterialRenderer.h
+++ b/source/Irrlicht/COpenGLSLMaterialRenderer.h
@@ -25,7 +25,7 @@
 	#include <GL/gl.h>
 #endif
 #if defined(_IRR_OPENGL_USE_EXTPOINTER_)
-	#include "glext.h"
+	#include <GL/glext.h>
 #endif
 #endif

diff --git a/source/Irrlicht/Makefile b/source/Irrlicht/Makefile
index 67a3899..d9ea7f3 100644
--- a/source/Irrlicht/Makefile
+++ b/source/Irrlicht/Makefile
@@ -43,7 +43,7 @@ IRRIMAGEOBJ = CColorConverter.o CImage.o CImageLoaderBMP.o CImageLoaderDDS.o CIm
 	CImageWriterBMP.o CImageWriterJPG.o CImageWriterPCX.o CImageWriterPNG.o CImageWriterPPM.o CImageWriterPSD.o CImageWriterTGA.o
 IRRVIDEOOBJ = CVideoModeList.o CFPSCounter.o $(IRRDRVROBJ) $(IRRIMAGEOBJ)
 IRRSWRENDEROBJ = CSoftwareDriver.o CSoftwareTexture.o CTRFlat.o CTRFlatWire.o CTRGouraud.o CTRGouraudWire.o CTRNormalMap.o CTRStencilShadow.o CTRTextureFlat.o CTRTextureFlatWire.o CTRTextureGouraud.o CTRTextureGouraudAdd.o CTRTextureGouraudNoZ.o CTRTextureGouraudWire.o CZBuffer.o CTRTextureGouraudVertexAlpha2.o CTRTextureGouraudNoZ2.o CTRTextureLightMap2_M2.o CTRTextureLightMap2_M4.o CTRTextureLightMap2_M1.o CSoftwareDriver2.o CSoftwareTexture2.o CTRTextureGouraud2.o CTRGouraud2.o CTRGouraudAlpha2.o CTRGouraudAlphaNoZ2.o CTRTextureDetailMap2.o CTRTextureGouraudAdd2.o CTRTextureGouraudAddNoZ2.o CTRTextureWire2.o CTRTextureLightMap2_Add.o CTRTextureLightMapGouraud2_M4.o IBurningShader.o CTRTextureBlend.o CTRTextureGouraudAlpha.o CTRTextureGouraudAlphaNoZ.o CDepthBuffer.o CBurningShader_Raster_Reference.o
-IRRIOOBJ = CFileList.o CFileSystem.o CLimitReadFile.o CMemoryFile.o CReadFile.o CWriteFile.o CXMLReader.o CXMLWriter.o CWADReader.o CZipReader.o CPakReader.o CNPKReader.o CTarReader.o CMountPointReader.o irrXML.o CAttributes.o lzma/LzmaDec.o
+IRRIOOBJ = CFileList.o CFileSystem.o CLimitReadFile.o CMemoryFile.o CReadFile.o CWriteFile.o CXMLReader.o CXMLWriter.o CWADReader.o CZipReader.o CPakReader.o CNPKReader.o CTarReader.o CMountPointReader.o irrXML.o CAttributes.o
 IRROTHEROBJ = CIrrDeviceSDL.o CIrrDeviceLinux.o CIrrDeviceConsole.o CIrrDeviceStub.o CIrrDeviceWin32.o CIrrDeviceFB.o CLogger.o COSOperator.o Irrlicht.o os.o
 IRRGUIOBJ = CGUIButton.o CGUICheckBox.o CGUIComboBox.o CGUIContextMenu.o CGUIEditBox.o CGUIEnvironment.o CGUIFileOpenDialog.o CGUIFont.o CGUIImage.o CGUIInOutFader.o CGUIListBox.o CGUIMenu.o CGUIMeshViewer.o CGUIMessageBox.o CGUIModalScreen.o CGUIScrollBar.o CGUISpinBox.o CGUISkin.o CGUIStaticText.o CGUITabControl.o CGUITable.o CGUIToolBar.o CGUIWindow.o CGUIColorSelectDialog.o CDefaultGUIElementFactory.o CGUISpriteBank.o CGUIImageList.o CGUITreeView.o
 ZLIBOBJ = zlib/adler32.o zlib/compress.o zlib/crc32.o zlib/deflate.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/trees.o zlib/uncompr.o zlib/zutil.o
@@ -56,14 +56,14 @@ BZIP2OBJ = bzip2/blocksort.o bzip2/huffman.o bzip2/crctable.o bzip2/randtable.o
 EXTRAOBJ =
 LINKOBJ = $(IRRMESHOBJ) $(IRROBJ) $(IRRPARTICLEOBJ) $(IRRANIMOBJ) \
 	$(IRRVIDEOOBJ) $(IRRSWRENDEROBJ) $(IRRIOOBJ) $(IRROTHEROBJ) \
-	$(IRRGUIOBJ) $(ZLIBOBJ) $(JPEGLIBOBJ) $(LIBPNGOBJ) $(LIBAESGM) \
-	$(BZIP2OBJ) $(EXTRAOBJ)
+	$(IRRGUIOBJ) $(LIBAESGM) \
+	$(EXTRAOBJ)

 ###############
 #Compiler flags
-CXXINCS = -I../../include -Izlib -Ijpeglib -Ilibpng
+CXXINCS = -I../../include # -Izlib -Ijpeglib -Ilibpng
 CPPFLAGS += $(CXXINCS) -DIRRLICHT_EXPORTS=1
-CXXFLAGS += -Wall -pipe -fno-exceptions -fno-rtti -fstrict-aliasing
+CXXFLAGS += -Wall -pipe -fno-exceptions -fstrict-aliasing
 ifndef NDEBUG
 CXXFLAGS += -g -D_DEBUG
 else
@@ -88,7 +88,7 @@ STATIC_LIB = libIrrlicht.a
 LIB_PATH = ../../lib/$(SYSTEM)
 INSTALL_DIR = /usr/local/lib
 sharedlib install: SHARED_LIB = libIrrlicht.so
-sharedlib: LDFLAGS += -L/usr/X11R6/lib$(LIBSELECT) -lGL -lXxf86vm
+staticlib sharedlib: LDFLAGS += -L/usr/X11R6/lib$(LIBSELECT) -lGL -lXxf86vm -lX11 -lz -lpng -ljpeg -lbz2
 staticlib sharedlib: CXXINCS += -I/usr/X11R6/include

 #OSX specific options
@@ -153,7 +153,8 @@ install install_osx:
 	$(RM) -r $(INSTALL_DIR)/../include/irrlicht
 	mkdir -p $(INSTALL_DIR)/../include/irrlicht
 	cp ../../include/*.h $(INSTALL_DIR)/../include/irrlicht/
-	cp $(LIB_PATH)/$(SHARED_FULLNAME) $(INSTALL_DIR)
+	cp $(LIB_PATH)/$(SHARED_FULLNAME) $(INSTALL_DIR) || true
+	cp $(LIB_PATH)/$(STATIC_LIB) $(INSTALL_DIR) || true
 	cd $(INSTALL_DIR) && ln -s -f $(SHARED_FULLNAME) $(SONAME)
 	cd $(INSTALL_DIR) && ln -s -f $(SONAME) $(SHARED_LIB)
 #	ldconfig -n $(INSTALL_DIR)
--
2.18.0


code:
Add aarch64 support to config.guess and config.sub, as would be found if using
a more recent version of autoconf.
---
 config.guess          |    7 +++++++
 config.sub            |    1 +
 2 files changed, 8 insertions(+)

diff --git a/config.guess b/config.guess
index 40eaed4..baad294 100755
--- a/config.guess
+++ b/config.guess
@@ -861,6 +861,13 @@ EOF
     i*86:Minix:*:*)
 	echo ${UNAME_MACHINE}-pc-minix
 	exit ;;
+    aarch64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    aarch64_be:Linux:*:*)
+	UNAME_MACHINE=aarch64_be
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
     alpha:Linux:*:*)
 	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
 	  EV5)   UNAME_MACHINE=alphaev5 ;;
diff --git a/config.sub b/config.sub
index 30fdca8..8f5b018 100755
--- a/config.sub
+++ b/config.sub
@@ -247,6 +247,7 @@ case $basic_machine in
 	# Some are omitted here because they have special meanings below.
 	1750a | 580 \
 	| a29k \
+	| aarch64 | aarch64_be \
 	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
 	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
 	| am33_2.0 \
--
2.9.0


code:
Fix the broken Texinfo in the Jacal package documentation

--- jacal/jacal.texi,orig	2017-02-23 20:35:55.303980444 +0100
+++ jacal/jacal.texi	2017-02-23 20:53:14.539024674 +0100
@@ -343,7 +343,7 @@

 With the standard input grammar, the precedence of @samp{-} as a prefix
 behaves strangely.  @code{a^-b*c} becomes @code{a^(-b*c)} while
-@code{@result{a^b*c} (a^b)*c}.
+@code{a^b*c @result{} (a^b)*c}.

 Using @code{divide} to divide a polynomial by an integer does not work.

@@ -675,8 +675,9 @@
 e1: ---------
         a
 @end example
+@end deffn

-@deffnx Command suchthat var exp
+@deffn Command suchthat var exp

 If an expression rather than an equation is given to @code{suchthat}, it
 is as though the equation @code{@var{exp}=0} was given.
@@ -688,8 +689,9 @@
 e2: ---------
         a
 @end example
+@end deffn

-@deffnx Operator | var exp_or_eqn
+@deffn Operator | var exp_or_eqn

 An alternative infix notation is also available for @code{suchthat}.

@@ -857,8 +859,9 @@

 Returns the degree of polynomial or equation @var{poly} in variable
 @var{var}.
+@end deffn

-@deffnx Operator degree poly
+@deffn Operator degree poly

 Returns the total-degree, the degree of its highest degree monomial,
 of polynomial or equation @var{poly}.
@@ -1016,10 +1019,12 @@
 Returns @var{poly1} reduced with respect to @var{poly2} (or @var{eqn})
 and @var{var}.  If @var{poly2} is univariate, the third argument is not
 needed.
+@end deffn

-@deffnx Command mod poly1 n
+@deffn Command mod poly1 n
 Returns @var{poly1} with all the coefficients taken modulo @var{n}.
-@deffnx Command mod poly1
+@end deffn
+@deffn Command mod poly1
 Returns @var{poly1} with all the coefficients taken modulo the
 current modulus.

@@ -1220,8 +1225,9 @@
 e1: -1 2  3 5
 @end group
 @end example
+@end deffn

-@deffnx Command factor polyratio
+@deffn Command factor polyratio
 Given a univariate ratio of polynomials @var{polyratio}, returns a
 matrix of factors and exponents.

@@ -2028,7 +2034,7 @@
 formed from the pair-wise products of components of the inputs.  For
 example, for the input tensors @code{x[a,b]} and @code{y[c]}
 @example
-@result{z:tmult(x,y);} z[a,b,c] = x[a,b]*y[c]
+z:tmult(x,y); @result{} z[a,b,c] = x[a,b]*y[c]
 @end example

 With an additional argument, @code{tmult} will produce the inner product
@@ -2464,8 +2470,9 @@
 If you do not wish to return to Jacal but really want to terminate the
 session and return to the operating system, then after typing
 @code{qed();}, type @code{(slib:exit)} or use @code{quit}.
+@end deffn

-@deffnx Command quit
+@deffn Command quit
 Exit directly from Jacal to the operating system.  You will not be able
 to continue your Jacal session.