code:
Support compiling on the Hurd.

Taken from https://git.hadrons.org/cgit/debian/pkgs/inetutils.git/tree/debian/patches/0002-ifconfig-Improve-the-support-for-GNU-Hurd.patch

From 9a90d9b9119906df23cb2db1503cb0f099942dd9 Mon Sep 17 00:00:00 2001
From: Mats Erik Andersson <gnu@gisladisker.se>
Date: Sat, 18 Jul 2015 01:12:41 +0200
Subject: [PATCH 02/35] ifconfig: Improve the support for GNU/Hurd.

Use system specific code instead of generic code.
This provides abilities similar to other systems.
---
 ChangeLog                   |  17 +++
 ifconfig/system.c           |  10 +-
 ifconfig/system.h           |   2 +
 ifconfig/system/Makefile.am |   4 +-
 ifconfig/system/generic.c   |  14 +-
 ifconfig/system/hurd.c      | 292 ++++++++++++++++++++++++++++++++++++
 ifconfig/system/hurd.h      |  50 ++++++
 7 files changed, 381 insertions(+), 8 deletions(-)
 create mode 100644 ifconfig/system/hurd.c
 create mode 100644 ifconfig/system/hurd.h

diff --git a/ifconfig/system.c b/ifconfig/system.c
index 30677e41..e108dc2e 100644
--- a/ifconfig/system.c
+++ b/ifconfig/system.c
@@ -25,10 +25,12 @@
 # include "system/solaris.c"
 #elif defined __QNX__
 # include "system/qnx.c"
-# elif defined __DragonFly__ || defined __FreeBSD__ || \
-       defined __FreeBSD_kernel__ || \
-       defined __NetBSD__ || defined __OpenBSD__
-#  include "system/bsd.c"
+#elif defined __DragonFly__ || defined __FreeBSD__ || \
+      defined __FreeBSD_kernel__ || \
+      defined __NetBSD__ || defined __OpenBSD__
+# include "system/bsd.c"
+#elif defined __GNU__
+# include "system/hurd.c"
 #else
 # include "system/generic.c"
 #endif
diff --git a/ifconfig/system.h b/ifconfig/system.h
index 8521ad95..66878d3a 100644
--- a/ifconfig/system.h
+++ b/ifconfig/system.h
@@ -97,6 +97,8 @@ extern struct if_nameindex* (*system_if_nameindex) (void);
        defined __FreeBSD_kernel__ || \
        defined __NetBSD__ || defined __OpenBSD__
 #  include "system/bsd.h"
+# elif defined __GNU__
+#  include "system/hurd.h"
 # else
 #  include "system/generic.h"
 # endif
diff --git a/ifconfig/system/Makefile.am b/ifconfig/system/Makefile.am
index 954c6774..62a9f1c4 100644
--- a/ifconfig/system/Makefile.am
+++ b/ifconfig/system/Makefile.am
@@ -26,8 +26,10 @@ noinst_HEADERS = \
 	linux.h \
 	solaris.h \
 	qnx.h \
+	hurd.h \
 	bsd.c \
 	generic.c \
 	linux.c \
 	solaris.c \
-	qnx.c
+	qnx.c \
+	hurd.c
diff --git a/ifconfig/system/generic.c b/ifconfig/system/generic.c
index 9a2bda55..20a78bde 100644
--- a/ifconfig/system/generic.c
+++ b/ifconfig/system/generic.c
@@ -22,6 +22,8 @@
 #include <config.h>

 #include "../ifconfig.h"
+
+#include <unused-parameter.h>

 /* Output format stuff.  */
@@ -36,19 +38,25 @@ const char *system_help;
 struct argp_child system_argp_child;

 int
-system_parse_opt (struct ifconfig **ifp, char option, char *optarg)
+system_parse_opt (struct ifconfig **ifp _GL_UNUSED_PARAMETER,
+		  char option _GL_UNUSED_PARAMETER,
+		  char *optarg _GL_UNUSED_PARAMETER)
 {
   return 0;
 }

 int
-system_parse_opt_rest (struct ifconfig **ifp, int argc, char *argv[])
+system_parse_opt_rest (struct ifconfig **ifp _GL_UNUSED_PARAMETER,
+		       int argc _GL_UNUSED_PARAMETER,
+		       char *argv[] _GL_UNUSED_PARAMETER)
 {
   return 0;
 }

 int
-system_configure (int sfd, struct ifreq *ifr, struct system_ifconfig *ifs)
+system_configure (int sfd _GL_UNUSED_PARAMETER,
+		  struct ifreq *ifr _GL_UNUSED_PARAMETER,
+		  struct system_ifconfig *ifs _GL_UNUSED_PARAMETER)
 {
   return 0;
 }
diff --git a/ifconfig/system/hurd.c b/ifconfig/system/hurd.c
new file mode 100644
index 00000000..3bd19775
--- /dev/null
+++ b/ifconfig/system/hurd.c
@@ -0,0 +1,292 @@
+/* hurd.c -- Code for ifconfig specific to GNU/Hurd.
+  Copyright (C) 2015 Free Software Foundation, Inc.
+
+  This file is part of GNU Inetutils.
+
+  GNU Inetutils is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or (at
+  your option) any later version.
+
+  GNU Inetutils is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see `http://www.gnu.org/licenses/'. */
+
+/* Mostly written by Marcus Brinkmann.
+   Adaptions to GNU/Hurd by Mats Erik Andersson.  */
+
+#include <config.h>
+
+#include <stdlib.h>
+#include <sys/ioctl.h>
+#include <net/if_arp.h>
+#include "../ifconfig.h"
+
+#include <unused-parameter.h>
+
+
+/* Output format stuff.  */
+
+const char *system_default_format = "gnu";
+
+
+/* Argument parsing stuff.  */
+
+const char *system_help = "NAME [ADDR]\
+ [broadcast BRDADDR] [netmask MASK]\
+ [mtu N] [up|down] [FLAGS]";
+
+struct argp_child system_argp_child;
+
+int
+system_parse_opt (struct ifconfig **ifp _GL_UNUSED_PARAMETER,
+		  char option _GL_UNUSED_PARAMETER,
+		  char *optarg _GL_UNUSED_PARAMETER)
+{
+  return 0;
+}
+
+int
+system_parse_opt_rest (struct ifconfig **ifp, int argc, char *argv[])
+{
+  int i = 0, mask, rev;
+  enum {
+    EXPECT_NOTHING,
+    EXPECT_AF,
+    EXPECT_BROADCAST,
+    EXPECT_NETMASK,
+    EXPECT_METRIC,
+    EXPECT_MTU
+  } expect = EXPECT_AF;
+
+  *ifp = parse_opt_new_ifs (argv[0]);
+
+  while (++i < argc)
+    {
+      switch (expect)
+	{
+	case EXPECT_BROADCAST:
+	  parse_opt_set_brdaddr (*ifp, argv[i]);
+	  break;
+
+	case EXPECT_NETMASK:
+	  parse_opt_set_netmask (*ifp, argv[i]);
+	  break;
+
+	case EXPECT_MTU:
+	  parse_opt_set_mtu (*ifp, argv[i]);
+	  break;
+
+	/* XXX: 2015-07-18, GNU/Hurd does not yet support
+		ioctl(SIOCSIFMETRIC), but we let the code
+		handle this standard ability anyway!
+	 */
+	case EXPECT_METRIC:
+	  parse_opt_set_metric (*ifp, argv[i]);
+	  break;
+
+	case EXPECT_AF:
+	  expect = EXPECT_NOTHING;
+	  if (!strcmp (argv[i], "inet"))
+	    continue;
+	  else if (!strcmp (argv[i], "inet6"))
+	    {
+	      error (0, 0, "%s is not a supported address family", argv[i]);
+	      return 0;
+	    }
+	  break;
+
+	case EXPECT_NOTHING:
+	  break;
+	}
+
+      if (expect != EXPECT_NOTHING)
+	expect = EXPECT_NOTHING;
+      else if (!strcmp (argv[i], "broadcast"))
+	expect = EXPECT_BROADCAST;
+      else if (!strcmp (argv[i], "netmask"))
+	expect = EXPECT_NETMASK;
+      else if (!strcmp (argv[i], "metric"))
+	expect = EXPECT_METRIC;
+      else if (!strcmp (argv[i], "mtu"))
+	expect = EXPECT_MTU;
+      else if (!strcmp (argv[i], "up"))
+	parse_opt_set_flag (*ifp, IFF_UP | IFF_RUNNING, 0);
+      else if (!strcmp (argv[i], "down"))
+	parse_opt_set_flag (*ifp, IFF_UP, 1);
+      else if (((mask = if_nameztoflag (argv[i], &rev))
+		& ~IU_IFF_CANTCHANGE) != 0)
+	parse_opt_set_flag (*ifp, mask, rev);
+      else
+	{
+	  if (!((*ifp)->valid & IF_VALID_ADDR))
+	    parse_opt_set_address (*ifp, argv[i]);
+	  else if (!((*ifp)->valid & IF_VALID_DSTADDR))
+	    parse_opt_set_dstaddr (*ifp, argv[i]);
+	}
+    }
+
+  switch (expect)
+    {
+    case EXPECT_BROADCAST:
+      error (0, 0, "option `broadcast' requires an argument");
+      break;
+
+    case EXPECT_NETMASK:
+      error (0, 0, "option `netmask' requires an argument");
+      break;
+
+    case EXPECT_METRIC:
+      error (0, 0, "option `metric' requires an argument");
+      break;
+
+    case EXPECT_MTU:
+      error (0, 0, "option `mtu' requires an argument");
+      break;
+
+    case EXPECT_AF:
+    case EXPECT_NOTHING:
+      return 1;
+    }
+
+  return 0;
+}
+
+int
+system_configure (int sfd _GL_UNUSED_PARAMETER,
+		  struct ifreq *ifr _GL_UNUSED_PARAMETER,
+		  struct system_ifconfig *ifs _GL_UNUSED_PARAMETER)
+{
+  return 0;
+}
+
+struct if_nameindex* (*system_if_nameindex) (void) = if_nameindex;
+
+static void
+print_hwaddr_ether (format_data_t form _GL_UNUSED_PARAMETER,
+		    unsigned char *data)
+{
+  *column += printf ("%02X:%02X:%02X:%02X:%02X:%02X",
+		     data[0], data[1], data[2], data[3], data[4], data[5]);
+  had_output = 1;
+}
+
+struct arphrd_symbol
+{
+  const char *name;
+  const char *title;
+  int value;
+  void (*print_hwaddr) (format_data_t form, unsigned char *data);
+} arphrd_symbols[] =
+  {
+#ifdef ARPHRD_ETHER		/* Ethernet 10/100Mbps.  */
+    { "ETHER", "Ethernet", ARPHRD_ETHER, print_hwaddr_ether},
+#endif
+#ifdef ARPHRD_LOOPBACK		/* Loopback device.  */
+    { "LOOPBACK", "Local Loopback", ARPHRD_LOOPBACK, NULL},
+#endif
+    /* XXX: The image debian-hurd-20150424 returns the value 4
+	    instead of expected ARPHRD_LOOPBACK.  This has been
+	    discussed in the list debian-hurd, where I was asked
+	    to resist the temptation of a work around!
+     */
+    { NULL, NULL, 0, NULL}
+  };
+
+struct arphrd_symbol *
+arphrd_findvalue (int value)
+{
+  struct arphrd_symbol *arp = arphrd_symbols;
+  while (arp->name != NULL)
+    {
+      if (arp->value == value)
+	break;
+      arp++;
+    }
+  if (arp->name)
+    return arp;
+  else
+    return NULL;
+}
+
+void
+system_fh_hwaddr_query (format_data_t form, int argc, char *argv[])
+{
+#ifdef SIOCGIFHWADDR
+  struct arphrd_symbol *arp;
+
+  if (ioctl (form->sfd, SIOCGIFHWADDR, form->ifr) < 0)
+    select_arg (form, argc, argv, 1);
+
+  arp = arphrd_findvalue (form->ifr->ifr_hwaddr.sa_family);
+  select_arg (form, argc, argv, (arp && arp->print_hwaddr) ? 0 : 1);
+#else
+  select_arg (form, argc, argv, 1);
+#endif
+}
+
+void
+system_fh_hwaddr (format_data_t form, int argc _GL_UNUSED_PARAMETER,
+		  char *argv[] _GL_UNUSED_PARAMETER)
+{
+#ifdef SIOCGIFHWADDR
+  if (ioctl (form->sfd, SIOCGIFHWADDR, form->ifr) < 0)
+    error (EXIT_FAILURE, errno,
+	   "SIOCGIFHWADDR failed for interface `%s'",
+	   form->ifr->ifr_name);
+  else
+    {
+      struct arphrd_symbol *arp;
+
+      arp = arphrd_findvalue (form->ifr->ifr_hwaddr.sa_family);
+      if (arp && arp->print_hwaddr)
+	arp->print_hwaddr (form,
+			   (unsigned char *) form->ifr->ifr_hwaddr.sa_data);
+      else
+	put_string (form, "(hwaddr unknown)");
+    }
+#else
+  *column += printf ("(not available)");
+  had_output = 1;
+#endif
+}
+
+void
+system_fh_hwtype_query (format_data_t form, int argc, char *argv[])
+{
+#ifdef SIOCGIFHWADDR
+  if (ioctl (form->sfd, SIOCGIFHWADDR, form->ifr) >= 0)
+    select_arg (form, argc, argv, 0);
+  else
+#endif
+    select_arg (form, argc, argv, 1);
+}
+
+void
+system_fh_hwtype (format_data_t form, int argc _GL_UNUSED_PARAMETER,
+		  char *argv[] _GL_UNUSED_PARAMETER)
+{
+#ifdef SIOCGIFHWADDR
+  if (ioctl (form->sfd, SIOCGIFHWADDR, form->ifr) < 0)
+    error (EXIT_FAILURE, errno,
+	   "SIOCGIFHWADDR failed for interface `%s'",
+	   form->ifr->ifr_name);
+  else
+    {
+      struct arphrd_symbol *arp;
+
+      arp = arphrd_findvalue (form->ifr->ifr_hwaddr.sa_family);
+      if (arp)
+	put_string (form, arp->title);
+      else
+	put_string (form, "(hwtype unknown)");
+    }
+#else
+  *column += printf ("(not available)");
+  had_output = 1;
+#endif
+}
diff --git a/ifconfig/system/hurd.h b/ifconfig/system/hurd.h
new file mode 100644
index 00000000..bab14565
--- /dev/null
+++ b/ifconfig/system/hurd.h
@@ -0,0 +1,50 @@
+/*
+  Copyright (C) 2015 Free Software Foundation, Inc.
+
+  This file is part of GNU Inetutils.
+
+  GNU Inetutils is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or (at
+  your option) any later version.
+
+  GNU Inetutils is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see `http://www.gnu.org/licenses/'. */
+
+/* Written by Mats Erik Andersson.  */
+
+#ifndef IFCONFIG_SYSTEM_HURD_H
+# define IFCONFIG_SYSTEM_HURD_H
+
+# include "../printif.h"
+# include "../options.h"
+
+
+/* Option support.  */
+
+struct system_ifconfig
+{
+  int valid;
+};
+
+
+/* Output format support.  */
+
+# define SYSTEM_FORMAT_HANDLER \
+  { "hurd", fh_nothing}, \
+  { "hwaddr?", system_fh_hwaddr_query}, \
+  { "hwaddr", system_fh_hwaddr}, \
+  { "hwtype?", system_fh_hwtype_query}, \
+  { "hwtype", system_fh_hwtype},
+
+void system_fh_hwaddr_query (format_data_t form, int argc, char *argv[]);
+void system_fh_hwaddr (format_data_t form, int argc, char *argv[]);
+void system_fh_hwtype_query (format_data_t form, int argc, char *argv[]);
+void system_fh_hwtype (format_data_t form, int argc, char *argv[]);
+
+#endif /* !IFCONFIG_SYSTEM_HURD_H */
--
2.23.0.rc1.170.gbd704faa3e

From 589dab9c7d3119da82837dabae34c8a3d16cbe49 Mon Sep 17 00:00:00 2001
From: Mats Erik Andersson <gnu@gisladisker.se>
Date: Thu, 30 Jul 2015 01:06:42 +0200
Subject: [PATCH 07/35] ifconfig: Hardware detection in GNU/Hurd.

A work-around needed to distinguish hardware type.
---
 ChangeLog              | 10 ++++++++++
 ifconfig/system/hurd.c | 19 ++++++++++++-------
 2 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/ifconfig/system/hurd.c b/ifconfig/system/hurd.c
index 3bd19775..b6261a00 100644
--- a/ifconfig/system/hurd.c
+++ b/ifconfig/system/hurd.c
@@ -175,6 +175,16 @@ print_hwaddr_ether (format_data_t form _GL_UNUSED_PARAMETER,
   had_output = 1;
 }

+/* GNU/Hurd and Mach are using a mixture of BSD definitions
+ * and GNU/Linux interface headers, which in this situation
+ * means that sa_family_t is an unsigned char, from BSD, while
+ * all ARPHRD_* come from GNU/Linux and are thus 16 bits wide.
+ * We must account for this.  The following bitmask will
+ * adapt to any future change!
+ */
+
+#define _ARP_MASK ((sizeof (sa_family_t) == 1) ? 0xff : 0xffff)
+
 struct arphrd_symbol
 {
   const char *name;
@@ -184,16 +194,11 @@ struct arphrd_symbol
 } arphrd_symbols[] =
   {
 #ifdef ARPHRD_ETHER		/* Ethernet 10/100Mbps.  */
-    { "ETHER", "Ethernet", ARPHRD_ETHER, print_hwaddr_ether},
+    { "ETHER", "Ethernet", ARPHRD_ETHER & _ARP_MASK, print_hwaddr_ether},
 #endif
 #ifdef ARPHRD_LOOPBACK		/* Loopback device.  */
-    { "LOOPBACK", "Local Loopback", ARPHRD_LOOPBACK, NULL},
+    { "LOOPBACK", "Local Loopback", ARPHRD_LOOPBACK & _ARP_MASK, NULL},
 #endif
-    /* XXX: The image debian-hurd-20150424 returns the value 4
-	    instead of expected ARPHRD_LOOPBACK.  This has been
-	    discussed in the list debian-hurd, where I was asked
-	    to resist the temptation of a work around!
-     */
     { NULL, NULL, 0, NULL}
   };

--
2.23.0.rc1.170.gbd704faa3e

From d379784b4461d17b2536effd1b52bae21cd28a32 Mon Sep 17 00:00:00 2001
From: Guillem Jover <guillem@hadrons.org>
Date: Fri, 16 Aug 2019 00:34:03 +0200
Subject: [PATCH 35/35] telnet: Several ioctls have been disabled in the Hurd's
 glibc

But not the related option macros. inetutils uses those macros to decide
whether the ioctls are available, so it is FTBFS now. The Hurd's glibc
is being fixed, but we'll use this for now to get the builds going.
---
 telnet/sys_bsd.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/telnet/sys_bsd.c b/telnet/sys_bsd.c
index 662536ab..5eb35cb5 100644
--- a/telnet/sys_bsd.c
+++ b/telnet/sys_bsd.c
@@ -63,6 +63,7 @@
 #include <errno.h>
 #include <arpa/telnet.h>
 #include <sys/select.h>
+#include <sys/ioctl.h>
 #include <unused-parameter.h>

 #include "ring.h"
@@ -157,7 +158,7 @@ TerminalRead (char *buf, int n)
 int
 TerminalAutoFlush (void)
 {
-#if defined LNOFLSH
+#if defined TIOCLGET && defined LNOFLSH
   int flush;

   ioctl (0, TIOCLGET, (char *) &flush);
@@ -260,7 +261,9 @@ TerminalSaveState (void)
   ioctl (0, TIOCGETP, (char *) &ottyb);
   ioctl (0, TIOCGETC, (char *) &otc);
   ioctl (0, TIOCGLTC, (char *) &oltc);
+#ifdef TIOCLGET
   ioctl (0, TIOCLGET, (char *) &olmode);
+#endif

   ntc = otc;
   nltc = oltc;
@@ -755,7 +758,9 @@ TerminalNewMode (register int f)
 #endif
     }
 #ifndef USE_TERMIO
+#ifdef TIOCLSET
   ioctl (tin, TIOCLSET, (char *) &lmode);
+#endif
   ioctl (tin, TIOCSLTC, (char *) &ltc);
   ioctl (tin, TIOCSETC, (char *) &tc);
   ioctl (tin, TIOCSETN, (char *) &sb);
--
2.23.0.rc1.170.gbd704faa3e


code:
From 0ae15d7e89b984f72780ff7afa8e57dd6ae7765a Mon Sep 17 00:00:00 2001
From: "Boris A. Dekshteyn" <boris.dekshteyn@gmail.com>
Date: Mon, 14 Jun 2021 23:52:16 +1200
Subject: [PATCH] Fix build witch GCC@7.5.

---
 src/object/sp-use-reference.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/object/sp-use-reference.h b/src/object/sp-use-reference.h
index 5958632059..f07c2a3721 100644
--- a/src/object/sp-use-reference.h
+++ b/src/object/sp-use-reference.h
@@ -14,6 +14,7 @@

 #include "sp-item.h"
 #include "uri-references.h"
+#include "display/curve.h"

 #include <memory>

--
2.32.0

repo_name: maximed/guix

license: mit


code:
This patch adds support for Poppler 0.76 and later.

Taken from upstream:
<https://gitlab.com/inkscape/inkscape/commit/e831b034746f8dc3c3c1b88372751f6dcb974831>

diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp
index 8484984bdf..4f798e35bf 100644
--- a/src/extension/internal/pdfinput/pdf-parser.cpp
+++ b/src/extension/internal/pdfinput/pdf-parser.cpp
@@ -421,7 +421,7 @@ void PdfParser::parse(Object *obj, GBool topLevel) {
 	error(errInternal, -1, "Weird page contents");
     	return;
   }
-  parser = new Parser(xref, new Lexer(xref, obj), gFalse);
+  parser = new _POPPLER_NEW_PARSER(xref, obj);
   go(topLevel);
   delete parser;
   parser = nullptr;
diff --git a/src/extension/internal/pdfinput/poppler-transition-api.h b/src/extension/internal/pdfinput/poppler-transition-api.h
index 61a15083a0..5e8bc4ae90 100644
--- a/src/extension/internal/pdfinput/poppler-transition-api.h
+++ b/src/extension/internal/pdfinput/poppler-transition-api.h
@@ -14,6 +14,13 @@

 #include <glib/poppler-features.h>

+#if POPPLER_CHECK_VERSION(0, 76, 0)
+#define _POPPLER_NEW_PARSER(xref, obj) Parser(xref, obj, gFalse)
+#else
+#define _POPPLER_NEW_PARSER(xref, obj) Parser(xref, new Lexer(xref, obj), gFalse)
+#endif
+
+
 #if POPPLER_CHECK_VERSION(0, 72, 0)
 #define getCString c_str
 #endif


code:
This patch removes sources of build non-determinism in the upstream sources.

In particular, many of the compiled sources are generated with Python code,
which in turn uses dictionaries to index the output C functions.  However,
iterators over Python dictionaries have no guaranteed order, thus resulting in
the C functions being output in a random order between builds.

The patch below fixes this by forcing an order during output in several key
places.  Note, however, that future updates may uncover new such places that
just happen to be non-problematic at the time of this patch.  If you are
reading this due to finding such issues, feel free to contact me at
elaexuotee@wilsonb.com for help.

diff --git a/pysrc/ild_codegen.py b/pysrc/ild_codegen.py
index 628ec45..a9bff79 100755
--- a/pysrc/ild_codegen.py
+++ b/pysrc/ild_codegen.py
@@ -188,14 +188,14 @@ def gen_l2_func_list(agi, target_nt_dict, arg_nt_dict,
                      ild_t_member):
     """generate L2 functions"""
     l2_func_list = []
-    for (nt_name,array) in target_nt_dict.items():
+    for (nt_name,array) in sorted(target_nt_dict.items()):
         target_opname = array.get_target_opname()
         if array.is_const_lookup_fun():
             fo = gen_const_l2_function(agi, nt_name,
                                 target_opname, ild_t_member)
             l2_func_list.append(fo)
         else:
-            for arg_nt_seq,arg_arr in arg_nt_dict.items():
+            for arg_nt_seq,arg_arr in sorted(arg_nt_dict.items()):
                 fo = gen_scalable_l2_function(agi, nt_name,
                      target_opname, ild_t_member, arg_arr, list(arg_nt_seq))
                 l2_func_list.append(fo)
diff --git a/pysrc/ild_disp.py b/pysrc/ild_disp.py
index 942c036..cf80e29 100755
--- a/pysrc/ild_disp.py
+++ b/pysrc/ild_disp.py
@@ -350,7 +350,8 @@ def work(agi, united_lookup,  disp_nts, brdisp_nts, ild_gendir,
     disp_dict = _gen_l3_array_dict(agi, disp_nts, _disp_token)

-    nt_arr_list = list(brdisp_dict.values()) + list(disp_dict.values())
+    nt_arr_list = ([v for (k,v) in sorted(brdisp_dict.items())] +
+                   [v for (k,v) in sorted(disp_dict.items())])
     #create function that calls all initialization functions
     init_f = ild_nt.gen_init_function(nt_arr_list, 'xed_ild_disp_l3_init')

@@ -367,7 +368,7 @@ def work(agi, united_lookup,  disp_nts, brdisp_nts, ild_gendir,
     l2_functions = []
     eosz_op = ild_eosz.get_target_opname()
     easz_op = ild_easz.get_target_opname()
-    for nt_name,array in list(disp_dict.items()) + list(brdisp_dict.items()):
+    for nt_name,array in sorted(disp_dict.items()) + sorted(brdisp_dict.items()):
         #Some DISP NTs depend on EOSZ, others on EASZ, we need to know
         #that when we generate L2 functions
         if eosz_op in array.get_arg_names():
diff --git a/pysrc/ild_easz.py b/pysrc/ild_easz.py
index 02cd691..c53b9f2 100755
--- a/pysrc/ild_easz.py
+++ b/pysrc/ild_easz.py
@@ -165,9 +165,10 @@ def work(agi, united_lookup, easz_nts, ild_gendir, debug):
             return
         nt_seq_arrays[tuple(nt_seq)] = array
     #init function calls all single init functions for the created tables
-    init_f = ild_nt.gen_init_function(list(nt_seq_arrays.values()),
+    nt_seq_values = [v for (k,v) in sorted(nt_seq_arrays.items())]
+    init_f = ild_nt.gen_init_function(nt_seq_values,
                                        'xed_ild_easz_init')
-    ild_nt.dump_lu_arrays(agi, list(nt_seq_arrays.values()), _easz_c_fn,
+    ild_nt.dump_lu_arrays(agi, nt_seq_values, _easz_c_fn,
                           mbuild.join('include-private', _easz_header_fn),
                           init_f)
     getter_fos = []
diff --git a/pysrc/ild_eosz.py b/pysrc/ild_eosz.py
index 6643bc3..89d2d89 100755
--- a/pysrc/ild_eosz.py
+++ b/pysrc/ild_eosz.py
@@ -200,10 +200,11 @@ def work(agi, united_lookup, eosz_nts, ild_gendir, debug):
             return None
         nt_seq_arrays[tuple(nt_seq)] = array
     #init function calls all single init functions for the created tables
-    init_f = ild_nt.gen_init_function(list(nt_seq_arrays.values()),
+    nt_seq_values = [v for (k,v) in sorted(nt_seq_arrays.items())]
+    init_f = ild_nt.gen_init_function(nt_seq_values,
                                       'xed_ild_eosz_init')
     #dump init and lookup functions for EOSZ sequences
-    ild_nt.dump_lu_arrays(agi, list(nt_seq_arrays.values()), _eosz_c_fn,
+    ild_nt.dump_lu_arrays(agi, nt_seq_values, _eosz_c_fn,
                           mbuild.join('include-private', _eosz_header_fn),
                           init_f)
     #generate EOSZ getter functions - they get xed_decoded_inst_t*
diff --git a/pysrc/ild_imm.py b/pysrc/ild_imm.py
index 51c413c..0530bae 100755
--- a/pysrc/ild_imm.py
+++ b/pysrc/ild_imm.py
@@ -322,12 +322,14 @@ def work(agi, united_lookup, imm_nts, ild_gendir, eosz_dict,
                                      level='l3')
         nt_dict[nt_name] = array

+    nt_dict_values = [v for (k,v) in sorted(nt_dict.items())]
+
     #create function that calls all initialization functions for L3
-    init_f = ild_nt.gen_init_function(list(nt_dict.values()),
+    init_f = ild_nt.gen_init_function(nt_dict_values,
                                       'xed_ild_imm_l3_init')

     #dump L3 functions
-    ild_nt.dump_lu_arrays(agi, list(nt_dict.values()), _l3_c_fn,
+    ild_nt.dump_lu_arrays(agi, nt_dict_values, _l3_c_fn,
                           mbuild.join('include-private',_l3_header_fn),
                           init_f)


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:
Fix name clash with libcap 2.29.

Taken from upstream:
https://github.com/iputils/iputils/commit/18f9a84e0e702841d6cc4d5f593de4fbd1348e83

diff --git a/ninfod/ninfod.c b/ninfod/ninfod.c
--- a/ninfod/ninfod.c
+++ b/ninfod/ninfod.c
@@ -455,7 +455,7 @@ static void do_daemonize(void)
 /* --------- */
 #ifdef HAVE_LIBCAP
 static const cap_value_t cap_net_raw = CAP_NET_RAW;
-static const cap_value_t cap_setuid =  CAP_SETUID;
+static const cap_value_t cap_setuserid = CAP_SETUID;
 static cap_flag_value_t cap_ok;
 #else
 static uid_t euid;
@@ -487,7 +487,7 @@ static void limit_capabilities(void)

 	cap_get_flag(cap_cur_p, CAP_SETUID, CAP_PERMITTED, &cap_ok);
 	if (cap_ok != CAP_CLEAR)
-		cap_set_flag(cap_p, CAP_PERMITTED, 1, &cap_setuid, CAP_SET);
+		cap_set_flag(cap_p, CAP_PERMITTED, 1, &cap_setuserid, CAP_SET);

 	if (cap_set_proc(cap_p) < 0) {
 		DEBUG(LOG_ERR, "cap_set_proc: %s\n", strerror(errno));
@@ -520,8 +520,8 @@ static void drop_capabilities(void)

 	/* setuid / setuid */
 	if (cap_ok != CAP_CLEAR) {
-		cap_set_flag(cap_p, CAP_PERMITTED, 1, &cap_setuid, CAP_SET);
-		cap_set_flag(cap_p, CAP_EFFECTIVE, 1, &cap_setuid, CAP_SET);
+		cap_set_flag(cap_p, CAP_PERMITTED, 1, &cap_setuserid, CAP_SET);
+		cap_set_flag(cap_p, CAP_EFFECTIVE, 1, &cap_setuserid, CAP_SET);

 		if (cap_set_proc(cap_p) < 0) {
 			DEBUG(LOG_ERR, "cap_set_proc: %s\n", strerror(errno));


code:
From 052d24d8217c51c572c2f6cbb4a687be2e8ba52d Mon Sep 17 00:00:00 2001
From: Brice Waegeneire <brice@waegenei.re>
Date: Fri, 5 Jun 2020 14:38:43 +0200
Subject: [PATCH] [geniso] Make it reproducible

Some timestamps get embedded in the generated ISO, making it
unreproducible so we overwrite those timestamps to be at the UNIX epoch.
---
 src/util/geniso | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/src/util/geniso b/src/util/geniso
index ff090d4a..e032ffb0 100755
--- a/src/util/geniso
+++ b/src/util/geniso
@@ -11,6 +11,13 @@ function help() {
 	echo " -o FILE  save iso image to file"
 }

+function reset_timestamp() {
+	for f in "$1"/*; do
+		touch -t 197001010100 "$f"
+	done
+	touch -t 197001010100 "$1"
+}
+
 LEGACY=0
 FIRST=""

@@ -37,8 +44,9 @@ if [ -z "${OUT}" ]; then
 	exit 1
 fi

-# There should either be mkisofs or the compatible genisoimage program
-for command in genisoimage mkisofs; do
+# There should either be mkisofs, xorriso or the compatible genisoimage
+# program
+for command in xorriso genisoimage mkisofs; do
 	if ${command} --version >/dev/null 2>/dev/null; then
 		mkisofs=(${command})
 		break
@@ -46,8 +54,10 @@ for command in genisoimage mkisofs; do
 done

 if [ -z "${mkisofs}" ]; then
-	echo "${0}: mkisofs or genisoimage not found, please install or set PATH" >&2
+	echo "${0}: mkisofs, xorriso or genisoimage not found, please install or set PATH" >&2
 	exit 1
+elif [ "$mkisofs" = "xorriso" ]; then
+	 mkisofs+=(-as mkisofs)
 fi

 dir=$(mktemp -d bin/iso.dir.XXXXXX)
@@ -115,6 +125,8 @@ case "${LEGACY}" in
 			exit 1
 		fi

+		reset_timestamp "$dir"
+
 		# generate the iso image
 		"${mkisofs[@]}" -b boot.img -output ${OUT} ${dir}
 		;;
@@ -127,6 +139,12 @@ case "${LEGACY}" in
 			cp ${LDLINUX_C32} ${dir}
 		fi

+		reset_timestamp "$dir"
+
+		if [ "${mkisofs[0]}" = "xorriso" ]; then
+			mkisofs+=(-isohybrid-mbr "$SYSLINUX_MBR_DISK_PATH")
+		fi
+
 		# generate the iso image
 		"${mkisofs[@]}" -b isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table -output ${OUT} ${dir}

--
2.26.2


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 minor fixes for compiling with GCC 10.

Taken from upstream:
https://gitlab.isc.org/isc-projects/dhcp/-/commit/6c7e61578b1b449272dbb40dd8b98d03dad8a57a

diff --git a/client/dhclient.c b/client/dhclient.c
--- a/client/dhclient.c
+++ b/client/dhclient.c
@@ -83,8 +83,9 @@ static const char message [] = "Internet Systems Consortium DHCP Client";
 static const char url [] = "For info, please visit https://www.isc.org/software/dhcp/";
 #endif /* UNIT_TEST */

-u_int16_t local_port = 0;
-u_int16_t remote_port = 0;
+extern u_int16_t local_port;
+extern u_int16_t remote_port;
+
 #if defined(DHCPv6) && defined(DHCP4o6)
 int dhcp4o6_state = -1; /* -1 = stopped, 0 = polling, 1 = started */
 #endif
diff --git a/common/discover.c b/common/discover.c
--- a/common/discover.c
+++ b/common/discover.c
@@ -45,8 +45,8 @@ struct interface_info *fallback_interface = 0;

 int interfaces_invalidated;
 int quiet_interface_discovery;
-u_int16_t local_port;
-u_int16_t remote_port;
+u_int16_t local_port = 0;
+u_int16_t remote_port = 0;
 u_int16_t relay_port = 0;
 int dhcpv4_over_dhcpv6 = 0;
 int (*dhcp_interface_setup_hook) (struct interface_info *, struct iaddr *);
diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c
--- a/relay/dhcrelay.c
+++ b/relay/dhcrelay.c
@@ -95,8 +95,8 @@ enum { forward_and_append,	/* Forward and append our own relay option. */
        forward_untouched,	/* Forward without changes. */
        discard } agent_relay_mode = forward_and_replace;

-u_int16_t local_port;
-u_int16_t remote_port;
+extern u_int16_t local_port;
+extern u_int16_t remote_port;

 /* Relay agent server list. */
 struct server_list {
diff --git a/server/mdb.c b/server/mdb.c
--- a/server/mdb.c
+++ b/server/mdb.c
@@ -67,7 +67,7 @@ static host_id_info_t *host_id_info = NULL;

 int numclasseswritten;

-omapi_object_type_t *dhcp_type_host;
+extern omapi_object_type_t *dhcp_type_host;

 isc_result_t enter_class(cd, dynamicp, commit)
 	struct class *cd;
diff --git a/server/mdb6.c b/server/mdb6.c
--- a/server/mdb6.c
+++ b/server/mdb6.c
@@ -1945,7 +1945,7 @@ create_prefix6(struct ipv6_pool *pool, struct iasubopt **pref,
 		}
 		new_ds.data = new_ds.buffer->data;
 		memcpy(new_ds.buffer->data, ds.data, ds.len);
-		memcpy(new_ds.buffer->data + ds.len, &tmp, sizeof(tmp));
+		memcpy(&new_ds.buffer->data[0] + ds.len, &tmp, sizeof(tmp));
 		data_string_forget(&ds, MDL);
 		data_string_copy(&ds, &new_ds, MDL);
 		data_string_forget(&new_ds, MDL);


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.


code:
From 9c83c3d3f443eb92f87dc87c7dcfe95577b95621 Mon Sep 17 00:00:00 2001
From: Simon South <simon@simonsouth.net>
Date: Thu, 28 May 2020 14:29:55 -0400
Subject: [PATCH] Add support for aarch64 on GNU/Linux

---
 configure.ac                      |  10 +-
 src/arch/Makefile.am              |   2 +-
 src/arch/aarch64.h                | 110 ++++++++++++++++
 src/os/linux/Makefile.am          |   2 +-
 src/os/linux/aarch64/Makefile.am  |  28 ++++
 src/os/linux/aarch64/callNative.S | 212 ++++++++++++++++++++++++++++++
 src/os/linux/aarch64/dll_md.c     |  59 +++++++++
 src/os/linux/aarch64/init.c       |  51 +++++++
 8 files changed, 469 insertions(+), 5 deletions(-)
 create mode 100644 src/arch/aarch64.h
 create mode 100644 src/os/linux/aarch64/Makefile.am
 create mode 100644 src/os/linux/aarch64/callNative.S
 create mode 100644 src/os/linux/aarch64/dll_md.c
 create mode 100644 src/os/linux/aarch64/init.c

diff --git a/configure.ac b/configure.ac
index ccd530f..707f281 100644
--- a/configure.ac
+++ b/configure.ac
@@ -43,6 +43,7 @@ amd64-*-freebsd*) host_os=bsd libdl_needed=no ;;
 arm*-*-linux*) host_cpu=arm host_os=linux ;;
 arm*-*-openbsd*) host_cpu=arm host_os=bsd libdl_needed=no ;;
 arm*-*-freebsd*) host_cpu=arm host_os=bsd libdl_needed=no ;;
+aarch64*-*-linux*) host_cpu=aarch64 host_os=linux ;;
 powerpc*-*-linux*) host_cpu=powerpc host_os=linux ;;
 powerpc*-*-openbsd*) host_cpu=powerpc host_os=bsd libdl_needed=no ;;
 powerpc*-*-freebsd*) host_cpu=powerpc host_os=bsd libdl_needed=no ;;
@@ -149,9 +150,11 @@ AC_ARG_ENABLE(runtime-reloc-checks,

 AC_ARG_ENABLE(int-inlining,
     [AS_HELP_STRING(--enable-int-inlining,enable inline threaded version of the interpreter
-                   (by default enabled on x86_64, i386 and powerpc, disabled otherwise))],,
-    [if test "$host_cpu" = x86_64 -o "$host_cpu" = i386 -o "$host_cpu" = powerpc && \
-        test "$cross_compiling" = no -o "$enable_runtime_reloc_checks" != no; then
+                   (by default enabled on x86_64, i386, powerpc and aarch64,
+                   disabled otherwise))],,
+    [if test "$host_cpu" = x86_64 -o "$host_cpu" = i386 -o "$host_cpu" = powerpc -o \
+             "$host_cpu" = aarch64 && test "$cross_compiling" = no -o \
+             "$enable_runtime_reloc_checks" != no; then
          enable_int_inlining=yes
        else
          enable_int_inlining=no
@@ -298,6 +301,7 @@ AC_CONFIG_FILES(
     src/os/linux/x86_64/Makefile \
     src/os/linux/parisc/Makefile \
     src/os/linux/mips/Makefile \
+    src/os/linux/aarch64/Makefile \
     src/os/darwin/i386/Makefile \
     src/os/darwin/arm/Makefile \
     src/os/darwin/powerpc/Makefile \
diff --git a/src/arch/Makefile.am b/src/arch/Makefile.am
index 078c1de..afb26d1 100644
--- a/src/arch/Makefile.am
+++ b/src/arch/Makefile.am
@@ -19,4 +19,4 @@
 ## Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 ##

-EXTRA_DIST = powerpc.h arm.h i386.h x86_64.h parisc.h mips.h
+EXTRA_DIST = powerpc.h arm.h i386.h x86_64.h parisc.h mips.h aarch64.h
diff --git a/src/arch/aarch64.h b/src/arch/aarch64.h
new file mode 100644
index 0000000..c96aa9f
--- /dev/null
+++ b/src/arch/aarch64.h
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008
+ * Robert Lougher <rob@lougher.org.uk>.
+ * Copyright (C) 2020 Simon South <simon@simonsouth.net>.
+ *
+ * This file is part of JamVM.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2,
+ * or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <stdint.h>
+
+#define OS_ARCH "aarch64"
+
+#define HANDLER_TABLE_T static const void
+#define DOUBLE_1_BITS 0x3ff0000000000000LL
+
+#define READ_DBL(v,p,l) v = ((u8)p[0]<<56)|((u8)p[1]<<48)|((u8)p[2]<<40) \
+                            |((u8)p[3]<<32)|((u8)p[4]<<24)|((u8)p[5]<<16) \
+                            |((u8)p[6]<<8)|(u8)p[7]; p+=8
+
+/* Needed for i386 -- empty here */
+#define FPU_HACK
+
+#define COMPARE_AND_SWAP_64(addr, old_val, new_val)             \
+({                                                              \
+    int result, read_val;                                       \
+    __asm__ __volatile__ ("                                     \
+        1:      ldaxr %2, %1;                                   \
+                cmp %2, %3;                                     \
+                b.ne 2f;                                        \
+                stlxr %w0, %4, %1;                              \
+                cmp %w0, wzr;                                   \
+                b.ne 1b;                                        \
+        2:      cset %w0, eq;"                                  \
+    : "=&r" (result), "+Q" (*addr), "=&r" (read_val)            \
+    : "r" (old_val), "r" (new_val)                              \
+    : "cc");                                                    \
+    result;                                                     \
+})
+
+#define COMPARE_AND_SWAP(addr, old_val, new_val)                \
+        COMPARE_AND_SWAP_64(addr, old_val, new_val)
+
+#define LOCKWORD_READ(addr)                                     \
+({                                                              \
+    uintptr_t result;                                           \
+    __asm__ __volatile__ ("                                     \
+                ldar %0, %1;"                                   \
+    : "=r" (result)                                             \
+    : "Q" (*addr)                                               \
+    : "cc");                                                    \
+    result;                                                     \
+})
+
+#define LOCKWORD_WRITE(addr, value)                             \
+({                                                              \
+    __asm__ __volatile__ ("                                     \
+                stlr %1, %0;"                                   \
+    : "=Q" (*addr)                                              \
+    : "r" (value)                                               \
+    : "cc");                                                    \
+})
+
+#define LOCKWORD_COMPARE_AND_SWAP(addr, old_val, new_val)       \
+        COMPARE_AND_SWAP_64(addr, old_val, new_val)
+
+#define FLUSH_CACHE(addr, length)                               \
+{                                                               \
+    uintptr_t start = (uintptr_t) (addr);                       \
+    uintptr_t end = start + length;                             \
+    uintptr_t i;                                                \
+                                                                \
+    for(i = start & aarch64_data_cache_line_mask;               \
+        i < end;                                                \
+        i += aarch64_data_cache_line_len)                       \
+        __asm__ ("dc cvau, %0" :: "r" (i));                     \
+                                                                \
+    __asm__ ("dsb ish");                                        \
+                                                                \
+    for(i = start & aarch64_instruction_cache_line_mask;        \
+        i < end;                                                \
+        i += aarch64_instruction_cache_line_len)                \
+        __asm__ ("ic ivau, %0" :: "r" (i));                     \
+                                                                \
+    __asm__ ("dsb ish; isb");                                   \
+}
+
+#define MBARRIER() __asm__ ("dmb ish" ::: "memory")
+#define UNLOCK_MBARRIER() __asm__ ("dmb ish" ::: "memory")
+#define JMM_LOCK_MBARRIER() __asm__ ("dmb ish" ::: "memory")
+#define JMM_UNLOCK_MBARRIER() JMM_LOCK_MBARRIER()
+
+/* Defined in src/os/linux/aarch64/init.c */
+extern unsigned char aarch64_data_cache_line_len;
+extern uintptr_t aarch64_data_cache_line_mask;
+extern unsigned char aarch64_instruction_cache_line_len;
+extern uintptr_t aarch64_instruction_cache_line_mask;
diff --git a/src/os/linux/Makefile.am b/src/os/linux/Makefile.am
index aa29be1..d582b97 100644
--- a/src/os/linux/Makefile.am
+++ b/src/os/linux/Makefile.am
@@ -20,7 +20,7 @@
 ##

 SUBDIRS = @arch@
-DIST_SUBDIRS = powerpc arm i386 x86_64 parisc mips
+DIST_SUBDIRS = powerpc arm i386 x86_64 parisc mips aarch64

 noinst_LTLIBRARIES = libos.la
 libos_la_SOURCES = os.c
diff --git a/src/os/linux/aarch64/Makefile.am b/src/os/linux/aarch64/Makefile.am
new file mode 100644
index 0000000..1024c3a
--- /dev/null
+++ b/src/os/linux/aarch64/Makefile.am
@@ -0,0 +1,28 @@
+##
+## Copyright (C) 2003, 2004, 2005, 2006, 2007, 2010, 2011, 2012
+## Robert Lougher <rob@lougher.org.uk>.
+##
+## File added by Simon South <simon@simonsouth.net>.
+##
+## This file is part of JamVM.
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2,
+## or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+##
+
+noinst_LTLIBRARIES = libnative.la
+libnative_la_SOURCES = init.c dll_md.c callNative.S
+
+AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src
+AM_CCASFLAGS = -I$(top_builddir)/src
diff --git a/src/os/linux/aarch64/callNative.S b/src/os/linux/aarch64/callNative.S
new file mode 100644
index 0000000..e067c4f
--- /dev/null
+++ b/src/os/linux/aarch64/callNative.S
@@ -0,0 +1,212 @@
+/*
+ * Copyright (C) 2008, 2009, 2011, 2012 Robert Lougher <rob@jamvm.org.uk>.
+ * Copyright (C) 2020 Simon South <simon@simonsouth.net>.
+ *
+ * This file is part of JamVM.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2,
+ * or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+
+#ifndef USE_FFI
+        .text
+        .arch armv8-a
+        .align 2
+        .global callJNIMethod
+        .type callJNIMethod,function
+
+/*
+ * Arguments passed in:
+ *
+ * x0 JNIEnv
+ * x1 class or NULL
+ * x2 sig
+ * w3 extra arg
+ * x4 ostack
+ * x5 function pntr
+ * w6 args count
+ */
+
+/* Register usage:
+ *
+ * x20 ostack
+ * x19 sig pntr
+ * x16 function pntr
+ * x15 ostack pntr
+ * x14 args pntr
+ * x13 float/double handler
+ * x12 int/long handler
+ * w11 fp regs remaining
+ * w10 int regs remaining
+ * x9 scratch
+ * x2-x7 outgoing int args
+ * x1 outgoing class or this pntr
+ * x0 outgoing JNIEnv (as passed in)
+ *
+ * d0 - d7 outgoing float args
+ */
+
+callJNIMethod:
+        stp     x29, x30, [sp, #-32]!
+        mov     x29, sp
+        stp     x19, x20, [x29, #16]
+
+        sub     sp, sp, w3              /* allocate room for stacked args */
+        mov     x14, sp
+
+        mov     x20, x4                 /* preserve ostack */
+        add     x19, x2, #1             /* init sig pntr -- skipping '(' */
+
+        mov     x16, x5                 /* save function pntr */
+        mov     x15, x20                /* init ostack pntr */
+
+        adr     x13, fp_reg_handlers-8
+        adr     x12, int_reg_handlers-8
+
+        mov     w11, #8                 /* fp regs remaining */
+        mov     w10, #6                 /* int regs remaining */
+
+        cbnz    x1, scan_sig            /* is method non-static? */
+        ldr     x1, [x15], #8           /* yes, load x1 with "this" */
+
+scan_sig:
+        ldrb    w9, [x19], #1           /* get next sig char */
+
+        cmp     w9, #41                 /* ')' */
+        b.eq    done
+
+        cmp     w9, #74                 /* 'J' */
+        b.eq    long
+
+        cmp     w9, #70                 /* 'F' */
+        b.eq    float
+
+        cmp     w9, #68                 /* 'D' */
+        b.eq    double
+
+skip_brackets:
+        cmp     w9, #91                 /* '[' */
+        b.ne    1f
+        ldrb    w9, [x19], #1
+        b       skip_brackets
+1:
+        cmp     w9, #76                 /* 'L' */
+        b.ne    int
+
+skip_ref:
+        ldrb    w9, [x19], #1
+        cmp     w9, #59                 /* ';' */
+        b.ne    skip_ref
+
+int:
+        ldr     x9, [x15], #8
+        cbz     w10, stack_push
+
+load_int_reg:
+        sub     w10, w10, #1
+        add     x12, x12, #8
+        br      x12
+
+int_reg_handlers:
+        mov     x2, x9
+        b       scan_sig
+        mov     x3, x9
+        b       scan_sig
+        mov     x4, x9
+        b       scan_sig
+        mov     x5, x9
+        b       scan_sig
+        mov     x6, x9
+        b       scan_sig
+        mov     x7, x9
+        b       scan_sig
+
+long:
+        ldr     x9, [x15], #16
+        cbz     w10, stack_push
+        b       load_int_reg
+
+float:
+        ldr     w9, [x15], #8
+        cbz     w11, stack_push
+        b       load_fp_reg
+
+double:
+        ldr     x9, [x15], #16
+        cbz     w11, stack_push
+
+load_fp_reg:
+        sub     w11, w11, #1
+        add     x13, x13, #8
+        br      x13
+
+fp_reg_handlers:
+        fmov    d0, x9
+        b       scan_sig
+        fmov    d1, x9
+        b       scan_sig
+        fmov    d2, x9
+        b       scan_sig
+        fmov    d3, x9
+        b       scan_sig
+        fmov    d4, x9
+        b       scan_sig
+        fmov    d5, x9
+        b       scan_sig
+        fmov    d6, x9
+        b       scan_sig
+        fmov    d7, x9
+        b       scan_sig
+
+stack_push:
+        str     x9, [x14], #8
+        b       scan_sig
+
+done:
+        /* Call the function */
+        blr     x16
+
+        mov     sp, x29                 /* Pop argument area */
+
+        ldrb    w9, [x19]               /* Return type */
+
+        cmp     w9, #86                 /* 'V' */
+        b.eq    return
+
+        cmp     w9, #68                 /* 'D' */
+        b.ne    2f
+        str     d0, [x20], #16
+        b       return
+2:
+        cmp     w9, #70                 /* 'F' */
+        b.ne    3f
+        str     s0, [x20], #8
+        b       return
+3:
+        cmp     w9, #74                 /* 'J' */
+        b.ne    4f
+        str     x0, [x20], #16
+        b       return
+4:
+        str     x0, [x20], #8
+
+return:
+        mov     x0, x20                 /* return ostack */
+
+        ldp     x19, x20, [x29, #16]
+        ldp     x29, x30, [sp], #32
+        ret
+#endif
diff --git a/src/os/linux/aarch64/dll_md.c b/src/os/linux/aarch64/dll_md.c
new file mode 100644
index 0000000..189f8a8
--- /dev/null
+++ b/src/os/linux/aarch64/dll_md.c
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2011
+ * Robert Lougher <rob@jamvm.org.uk>.
+ * Copyright (C) 2020 Simon South <simon@simonsouth.net>.
+ *
+ * This file is part of JamVM.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2,
+ * or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "jam.h"
+
+#ifndef USE_FFI
+
+int nativeExtraArg(MethodBlock *mb) {
+    char *sig = mb->type;
+    int stack_args = 0;
+    int int_args = 6;
+    int fp_args = 8;
+
+    while(*++sig != ')')
+        switch(*sig) {
+        case 'F':
+        case 'D':
+            if(fp_args == 0)
+                stack_args += 8;
+            else
+                fp_args--;
+
+        default:
+            if(int_args == 0)
+                stack_args += 8;
+            else
+                int_args--;
+
+            if(*sig == '[')
+                while(*++sig == '[');
+            if(*sig == 'L')
+                while(*++sig != ';');
+            break;
+        }
+
+    /* Ensure the stack remains 16 byte aligned. */
+    return (stack_args + 15) & ~15;
+}
+
+#endif
diff --git a/src/os/linux/aarch64/init.c b/src/os/linux/aarch64/init.c
new file mode 100644
index 0000000..e03b446
--- /dev/null
+++ b/src/os/linux/aarch64/init.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007
+ * Robert Lougher <rob@lougher.org.uk>.
+ * Copyright (C) 2020 Simon South <simon@simonsouth.net>.
+ *
+ * This file is part of JamVM.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2,
+ * or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "arch/aarch64.h"
+
+/* Length in bytes of the smallest line in the host system's data cache */
+unsigned char aarch64_data_cache_line_len;
+
+/* Mask used to align a virtual address to a line in the data cache */
+uintptr_t aarch64_data_cache_line_mask;
+
+/* Length in bytes of the smallest line in the host system's instruction
+   cache */
+unsigned char aarch64_instruction_cache_line_len;
+
+/* Mask used to align a virtual address to a line in the instruction cache */
+uintptr_t aarch64_instruction_cache_line_mask;
+
+void initialisePlatform() {
+    unsigned int cache_type;
+
+    /* Extract information from the cache-type register, which describes aspects
+       of the host's cache configuration */
+    __asm__ ("mrs %0, ctr_el0" : "=r" (cache_type));
+
+    aarch64_data_cache_line_len = 4 << ((cache_type >> 16) & 0x0f);
+    aarch64_data_cache_line_mask = ~(aarch64_data_cache_line_len - 1);
+
+    aarch64_instruction_cache_line_len = 4 << (cache_type & 0x0f);
+    aarch64_instruction_cache_line_mask =
+        ~(aarch64_instruction_cache_line_len - 1);
+}
--
2.26.2