[dgit import tarball luametatex 2.11.02+really2.11.01+ds-1 luametatex_2.11.02+really2.11.01+ds-1.debian.tar.xz]
--- /dev/null
+luametatex for Debian
+--------------------
+
+I've patched upstreams CMakeLists.txt file to link dynamically with
+libmimalloc in Debian. The libcerf and the potrace in the source package
+is patched by the luametatex maintainers, hence I use that instead of the
+Debian package.
+
+ -- Hilmar Preusse <hille42@web.de> Mon, 17 Apr 2023 09:33:47 +0200
--- /dev/null
+luametatex for Debian
+--------------------
+
+The luametatex_2.11.01+really2.10.08+ds.orig.tar.gz is identical to
+luametatex_2.10.08+ds.orig.tar.gz, hence not another commit in the
+pristine-tar branch. Create a soft link to luametatex_2.10.08+ds.orig.tar.gz
+named luametatex_2.11.01+really2.10.08+ds.orig.tar.gz you should be
+able to create a source package.
+
+Command to build the source tree from git could be:
+
+gbp buildpackage --git-upstream-tag=upstream/2.10.08+ds --git-no-create-orig \
+--git-export-dir=/tmp --git-builder=/bin/true --git-no-pbuilder --git-no-purge
+
+Similar procedure for luametatex_2.11.01+really2.11.01+ds
+
+If everything fails scroll back to the upstream tag e.g.:
+
+git checkout 0edb7d5eac96e7f5be51194e82a79f932cc63023
+
+Copy the directory to another one, scroll back "git checkout master" and copy
+subdir "debian" to the new directory and build the source package.
+
+ -- Hilmar Preusse <hille42@web.de> Wed, 06 Mar 2024 23:19:06 +0100
--- /dev/null
+luametatex (2.11.02+really2.11.01+ds-1) unstable; urgency=medium
+
+ * The version/snapshot of ConTeXt in Debian does to fit to ltmx
+ 2.11.02, downgrade to 2.11.01 again (Closes: #1072682).
+ * Disable patches for mimalloc.
+
+ -- Hilmar Preusse <hille42@web.de> Sat, 15 Jun 2024 23:25:01 +0200
+
+luametatex (2.11.02+ds-4) unstable; urgency=medium
+
+ * Upload to unstable.
+
+ -- Hilmar Preusse <hille42@web.de> Wed, 05 Jun 2024 14:13:07 +0200
+
+luametatex (2.11.02+ds-3) experimental; urgency=medium
+
+ * Link dynamically with mimalloc.
+ * Patch handling:
+ - adding, fixing DEP-3 headers
+ - removing obsolete patch
+
+ -- Hilmar Preusse <hille42@web.de> Fri, 24 May 2024 22:35:07 +0200
+
+luametatex (2.11.02+ds-2) experimental; urgency=medium
+
+ * Add patches from upstream to fix build failures on arches, where
+ ‘__builtin_thread_pointer’ is not supported.
+ https://github.com/microsoft/mimalloc/issues/883 .
+
+ -- Hilmar Preusse <hille42@web.de> Thu, 16 May 2024 08:40:41 +0200
+
+luametatex (2.11.02+ds-1) experimental; urgency=medium
+
+ * New upstream version.
+ See https://github.com/contextgarden/luametatex/issues/12
+ * Add Breaks statement for old context.
+
+ -- Hilmar Preusse <hille42@web.de> Wed, 15 May 2024 23:53:44 +0200
+
+luametatex (2.11.01+really2.11.01+ds-1) experimental; urgency=medium
+
+ * Reupload version 2.11.01 for TL 2024.
+
+ -- Hilmar Preusse <hille42@web.de> Sun, 21 Apr 2024 16:35:11 +0200
+
+luametatex (2.11.01+really2.10.08+ds-1) unstable; urgency=medium
+
+ * Downgrade to 2.10.08 (Closes: #1064402).
+
+ -- Hilmar Preusse <hille42@web.de> Wed, 06 Mar 2024 23:18:47 +0100
+
+luametatex (2.11.01+ds-2) unstable; urgency=medium
+
+ * armel needs linking with libatomic too.
+
+ -- Hilmar Preusse <hille42@web.de> Tue, 20 Feb 2024 23:26:24 +0100
+
+luametatex (2.11.01+ds-1) unstable; urgency=medium
+
+ * New upstream release, refresh patches.
+ - Should fix build failure on HURD.
+ - Contains a local copy of potrace -> extend d/copyright.
+ - Redo d/patches/no_strip.diff, stripping is configured in a
+ different file.
+ * Update d/gbp.conf.
+ * Link luametatex with libatomic on m68k, powerpc and sh4. Should fix
+ FTBFS on these arches.
+
+ -- Hilmar Preusse <hille42@web.de> Tue, 20 Feb 2024 08:23:29 +0000
+
+luametatex (2.10.08+ds-1) unstable; urgency=medium
+
+ * Initial release. (Closes: #1034501)
+
+ -- Hilmar Preusse <hille42@web.de> Tue, 18 Jul 2023 00:02:20 +0200
--- /dev/null
+Source: luametatex
+Section: tex
+Priority: optional
+Maintainer: Debian TeX Task Force <debian-tex-maint@lists.debian.org>
+Uploaders: Hilmar Preusse <hille42@web.de>
+Rules-Requires-Root: no
+Build-Depends:
+ debhelper-compat (= 13),
+ cmake,
+ libmimalloc-dev
+Standards-Version: 4.6.2
+Homepage: https://github.com/contextgarden/luametatex
+Vcs-Browser: https://github.com/debian-tex/luametatex
+Vcs-Git: https://github.com/debian-tex/luametatex.git
+
+Package: luametatex
+Architecture: any
+Breaks: context (<< 2024)
+Depends:
+ ${shlibs:Depends},
+ ${misc:Depends},
+Description: Next generation ConTeXt processing engine
+ The LuaMetaTeX program is a light weight variant of LuaTeX. This
+ program finds its origin in parts of TeX (the original program, eTeX
+ (some extensions), pdfTeX (more extensions) Aleph (based on Omega,
+ directions) and of course LuaTeX (lots of things).
+ .
+ This is a follow up on the LuaTeX project. The source is considered
+ part of the ConTeXt distribution and managed by the ConTeXt development
+ team and the ConTeXt user group. That way it can be guaranteed that the
+ engine and this TeX macro package work together as expected. The idea
+ is that users can easily compile the source themselves and that way
+ have a guaranteed long term (minimal) TeX based installation. Because
+ the management scripts are in Lua, only one binary is needed to serve
+ the ConTeXt distribution.
+ .
+ In the source code it was tried to stay close to the ancestors, LuaTeX,
+ pdfTeX, eTeX and TeX, but in the meantime due to additions there is
+ quite some diverge. There are new primitives and submechanisms, there
+ is more control over the inner workings, font handling is mostly
+ delegated to Lua and there is no built-in backend. The code base is
+ all-inclusive and has no (nor will have) dependencies on external
+ libraries. Performance and memory consumption have been optimized and
+ the additions (compared to LuaTeX) don’t have a negative impact.
--- /dev/null
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Source: https://github.com/contextgarden/luametatex
+Upstream-Name: luametatex
+Upstream-Contact: Hans Hagen <pragma@wxs.nl>
+Files-Excluded:
+ source/libraries/softposit/build/Linux-x86_64-GCC/softposit_test.a
+
+Files:
+ *
+Copyright:
+ 19xx - 2023 tex: Donald Knuth
+ 19xx - 20xx etex: Peter Breitenlohner, Phil Taylor and friends
+ 19xx - 20xx pdftex: Han The Thanh and friends
+ 1991 - 20xx omega: John Plaice and Yannis Haralambous
+ 19xx - 20xx aleph: Giuseppe Bilotta
+ 1994 - 20xx metapost: John Hobby, Taco Hoekwater, Luigi Scarso, Hans Hagen
+ 2018 - 2023 Hans Hagen <j.hagen@xs4all.nl>
+ 2018 - 2023 Wolfgang Schuster
+ 2018 - 2023 Mojca Miklavec
+ 2018 - 2023 Alan Braslau
+License: GPL-2+
+
+Files: debian/*
+Copyright: 2023 - 2024 Hilmar Preusse <hille42@web.de>
+License: GPL-2+
+
+Files: source/libraries/avl/*
+Copyright: 2002 - 2012 Richard McGraw <dasnar@fastmail.fm>
+License: GPL-2+
+
+Files: source/libraries/decnumber/*
+Copyright: 2000 - 2009 Mike Cowlishaw <mfc@uk.ibm.com>
+License: ICU
+
+Files: source/libraries/hnj/*
+Copyright:
+ 1998 Raph Levien
+ 2001 ALTLinux, Moscow (http://www.alt-linux.org)
+ 2001 Peter Novodvorsky (nidd@cs.msu.su)
+License: GPL-2+
+
+Files: source/libraries/libcerf/*
+Copyright:
+ 2012 Steven G. Johnson
+ 2013 Joachim Wuttke
+License: MIT
+
+Files: source/libraries/mimalloc/*
+Copyright:
+ 2018 - 2021 Microsoft Corporation, Daan Leijen
+License: MIT
+
+Files: source/libraries/miniz/*
+Copyright:
+ 2013 - 2014 RAD Game Tools and Valve Software
+ 2010 - 2014 Rich Geldreich and Tenacious Software LLC
+License: MIT
+
+Files: source/libraries/potrace/*
+Copyright:
+ 2001 - 2019 Peter Selinger <selinger@users.sourceforge.net>
+License: GPL-2+
+
+Files: source/libraries/pplib/*
+Copyright:
+ 2019 Paweł Jackowski <p.jackowski@gust.org.pl>
+License: PD
+
+Files: source/libraries/softposit/*
+Copyright:
+ 2017 - 2018 A*STAR.
+License: BSD-3
+
+Files: source/lua/*
+Copyright:
+ Roberto Ierusalimschy, Waldemar Celes and Luiz Henrique de Figueiredo
+License: GPL-2+
+
+Files: source/luacore/lua55/*
+Copyright:
+ 2007 - 2019 Lua.org, PUC-Rio, Brazil (http://www.lua.org)
+License: MIT
+
+Files: source/luacore/luapeg/*
+Copyright:
+ 2007 - 2019 Lua.org, PUC-Rio, Brazil (http://www.lua.org)
+ 2007 - 2019 Roberto Ierusalimschy
+License: MIT
+
+Files: source/luacore/luasocket/*
+Copyright:
+ 2004 - 2013 Diego Nehab
+License: MIT
+
+License: GPL-2+
+ This package 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 of the License, or
+ (at your option) any later version.
+ .
+ This package 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 <https://www.gnu.org/licenses/>
+Comment:
+ On Debian systems, the complete text of the GNU General
+ Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
+
+License: PD
+ Public domain software, produced as part of work done by the
+ United States Government & not subject to copyright in the US.
+ .
+ To the extent that any copyright protections may be considered to be held by
+ the authors of this software in some jurisdiction outside the United States,
+ the authors hereby waive those copyright protections and dedicate the
+ software to the public domain. Thus, this license may be considered
+ equivalent to Creative Commons 0: ”No Rights Reserved”.
+ .
+ Note that, according to Gnu.org, public domain is compatible with GPL.
+
+License: ICU
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, provided that the above copyright notice(s) and this
+ permission notice appear in all copies of the Software and that both the
+ above copyright notice(s) and this permission notice appear in supporting
+ documentation.
+ .
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
+ IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE
+ LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR
+ ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
+ IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ .
+ Except as contained in this notice, the name of a copyright holder shall not
+ be used in advertising or otherwise to promote the sale, use or other
+ dealings in this Software without prior written authorization of the
+ copyright holder.
+
+License: MIT
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+ .
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+ .
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+
+License: BSD-3
+ Copyright (c) The Regents of the University of California.
+ All rights reserved.
+ .
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the University nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+ .
+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
--- /dev/null
+README.adoc
+luametatex.svg
--- /dev/null
+[import-orig]
+pristine-tar = True
+
+[push]
+pristine-tar = True
+
+[pull]
+pristine-tar = True
+upstream = True
--- /dev/null
+.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3.
+.TH LuaMetaTeX "1" "April 2023" "LuaMetaTeX" "User Commands"
+.SH NAME
+luametatex \- Next generation ConTeXt procession engine.
+.SH SYNOPSIS
+.B luametatex
+\fI\,--lua=FILE \/\fR[\fI\,OPTION\/\fR]... [\fI\,TEXNAME\/\fR[\fI\,.tex\/\fR]] [\fI\,COMMANDS\/\fR]
+.br
+.B luametatex
+\fI\,--lua=FILE \/\fR[\fI\,OPTION\/\fR]... \fI\,\FIRST-LINE\/\fR
+.br
+.B luametatex
+\fI\,--lua=FILE \/\fR[\fI\,OPTION\/\fR]... \fI\,&FMT ARGS\/\fR
+.SH DESCRIPTION
+Run LuaMetaTeX on TEXNAME, usually creating TEXNAME.pdf. Any remaining COMMANDS are processed as luatex input, after TEXNAME is read.
+.PP
+Alternatively, if the first non\-option argument begins with a backslash,
+LuaMetaTeX interprets all non\-option arguments as an input line.
+.PP
+Alternatively, if the first non\-option argument begins with a &, the next word
+is taken as the FMT to read, overriding all else. Any remaining arguments are
+processed as above.
+.PP
+If no arguments or options are specified, prompt for input.
+.PP
+The following regular options are understood:
+.TP
+\fB\-\-credits\fR
+display credits and exit
+.TP
+\fB\-\-fmt\fR=\fI\,FORMAT\/\fR
+load the format file FORMAT
+.TP
+\fB\-\-help\fR
+display help and exit
+.TP
+\fB\-\-ini\fR
+be iniluametatex, for dumping formats
+.TP
+\fB\-\-jobname\fR=\fI\,STRING\/\fR
+set the job name to STRING
+.TP
+\fB\-\-lua\fR=\fI\,FILE\/\fR
+load and execute a lua initialization script
+.TP
+\fB\-\-version\fR
+display version and exit
+.PP
+Alternate behaviour models can be obtained by special switches
+.TP
+\fB\-\-luaonly\fR
+run a lua file, then exit
+.PP
+Loading libraries from Lua is blocked unless one explicitly permits it:
+.TP
+\fB\-\-permitloadlib\fR
+permit loading of external libraries (coming)
+.PP
+See the reference manual for more information about the startup process.
+.SH "REPORTING BUGS"
+Email bug reports to dev\-context@ntg.nl.
+.PP
+.br
+Execute 'luametatex \fB\-\-credits\fR' for credits and version details.
+.PP
+.br
+There is NO warranty. Redistribution of this software is covered by the terms
+of the GNU General Public License, version 2 or (at your option) any later
+version. For more information about these matters, see the file named COPYING
+and the LuaMetaTeX source.
+.PP
+.br
+Functionality : level 20230310
+.br
+Support : context@ntg.nl
+.br
+Copyright : The Lua(Meta)TeX Team(s) (2005\-2023+)
+.PP
+.br
+The LuaMetaTeX project is related to ConTeXt development. This macro package
+tightly integrates TeX and MetaPost in close cooperation with Lua. Updates will
+happen in sync with ConTeXt and when needed. Don't be fooled by unchanged dates:
+long term stability is the objective.
--- /dev/null
+debian/luametatex.1
--- /dev/null
+From 146f9d2333bc0aeed1593dc659b17e65b38a33e7 Mon Sep 17 00:00:00 2001
+From: Daan <daanl@outlook.com>
+Date: Wed, 24 Apr 2024 19:48:04 -0700
+Subject: [PATCH] make TLS slot default instead of __builtin_thread_pointer.
+ Potentially fixes build errors on various platforms (see issue #883)
+
+---
+ include/mimalloc/prim.h | 29 +++++++++++++++--------------
+ 1 file changed, 15 insertions(+), 14 deletions(-)
+
+diff --git a/include/mimalloc/prim.h b/include/mimalloc/prim.h
+index f8a40323..6063d44a 100644
+--- a/source/libraries/mimalloc/include/mimalloc/prim.h
++++ b/source/libraries/mimalloc/include/mimalloc/prim.h
+@@ -203,11 +203,14 @@ static inline void mi_prim_tls_slot_set(size_t slot, void* value) mi_attr_noexce
+
+ #endif
+
+-// Do we have __builtin_thread_pointer? (do not make this a compound test as it fails on older gcc's, see issue #851)
+-#if defined(__has_builtin)
+-#if __has_builtin(__builtin_thread_pointer)
+-#define MI_HAS_BUILTIN_THREAD_POINTER 1
+-#endif
++// Do we have __builtin_thread_pointer? (do not make this a compound test as that fails on older gcc's, see issue #851)
++#ifdef __has_builtin
++ #if __has_builtin(__builtin_thread_pointer)
++ #if (!defined(__APPLE__)) && /* on apple (M1) the wrong register is read (tpidr_el0 instead of tpidrro_el0) so fall back to TLS slot assembly (<https://github.com/microsoft/mimalloc/issues/343#issuecomment-763272369>)*/ \
++ (!defined(__clang_major__) || __clang_major__ >= 14) // older clang versions emit bad code; fall back to using the TLS slot (<https://lore.kernel.org/linux-arm-kernel/202110280952.352F66D8@keescook/T/>)
++ #define MI_HAS_BUILTIN_THREAD_POINTER 1
++ #endif
++ #endif
+ #elif defined(__GNUC__) && (__GNUC__ >= 7) && defined(__aarch64__) // special case aarch64 for older gcc versions (issue #851)
+ #define MI_HAS_BUILTIN_THREAD_POINTER 1
+ #endif
+@@ -231,15 +234,6 @@ static inline mi_threadid_t _mi_prim_thread_id(void) mi_attr_noexcept {
+ return (uintptr_t)NtCurrentTeb();
+ }
+
+-#elif MI_HAS_BUILTIN_THREAD_POINTER && \
+- (!defined(__APPLE__)) && /* on apple (M1) the wrong register is read (tpidr_el0 instead of tpidrro_el0) so fall back to TLS slot assembly (<https://github.com/microsoft/mimalloc/issues/343#issuecomment-763272369>)*/ \
+- (!defined(__clang_major__) || __clang_major__ >= 14) // older clang versions emit bad code; fall back to using the TLS slot (<https://lore.kernel.org/linux-arm-kernel/202110280952.352F66D8@keescook/T/>)
+-
+-static inline mi_threadid_t _mi_prim_thread_id(void) mi_attr_noexcept {
+- // Works on most Unix based platforms
+- return (uintptr_t)__builtin_thread_pointer();
+-}
+-
+ #elif defined(MI_HAS_TLS_SLOT)
+
+ static inline mi_threadid_t _mi_prim_thread_id(void) mi_attr_noexcept {
+@@ -255,6 +249,13 @@ static inline mi_threadid_t _mi_prim_thread_id(void) mi_attr_noexcept {
+ #endif
+ }
+
++#elif MI_HAS_BUILTIN_THREAD_POINTER
++
++static inline mi_threadid_t _mi_prim_thread_id(void) mi_attr_noexcept {
++ // Works on most Unix based platforms
++ return (uintptr_t)__builtin_thread_pointer();
++}
++
+ #else
+
+ // otherwise use portable C, taking the address of a thread local variable (this is still very fast on most platforms).
--- /dev/null
+From cc3c14f2ed374f908e60a3bf29c1dff84fc8cfc2 Mon Sep 17 00:00:00 2001
+From: Daan <daanl@outlook.com>
+Date: Fri, 26 Apr 2024 23:34:10 -0700
+Subject: [PATCH] use builtin_thread_pointer only on non-apple arm64 (issue
+ #883 and #851)
+
+---
+ include/mimalloc/prim.h | 32 +++++++++++++++-----------------
+ 1 file changed, 15 insertions(+), 17 deletions(-)
+
+diff --git a/include/mimalloc/prim.h b/include/mimalloc/prim.h
+index 6063d44a..89266817 100644
+--- a/source/libraries/mimalloc/include/mimalloc/prim.h
++++ b/source/libraries/mimalloc/include/mimalloc/prim.h
+@@ -203,16 +203,14 @@ static inline void mi_prim_tls_slot_set(size_t slot, void* value) mi_attr_noexce
+
+ #endif
+
+-// Do we have __builtin_thread_pointer? (do not make this a compound test as that fails on older gcc's, see issue #851)
+-#ifdef __has_builtin
+- #if __has_builtin(__builtin_thread_pointer)
+- #if (!defined(__APPLE__)) && /* on apple (M1) the wrong register is read (tpidr_el0 instead of tpidrro_el0) so fall back to TLS slot assembly (<https://github.com/microsoft/mimalloc/issues/343#issuecomment-763272369>)*/ \
+- (!defined(__clang_major__) || __clang_major__ >= 14) // older clang versions emit bad code; fall back to using the TLS slot (<https://lore.kernel.org/linux-arm-kernel/202110280952.352F66D8@keescook/T/>)
+- #define MI_HAS_BUILTIN_THREAD_POINTER 1
+- #endif
+- #endif
+-#elif defined(__GNUC__) && (__GNUC__ >= 7) && defined(__aarch64__) // special case aarch64 for older gcc versions (issue #851)
+-#define MI_HAS_BUILTIN_THREAD_POINTER 1
++// Do we have __builtin_thread_pointer? This would be the preferred way to get a unique thread id
++// but unfortunately, it seems we cannot test for this reliably at this time (see issue #883)
++// Nevertheless, it seems needed on older graviton platforms (see issue #851).
++// For now, we only enable this for specific platforms.
++#if defined(__GNUC__) && (__GNUC__ >= 7) && defined(__aarch64__) /* special case aarch64 for older gcc versions (issue #851) */ \
++ && !defined(__APPLE__) /* on apple (M1) the wrong register is read (tpidr_el0 instead of tpidrro_el0) so fall back to TLS slot assembly (<https://github.com/microsoft/mimalloc/issues/343#issuecomment-763272369>)*/ \
++ && (!defined(__clang_major__) || __clang_major__ >= 14) /* older clang versions emit bad code; fall back to using the TLS slot (<https://lore.kernel.org/linux-arm-kernel/202110280952.352F66D8@keescook/T/>) */
++#define MI_USE_BUILTIN_THREAD_POINTER 1
+ #endif
+
+
+@@ -234,6 +232,13 @@ static inline mi_threadid_t _mi_prim_thread_id(void) mi_attr_noexcept {
+ return (uintptr_t)NtCurrentTeb();
+ }
+
++#elif MI_USE_BUILTIN_THREAD_POINTER
++
++static inline mi_threadid_t _mi_prim_thread_id(void) mi_attr_noexcept {
++ // Works on most Unix based platforms with recent compilers
++ return (uintptr_t)__builtin_thread_pointer();
++}
++
+ #elif defined(MI_HAS_TLS_SLOT)
+
+ static inline mi_threadid_t _mi_prim_thread_id(void) mi_attr_noexcept {
+@@ -249,13 +254,6 @@ static inline mi_threadid_t _mi_prim_thread_id(void) mi_attr_noexcept {
+ #endif
+ }
+
+-#elif MI_HAS_BUILTIN_THREAD_POINTER
+-
+-static inline mi_threadid_t _mi_prim_thread_id(void) mi_attr_noexcept {
+- // Works on most Unix based platforms
+- return (uintptr_t)__builtin_thread_pointer();
+-}
+-
+ #else
+
+ // otherwise use portable C, taking the address of a thread local variable (this is still very fast on most platforms).
--- /dev/null
+Description: Do not build mimalloc as static lib
+Author: Hilmar Preusse <hille42@web.de>
+Last-Update: 2024-05-18
+Forwarded: not-needed
+
+--- luametatex.orig/CMakeLists.txt
++++ luametatex/CMakeLists.txt
+@@ -262,7 +262,7 @@
+ add_definitions(-DLUAMETATEX_USE_MIMALLOC=1)
+ # add_definitions(-DMIMALLOC_RESET_DELAY=250)
+ # set(luametatex_use_mimalloc 1)
+- include(cmake/mimalloc.cmake)
++ #include(cmake/mimalloc.cmake)
+ endif()
+
+ include(cmake/tex.cmake)
--- /dev/null
+Description: Link with libatomic on some arches.
+Author: Hilmar Preusse <hille42@web.de>
+Last-Update: 2024-02-21
+Forwarded: not needed.
+
+--- luametatex.orig/cmake/luametatex.cmake
++++ luametatex/cmake/luametatex.cmake
+@@ -1,3 +1,13 @@
++# Debian: determine host arch.
++execute_process(COMMAND
++ dpkg-architecture
++ -qDEB_HOST_ARCH
++ OUTPUT_VARIABLE
++ CMAKE_DEB_HOST_ARCH
++ OUTPUT_STRIP_TRAILING_WHITESPACE
++)
++
++
+ add_compile_options(-DLUA_CORE)
+
+ set(luametatex_sources
+@@ -69,6 +79,13 @@
+ )
+ endif()
+
++# Debian: link with atomic on specific arches.
++if(${CMAKE_DEB_HOST_ARCH} MATCHES "m68k" OR ${CMAKE_DEB_HOST_ARCH} MATCHES "powerpc" OR ${CMAKE_DEB_HOST_ARCH} MATCHES "sh4" OR ${CMAKE_DEB_HOST_ARCH} MATCHES "armel")
++ target_link_libraries(luametatex
++ atomic
++)
++endif()
++
+ if (${CMAKE_HOST_SOLARIS})
+ target_link_libraries(luametatex
+ rt
--- /dev/null
+Description: Do not strip binary after build.
+Author: Hilmar Preusse <hille42@web.de>
+Last-Update: 2023-04-17
+Forwarded: not-needed
+
+--- luametatex.orig/cmake/luametatex.cmake
++++ luametatex/cmake/luametatex.cmake
+@@ -77,14 +77,3 @@
+ resolv
+ )
+ endif()
+-
+-if (DEFINED LMT_OPTIMIZE)
+- # we strip anyway
+-elseif (CMAKE_HOST_SOLARIS)
+- # no strip
+-elseif (CMAKE_C_COMPILER_ID MATCHES "GNU")
+- # -g -S -d : remove all debugging symbols & sections
+- # -x : remove all non-global symbols
+- # -X : remove any compiler-generated symbols
+- add_custom_command(TARGET luametatex POST_BUILD COMMAND ${CMAKE_STRIP} -g -S -d -x luametatex${CMAKE_EXECUTABLE_SUFFIX})
+-endif()
+--- luametatex.orig/CMakeLists.txt
++++ luametatex/CMakeLists.txt
+@@ -33,7 +33,7 @@
+ # nice (the smaller as runner the better). After all, we don't load external (Lua) libraries
+ # anyway.
+
+-set(LMT_STRIP 1)
++# set(LMT_STRIP 1)
+
+ if (MSVC)
+
--- /dev/null
+dynamic_linking.diff
+no_strip.diff
+link_atomic.diff
+#146f9d2333bc0aeed1593dc659b17e65b38a33e7.patch
+#cc3c14f2ed374f908e60a3bf29c1dff84fc8cfc2.patch
--- /dev/null
+#!/usr/bin/make -f
+
+# See debhelper(7) (uncomment to enable).
+# Output every command that modifies files on the build system.
+#export DH_VERBOSE = 1
+
+
+# See FEATURE AREAS in dpkg-buildflags(1).
+export DEB_BUILD_MAINT_OPTIONS = hardening=+all
+
+# See ENVIRONMENT in dpkg-buildflags(1).
+# Package maintainers to append CFLAGS.
+#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
+# Package maintainers to append LDFLAGS.
+#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
+
+
+%:
+ dh $@
+
+
+#override_dh_auto_configure:
+# dh_auto_configure -- \
+# -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)
--- /dev/null
+3.0 (quilt)
--- /dev/null
+Bug-Database: https://github.com/contextgarden/luametatex/issues
+Bug-Submit: https://github.com/contextgarden/luametatex/issues/new
+Repository-Browse: https://github.com/contextgarden/luametatex
+Repository: https://github.com/contextgarden/luametatex.git
--- /dev/null
+# See uscan(1) for format.
+
+# Compulsory line, this is a version 4 file.
+version=4
+
+# PGP signature mangle, so foo.tar.gz has foo.tar.gz.sig.
+#opts="pgpsigurlmangle=s%$%.sig%"
+
+# HTTP site (basic).
+#http://example.com/downloads.html \
+# files/luametatex-([\d\.]+)\.tar\.gz
+
+# Uncomment to examine an FTP server.
+#ftp://ftp.example.com/pub/luametatex-(.*)\.tar\.gz
+
+# SourceForge hosted projects.
+#http://sf.net/luametatex/ luametatex-(.*)\.tar\.gz
+
+# GitHub hosted projects.
+#opts="filenamemangle=s%(?:.*?)?v?(@ANY_VERSION@@ARCHIVE_EXT@)%@PACKAGE@-$1%" \
+# https://github.com/contextgarden/luametatex/tags \
+# (?:.*?/)v?@ANY_VERSION@@ARCHIVE_EXT@
+opts=repack,repacksuffix=+ds,compression=gz,dversionmangle=s/\+ds// \
+ https://github.com/contextgarden/luametatex/tags \
+ (?:.*?/)v?@ANY_VERSION@@ARCHIVE_EXT@
+
+# PyPI.
+#https://pypi.debian.net/luametatex/luametatex-(.+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))
+
+# Direct Git.
+#opts="mode=git" http://git.example.com/luametatex.git \
+# refs/tags/v([\d\.]+)