Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/extra
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2023-05-22 20:18:50 +0200
committerErich Eckner <git@eckner.net>2023-05-22 20:18:50 +0200
commite74cde76c104df82b120a7b13964cb786da8f565 (patch)
tree39967e24037929c04aaf79922aa260b437a60a5e /extra
parent73e1d3b448cc583ab38cae4d61a26f313fad946b (diff)
community -> extra
Diffstat (limited to 'extra')
-rw-r--r--extra/acpi_call-lts/PKGBUILD13
-rw-r--r--extra/acpi_call/PKGBUILD13
-rw-r--r--extra/alacritty/PKGBUILD9
-rw-r--r--extra/allure/PKGBUILD0
-rw-r--r--extra/aubio/PKGBUILD19
-rw-r--r--extra/aubio/assert-almost.patch27
-rw-r--r--extra/auth-tarball-from-git/PKGBUILD8
-rw-r--r--extra/autopep8/PKGBUILD1
-rw-r--r--extra/bazel/PKGBUILD11
-rw-r--r--extra/binaryen/PKGBUILD6
-rw-r--r--extra/blender/PKGBUILD59
-rw-r--r--extra/blender/blender-idprop_create-static-assert-float.patch12
-rw-r--r--extra/blender/no-sse2.patch12
-rw-r--r--extra/boost178-libs/PKGBUILD102
-rw-r--r--extra/boost179-libs/PKGBUILD102
-rw-r--r--extra/boost180-libs/PKGBUILD102
-rw-r--r--extra/borg/PKGBUILD9
-rw-r--r--extra/broadcom-wl-dkms/PKGBUILD4
-rw-r--r--extra/calibre/PKGBUILD14
-rw-r--r--extra/carla/PKGBUILD27
-rw-r--r--extra/carla/carla-git-no-sse.patch74
-rw-r--r--extra/carla/carla-git-no-sse2.patch74
-rw-r--r--extra/chezmoi/PKGBUILD8
-rw-r--r--extra/clementine/PKGBUILD25
-rw-r--r--extra/codeblocks/PKGBUILD8
-rw-r--r--extra/coin-or-cbc/PKGBUILD2
-rw-r--r--extra/consul/PKGBUILD13
-rw-r--r--extra/containerd/PKGBUILD2
-rw-r--r--extra/coq/PKGBUILD18
-rw-r--r--extra/crun/PKGBUILD2
-rw-r--r--extra/crypto++/PKGBUILD9
-rw-r--r--extra/dart/PKGBUILD3
-rw-r--r--extra/dbeaver/PKGBUILD8
-rw-r--r--extra/dgen-sdl/PKGBUILD9
-rw-r--r--extra/dhall/PKGBUILD7
-rw-r--r--extra/diffoscope/PKGBUILD1
-rw-r--r--extra/dmd/PKGBUILD2
-rw-r--r--extra/dolphin-emu/PKGBUILD6
-rw-r--r--extra/dtc/PKGBUILD3
-rw-r--r--extra/dwarffortress/PKGBUILD7
-rw-r--r--extra/e3/PKGBUILD8
-rw-r--r--extra/electron/PKGBUILD16
-rw-r--r--extra/electron/allow-i686.patch14
-rw-r--r--extra/embree/PKGBUILD27
-rw-r--r--extra/embree/embree-3.2.0-intrinsic.patch12
-rw-r--r--extra/exa/PKGBUILD25
-rw-r--r--extra/fasm/PKGBUILD13
-rw-r--r--extra/fig2dev/PKGBUILD12
-rw-r--r--extra/fio/PKGBUILD3
-rw-r--r--extra/fpc/PKGBUILD28
-rw-r--r--extra/freebasic/PKGBUILD11
-rw-r--r--extra/freecad/PKGBUILD16
-rw-r--r--extra/fzf/PKGBUILD6
-rw-r--r--extra/gap/PKGBUILD6
-rw-r--r--extra/gdal/PKGBUILD35
-rw-r--r--extra/ghc/PKGBUILD11
-rw-r--r--extra/ghdl/PKGBUILD2
-rw-r--r--extra/gitlab-runner/PKGBUILD6
-rw-r--r--extra/gitlab/PKGBUILD10
-rw-r--r--extra/glfw/PKGBUILD14
-rw-r--r--extra/go/PKGBUILD52
-rw-r--r--extra/go/go-x87.patch28
-rw-r--r--extra/grafana/PKGBUILD7
-rw-r--r--extra/grpc/PKGBUILD12
-rw-r--r--extra/gtest/PKGBUILD8
-rw-r--r--extra/handbrake/PKGBUILD8
-rw-r--r--extra/haskell-aeson/PKGBUILD10
-rw-r--r--extra/haskell-bsb-http-chunked/PKGBUILD2
-rw-r--r--extra/haskell-gauge/PKGBUILD15
-rw-r--r--extra/haskell-hedgehog/PKGBUILD2
-rw-r--r--extra/haskell-hslua-module-text/PKGBUILD3
-rw-r--r--extra/haskell-hslua/PKGBUILD15
-rw-r--r--extra/haskell-microlens-aeson/PKGBUILD11
-rw-r--r--extra/haskell-pantry/PKGBUILD2
-rw-r--r--extra/haskell-servant-swagger/PKGBUILD30
-rw-r--r--extra/heaptrack/49577e019ea791ee63962cdfe7e9c0c5b5c6ea4b.patch25
-rw-r--r--extra/heaptrack/76fd2e84ba133e96d2cfdf90cb715e66e923eb8f.patch16
-rw-r--r--extra/heaptrack/PKGBUILD15
-rw-r--r--extra/heaptrack/c456f6a1575fb2834238a1f693e7c7787d768d42.patch13
-rw-r--r--extra/helm-synth/PKGBUILD10
-rw-r--r--extra/helm-synth/helm-0.9.0-sigemptyset-glibc-2.26.patch15
-rw-r--r--extra/hotdoc/PKGBUILD7
-rw-r--r--extra/imapsync/PKGBUILD2
-rw-r--r--extra/intel-graphics-compiler/PKGBUILD5
-rw-r--r--extra/ipxe/PKGBUILD14
-rw-r--r--extra/ispc/PKGBUILD41
-rw-r--r--extra/ispc/ispc-1.16.1-host-amd64.patch16
-rw-r--r--extra/john/PKGBUILD51
-rw-r--r--extra/julia/PKGBUILD31
-rw-r--r--extra/kernel-headers-musl/PKGBUILD16
-rw-r--r--extra/keybase/PKGBUILD10
-rw-r--r--extra/kodi/PKGBUILD1
-rw-r--r--extra/ksh/PKGBUILD9
-rw-r--r--extra/kustomize/PKGBUILD3
-rw-r--r--extra/kvazaar/PKGBUILD2
-rw-r--r--extra/ldc/PKGBUILD2
-rw-r--r--extra/libantlr3c/PKGBUILD7
-rw-r--r--extra/libavif/PKGBUILD20
-rw-r--r--extra/libffado/PKGBUILD32
-rw-r--r--extra/libffi33/PKGBUILD50
-rw-r--r--extra/libfilezilla/PKGBUILD11
-rw-r--r--extra/libgda/PKGBUILD26
-rw-r--r--extra/libgda/java.patch36
-rw-r--r--extra/libjxl/PKGBUILD20
-rw-r--r--extra/libkeccak/PKGBUILD19
-rw-r--r--extra/libkeccak/libkeccak-1.2.2-no-valgrind.patch15
-rw-r--r--extra/libmysofa/PKGBUILD5
-rw-r--r--extra/libnids/PKGBUILD17
-rw-r--r--extra/libnids/libnids-1.24-inline.patch46
-rw-r--r--extra/libretro-blastem/PKGBUILD6
-rw-r--r--extra/libretro-pcsx-rearmed/PKGBUILD1
-rw-r--r--extra/libvirt/PKGBUILD36
-rw-r--r--extra/linux-tools/PKGBUILD60
-rw-r--r--extra/luajit/PKGBUILD69
-rw-r--r--extra/luajit/c7815e1a1b49871e645252bb12e722fb4879df11.patch1668
-rw-r--r--extra/luajit/luajit-2.0-505e2c0-i486.patch2366
-rw-r--r--extra/mame/PKGBUILD6
-rw-r--r--extra/mate-sensors-applet/PKGBUILD3
-rw-r--r--extra/midori/PKGBUILD2
-rw-r--r--extra/mixxx/PKGBUILD7
-rw-r--r--extra/mongo-c-driver/PKGBUILD1
-rw-r--r--extra/mpv/PKGBUILD5
-rw-r--r--extra/mupdf/PKGBUILD4
-rw-r--r--extra/mysql-workbench/PKGBUILD16
-rw-r--r--extra/mysql-workbench/mysql-workbench-community-6.3.10-32bit.patch123
-rw-r--r--extra/netcdf-openmpi/PKGBUILD11
-rw-r--r--extra/netcdf/PKGBUILD19
-rw-r--r--extra/netplan/PKGBUILD13
-rw-r--r--extra/netplan/netplan-0.102-no-pandoc.patch22
-rw-r--r--extra/netsurf/PKGBUILD1
-rw-r--r--extra/newsboat-og/PKGBUILD33
-rw-r--r--extra/nodejs-lts-fermium/PKGBUILD3
-rw-r--r--extra/nodejs/PKGBUILD35
-rw-r--r--extra/nodejs/node-17.1.0-atomic.patch40
-rw-r--r--extra/npm/PKGBUILD22
-rw-r--r--extra/nvchecker/PKGBUILD2
-rw-r--r--extra/octave/PKGBUILD4
-rw-r--r--extra/opam/PKGBUILD3
-rw-r--r--extra/opencascade/PKGBUILD2
-rw-r--r--extra/openipmi/PKGBUILD2
-rw-r--r--extra/openscenegraph/PKGBUILD6
-rw-r--r--extra/opensubdiv/PKGBUILD19
-rw-r--r--extra/openvdb/PKGBUILD23
-rw-r--r--extra/openvdb/openvdb-8.0.1-i486-atomic.patch12
-rw-r--r--extra/pacman-contrib/PKGBUILD9
-rw-r--r--extra/pacman-contrib/rankmirror.sh.diff16
-rw-r--r--extra/pacutils/PKGBUILD10
-rw-r--r--extra/pandoc-cli/PKGBUILD2
-rw-r--r--extra/percona-server/LF_PINS-size.patch11
-rw-r--r--extra/percona-server/PKGBUILD36
-rw-r--r--extra/perl-cgi/PKGBUILD9
-rw-r--r--extra/perl-image-sane/PKGBUILD2
-rw-r--r--extra/perl-term-readline-gnu/PKGBUILD3
-rw-r--r--extra/pifpaf/PKGBUILD6
-rw-r--r--extra/ponyc/PKGBUILD19
-rw-r--r--extra/postgrest/PKGBUILD9
-rw-r--r--extra/prjtrellis/PKGBUILD18
-rw-r--r--extra/prusa-slicer/PKGBUILD2
-rw-r--r--extra/psensor/PKGBUILD3
-rw-r--r--extra/pypy/PKGBUILD5
-rw-r--r--extra/pypy3/PKGBUILD5
-rw-r--r--extra/python-apipkg/PKGBUILD7
-rw-r--r--extra/python-autobahn/PKGBUILD3
-rw-r--r--extra/python-babel/PKGBUILD10
-rw-r--r--extra/python-build/PKGBUILD25
-rw-r--r--extra/python-cairocffi/PKGBUILD9
-rw-r--r--extra/python-commonmark/PKGBUILD17
-rw-r--r--extra/python-debugpy/PKGBUILD11
-rw-r--r--extra/python-docs/PKGBUILD1
-rw-r--r--extra/python-factory-boy/PKGBUILD2
-rw-r--r--extra/python-faker/PKGBUILD18
-rw-r--r--extra/python-flit-core/PKGBUILD6
-rw-r--r--extra/python-flit/PKGBUILD10
-rw-r--r--extra/python-fsspec/PKGBUILD4
-rw-r--r--extra/python-hglib/PKGBUILD11
-rw-r--r--extra/python-httpcore/PKGBUILD2
-rw-r--r--extra/python-httpx/PKGBUILD2
-rw-r--r--extra/python-hypothesis/PKGBUILD8
-rw-r--r--extra/python-installer/PKGBUILD23
-rw-r--r--extra/python-iwlib/PKGBUILD8
-rw-r--r--extra/python-jaraco.context/PKGBUILD18
-rw-r--r--extra/python-jaraco.functools/PKGBUILD13
-rw-r--r--extra/python-jaraco.text/PKGBUILD18
-rw-r--r--extra/python-jedi/PKGBUILD15
-rw-r--r--extra/python-libevdev/PKGBUILD11
-rw-r--r--extra/python-libnacl/PKGBUILD15
-rw-r--r--extra/python-matplotlib/PKGBUILD14
-rw-r--r--extra/python-mongoengine/PKGBUILD1
-rw-r--r--extra/python-more-itertools/PKGBUILD8
-rw-r--r--extra/python-networkx/PKGBUILD7
-rw-r--r--extra/python-pluggy/PKGBUILD7
-rw-r--r--extra/python-pyproject-hooks/PKGBUILD8
-rw-r--r--extra/python-pytest/PKGBUILD7
-rw-r--r--extra/python-pyudev/PKGBUILD15
-rw-r--r--extra/python-pyvirtualdisplay/PKGBUILD2
-rw-r--r--extra/python-scipy/PKGBUILD11
-rw-r--r--extra/python-setuptools-scm/PKGBUILD9
-rw-r--r--extra/python-shapely/PKGBUILD23
-rw-r--r--extra/python-shapely/load_dll_c.patch13
-rw-r--r--extra/python-simplejson/PKGBUILD4
-rw-r--r--extra/python-sphinxcontrib-applehelp/PKGBUILD2
-rw-r--r--extra/python-sphinxcontrib-devhelp/PKGBUILD2
-rw-r--r--extra/python-sphinxcontrib-htmlhelp/PKGBUILD3
-rw-r--r--extra/python-sphinxcontrib-jsmath/PKGBUILD2
-rw-r--r--extra/python-sphinxcontrib-serializinghtml/PKGBUILD2
-rw-r--r--extra/python-tqdm/PKGBUILD11
-rw-r--r--extra/python-tqdm/tqdm-4.22.0-sleep-test-workaround.patch12
-rw-r--r--extra/python-wheel/PKGBUILD9
-rw-r--r--extra/python-xarray/PKGBUILD2
-rw-r--r--extra/qcad/PKGBUILD8
-rw-r--r--extra/qtile/PKGBUILD10
-rw-r--r--extra/rathole/PKGBUILD3
-rw-r--r--extra/redis/PKGBUILD9
-rw-r--r--extra/reflector/PKGBUILD15
-rw-r--r--extra/ruby-bigdecimal/PKGBUILD8
-rw-r--r--extra/ruby-cgi/PKGBUILD8
-rw-r--r--extra/ruby-date/PKGBUILD8
-rw-r--r--extra/ruby-digest/PKGBUILD8
-rw-r--r--extra/ruby-etc/PKGBUILD8
-rw-r--r--extra/ruby-fcntl/PKGBUILD8
-rw-r--r--extra/ruby-fiddle/PKGBUILD8
-rw-r--r--extra/ruby-io-console/PKGBUILD8
-rw-r--r--extra/ruby-io-nonblock/PKGBUILD8
-rw-r--r--extra/ruby-io-wait/PKGBUILD8
-rw-r--r--extra/ruby-json/PKGBUILD8
-rw-r--r--extra/ruby-psych/PKGBUILD8
-rw-r--r--extra/ruby-racc/PKGBUILD8
-rw-r--r--extra/ruby-stringio/PKGBUILD8
-rw-r--r--extra/ruby/PKGBUILD17
-rw-r--r--extra/rxvt-unicode/PKGBUILD13
-rw-r--r--extra/s2n-tls/PKGBUILD7
-rw-r--r--extra/sarg/PKGBUILD8
-rw-r--r--extra/sarg/no-werror.patch23
-rw-r--r--extra/sensors-applet/PKGBUILD3
-rw-r--r--extra/serialdv/PKGBUILD6
-rw-r--r--extra/skim/PKGBUILD11
-rw-r--r--extra/smbnetfs/PKGBUILD10
-rw-r--r--extra/sonic-visualiser/PKGBUILD6
-rw-r--r--extra/spiped/PKGBUILD2
-rw-r--r--extra/spirv-llvm-translator/PKGBUILD15
-rw-r--r--extra/spring/PKGBUILD14
-rw-r--r--extra/spring/gold-linker.patch26
-rw-r--r--extra/squid/PKGBUILD13
-rw-r--r--extra/stratisd/PKGBUILD6
-rw-r--r--extra/swi-prolog/PKGBUILD11
-rw-r--r--extra/teamspeak3-server/PKGBUILD14
-rw-r--r--extra/teamspeak3/PKGBUILD15
-rw-r--r--extra/teeworlds/PKGBUILD6
-rw-r--r--extra/tensorflow/PKGBUILD13
-rw-r--r--extra/terraform/PKGBUILD1
-rw-r--r--extra/testssl.sh/PKGBUILD2
-rw-r--r--extra/thrift/PKGBUILD8
-rw-r--r--extra/tinyemu/PKGBUILD11
-rw-r--r--extra/tpm2-tools/PKGBUILD3
-rw-r--r--extra/tpm2-tss-engine/PKGBUILD3
-rw-r--r--extra/tpm2-tss-engine/tpm2-tss-engine_check.sh3
-rw-r--r--extra/v2ray/PKGBUILD9
-rw-r--r--extra/vamp-aubio-plugins/PKGBUILD11
-rw-r--r--extra/vault/PKGBUILD6
-rw-r--r--extra/vbam/PKGBUILD1
-rw-r--r--extra/virtualbox/PKGBUILD49
-rw-r--r--extra/vtk/PKGBUILD4
-rw-r--r--extra/wine-gecko/PKGBUILD6
-rw-r--r--extra/wine/30-win32-aliases.conf20
-rw-r--r--extra/wine/PKGBUILD154
-rw-r--r--extra/wine/wine-binfmt.conf2
-rw-r--r--extra/wine/wine.install7
-rw-r--r--extra/xaos/PKGBUILD14
-rw-r--r--extra/xaos/xaos.patch22
-rw-r--r--extra/yder/PKGBUILD2
-rw-r--r--extra/z3/PKGBUILD9
-rw-r--r--extra/zeroc-ice/PKGBUILD7
-rw-r--r--extra/zeromq/PKGBUILD9
-rw-r--r--extra/zig/PKGBUILD3
274 files changed, 7932 insertions, 0 deletions
diff --git a/extra/acpi_call-lts/PKGBUILD b/extra/acpi_call-lts/PKGBUILD
new file mode 100644
index 00000000..891b535f
--- /dev/null
+++ b/extra/acpi_call-lts/PKGBUILD
@@ -0,0 +1,13 @@
+eval "$(
+ declare -f package \
+ | sed '
+ /\$CARCH/ {
+ h
+ s/^/[ "$CARCH" = pentium4 ] || /
+ p
+ g
+ s/\$CARCH/i686/g
+ s/^/[ "$CARCH" != pentium4 ] || /
+ }
+ '
+)"
diff --git a/extra/acpi_call/PKGBUILD b/extra/acpi_call/PKGBUILD
new file mode 100644
index 00000000..891b535f
--- /dev/null
+++ b/extra/acpi_call/PKGBUILD
@@ -0,0 +1,13 @@
+eval "$(
+ declare -f package \
+ | sed '
+ /\$CARCH/ {
+ h
+ s/^/[ "$CARCH" = pentium4 ] || /
+ p
+ g
+ s/\$CARCH/i686/g
+ s/^/[ "$CARCH" != pentium4 ] || /
+ }
+ '
+)"
diff --git a/extra/alacritty/PKGBUILD b/extra/alacritty/PKGBUILD
new file mode 100644
index 00000000..381c5f82
--- /dev/null
+++ b/extra/alacritty/PKGBUILD
@@ -0,0 +1,9 @@
+# patch architecture for fetching the right rust modules
+# do not verify PGP signatures (fails)
+eval "$(
+ declare -f prepare | \
+ sed '
+ s|$CARCH|i686|g
+ /auth-tarball-from-git/d
+ '
+)"
diff --git a/extra/allure/PKGBUILD b/extra/allure/PKGBUILD
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/extra/allure/PKGBUILD
diff --git a/extra/aubio/PKGBUILD b/extra/aubio/PKGBUILD
new file mode 100644
index 00000000..578b458a
--- /dev/null
+++ b/extra/aubio/PKGBUILD
@@ -0,0 +1,19 @@
+eval "$(
+ declare -f prepare | \
+ sed '
+ /^{/ a patch -d "${pkgbase}-${pkgver}" -p1 -i "${srcdir}/assert-almost.patch"
+ '
+)"
+source+=(assert-almost.patch)
+sha512sums+=('3a946aaf305ee93ad70ca3b26529fdd58822c9bd177b5a00ace99426b1ba50672d24331d13b6b172a0f8d01ed23feea478b6a15f379d6affa796eb6c2aaadeb2')
+b2sums+=('44d2e64fd38d9f57c2e281e3a656f4bf66ccc9c4434a75c216c7605df25f4383256d57d9cacf3ea46b2eaaa8de52ef460d82bf4500d46591caf0a1a26bd25b2a')
+
+# CARCH -> pentium4 bug
+if [ "${CARCH}" = "pentium4" ]; then
+ eval "$(
+ declare -f check | \
+ sed '
+ s/$CARCH/i686/
+ '
+ )"
+fi
diff --git a/extra/aubio/assert-almost.patch b/extra/aubio/assert-almost.patch
new file mode 100644
index 00000000..9951636e
--- /dev/null
+++ b/extra/aubio/assert-almost.patch
@@ -0,0 +1,27 @@
+--- a/python/tests/test_hztomel.py 2019-03-07 15:05:44.804472410 +0100
++++ b/python/tests/test_hztomel.py 2019-03-07 15:05:44.804472410 +0100
+@@ -17,10 +17,10 @@
+ assert_equal(hztomel(0.), 0.)
+ assert_almost_equal(hztomel(400. / 3.), 2., decimal=5)
+ assert_almost_equal(hztomel(1000. / 3), 5.)
+- assert_equal(hztomel(200.), 3.)
++ assert_almost_equal(hztomel(200.), 3.)
+ assert_almost_equal(hztomel(1000.), 15)
+- assert_almost_equal(hztomel(6400), 42)
+- assert_almost_equal(hztomel(40960), 69)
++ assert_almost_equal(hztomel(6400), 42, decimal=5)
++ assert_almost_equal(hztomel(40960), 69, decimal=5)
+
+ for m in np.linspace(0, 1000, 100):
+ assert_almost_equal(hztomel(meltohz(m)) - m, 0, decimal=3)
+--- a/python/tests/test_hztomel.py 2019-03-07 15:16:06.396709250 +0100
++++ b/python/tests/test_hztomel.py 2019-03-07 15:16:06.396709250 +0100
+@@ -28,7 +28,7 @@
+ def test_meltohz(self):
+ assert_equal(meltohz(0.), 0.)
+ assert_almost_equal(meltohz(2), 400. / 3., decimal=4)
+- assert_equal(meltohz(3.), 200.)
++ assert_almost_equal(meltohz(3.), 200., decimal=5)
+ assert_almost_equal(meltohz(5), 1000. / 3., decimal=4)
+ assert_almost_equal(meltohz(15), 1000., decimal=4)
+ assert_almost_equal(meltohz(42), 6400., decimal=2)
diff --git a/extra/auth-tarball-from-git/PKGBUILD b/extra/auth-tarball-from-git/PKGBUILD
new file mode 100644
index 00000000..4898d5c6
--- /dev/null
+++ b/extra/auth-tarball-from-git/PKGBUILD
@@ -0,0 +1,8 @@
+# patch architecture for fetching the right rust modules
+eval "$(
+ declare -f prepare | \
+ sed '
+ s|$CARCH|i686|g
+ '
+)"
+
diff --git a/extra/autopep8/PKGBUILD b/extra/autopep8/PKGBUILD
new file mode 100644
index 00000000..3692e5fe
--- /dev/null
+++ b/extra/autopep8/PKGBUILD
@@ -0,0 +1 @@
+unset check
diff --git a/extra/bazel/PKGBUILD b/extra/bazel/PKGBUILD
new file mode 100644
index 00000000..7dd96e62
--- /dev/null
+++ b/extra/bazel/PKGBUILD
@@ -0,0 +1,11 @@
+depends=("${depends[@]/java-environment>=8/java-environment=8}")
+
+eval "$(
+ {
+ declare -f prepare || \
+ printf 'prepare() {\n}\n'
+ } \
+ | sed '
+ $i sed -i '"'"'s|#error This code for 64 bit Unix|//#error This code for 64 bit Unix|g'"'"' ${srcdir}/src/tools/singlejar/mapped_file.h
+ '
+)"
diff --git a/extra/binaryen/PKGBUILD b/extra/binaryen/PKGBUILD
new file mode 100644
index 00000000..62ac4c82
--- /dev/null
+++ b/extra/binaryen/PKGBUILD
@@ -0,0 +1,6 @@
+eval "$(
+ declare -f package | \
+ sed '
+ /.*\usr\/lib64.*/d
+ '
+)"
diff --git a/extra/blender/PKGBUILD b/extra/blender/PKGBUILD
new file mode 100644
index 00000000..97c987b0
--- /dev/null
+++ b/extra/blender/PKGBUILD
@@ -0,0 +1,59 @@
+makedepends=(
+ ${makedepends[@]/cuda/}
+)
+depends=(
+ ${depends[@]/openimagedenoise/}
+)
+pkgdesc+=", without CUDA support"
+eval "$(
+ declare -f build \
+ | sed '
+ /^\s*cmake / s/;$/ -DWITH_CYCLES_CUDA_BINARIES=OFF -DWITH_CYCLES_DEVICE_CUDA=OFF -DWITH_RAYOPTIMIZATION=OFF;/
+ '
+)"
+source_i686+=('no-sse2.patch')
+sha512sums_i686+=('87da2bedb90af6dee559ef9d1eb83262ba75fb412aba83dcb2b88fe9c0740ff75ad336331033fec7a14ad6ecc3dd70f8f4742f147594e8dc530197dd51922c01')
+if [ "${CARCH}" = 'i686' ]; then
+ eval "$(
+ declare -f prepare \
+ | sed '
+ $ i patch -Np1 -i "$srcdir"/no-sse2.patch
+ '
+ )"
+fi
+
+# no Nvidia Optix
+pkgdesc+=", without Optix support"
+eval "$(
+ declare -f build \
+ | sed '
+ /^\s*cmake / s/;$/ -DWITH_CYCLES_DEVICE_OPTIX=OFF/
+ '
+)"
+
+# FS32#182: opensubdiv/openexr/openvdb currently fails to rebuild
+depends=(
+ ${depends[@]/opensubdiv/}
+)
+depends=(
+ ${depends[@]/openexr/}
+)
+depends=(
+ ${depends[@]/openvdb/}
+)
+
+# float_t is a long double on 32-bit, but it's a primitive in all cases anyway
+# (seems to be in a part of the blendkernel on i686 only..)
+source+=('blender-idprop_create-static-assert-float.patch')
+sha512sums+=('36b98ec7e53402909a9e531c30b444b1afc22cc597c5bb3393c73862929dcc6275b00a53de6171a81af3c8804d233359d2e797886d0b776e7a9b29b23ce24e3b')
+eval "$(
+ declare -f prepare \
+ | sed '
+ $ i patch -Np1 -i "$srcdir"/blender-idprop_create-static-assert-float.patch
+ '
+)"
+
+# fails happily to build
+depends=(
+ ${depends[@]/openpgl/}
+)
diff --git a/extra/blender/blender-idprop_create-static-assert-float.patch b/extra/blender/blender-idprop_create-static-assert-float.patch
new file mode 100644
index 00000000..5be594e5
--- /dev/null
+++ b/extra/blender/blender-idprop_create-static-assert-float.patch
@@ -0,0 +1,12 @@
+diff -rauN blender/source/blender/blenkernel/intern/idprop_create.cc blender-idprop_create-static-assert-float-patch/source/blender/blenkernel/intern/idprop_create.cc
+--- blender/source/blender/blenkernel/intern/idprop_create.cc 2022-04-03 14:32:20.257350527 +0200
++++ blender-idprop_create-static-assert-float-patch/source/blender/blenkernel/intern/idprop_create.cc 2022-04-03 14:35:17.851234918 +0200
+@@ -92,7 +92,7 @@
+ Span<PrimitiveType> values)
+ {
+ static_assert(std::is_same_v<PrimitiveType, int32_t> || std::is_same_v<PrimitiveType, float_t> ||
+- std::is_same_v<PrimitiveType, double>,
++ std::is_same_v<PrimitiveType, float> || std::is_same_v<PrimitiveType, double>,
+ "Allowed values for PrimitiveType are int32_t, float and double.");
+ static_assert(!std::is_same_v<PrimitiveType, int32_t> || id_property_subtype == IDP_INT,
+ "PrimitiveType and id_property_type do not match (int32_t).");
diff --git a/extra/blender/no-sse2.patch b/extra/blender/no-sse2.patch
new file mode 100644
index 00000000..a32f7c64
--- /dev/null
+++ b/extra/blender/no-sse2.patch
@@ -0,0 +1,12 @@
+diff -rauN blender-vanilla/CMakeLists.txt blender-no-sse2-patch/CMakeLists.txt
+--- blender-vanilla/CMakeLists.txt 2022-04-07 16:36:48.842414275 +0200
++++ blender-no-sse2-patch/CMakeLists.txt 2022-04-07 16:37:12.012470531 +0200
+@@ -981,7 +981,7 @@
+ # Test SIMD support, before platform includes to determine if sse2neon is needed.
+ if(WITH_CPU_SIMD)
+ set(COMPILER_SSE_FLAG)
+- set(COMPILER_SSE2_FLAG)
++# set(COMPILER_SSE2_FLAG)
+
+ # Test Neon first since macOS Arm can compile and run x86-64 SSE binaries.
+ TEST_NEON_SUPPORT()
diff --git a/extra/boost178-libs/PKGBUILD b/extra/boost178-libs/PKGBUILD
new file mode 100644
index 00000000..4c27c20b
--- /dev/null
+++ b/extra/boost178-libs/PKGBUILD
@@ -0,0 +1,102 @@
+# Maintainer: Evangelos Foutras <evangelos@foutrelis.com>
+# Contributor: Levente Polyak <anthraxx[at]archlinux[dot]org>
+# Contributor: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
+# Contributor: Marius Knaust <marius.knaust@gmail.com>
+# Contributor: Ionut Biru <ibiru@archlinux.org>
+# Contributor: Stéphane Gaudreault <stephane@archlinux.org>
+# Contributor: kevin <kevin@archlinux.org>
+# Contributor: Giovanni Scafora <giovanni@archlinux.org>
+# Contributor: Kritoke <kritoke@gamebox.net>
+# Contributor: Luca Roccia <little_rock@users.sourceforge.net>
+
+pkgname=('boost178-libs')
+pkgver=1.78.0
+pkgrel=1
+_srcname=boost_${pkgver//./_}
+pkgdesc="Free peer-reviewed portable C++ source libraries"
+arch=(i486 i686 pentium4 'x86_64')
+url="https://www.boost.org/"
+license=('custom')
+makedepends=('icu' 'python' 'python-numpy' 'bzip2' 'zlib' 'openmpi' 'zstd')
+source=(https://boostorg.jfrog.io/artifactory/main/release/$pkgver/source/$_srcname.tar.gz
+ $pkgname-locale-empty-vector.patch::https://github.com/boostorg/locale/commit/1ff0ead837b3.patch
+ $pkgname-ublas-c++20-iterator.patch::https://github.com/boostorg/ublas/commit/a31e5cffa85f.patch)
+sha256sums=('94ced8b72956591c4775ae2207a9763d3600b30d9d7446562c552f0a14a63be7'
+ '6c05bd362bc18908a7e23eec3b4a714f82c15c722bda4c340778e2f5b1a9bf25'
+ 'aa38addb40d5f44b4a8472029b475e7e6aef1c460509eb7d8edf03491dc1b5ee')
+
+prepare() {
+ cd $_srcname
+
+ # https://github.com/boostorg/locale/issues/52
+ patch -Np1 -d libs/locale <../$pkgname-locale-empty-vector.patch
+
+ # https://github.com/boostorg/ublas/pull/97
+ patch -Np2 -i ../$pkgname-ublas-c++20-iterator.patch
+}
+
+build() {
+ local JOBS="$(sed 's/.*\(-j *[0-9]\+\).*/\1/' <<<$MAKEFLAGS)"
+
+ pushd $_srcname/tools/build
+ ./bootstrap.sh --cxxflags="$CXXFLAGS $LDFLAGS"
+ ./b2 install --prefix="$srcdir"/fakeinstall
+ ln -s b2 "$srcdir"/fakeinstall/bin/bjam
+ popd
+
+ cd $_srcname
+ ./bootstrap.sh --with-toolset=gcc --with-icu --with-python=python3
+
+ # support for OpenMPI
+ echo "using mpi ;" >>project-config.jam
+
+ # boostbook is needed by quickbook
+ install -dm755 "$srcdir"/fakeinstall/share/boostbook
+ cp -a tools/boostbook/{xsl,dtd} "$srcdir"/fakeinstall/share/boostbook/
+
+ # install to $srcdir/fakeinstall in preparation for split packaging
+ ./b2 install \
+ variant=release \
+ debug-symbols=off \
+ threading=multi \
+ runtime-link=shared \
+ link=shared,static \
+ toolset=gcc \
+ python=3.10 \
+ cflags="$CPPFLAGS $CFLAGS -fPIC -O3 -ffat-lto-objects" \
+ cxxflags="$CPPFLAGS $CXXFLAGS -fPIC -O3 -ffat-lto-objects" \
+ linkflags="$LDFLAGS" \
+ --layout=system \
+ $JOBS \
+ \
+ --prefix="$srcdir"/fakeinstall
+}
+
+package_boost178-libs() {
+ pkgdesc+=' (runtime libraries)'
+ depends=('bzip2' 'zlib' 'icu' 'zstd')
+ optdepends=('openmpi: for mpi support')
+
+ install -dm755 "$pkgdir"/usr/lib
+ cp -a fakeinstall/lib/*.so* "$pkgdir"/usr/lib/
+ # no develpment so links, just the so libs
+ rm -f "$pkgdir"/usr/lib/*.so
+
+ install -Dm644 -t "$pkgdir/usr/share/licenses/$pkgname" $_srcname/LICENSE_1_0.txt
+}
+
+# vim:set ts=2 sw=2 et:
+# no LTO on i486
+if [ "$CARCH" = 'i486' ]; then
+ sed -i '
+ 1i options=(!lto)
+ ' PKGBUILD
+fi
+if [ "$CARCH" == 'i486' ]; then
+ eval "$(
+ declare -f build | \
+ sed '
+ s/-ffat-lto-objects//g
+ '
+ )"
+fi
diff --git a/extra/boost179-libs/PKGBUILD b/extra/boost179-libs/PKGBUILD
new file mode 100644
index 00000000..8836c875
--- /dev/null
+++ b/extra/boost179-libs/PKGBUILD
@@ -0,0 +1,102 @@
+# Maintainer: Evangelos Foutras <evangelos@foutrelis.com>
+# Contributor: Levente Polyak <anthraxx[at]archlinux[dot]org>
+# Contributor: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
+# Contributor: Marius Knaust <marius.knaust@gmail.com>
+# Contributor: Ionut Biru <ibiru@archlinux.org>
+# Contributor: Stéphane Gaudreault <stephane@archlinux.org>
+# Contributor: kevin <kevin@archlinux.org>
+# Contributor: Giovanni Scafora <giovanni@archlinux.org>
+# Contributor: Kritoke <kritoke@gamebox.net>
+# Contributor: Luca Roccia <little_rock@users.sourceforge.net>
+
+pkgname=('boost179-libs')
+pkgver=1.79.0
+pkgrel=1
+_srcname=boost_${pkgver//./_}
+pkgdesc="Free peer-reviewed portable C++ source libraries"
+arch=(i486 i686 pentium4 'x86_64')
+url="https://www.boost.org/"
+license=('custom')
+makedepends=('icu' 'python' 'python-numpy' 'bzip2' 'zlib' 'openmpi' 'zstd')
+source=(https://boostorg.jfrog.io/artifactory/main/release/$pkgver/source/$_srcname.tar.gz
+ $pkgname-locale-empty-vector.patch::https://github.com/boostorg/locale/commit/1ff0ead837b3.patch
+ $pkgname-ublas-c++20-iterator.patch::https://github.com/boostorg/ublas/commit/a31e5cffa85f.patch)
+sha256sums=('273f1be93238a068aba4f9735a4a2b003019af067b9c183ed227780b8f36062c'
+ '6c05bd362bc18908a7e23eec3b4a714f82c15c722bda4c340778e2f5b1a9bf25'
+ 'aa38addb40d5f44b4a8472029b475e7e6aef1c460509eb7d8edf03491dc1b5ee')
+
+prepare() {
+ cd $_srcname
+
+ # https://github.com/boostorg/locale/issues/52
+ patch -Np1 -d libs/locale <../$pkgname-locale-empty-vector.patch
+
+ # https://github.com/boostorg/ublas/pull/97
+ patch -Np2 -i ../$pkgname-ublas-c++20-iterator.patch
+}
+
+build() {
+ local JOBS="$(sed 's/.*\(-j *[0-9]\+\).*/\1/' <<<$MAKEFLAGS)"
+
+ pushd $_srcname/tools/build
+ ./bootstrap.sh --cxxflags="$CXXFLAGS $LDFLAGS"
+ ./b2 install --prefix="$srcdir"/fakeinstall
+ ln -s b2 "$srcdir"/fakeinstall/bin/bjam
+ popd
+
+ cd $_srcname
+ ./bootstrap.sh --with-toolset=gcc --with-icu --with-python=python3
+
+ # support for OpenMPI
+ echo "using mpi ;" >>project-config.jam
+
+ # boostbook is needed by quickbook
+ install -dm755 "$srcdir"/fakeinstall/share/boostbook
+ cp -a tools/boostbook/{xsl,dtd} "$srcdir"/fakeinstall/share/boostbook/
+
+ # install to $srcdir/fakeinstall in preparation for split packaging
+ ./b2 install \
+ variant=release \
+ debug-symbols=off \
+ threading=multi \
+ runtime-link=shared \
+ link=shared,static \
+ toolset=gcc \
+ python=3.10 \
+ cflags="$CPPFLAGS $CFLAGS -fPIC -O3 -ffat-lto-objects" \
+ cxxflags="$CPPFLAGS $CXXFLAGS -fPIC -O3 -ffat-lto-objects" \
+ linkflags="$LDFLAGS" \
+ --layout=system \
+ $JOBS \
+ \
+ --prefix="$srcdir"/fakeinstall
+}
+
+package_boost179-libs() {
+ pkgdesc+=' (runtime libraries)'
+ depends=('bzip2' 'zlib' 'icu' 'zstd')
+ optdepends=('openmpi: for mpi support')
+
+ install -dm755 "$pkgdir"/usr/lib
+ cp -a fakeinstall/lib/*.so* "$pkgdir"/usr/lib/
+ # no develpment so links, just the so libs
+ rm -f "$pkgdir"/usr/lib/*.so
+
+ install -Dm644 -t "$pkgdir/usr/share/licenses/$pkgname" $_srcname/LICENSE_1_0.txt
+}
+
+# vim:set ts=2 sw=2 et:
+# no LTO on i486
+if [ "$CARCH" = 'i486' ]; then
+ sed -i '
+ 1i options=(!lto)
+ ' PKGBUILD
+fi
+if [ "$CARCH" == 'i486' ]; then
+ eval "$(
+ declare -f build | \
+ sed '
+ s/-ffat-lto-objects//g
+ '
+ )"
+fi
diff --git a/extra/boost180-libs/PKGBUILD b/extra/boost180-libs/PKGBUILD
new file mode 100644
index 00000000..502a065e
--- /dev/null
+++ b/extra/boost180-libs/PKGBUILD
@@ -0,0 +1,102 @@
+options=(!lto)
+options=(!lto)
+options=(!lto)
+# Maintainer: Evangelos Foutras <evangelos@foutrelis.com>
+# Contributor: Levente Polyak <anthraxx[at]archlinux[dot]org>
+# Contributor: Bart?omiej Piotrowski <bpiotrowski@archlinux.org>
+# Contributor: Marius Knaust <marius.knaust@gmail.com>
+# Contributor: Ionut Biru <ibiru@archlinux.org>
+# Contributor: Stéphane Gaudreault <stephane@archlinux.org>
+# Contributor: kevin <kevin@archlinux.org>
+# Contributor: Giovanni Scafora <giovanni@archlinux.org>
+# Contributor: Kritoke <kritoke@gamebox.net>
+# Contributor: Luca Roccia <little_rock@users.sourceforge.net>
+
+pkgname=('boost180-libs')
+pkgver=1.80.0
+pkgrel=1
+_srcname=boost_${pkgver//./_}
+pkgdesc="Free peer-reviewed portable C++ source libraries"
+arch=(i486 i686 pentium4 'x86_64')
+url="https://www.boost.org/"
+license=('custom')
+makedepends=('icu' 'python' 'python-numpy' 'bzip2' 'zlib' 'openmpi' 'zstd')
+source=(https://boostorg.jfrog.io/artifactory/main/release/$pkgver/source/$_srcname.tar.gz
+ $pkgname-ublas-c++20-iterator.patch::https://github.com/boostorg/ublas/commit/a31e5cffa85f.patch)
+sha256sums=('4b2136f98bdd1f5857f1c3dea9ac2018effe65286cf251534b6ae20cc45e1847'
+ 'aa38addb40d5f44b4a8472029b475e7e6aef1c460509eb7d8edf03491dc1b5ee')
+
+prepare() {
+ cd $_srcname
+
+ # https://github.com/boostorg/ublas/pull/97
+ patch -Np2 -i ../$pkgname-ublas-c++20-iterator.patch
+}
+
+build() {
+ local JOBS="$(sed 's/.*\(-j *[0-9]\+\).*/\1/' <<<$MAKEFLAGS)"
+ local python_version=$(
+ python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
+
+ pushd $_srcname/tools/build
+ ./bootstrap.sh --cxxflags="$CXXFLAGS $LDFLAGS"
+ ./b2 install --prefix="$srcdir"/fakeinstall
+ ln -s b2 "$srcdir"/fakeinstall/bin/bjam
+ popd
+
+ cd $_srcname
+ ./bootstrap.sh --with-toolset=gcc --with-icu --with-python=python3
+
+ # support for OpenMPI
+ echo "using mpi ;" >>project-config.jam
+
+ # boostbook is needed by quickbook
+ install -dm755 "$srcdir"/fakeinstall/share/boostbook
+ cp -a tools/boostbook/{xsl,dtd} "$srcdir"/fakeinstall/share/boostbook/
+
+ # install to $srcdir/fakeinstall in preparation for split packaging
+ ./b2 install \
+ variant=release \
+ debug-symbols=off \
+ threading=multi \
+ runtime-link=shared \
+ link=shared,static \
+ toolset=gcc \
+ python=$python_version \
+ cflags="$CPPFLAGS $CFLAGS -fPIC -O3 -ffat-lto-objects" \
+ cxxflags="$CPPFLAGS $CXXFLAGS -fPIC -O3 -ffat-lto-objects" \
+ linkflags="$LDFLAGS" \
+ --layout=system \
+ $JOBS \
+ \
+ --prefix="$srcdir"/fakeinstall
+}
+
+package_boost180-libs() {
+ pkgdesc+=' (runtime libraries)'
+ depends=('bzip2' 'zlib' 'icu' 'zstd')
+ optdepends=('openmpi: for mpi support')
+
+ install -dm755 "$pkgdir"/usr/lib
+ cp -a fakeinstall/lib/*.so* "$pkgdir"/usr/lib/
+ # no develpment so links, just the so libs
+ rm -f "$pkgdir"/usr/lib/*.so
+
+ install -Dm644 -t "$pkgdir/usr/share/licenses/$pkgname" $_srcname/LICENSE_1_0.txt
+}
+
+# vim:set ts=2 sw=2 et:
+# no LTO on i486
+if [ "$CARCH" = 'i486' ]; then
+ sed -i '
+ 1i options=(!lto)
+ ' PKGBUILD
+fi
+if [ "$CARCH" == 'i486' ]; then
+ eval "$(
+ declare -f build | \
+ sed '
+ s/-ffat-lto-objects//g
+ '
+ )"
+fi
diff --git a/extra/borg/PKGBUILD b/extra/borg/PKGBUILD
new file mode 100644
index 00000000..cede8a2e
--- /dev/null
+++ b/extra/borg/PKGBUILD
@@ -0,0 +1,9 @@
+# CARCH -> pentium4 bug
+if [ "${CARCH}" = "pentium4" ] || [ "${CARCH}" = "i486" ]; then
+ eval "$(
+ declare -f check | \
+ sed '
+ /cd/s/\$CARCH/i686/
+ '
+ )"
+fi
diff --git a/extra/broadcom-wl-dkms/PKGBUILD b/extra/broadcom-wl-dkms/PKGBUILD
new file mode 100644
index 00000000..f16f641c
--- /dev/null
+++ b/extra/broadcom-wl-dkms/PKGBUILD
@@ -0,0 +1,4 @@
+source_i686=("https://docs.broadcom.com/docs-and-downloads/docs/linux_sta/hybrid-v35-nodebug-pcoem-${pkgver//./_}.tar.gz")
+sha256sums_i686=('4f8b70b293ac8cc5c70e571ad5d1878d0f29d133a46fe7869868d9c19b5058cd')
+source_pentium4=("${source_i686[@]}")
+sha256sums_pentium4=("${sha256sums_i686[@]}")
diff --git a/extra/calibre/PKGBUILD b/extra/calibre/PKGBUILD
new file mode 100644
index 00000000..43e09de8
--- /dev/null
+++ b/extra/calibre/PKGBUILD
@@ -0,0 +1,14 @@
+# disable Bonjour testing on build slaves
+eval "$(
+ declare -f check | \
+ sed '
+ s/.*setup.py test/CI=true &/g
+ '
+)"
+
+# ignore checksum
+sha256sums[0]='SKIP'
+
+# disabled testing, too many Python stuff currently broken
+unset check
+unset checkdepends
diff --git a/extra/carla/PKGBUILD b/extra/carla/PKGBUILD
new file mode 100644
index 00000000..aa111698
--- /dev/null
+++ b/extra/carla/PKGBUILD
@@ -0,0 +1,27 @@
+# disable SSE, SSE2 according to platform
+
+if [ "${CARCH}" = "i686" ]; then
+ source+=('carla-git-no-sse2.patch')
+ sha512sums+=('b481a9f9b1e404536a42706a36255216f64e49022c1c0f012e40be2941eb4a74b8d2b2f30998e16678a3d46e57dbeffa6f63259afff5a94a1bc4c7d8ba35a67c')
+ b2sums+=('cb314334ffb6552f11a6d5b3a2de707a846d316956a565ab350afee450c224ab693beace1a0e52b50d9150beca592d5ec79b3e8014bca2c4c8e44450dfbe6ee3')
+ eval "$(
+ declare -f prepare | \
+ sed '
+ /git.*cherry.*/ i \
+ patch -Np1 -i "$srcdir/carla-git-no-sse2.patch"
+ '
+ )"
+fi
+
+if [ "${CARCH}" = "i486" ]; then
+ source+=('carla-git-no-sse.patch')
+ sha512sums+=('bdce143bf9001c970d4001f9a65842f5f7130a26cb6c2804062146f80f672132181af0630d379fae5c51690761983df4cf1b37413d094d0157699dd509f828e4')
+ b2sums+=('294e7b6a3a902992b860867088e21e96f66316e41db8ecd510bf3ef6912ba0432ceb0abfe2ca6f78072858ed6e805e4f24f7aca598688eac45f7b41b8d5e72cd')
+ eval "$(
+ declare -f prepare | \
+ sed '
+ /git.*cherry.*/ i \
+ patch -Np1 -i "$srcdir/carla-git-no-sse.patch"
+ '
+ )"
+fi
diff --git a/extra/carla/carla-git-no-sse.patch b/extra/carla/carla-git-no-sse.patch
new file mode 100644
index 00000000..ba302425
--- /dev/null
+++ b/extra/carla/carla-git-no-sse.patch
@@ -0,0 +1,74 @@
+diff -rauN carla-git/data/linux/build-deps.sh carla-git-no-sse/data/linux/build-deps.sh
+--- carla-git/data/linux/build-deps.sh 2021-09-23 08:50:25.065006050 +0200
++++ carla-git-no-sse/data/linux/build-deps.sh 2021-09-23 09:04:11.823846586 +0200
+@@ -52,7 +52,7 @@
+ export PATH=${PREFIX}/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
+ export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig
+
+-export CFLAGS="-O3 -mtune=generic -msse -msse2 -mfpmath=sse -fvisibility=hidden -fdata-sections -ffunction-sections"
++export CFLAGS="-O3 -mtune=generic -fvisibility=hidden -fdata-sections -ffunction-sections"
+ export CFLAGS="${CFLAGS} -fPIC -DPIC -DNDEBUG -I${PREFIX}/include -m${ARCH}"
+ export CXXFLAGS="${CFLAGS} -fvisibility-inlines-hidden"
+
+@@ -115,7 +115,7 @@
+ cd qtbase-opensource-src-${QT5_VERSION}
+ if [ ! -f configured ]; then
+ ./configure -release -strip -silent \
+- -sse2 \
++ -no-sse -no-sse2 \
+ -no-sse3 -no-ssse3 -no-sse4.1 -no-sse4.2 \
+ -no-avx -no-avx2 -no-avx512 \
+ -prefix ${PREFIX} \
+@@ -347,14 +347,14 @@
+ export CXXFLAGS="${CXXFLAGS} -ffast-math"
+ cd fftw-${FFTW3_VERSION}
+ ./configure --enable-static --disable-shared --prefix=${PREFIX} \
+- --enable-sse2 \
++ --disable=sse --disable-sse2 \
+ --disable-debug --disable-alloca --disable-fortran \
+ --with-our-malloc
+ make
+ make install
+ make clean
+ ./configure --enable-static --disable-shared --prefix=${PREFIX} \
+- --enable-sse2 --enable-sse --enable-single \
++ --disable-sse2 --disable-sse --enable-single \
+ --disable-debug --disable-alloca --disable-fortran \
+ --with-our-malloc
+ make
+diff -rauN carla-git/data/linux/build-pyqt.sh carla-git-no-sse/data/linux/build-pyqt.sh
+--- carla-git/data/linux/build-pyqt.sh 2021-09-23 08:50:25.065006050 +0200
++++ carla-git-no-sse/data/linux/build-pyqt.sh 2021-09-23 09:03:34.840418148 +0200
+@@ -45,7 +45,7 @@
+ export PATH=${PREFIX}/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
+ export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig
+
+-export CFLAGS="-O3 -mtune=generic -msse -msse2 -mfpmath=sse -fPIC -DPIC -DNDEBUG -m${ARCH}"
++export CFLAGS="-O3 -mtune=generic -fPIC -DPIC -DNDEBUG -m${ARCH}"
+ export CXXFLAGS="${CFLAGS}"
+ export LDFLAGS="-m${ARCH} -Wl,-O1"
+
+diff -rauN carla-git/source/Makefile.mk carla-git-no-sse/source/Makefile.mk
+--- carla-git/source/Makefile.mk 2021-09-23 08:50:25.088339419 +0200
++++ carla-git-no-sse/source/Makefile.mk 2021-09-23 14:25:58.412917731 +0200
+@@ -162,7 +162,7 @@
+ BASE_OPTS = -O3 -ffast-math -fdata-sections -ffunction-sections
+
+ ifeq ($(CPU_I386_OR_X86_64),true)
+-BASE_OPTS += -mtune=generic -msse -msse2 -mfpmath=sse
++BASE_OPTS += -mtune=generic
+ endif
+
+ ifeq ($(CPU_ARM),true)
+diff -rauN carla-git/source/tests.old/Makefile carla-git-no-sse/source/tests.old/Makefile
+--- carla-git/source/tests.old/Makefile 2021-09-23 08:50:25.275006380 +0200
++++ carla-git-no-sse/source/tests.old/Makefile 2021-09-23 09:03:18.023708117 +0200
+@@ -33,7 +33,7 @@
+ ifeq ($(DEBUG),true)
+ BASE_FLAGS += -DDEBUG -O0 -g
+ else
+-BASE_FLAGS += -O3 -ffast-math -mtune=generic -msse -msse2 -mfpmath=sse -fdata-sections -ffunction-sections
++BASE_FLAGS += -O3 -ffast-math -mtune=generic -fdata-sections -ffunction-sections
+ LINK_FLAGS += -fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,-O1 -Wl,--as-needed -Wl,--strip-all
+ endif
+
diff --git a/extra/carla/carla-git-no-sse2.patch b/extra/carla/carla-git-no-sse2.patch
new file mode 100644
index 00000000..99d324ca
--- /dev/null
+++ b/extra/carla/carla-git-no-sse2.patch
@@ -0,0 +1,74 @@
+diff -rauN carla-git/data/linux/build-deps.sh carla-git-no-sse2/data/linux/build-deps.sh
+--- carla-git/data/linux/build-deps.sh 2021-09-23 08:50:25.065006050 +0200
++++ carla-git-no-sse2/data/linux/build-deps.sh 2021-09-23 08:52:22.391955977 +0200
+@@ -52,7 +52,7 @@
+ export PATH=${PREFIX}/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
+ export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig
+
+-export CFLAGS="-O3 -mtune=generic -msse -msse2 -mfpmath=sse -fvisibility=hidden -fdata-sections -ffunction-sections"
++export CFLAGS="-O3 -mtune=generic -msse -mfpmath=sse -fvisibility=hidden -fdata-sections -ffunction-sections"
+ export CFLAGS="${CFLAGS} -fPIC -DPIC -DNDEBUG -I${PREFIX}/include -m${ARCH}"
+ export CXXFLAGS="${CFLAGS} -fvisibility-inlines-hidden"
+
+@@ -115,7 +115,7 @@
+ cd qtbase-opensource-src-${QT5_VERSION}
+ if [ ! -f configured ]; then
+ ./configure -release -strip -silent \
+- -sse2 \
++ -no-sse2 \
+ -no-sse3 -no-ssse3 -no-sse4.1 -no-sse4.2 \
+ -no-avx -no-avx2 -no-avx512 \
+ -prefix ${PREFIX} \
+@@ -347,14 +347,14 @@
+ export CXXFLAGS="${CXXFLAGS} -ffast-math"
+ cd fftw-${FFTW3_VERSION}
+ ./configure --enable-static --disable-shared --prefix=${PREFIX} \
+- --enable-sse2 \
++ --disable-sse2 \
+ --disable-debug --disable-alloca --disable-fortran \
+ --with-our-malloc
+ make
+ make install
+ make clean
+ ./configure --enable-static --disable-shared --prefix=${PREFIX} \
+- --enable-sse2 --enable-sse --enable-single \
++ --disable-sse2 --enable-sse --enable-single \
+ --disable-debug --disable-alloca --disable-fortran \
+ --with-our-malloc
+ make
+diff -rauN carla-git/data/linux/build-pyqt.sh carla-git-no-sse2/data/linux/build-pyqt.sh
+--- carla-git/data/linux/build-pyqt.sh 2021-09-23 08:50:25.065006050 +0200
++++ carla-git-no-sse2/data/linux/build-pyqt.sh 2021-09-23 08:51:36.735162561 +0200
+@@ -45,7 +45,7 @@
+ export PATH=${PREFIX}/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
+ export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig
+
+-export CFLAGS="-O3 -mtune=generic -msse -msse2 -mfpmath=sse -fPIC -DPIC -DNDEBUG -m${ARCH}"
++export CFLAGS="-O3 -mtune=generic -msse -mfpmath=sse -fPIC -DPIC -DNDEBUG -m${ARCH}"
+ export CXXFLAGS="${CFLAGS}"
+ export LDFLAGS="-m${ARCH} -Wl,-O1"
+
+diff -rauN carla-git/source/Makefile.mk carla-git-no-sse2/source/Makefile.mk
+--- carla-git/source/Makefile.mk 2021-09-23 08:50:25.088339419 +0200
++++ carla-git-no-sse2/source/Makefile.mk 2021-09-23 14:25:10.466157641 +0200
+@@ -162,7 +162,7 @@
+ BASE_OPTS = -O3 -ffast-math -fdata-sections -ffunction-sections
+
+ ifeq ($(CPU_I386_OR_X86_64),true)
+-BASE_OPTS += -mtune=generic -msse -msse2 -mfpmath=sse
++BASE_OPTS += -mtune=generic -msse -mfpmath=sse
+ endif
+
+ ifeq ($(CPU_ARM),true)
+diff -rauN carla-git/source/tests.old/Makefile carla-git-no-sse2/source/tests.old/Makefile
+--- carla-git/source/tests.old/Makefile 2021-09-23 08:50:25.275006380 +0200
++++ carla-git-no-sse2/source/tests.old/Makefile 2021-09-23 08:51:13.868432167 +0200
+@@ -33,7 +33,7 @@
+ ifeq ($(DEBUG),true)
+ BASE_FLAGS += -DDEBUG -O0 -g
+ else
+-BASE_FLAGS += -O3 -ffast-math -mtune=generic -msse -msse2 -mfpmath=sse -fdata-sections -ffunction-sections
++BASE_FLAGS += -O3 -ffast-math -mtune=generic -msse -mfpmath=sse -fdata-sections -ffunction-sections
+ LINK_FLAGS += -fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,-O1 -Wl,--as-needed -Wl,--strip-all
+ endif
+
diff --git a/extra/chezmoi/PKGBUILD b/extra/chezmoi/PKGBUILD
new file mode 100644
index 00000000..6dac406f
--- /dev/null
+++ b/extra/chezmoi/PKGBUILD
@@ -0,0 +1,8 @@
+# Use gccgo and not go/gc on i686 and i486
+if [ "$CARCH" = 'i686' -o "$CARCH" = 'i486' ]; then
+ makedepends=(${makedepends[@]//go/})
+ makedepends+=(gcc-go)
+fi
+
+# failing test: FAIL github.com/twpayne/chezmoi/v2/pkg/git [build failed]
+unset check
diff --git a/extra/clementine/PKGBUILD b/extra/clementine/PKGBUILD
new file mode 100644
index 00000000..0fb1fc6d
--- /dev/null
+++ b/extra/clementine/PKGBUILD
@@ -0,0 +1,25 @@
+# broken Github downloads (again)
+source=("https://github.com/clementine-player/Clementine/archive/refs/tags/${pkgver}.tar.gz")
+sha256sums=('2395efdef013aa65ec8b8521d549bf76dbde4f933867be3953f31553101ead63')
+
+# of course the first level directory is different
+eval "$(
+ declare -f prepare | \
+ sed '
+ s|$pkgname-${pkgver//+/-}|Clementine-${pkgver}|g
+ '
+)"
+eval "$(
+ declare -f build | \
+ sed '
+ s|$pkgname-${pkgver//+/-}|Clementine-${pkgver}|g
+ '
+)"
+
+# disable -Werror
+eval "$(
+ declare -f build | \
+ sed '
+ s|cmake -B build |cmake -B build -DBUILD_WERROR=OFF |
+ '
+)"
diff --git a/extra/codeblocks/PKGBUILD b/extra/codeblocks/PKGBUILD
new file mode 100644
index 00000000..3fe0b833
--- /dev/null
+++ b/extra/codeblocks/PKGBUILD
@@ -0,0 +1,8 @@
+# doesn't find boost otherwise
+
+eval "$(
+ declare -f build | \
+ sed '
+ s,configure ,\0--with-boost-libdir=/usr/lib ,
+ '
+)"
diff --git a/extra/coin-or-cbc/PKGBUILD b/extra/coin-or-cbc/PKGBUILD
new file mode 100644
index 00000000..65382946
--- /dev/null
+++ b/extra/coin-or-cbc/PKGBUILD
@@ -0,0 +1,2 @@
+# hangs slaves
+unset check
diff --git a/extra/consul/PKGBUILD b/extra/consul/PKGBUILD
new file mode 100644
index 00000000..f54ee869
--- /dev/null
+++ b/extra/consul/PKGBUILD
@@ -0,0 +1,13 @@
+eval "$(
+ declare -f prepare | \
+ sed '
+ $ i sed -i "s/amd64/386/g" "${srcdir}/src/github.com/hashicorp/${pkgname}/GNUmakefile"
+ '
+)"
+
+eval "$(
+ declare -f build | \
+ sed '
+ s/amd64/i386/g
+ '
+)"
diff --git a/extra/containerd/PKGBUILD b/extra/containerd/PKGBUILD
new file mode 100644
index 00000000..e0a17330
--- /dev/null
+++ b/extra/containerd/PKGBUILD
@@ -0,0 +1,2 @@
+# fetches stuff from repos, fails in beatyful ways
+unset check
diff --git a/extra/coq/PKGBUILD b/extra/coq/PKGBUILD
new file mode 100644
index 00000000..533318f0
--- /dev/null
+++ b/extra/coq/PKGBUILD
@@ -0,0 +1,18 @@
+# disable documentation building with python-sphinx
+makedepends=(${makedepends[@]/python-sphinxcontrib-bibtex})
+makedepends=(${makedepends[@]/python-sphinx_rtd_theme})
+makedepends=(${makedepends[@]/python-sphinx})
+eval "$(
+ declare -f build | \
+ sed '
+ s/-with-doc yes//
+ /MAKE_TARGETS/s/refman-html//
+ /MAKE_TARGETS/s/doc-stdlib//
+ '
+)"
+eval "$(
+ declare -f package_coq-doc | \
+ sed '
+ /make/d
+ '
+)"
diff --git a/extra/crun/PKGBUILD b/extra/crun/PKGBUILD
new file mode 100644
index 00000000..73298fe2
--- /dev/null
+++ b/extra/crun/PKGBUILD
@@ -0,0 +1,2 @@
+# criu is blacklisted
+depends=(${depends[@]//criu/})
diff --git a/extra/crypto++/PKGBUILD b/extra/crypto++/PKGBUILD
new file mode 100644
index 00000000..23130381
--- /dev/null
+++ b/extra/crypto++/PKGBUILD
@@ -0,0 +1,9 @@
+# disable SSE2 on i686 and i486
+if [ "$CARCH" == 'i686' ] || [ "$CARCH" == 'i486' ]; then
+ eval "$(
+ declare -f build | \
+ sed '
+ s/export CXXFLAGS="\([^"]\+\)"/export CXXFLAGS="\1 -DCRYPTOPP_DISABLE_ASM=1"/g
+ '
+ )"
+fi
diff --git a/extra/dart/PKGBUILD b/extra/dart/PKGBUILD
new file mode 100644
index 00000000..6304d06a
--- /dev/null
+++ b/extra/dart/PKGBUILD
@@ -0,0 +1,3 @@
+source=("$pkgname-$pkgver-32.zip::http://storage.googleapis.com/dart-archive/channels/stable/release/latest/sdk/dartsdk-linux-ia32-release.zip")
+sha512sums=('c4e6532760f5880c61ce1b9ff4d428fb84f61670c48441635fef476ef6957e4a03258f15cb400cdec1e99a3eea87c85736c6857382d3f74ce3b2edc15f9e8556')
+sha512sums_x86_64=('71e6d211a9a32d1566c3f098e55fc2fe8db9e5574cbccd4b41d3a45ec4bfccc16ad785c27438814a6ac54b80d223bcee8235bfea78b227ab49ba2a9ca0a2ca1e')
diff --git a/extra/dbeaver/PKGBUILD b/extra/dbeaver/PKGBUILD
new file mode 100644
index 00000000..69e005b0
--- /dev/null
+++ b/extra/dbeaver/PKGBUILD
@@ -0,0 +1,8 @@
+# see 82be2453a4df
+
+eval "$(
+ declare -f package | \
+ sed '
+ s/\${CARCH}/x86/g
+ '
+)"
diff --git a/extra/dgen-sdl/PKGBUILD b/extra/dgen-sdl/PKGBUILD
new file mode 100644
index 00000000..b90dba4c
--- /dev/null
+++ b/extra/dgen-sdl/PKGBUILD
@@ -0,0 +1,9 @@
+# nasm: error: more than one input file specified
+# the -- is the problem, patching it out of Makefiles to avoid retooling
+
+eval "$(
+ declare -f build | \
+ sed '
+ 4 a find . -name Makefile -exec sed -i "/nasm/s/--//g" {} \\;
+ '
+)"
diff --git a/extra/dhall/PKGBUILD b/extra/dhall/PKGBUILD
new file mode 100644
index 00000000..4b0d762c
--- /dev/null
+++ b/extra/dhall/PKGBUILD
@@ -0,0 +1,7 @@
+# temporarily ignore test results
+eval "$(
+ declare -f check | \
+ sed '
+ s/runhaskell Setup test/runhaskell Setup test || true/
+ '
+)"
diff --git a/extra/diffoscope/PKGBUILD b/extra/diffoscope/PKGBUILD
new file mode 100644
index 00000000..f4f33a71
--- /dev/null
+++ b/extra/diffoscope/PKGBUILD
@@ -0,0 +1 @@
+checkdepends=("${checkdepends[@]/java-environment>=8/java-environment=8}")
diff --git a/extra/dmd/PKGBUILD b/extra/dmd/PKGBUILD
new file mode 100644
index 00000000..890baa0d
--- /dev/null
+++ b/extra/dmd/PKGBUILD
@@ -0,0 +1,2 @@
+# llvm10 for now
+makedepends+=("llvm10")
diff --git a/extra/dolphin-emu/PKGBUILD b/extra/dolphin-emu/PKGBUILD
new file mode 100644
index 00000000..e4d679bf
--- /dev/null
+++ b/extra/dolphin-emu/PKGBUILD
@@ -0,0 +1,6 @@
+eval "$(
+ declare -f build | \
+ sed '
+ s|cmake ../dolphin-emu|cmake ../dolphin-emu -DENABLE_GENERIC='TRUE'|
+ '
+)"
diff --git a/extra/dtc/PKGBUILD b/extra/dtc/PKGBUILD
new file mode 100644
index 00000000..d97cb9a7
--- /dev/null
+++ b/extra/dtc/PKGBUILD
@@ -0,0 +1,3 @@
+# revert commit 1799ef5ac2fba01a19e89b5bef23315a7570624b
+source+=('fix32bit.patch::https://github.com/dgibson/dtc/commit/f8872e29ce06d78d3db71b3ab26a7465fc8a9586.patch')
+sha256sums+=('e92bfc787b65e2610528d5c499835c083c1672455fc7998d202b7c986d5c5f1d')
diff --git a/extra/dwarffortress/PKGBUILD b/extra/dwarffortress/PKGBUILD
new file mode 100644
index 00000000..11b15ef6
--- /dev/null
+++ b/extra/dwarffortress/PKGBUILD
@@ -0,0 +1,7 @@
+for ((i=${#source[@]}; i>0; i--)); do
+ if [ "${source[${i}]}" = "http://www.bay12games.com/dwarves/df_${_pkgver}_linux.tar.bz2" ]; then
+ break;
+ fi
+done
+source[${i}]="http://www.bay12games.com/dwarves/df_${_pkgver}_linux32.tar.bz2"
+sha256sums[${i}]='542b29e4aae6ba71ae2e56e176c041ec0f6471e9c299db98695d4b0ddfd96ac9'
diff --git a/extra/e3/PKGBUILD b/extra/e3/PKGBUILD
new file mode 100644
index 00000000..99097f1f
--- /dev/null
+++ b/extra/e3/PKGBUILD
@@ -0,0 +1,8 @@
+# build(): 64 -> 32
+makedepends+=(nasm)
+eval "$(
+ declare -f build \
+ | sed '
+ s/ \(NASM_OR_YASM=\S\+\) clean 64/ \1 32/
+ '
+)"
diff --git a/extra/electron/PKGBUILD b/extra/electron/PKGBUILD
new file mode 100644
index 00000000..3446fe23
--- /dev/null
+++ b/extra/electron/PKGBUILD
@@ -0,0 +1,16 @@
+source+=('allow-i686.patch')
+sha512sums+=('bce6716f88c0ed7acc72f90ef62f7c4a28b88e98d7fc8dcb6abf545eb6ab7de11e06191618490ed83e7b38b08489063357682ebb909dc952e21cb6dd7b6ddb38')
+
+eval "$(
+ declare -f prepare | \
+ sed '
+ 3 a patch -Np1 -i "${srcdir}"/allow-i686.patch
+ /^}$/ i \
+ find "${srcdir}" \\( '"-name '*.a' -o -name '*.o'"' \\) -delete
+ '
+ declare -f build | \
+ sed '
+ s,^\s*script/bootstrap.py ,\0--target_arch=ia32 ,
+ s/-t x64/-t ia32/g
+ '
+)"
diff --git a/extra/electron/allow-i686.patch b/extra/electron/allow-i686.patch
new file mode 100644
index 00000000..154ab9bc
--- /dev/null
+++ b/extra/electron/allow-i686.patch
@@ -0,0 +1,14 @@
+--- a/script/update.py
++++ b/script/update.py
+@@ -15,11 +15,6 @@ SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
+
+ def main():
+ os.chdir(SOURCE_ROOT)
+-
+- if PLATFORM != 'win32' and platform.architecture()[0] != '64bit':
+- print 'Electron is required to be built on a 64bit machine'
+- return 1
+-
+ update_external_binaries()
+ return update_gyp()
+
diff --git a/extra/embree/PKGBUILD b/extra/embree/PKGBUILD
new file mode 100644
index 00000000..522a3482
--- /dev/null
+++ b/extra/embree/PKGBUILD
@@ -0,0 +1,27 @@
+# avoid breakage in newer CPU ISAs, supporting SSE2 should be enough for
+# 32-bit platforms
+# for special use cases (like running Archlinux32 on 64-bit hardware)
+# we can support up to SSE4.2 (everything above is too hard to fix).
+# As Embree chooses the ISA at runtime, this is no problem for machines
+# not having SSE4.2
+eval "$(
+ declare -f build | \
+ sed '
+ /cmake/s/-DEMBREE_MAX_ISA="AVX512SKX"/-DEMBREE_MAX_ISA="SSE4.2"/
+ '
+)"
+
+# some 32-bit fixes around intrinsics where applied to WIN32 only,
+# applying a counter-patch here
+source+=('embree-3.2.0-intrinsic.patch')
+sha256sums+=('7d5e44a034b02e14d7d37cd038d8c279d13d66b54a449c09e0687458f117723f')
+eval "$(
+ {
+ declare -f prepare || \
+ printf 'prepare() {\n}\n'
+ } \
+ | sed '
+ $i cd "$srcdir/$pkgname-$pkgver" \
+ patch -Np1 -i "$srcdir/embree-3.2.0-intrinsic.patch"
+ '
+)"
diff --git a/extra/embree/embree-3.2.0-intrinsic.patch b/extra/embree/embree-3.2.0-intrinsic.patch
new file mode 100644
index 00000000..afb49357
--- /dev/null
+++ b/extra/embree/embree-3.2.0-intrinsic.patch
@@ -0,0 +1,12 @@
+diff -rauN embree-3.2.0/common/simd/vint4_sse2.h embree-3.2.0-intrinsic-patch/common/simd/vint4_sse2.h
+--- embree-3.2.0/common/simd/vint4_sse2.h 2018-05-15 08:02:58.000000000 +0200
++++ embree-3.2.0-intrinsic-patch/common/simd/vint4_sse2.h 2018-06-20 20:44:57.322042285 +0200
+@@ -455,7 +455,7 @@
+ __forceinline int toScalar(const vint4& v) { return _mm_cvtsi128_si32(v); }
+
+ __forceinline size_t toSizeT(const vint4& v) {
+-#if defined(__WIN32__) && !defined(__X86_64__) // win32 workaround
++#if !defined(__X86_64__) // win32 workaround
+ return toScalar(v);
+ #else
+ return _mm_cvtsi128_si64(v);
diff --git a/extra/exa/PKGBUILD b/extra/exa/PKGBUILD
new file mode 100644
index 00000000..914a7177
--- /dev/null
+++ b/extra/exa/PKGBUILD
@@ -0,0 +1,25 @@
+# pandoc is mainly broken currently (FS32#180)
+makedepends=(${makedepends[@]//pandoc/})
+eval "$(
+ declare -f build | \
+ sed '
+ s/pandoc/#pandoc/
+ '
+)"
+eval "$(
+ declare -f package | \
+ sed '
+ /exa.1/d
+ /exa_colors.5/d
+ '
+)"
+
+# CARCH pentium4 makes compilation fail
+if [ "$CARCH" = 'pentium4' ]; then
+ eval "$(
+ declare -f prepare | \
+ sed '
+ s/--target "$CARCH-unknown-linux-gnu"/--target "i686-unknown-linux-gnu"/
+ '
+ )"
+fi
diff --git a/extra/fasm/PKGBUILD b/extra/fasm/PKGBUILD
new file mode 100644
index 00000000..15201927
--- /dev/null
+++ b/extra/fasm/PKGBUILD
@@ -0,0 +1,13 @@
+depends_i486+=('glibc')
+depends_i686+=('glibc')
+depends_pentium4+=('glibc')
+
+eval "$(
+ declare -f build | \
+ sed '
+ /if .*CARCH.* == .*x86_64.*/,/fi/{s/.*//g}
+ /mv/ i \
+ SRCDIR=Linux \
+ ./fasm source/${SRCDIR}/fasm.asm
+ '
+)"
diff --git a/extra/fig2dev/PKGBUILD b/extra/fig2dev/PKGBUILD
new file mode 100644
index 00000000..dba7e779
--- /dev/null
+++ b/extra/fig2dev/PKGBUILD
@@ -0,0 +1,12 @@
+eval "$(
+ {
+ declare -f prepare || \
+ printf 'prepare() {\n}\n'
+ } \
+ | sed '
+ $i find "${srcdir}/${pkgname}-${pkgver}" \\\
+ -exec sed -i '"'"' \
+ s/Invalid resolution information (-1)\\./Invalid spline object./g \
+ '"'"' {} \\;
+ '
+)"
diff --git a/extra/fio/PKGBUILD b/extra/fio/PKGBUILD
new file mode 100644
index 00000000..4e7a31b4
--- /dev/null
+++ b/extra/fio/PKGBUILD
@@ -0,0 +1,3 @@
+# ceph doesn't run on 32-bit currently (see FS32#21)
+
+depends=(${depends[@]/ceph})
diff --git a/extra/fpc/PKGBUILD b/extra/fpc/PKGBUILD
new file mode 100644
index 00000000..71bd6540
--- /dev/null
+++ b/extra/fpc/PKGBUILD
@@ -0,0 +1,28 @@
+# symlink for 32-bit Pascal compiler
+
+# temporary:
+# the package has been built wrongly in the past, so we have to force
+# a ppc386 symlink in build (PP variable) because the Makefile is trying to
+# guess the target platform by executing fpc
+
+eval "$(
+ declare -f package | \
+ sed '
+ 2 a _pkgver=$(find /usr/lib/fpc -name ppc386 | cut -d/ -f5 | sort -V | tail -n1)
+ /"\$CARCH" = "x86_64"/ {
+ p
+ s@ppcx64@ppc386@g
+ s@x86_64@i686@
+ p
+ s@i686@i486@
+ p
+ s@i486@pentium4@
+ }
+ s@NOGDB=1@NOGDB=1 PP=/usr/lib/fpc/$_pkgver/ppc386 @
+ '
+ declare -f build | \
+ sed '
+ 2 a _pkgver=$(find /usr/lib/fpc -name ppc386 | cut -d/ -f5 | sort -V | tail -n1)
+ s@NOGDB=1@NOGDB=1 PP=/usr/lib/fpc/$_pkgver/ppc386 @
+ '
+)"
diff --git a/extra/freebasic/PKGBUILD b/extra/freebasic/PKGBUILD
new file mode 100644
index 00000000..52ed3835
--- /dev/null
+++ b/extra/freebasic/PKGBUILD
@@ -0,0 +1,11 @@
+source_i686=("http://downloads.sourceforge.net/fbc/FreeBASIC-${pkgver}-linux-x86.tar.xz")
+md5sums_i686=('283275ebc3339ce03c2e7209dc81e46c')
+source_pentium4=("${source_i686[@]}")
+md5sums_pentium4=("${md5sums_i686[@]}")
+
+eval "$(
+ declare -f prepare | \
+ sed '
+ /CARCH/ a [[ "$CARCH" = "i686" ]] && _arch=x86; [[ "$CARCH" = "pentium4" ]] && _arch=x86
+ '
+)"
diff --git a/extra/freecad/PKGBUILD b/extra/freecad/PKGBUILD
new file mode 100644
index 00000000..57c08078
--- /dev/null
+++ b/extra/freecad/PKGBUILD
@@ -0,0 +1,16 @@
+# ospray is blacklisted
+makedepends=(${makedepends[@]//ospray/})
+
+# med-openmpi is blacklisted, using plain med instead
+depends=(${depends[@]//med-openmpi/})
+depends+=(med)
+
+# libdl.so does not exist, fast hack to fix it in the generated ninja
+# build script
+eval "$(
+ declare -f build | \
+ sed '
+ /ninja -C build/ i \
+ sed -i s'/libdl.so/libdl.so.2/g' build/build.ninja
+ '
+)"
diff --git a/extra/fzf/PKGBUILD b/extra/fzf/PKGBUILD
new file mode 100644
index 00000000..f64284ba
--- /dev/null
+++ b/extra/fzf/PKGBUILD
@@ -0,0 +1,6 @@
+eval "$(
+ declare -f package | \
+ sed '
+ s/amd64/386/g
+ '
+)"
diff --git a/extra/gap/PKGBUILD b/extra/gap/PKGBUILD
new file mode 100644
index 00000000..d5bf1291
--- /dev/null
+++ b/extra/gap/PKGBUILD
@@ -0,0 +1,6 @@
+eval "$(
+ declare -f package_gap-packages | \
+ sed '
+ /chrpath/ s/x86_64-/i686-/
+ '
+)"
diff --git a/extra/gdal/PKGBUILD b/extra/gdal/PKGBUILD
new file mode 100644
index 00000000..8a896f4e
--- /dev/null
+++ b/extra/gdal/PKGBUILD
@@ -0,0 +1,35 @@
+# enable SSE/SSE2 where appripriate
+if [ "${CARCH}" = "i486" -o "${CARCH}" = "i686" ]; then
+ eval "$(
+ declare -f build | \
+ sed '
+ s|./configure |./configure --with-sse=no --with-ssse3=no --with-avx=no |
+ '
+ )"
+fi
+if [ "${CARCH}" = "pentium4" ]; then
+ eval "$(
+ declare -f build | \
+ sed '
+ s|./configure |./configure --with-sse=yes --with-ssse3=no --with-avx=no |
+ '
+ )"
+fi
+
+# i486 has a stack smash when building the Python bindings (see FS32#188)
+if [ "${CARCH}" = "i486" ]; then
+ eval "$(
+ declare -f build | \
+ sed '
+ /swig\/python/d
+ /python setup.py build/d
+ '
+ )"
+ eval "$(
+ declare -f package_python-gdal | \
+ sed '
+ 3 i if false; then
+ $ i fi
+ '
+ )"
+fi
diff --git a/extra/ghc/PKGBUILD b/extra/ghc/PKGBUILD
new file mode 100644
index 00000000..e1aa6b7f
--- /dev/null
+++ b/extra/ghc/PKGBUILD
@@ -0,0 +1,11 @@
+# bootstrapping from binary version (when ghc-static is broken)
+makedepends=(${makedepends[@]//ghc-static/})
+makedepends_i486+=(ghc90-bin libffi33)
+makedepends_i686+=("${makedepends_i486[@]}")
+makedepends_pentium4=("${makedepends_i686[@]}")
+eval "$(
+ declare -f build | \
+ sed '
+ s|./configure|GHC=/usr/bin/ghc-9.0 ./configure|
+ '
+)"
diff --git a/extra/ghdl/PKGBUILD b/extra/ghdl/PKGBUILD
new file mode 100644
index 00000000..4a8f7879
--- /dev/null
+++ b/extra/ghdl/PKGBUILD
@@ -0,0 +1,2 @@
+source[6]='isl-0.23.tar.xz::https://downloads.sourceforge.net/project/libisl/isl-0.24.tar.xz?ts=gAAAAABhojIcYmUfplFkh4GCklCNjXe6c5A561-eOrQD92l7Dd9Lw5vOoApEOzfk2XL8NElrqvTKrH0enBWHiWCznbwG1pkAaQ%3D%3D&r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Flibisl%2Ffiles%2Fisl-0.23.tar.xz%2Fdownload%3Fuse_mirror%3Ddeac-fra%26download%3D%26failedmirror%3Ddeac-riga.dl.sourceforge.net'
+
diff --git a/extra/gitlab-runner/PKGBUILD b/extra/gitlab-runner/PKGBUILD
new file mode 100644
index 00000000..ac9c31c6
--- /dev/null
+++ b/extra/gitlab-runner/PKGBUILD
@@ -0,0 +1,6 @@
+eval "$(
+ declare -f build package | \
+ sed '
+ s/amd64/386/
+ '
+)"
diff --git a/extra/gitlab/PKGBUILD b/extra/gitlab/PKGBUILD
new file mode 100644
index 00000000..f584e72a
--- /dev/null
+++ b/extra/gitlab/PKGBUILD
@@ -0,0 +1,10 @@
+# temporarily use posix-spawn 0.3.12 (there is a bug in 0.3.13)
+# remove, when https://github.com/rtomayko/posix-spawn/pull/83 resolved
+
+eval "$(
+ declare -f build | \
+ sed '
+ /bundle-2\.3 config/ a \
+ sed -i "/posix-spawn/s/0\\.3\\.13/0.3.12/" Gemfile.lock
+ '
+)"
diff --git a/extra/glfw/PKGBUILD b/extra/glfw/PKGBUILD
new file mode 100644
index 00000000..21fa2996
--- /dev/null
+++ b/extra/glfw/PKGBUILD
@@ -0,0 +1,14 @@
+eval "$(
+ declare -f package_glfw-x11 | \
+ sed '
+ 2 a arch=('"${arch[*]}"')
+ '
+ declare -f package_glfw-wayland | \
+ sed '
+ 2 a arch=('"${arch[*]}"')
+ '
+ declare -f package_glfw-doc | \
+ sed '
+ 2 a arch=(any)
+ '
+)"
diff --git a/extra/go/PKGBUILD b/extra/go/PKGBUILD
new file mode 100644
index 00000000..c4adc372
--- /dev/null
+++ b/extra/go/PKGBUILD
@@ -0,0 +1,52 @@
+eval "$(
+ declare -f build | \
+ sed '
+ /install\( .*\)\? -race /d
+ '
+ declare -f package_go-pie package | \
+ sed '
+ s,\(/linux_\)amd64\([_/]\),\1386\2,g
+ '
+)"
+
+eval "$(
+ declare -f build check _package \
+ | sed '
+ s/\(export GOARCH=\)amd64/\1386 /
+ '
+)"
+
+# 1.16 dropped non-SSE2 floating point operations, so we must
+# use software floating points (see https://github.com/golang/go/issues/40255)
+if [ "$CARCH" = 'i686' -o "$CARCH" = 'i486' ]; then
+ eval "$(
+ declare -f build \
+ | sed '
+ 2 a export GO386='softfloat'
+ '
+ declare -f check \
+ | sed '
+ 2 a export GO386='softfloat'
+ '
+ )"
+fi
+
+# https://go-review.googlesource.com/c/go/+/257963
+source+=('go-x87.patch')
+sha256sums+=('8b124eaa7521bd0e3760b514829b1ecce3d3cd169f99c3629ff50b7769303802')
+eval "$(
+ {
+ declare -f prepare || \
+ printf 'prepare() { cd "$pkgname" \n}\n'
+ } \
+ | sed '
+ $i patch -Np1 -i ../go-x87.patch
+ '
+)"
+
+# tests are failing, ignore them
+unset check
+
+# bootstrap via go17
+makedepends=(${makedepends[@]//go/})
+makedepends+=('go17')
diff --git a/extra/go/go-x87.patch b/extra/go/go-x87.patch
new file mode 100644
index 00000000..0c0a584b
--- /dev/null
+++ b/extra/go/go-x87.patch
@@ -0,0 +1,28 @@
+diff -rauN go/src/buildall.bash go-x87-patch/src/buildall.bash
+--- go/src/buildall.bash 2023-04-04 17:38:07.330008547 +0200
++++ go-x87-patch/src/buildall.bash 2023-04-04 17:39:07.929938685 +0200
+@@ -37,6 +37,7 @@
+
+ gettargets() {
+ ../bin/go tool dist list | sed -e 's|/|-|'
++ echo linux-386-387
+ echo linux-arm-arm5
+ }
+
+@@ -63,11 +64,15 @@
+ echo "### Building $target"
+ export GOOS=$(echo $target | sed 's/-.*//')
+ export GOARCH=$(echo $target | sed 's/.*-//')
+- unset GOARM
++ unset GO386 GOARM
+ if [ "$GOARCH" = "arm5" ]; then
+ export GOARCH=arm
+ export GOARM=5
+ fi
++ if [ "$GOARCH" = "387" ]; then
++ export GOARCH=386
++ export GO386=387
++ fi
+
+ # Build and vet everything.
+ # cmd/go/internal/work/exec.go enables the same vet flags during go test of std cmd
diff --git a/extra/grafana/PKGBUILD b/extra/grafana/PKGBUILD
new file mode 100644
index 00000000..0a69ecce
--- /dev/null
+++ b/extra/grafana/PKGBUILD
@@ -0,0 +1,7 @@
+# fix architecture of generated binaries
+eval "$(
+ declare -f package | \
+ sed '
+ s/linux-amd64/linux-386/g
+ '
+)"
diff --git a/extra/grpc/PKGBUILD b/extra/grpc/PKGBUILD
new file mode 100644
index 00000000..05b3ada2
--- /dev/null
+++ b/extra/grpc/PKGBUILD
@@ -0,0 +1,12 @@
+# -latomic on i486
+if [ "$CARCH" == 'i486' ]; then
+ eval "$(
+ declare -f prepare | \
+ sed '
+ s/cmake /cmake -DCMAKE_CXX_STANDARD_LIBRARIES=-latomic /
+ '
+ )"
+fi
+
+# Python tests failing due to LDFLAGS stuff, disabled for now
+unset check
diff --git a/extra/gtest/PKGBUILD b/extra/gtest/PKGBUILD
new file mode 100644
index 00000000..ae04be46
--- /dev/null
+++ b/extra/gtest/PKGBUILD
@@ -0,0 +1,8 @@
+# Rounding error in Print, see https://github.com/google/googletest/issues/4210
+# Also some issues with threads in chroots (in tests)
+eval "$(
+ declare -f check | \
+ sed '
+ s/\(cmake.*\)/\1 || true/g
+ '
+)"
diff --git a/extra/handbrake/PKGBUILD b/extra/handbrake/PKGBUILD
new file mode 100644
index 00000000..9986e55a
--- /dev/null
+++ b/extra/handbrake/PKGBUILD
@@ -0,0 +1,8 @@
+# x265 has hand-optimized assembly breaking with arch i686, disabled for now
+# (reported as https://github.com/HandBrake/HandBrake/issues/1363)
+eval "$(
+ declare -f build | \
+ sed '
+ s@./configure@\0 --arch=i686 --disable-x265@
+ '
+)"
diff --git a/extra/haskell-aeson/PKGBUILD b/extra/haskell-aeson/PKGBUILD
new file mode 100644
index 00000000..63948c75
--- /dev/null
+++ b/extra/haskell-aeson/PKGBUILD
@@ -0,0 +1,10 @@
+# ErrorMessages
+# generic: FAIL
+
+eval "$(
+ declare -f check | \
+ sed '
+ s/runhaskell Setup test/runhaskell Setup test || true/
+ '
+)"
+
diff --git a/extra/haskell-bsb-http-chunked/PKGBUILD b/extra/haskell-bsb-http-chunked/PKGBUILD
new file mode 100644
index 00000000..51ae1fea
--- /dev/null
+++ b/extra/haskell-bsb-http-chunked/PKGBUILD
@@ -0,0 +1,2 @@
+# ignore tests, all failing
+unset check
diff --git a/extra/haskell-gauge/PKGBUILD b/extra/haskell-gauge/PKGBUILD
new file mode 100644
index 00000000..eeba4490
--- /dev/null
+++ b/extra/haskell-gauge/PKGBUILD
@@ -0,0 +1,15 @@
+# temporarily disabled 'verbose' test, see upstream:
+# https://github.com/vincenthz/hs-gauge/issues/54
+
+eval "$(
+ {
+ declare -f prepare || \
+ printf 'prepare() {\n}\n'
+ } \
+ | sed '
+ $i cd "${srcdir}/${_hkgname}-${pkgver}" \
+ sed -i '"'"'/test-suite verbose/, /test-suite quick/ { s/\(.*\)/#\1/ }'"'"' gauge.cabal \
+ sed -i '"'"'s/#test-suite quick/test-suite quick/'"'"' gauge.cabal \
+ sed -i '"'"'/^#.*/d'"'"' gauge.cabal
+ '
+)"
diff --git a/extra/haskell-hedgehog/PKGBUILD b/extra/haskell-hedgehog/PKGBUILD
new file mode 100644
index 00000000..756bce82
--- /dev/null
+++ b/extra/haskell-hedgehog/PKGBUILD
@@ -0,0 +1,2 @@
+# disable tests, for now
+unset check
diff --git a/extra/haskell-hslua-module-text/PKGBUILD b/extra/haskell-hslua-module-text/PKGBUILD
new file mode 100644
index 00000000..224ded1d
--- /dev/null
+++ b/extra/haskell-hslua-module-text/PKGBUILD
@@ -0,0 +1,3 @@
+# see haskell-hslua
+unset check
+unset checkdepends
diff --git a/extra/haskell-hslua/PKGBUILD b/extra/haskell-hslua/PKGBUILD
new file mode 100644
index 00000000..5aa68c34
--- /dev/null
+++ b/extra/haskell-hslua/PKGBUILD
@@ -0,0 +1,15 @@
+# See https://github.com/jgm/pandoc/issues/4224 and
+# https://github.com/jgm/pandoc/issues/3805
+
+eval "$(
+ declare -f build | \
+ sed '
+ s| -f-lua_32bits| -flua_32bits|
+ '
+)"
+
+# temporarily against:
+# "Setup: Encountered missing or private dependencies:
+# exceptions >=0.8 && <0.11
+makedepends+=(haskell-exceptions)
+
diff --git a/extra/haskell-microlens-aeson/PKGBUILD b/extra/haskell-microlens-aeson/PKGBUILD
new file mode 100644
index 00000000..b2ec4faa
--- /dev/null
+++ b/extra/haskell-microlens-aeson/PKGBUILD
@@ -0,0 +1,11 @@
+# testsuite fails due to random ordering:
+# https://github.com/fosskers/microlens-aeson/issues/1
+
+unset check
+unset checkdepends
+eval "$(
+ declare -f build | \
+ sed '
+ s/\s--enable-tests\([[:space:];]\)/\1/
+ '
+)"
diff --git a/extra/haskell-pantry/PKGBUILD b/extra/haskell-pantry/PKGBUILD
new file mode 100644
index 00000000..e5f6ef9d
--- /dev/null
+++ b/extra/haskell-pantry/PKGBUILD
@@ -0,0 +1,2 @@
+# spec runs for ages
+unset check
diff --git a/extra/haskell-servant-swagger/PKGBUILD b/extra/haskell-servant-swagger/PKGBUILD
new file mode 100644
index 00000000..dff1fac9
--- /dev/null
+++ b/extra/haskell-servant-swagger/PKGBUILD
@@ -0,0 +1,30 @@
+# first, we replace the hardcoded min/max of int
+
+eval "$(
+ declare -f check | \
+ sed '
+ 3 a find . -type f -exec sed -i '"'"'s/922337203685477580\\([78]\\)/214748364\\1/g; s/9\\.22337203685477580\\([78]\\)e18/2.14748364\\1e9/g'"'"' {} \\;
+ s/runhaskell Setup test/_check_diff \\0/
+ '
+)"
+
+# and then we make the check insensitive to changes of order
+
+_check_diff() {
+ if ! "$@" > check.log; then
+ if ! diff -u <(
+ grep '^\s*expected:' check.log | \
+ sed 's/^[^:]*://' | \
+ tr '{},' '\n' | \
+ sort
+ ) <(
+ grep '^\s*but got:' check.log | \
+ sed 's/^[^:]*://' | \
+ tr '{},' '\n' | \
+ sort
+ ); then
+ cat check.log
+ return 1
+ fi
+ fi
+}
diff --git a/extra/heaptrack/49577e019ea791ee63962cdfe7e9c0c5b5c6ea4b.patch b/extra/heaptrack/49577e019ea791ee63962cdfe7e9c0c5b5c6ea4b.patch
new file mode 100644
index 00000000..9ddad81e
--- /dev/null
+++ b/extra/heaptrack/49577e019ea791ee63962cdfe7e9c0c5b5c6ea4b.patch
@@ -0,0 +1,25 @@
+diff --git a/tests/auto/tst_io.cpp b/tests/auto/tst_io.cpp
+index 48abda6..fd31b31 100644
+--- a/tests/auto/tst_io.cpp
++++ b/tests/auto/tst_io.cpp
+@@ -27,6 +27,11 @@
+
+ using namespace std;
+
++constexpr uint64_t operator""_u64(unsigned long long v)
++{
++ return static_cast<uint64_t>(v);
++}
++
+ TEST_CASE ("write data", "[write]") {
+ TempFile file;
+ REQUIRE(file.open());
+@@ -124,7 +129,7 @@ TEST_CASE ("read line 64bit", "[read]") {
+ REQUIRE(reader >> module);
+ REQUIRE(module == "/tmp/KDevelop-5.2.1-x86_64/usr/lib/libKF5Completion.so.5");
+
+- for (uint64_t expected : {0x7f48beedc00ul, 0x0ul, 0x36854ul, 0x236858ul, 0x2700ul}) {
++ for (auto expected : {0x7f48beedc00_u64, 0x0_u64, 0x36854_u64, 0x236858_u64, 0x2700_u64}) {
+ uint64_t addr = 0;
+ REQUIRE(reader >> addr);
+ REQUIRE(addr == expected);
diff --git a/extra/heaptrack/76fd2e84ba133e96d2cfdf90cb715e66e923eb8f.patch b/extra/heaptrack/76fd2e84ba133e96d2cfdf90cb715e66e923eb8f.patch
new file mode 100644
index 00000000..8448d679
--- /dev/null
+++ b/extra/heaptrack/76fd2e84ba133e96d2cfdf90cb715e66e923eb8f.patch
@@ -0,0 +1,16 @@
+diff --git a/src/util/linewriter.h b/src/util/linewriter.h
+index 73a7930..e895e87 100644
+--- a/src/util/linewriter.h
++++ b/src/util/linewriter.h
+@@ -158,6 +158,11 @@ public:
+ return __builtin_clzl(V);
+ }
+
++ inline static unsigned clz(long long unsigned V)
++ {
++ return __builtin_clzll(V);
++ }
++
+ template <typename V>
+ static char* writeHexNumber(char* buffer, V value)
+ {
diff --git a/extra/heaptrack/PKGBUILD b/extra/heaptrack/PKGBUILD
new file mode 100644
index 00000000..86e5c06b
--- /dev/null
+++ b/extra/heaptrack/PKGBUILD
@@ -0,0 +1,15 @@
+# backport 32-bit specific fixed from trunk to 1.1.0
+
+source+=('76fd2e84ba133e96d2cfdf90cb715e66e923eb8f.patch' '49577e019ea791ee63962cdfe7e9c0c5b5c6ea4b.patch' 'c456f6a1575fb2834238a1f693e7c7787d768d42.patch')
+sha256sums+=('7e5256b5f129d5b88c72b8621fc676322c4bcbb4388973d3b5c9b7ff2c874334' '2ef8e8b95792cbebfb33a1959e2fdb8fcbb24edd0243cccd0f25958d1592aaab' 'a8ad15176973a074e97492d7008555ecd895a8fbe7f0805a9f4562054311091d')
+
+eval "$(
+ declare -f prepare | \
+ sed '
+ /}/ i \
+ cd ${pkgname}-${pkgver}\n \
+ patch -Np1 < ${srcdir}/76fd2e84ba133e96d2cfdf90cb715e66e923eb8f.patch\n \
+ patch -Np1 < ${srcdir}/49577e019ea791ee63962cdfe7e9c0c5b5c6ea4b.patch\n \
+ patch -Np1 < ${srcdir}/c456f6a1575fb2834238a1f693e7c7787d768d42.patch
+ '
+)"
diff --git a/extra/heaptrack/c456f6a1575fb2834238a1f693e7c7787d768d42.patch b/extra/heaptrack/c456f6a1575fb2834238a1f693e7c7787d768d42.patch
new file mode 100644
index 00000000..e6b8f739
--- /dev/null
+++ b/extra/heaptrack/c456f6a1575fb2834238a1f693e7c7787d768d42.patch
@@ -0,0 +1,13 @@
+diff --git a/src/track/libheaptrack.cpp b/src/track/libheaptrack.cpp
+index 8646893..af1ba5e 100644
+--- a/src/track/libheaptrack.cpp
++++ b/src/track/libheaptrack.cpp
+@@ -121,7 +121,7 @@ inline void debugLog(const char fmt[], Args... args)
+ if (debugLevel <= s_debugVerbosity) {
+ RecursionGuard guard;
+ flockfile(stderr);
+- fprintf(stderr, "heaptrack debug(%d) [%d:%d]@%lu ", static_cast<int>(debugLevel), getpid(), gettid(),
++ fprintf(stderr, "heaptrack debug(%d) [%d:%d]@%" PRIu64 " ", static_cast<int>(debugLevel), getpid(), gettid(),
+ elapsedTime().count());
+ fprintf(stderr, fmt, args...);
+ fputc('\n', stderr);
diff --git a/extra/helm-synth/PKGBUILD b/extra/helm-synth/PKGBUILD
new file mode 100644
index 00000000..727d65f8
--- /dev/null
+++ b/extra/helm-synth/PKGBUILD
@@ -0,0 +1,10 @@
+# reported upstream, see https://github.com/mtytel/helm/issues/190
+source+=('helm-0.9.0-sigemptyset-glibc-2.26.patch')
+sha512sums+=('7786c0fdf6ec0cfdb2e7344742327454e9ab82e83e43cb6492d3b6fd047f0070b8da23055d9d9df2fc325ce440b1b51ef8919fb9749cab3d6800946cebf03ab8')
+
+eval "$(
+ declare -f prepare | \
+ sed '
+ /cd/ a patch -Np1 -i "${srcdir}"/helm-0.9.0-sigemptyset-glibc-2.26.patch
+ '
+)"
diff --git a/extra/helm-synth/helm-0.9.0-sigemptyset-glibc-2.26.patch b/extra/helm-synth/helm-0.9.0-sigemptyset-glibc-2.26.patch
new file mode 100644
index 00000000..bf11db6c
--- /dev/null
+++ b/extra/helm-synth/helm-0.9.0-sigemptyset-glibc-2.26.patch
@@ -0,0 +1,15 @@
+diff -rauN helm-0.9.0/JUCE/modules/juce_audio_formats/codecs/flac/libFLAC/cpu.c helm-0.9.0-sigemptyset-glibc-2.26-patch/JUCE/modules/juce_audio_formats/codecs/flac/libFLAC/cpu.c
+--- helm-0.9.0/JUCE/modules/juce_audio_formats/codecs/flac/libFLAC/cpu.c 2017-07-08 23:40:42.000000000 +0200
++++ helm-0.9.0-sigemptyset-glibc-2.26-patch/JUCE/modules/juce_audio_formats/codecs/flac/libFLAC/cpu.c 2018-03-15 20:47:50.816542352 +0100
+@@ -244,11 +244,7 @@
+ struct sigaction sigill_save;
+ struct sigaction sigill_sse;
+ sigill_sse.sa_sigaction = sigill_handler_sse_os;
+- #ifdef __ANDROID__
+ sigemptyset (&sigill_sse.sa_mask);
+- #else
+- __sigemptyset(&sigill_sse.sa_mask);
+- #endif
+ sigill_sse.sa_flags = SA_SIGINFO | SA_RESETHAND; /* SA_RESETHAND just in case our SIGILL return jump breaks, so we don't get stuck in a loop */
+ if(0 == sigaction(SIGILL, &sigill_sse, &sigill_save))
+ {
diff --git a/extra/hotdoc/PKGBUILD b/extra/hotdoc/PKGBUILD
new file mode 100644
index 00000000..ab1235a9
--- /dev/null
+++ b/extra/hotdoc/PKGBUILD
@@ -0,0 +1,7 @@
+# patch CARCH
+eval "$(
+ declare -f check | \
+ sed '
+ s/\$CARCH/i686/
+ ';
+)"
diff --git a/extra/imapsync/PKGBUILD b/extra/imapsync/PKGBUILD
new file mode 100644
index 00000000..50de2046
--- /dev/null
+++ b/extra/imapsync/PKGBUILD
@@ -0,0 +1,2 @@
+# blocks slaves
+unset check
diff --git a/extra/intel-graphics-compiler/PKGBUILD b/extra/intel-graphics-compiler/PKGBUILD
new file mode 100644
index 00000000..85ef1d84
--- /dev/null
+++ b/extra/intel-graphics-compiler/PKGBUILD
@@ -0,0 +1,5 @@
+# we build for Linux32!
+eval "$(
+ declare -f build \
+ | sed 's/Linux64/Linux32/'
+)"
diff --git a/extra/ipxe/PKGBUILD b/extra/ipxe/PKGBUILD
new file mode 100644
index 00000000..1e6bcccd
--- /dev/null
+++ b/extra/ipxe/PKGBUILD
@@ -0,0 +1,14 @@
+# do not build 64-bit EFI version
+eval "$(
+ declare -f build | \
+ sed '
+ s|bin-x86_64-efi/ipxe.efi||g
+ s/.*mv.*src.*bin-x86_64-efi.*//g
+ '
+)"
+eval "$(
+ declare -f package | \
+ sed '
+ s|x86_64||g
+ '
+)"
diff --git a/extra/ispc/PKGBUILD b/extra/ispc/PKGBUILD
new file mode 100644
index 00000000..ead7793e
--- /dev/null
+++ b/extra/ispc/PKGBUILD
@@ -0,0 +1,41 @@
+# disable GENX
+eval "$(
+ declare -f build | \
+ sed '
+ s/-DGENX_ENABLED=ON/-DGENX_ENABLED=OFF/
+ '
+)"
+
+# don't assume to be on a 64-bit Intel host and draw in gnu64 headers everywhere
+source+=('ispc-1.16.1-host-amd64.patch')
+sha256sums+=('7a4a631ad178b13f9ab68e6aec94469e30a4b9dec48d40f732a701b4ed4d5c1f')
+eval "$(
+ {
+ declare -f prepare || \
+ printf 'prepare() {\n}\n'
+ } \
+ | sed '
+ $i cd "$srcdir/$pkgname-$pkgver" \
+ patch -Np1 -i "$srcdir/ispc-1.16.1-host-amd64.patch"
+ '
+)"
+
+# ignore test results, GENX tests failing obviously
+eval "$(
+ declare -f build | \
+ sed '
+ s/\(make.*check-all\)/\1 || true/
+ '
+)"
+
+# packaging issue now as we are not building everything
+eval "$(
+ declare -f package | \
+ sed '
+ /rm.*build/d
+ /rm.*libispcrt_static.a/d
+ '
+)"
+
+# tests don't build when disabling GENX
+unset check
diff --git a/extra/ispc/ispc-1.16.1-host-amd64.patch b/extra/ispc/ispc-1.16.1-host-amd64.patch
new file mode 100644
index 00000000..78ef5f20
--- /dev/null
+++ b/extra/ispc/ispc-1.16.1-host-amd64.patch
@@ -0,0 +1,16 @@
+diff -rauN ispc-1.16.1/CMakeLists.txt ispc-1.16.1-host-amd64-patch/CMakeLists.txt
+--- ispc-1.16.1/CMakeLists.txt 2021-07-16 01:04:31.000000000 +0200
++++ ispc-1.16.1-host-amd64-patch/CMakeLists.txt 2022-04-07 08:57:32.100539305 +0200
+@@ -45,9 +45,9 @@
+ project(${PROJECT_NAME})
+
+ set(X86_HOST FALSE)
+-if (${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "AMD64|86")
+- set(X86_HOST TRUE)
+-endif()
++#if (${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "AMD64|86")
++# set(X86_HOST TRUE)
++#endif()
+
+ option(X86_ENABLED "Enable x86 support" ${X86_HOST})
+ option(ARM_ENABLED "Enable ARM support" ON)
diff --git a/extra/john/PKGBUILD b/extra/john/PKGBUILD
new file mode 100644
index 00000000..597c394d
--- /dev/null
+++ b/extra/john/PKGBUILD
@@ -0,0 +1,51 @@
+# fix architecture case
+if [ "${CARCH}" = "pentium4" ]; then
+ eval "$(
+ declare -f build | \
+ sed '
+ s/i686/pentium4/
+ /.*avx.*/,/else/ {/.*avx.*/n;/else/!d}
+ '
+ )"
+ eval "$(
+ declare -f build | \
+ sed '
+ /avx/d
+ '
+ )"
+fi
+if [ "${CARCH}" = "i686" ]; then
+ eval "$(
+ declare -f build | \
+ sed '
+ /.*sse.*/,/else/ {/.*sse.*/n;/else/!d}
+ '
+ )"
+ eval "$(
+ declare -f build | \
+ sed '
+ /sse/d
+ '
+ )"
+fi
+if [ "${CARCH}" = "i486" ]; then
+ eval "$(
+ declare -f build | \
+ sed '
+ s/i686/i486/
+ /.* -mmmx.*/,/else/ {/.* -mmmx.*/n;/else/!d}
+ '
+ )"
+ eval "$(
+ declare -f build | \
+ sed '
+ /mmx/d
+ '
+ )"
+fi
+eval "$(
+ declare -f build | \
+ sed '
+ s/-DCPU_FALLBACK//
+ '
+)"
diff --git a/extra/julia/PKGBUILD b/extra/julia/PKGBUILD
new file mode 100644
index 00000000..a00df5b2
--- /dev/null
+++ b/extra/julia/PKGBUILD
@@ -0,0 +1,31 @@
+eval "$(
+ declare -f build | \
+ sed '
+ /.*make.*$_buildopts/ i \
+ _buildopts="${_buildopts/MARCH=x86-64/MARCH=pentium4}" \
+ '
+)"
+
+eval "$(
+ declare -f package | \
+ sed '
+ /.*make.*$_buildopts/ i \
+ _buildopts="${_buildopts/MARCH=x86-64/MARCH=pentium4}" \
+ '
+)"
+
+eval "$(
+ declare -f build | \
+ sed '
+ /^\s*make / i export CFLAGS+=" -march=pentium4" \
+ export CXXFLAGS+=" -march=pentium4"
+ '
+)"
+
+eval "$(
+ declare -f package | \
+ sed '
+ /^\s*make / i export CFLAGS+=" -march=pentium4" \
+ export CXXFLAGS+=" -march=pentium4"
+ '
+)"
diff --git a/extra/kernel-headers-musl/PKGBUILD b/extra/kernel-headers-musl/PKGBUILD
new file mode 100644
index 00000000..af11129f
--- /dev/null
+++ b/extra/kernel-headers-musl/PKGBUILD
@@ -0,0 +1,16 @@
+# set x86 for all our sub-architectures
+# (we should actually patch ${_CARCH}, but this is too complicated for me)
+
+eval "$(
+ declare -f build | \
+ sed '
+ s/ARCH=${_CARCH}/ARCH=x86/g
+ '
+)"
+
+eval "$(
+ declare -f package | \
+ sed '
+ s/ARCH=${_CARCH}/ARCH=x86/g
+ '
+)"
diff --git a/extra/keybase/PKGBUILD b/extra/keybase/PKGBUILD
new file mode 100644
index 00000000..f42f5141
--- /dev/null
+++ b/extra/keybase/PKGBUILD
@@ -0,0 +1,10 @@
+# no electron => no keybase-gui
+pkgname=(${pkgname[@]//keybase-gui/})
+unset -f package_keybase-gui
+
+eval "$(
+ declare -f build | \
+ sed '
+ /^\s*yarn\s/d
+ '
+)"
diff --git a/extra/kodi/PKGBUILD b/extra/kodi/PKGBUILD
new file mode 100644
index 00000000..44894427
--- /dev/null
+++ b/extra/kodi/PKGBUILD
@@ -0,0 +1 @@
+makedepends=("${makedepends[@]/java-runtime/java-runtime=8}")
diff --git a/extra/ksh/PKGBUILD b/extra/ksh/PKGBUILD
new file mode 100644
index 00000000..984eb7ba
--- /dev/null
+++ b/extra/ksh/PKGBUILD
@@ -0,0 +1,9 @@
+# on i486, uname reports the wrong architecture, so tests fail
+if [ "${CARCH}" = 'i486' ]; then
+ eval "$(
+ declare -f check \
+ | sed '
+ /meson test/ s@$@ || true; ! grep -vwF uname meson-logs/testlog.txt | grep -qwF FAIL@
+ '
+ )"
+fi
diff --git a/extra/kustomize/PKGBUILD b/extra/kustomize/PKGBUILD
new file mode 100644
index 00000000..ff9cb770
--- /dev/null
+++ b/extra/kustomize/PKGBUILD
@@ -0,0 +1,3 @@
+# skip check(), it fails
+unset check
+unset checkdepends
diff --git a/extra/kvazaar/PKGBUILD b/extra/kvazaar/PKGBUILD
new file mode 100644
index 00000000..290ac071
--- /dev/null
+++ b/extra/kvazaar/PKGBUILD
@@ -0,0 +1,2 @@
+# takes long or hangs
+unset check
diff --git a/extra/ldc/PKGBUILD b/extra/ldc/PKGBUILD
new file mode 100644
index 00000000..a14218b2
--- /dev/null
+++ b/extra/ldc/PKGBUILD
@@ -0,0 +1,2 @@
+# temporary workaround for building next version
+makedepends+=(llvm10-libs)
diff --git a/extra/libantlr3c/PKGBUILD b/extra/libantlr3c/PKGBUILD
new file mode 100644
index 00000000..f6c5ebfa
--- /dev/null
+++ b/extra/libantlr3c/PKGBUILD
@@ -0,0 +1,7 @@
+eval "$(
+ declare -f build | \
+ sed '
+ s/--enable-64bit //
+ '
+)"
+
diff --git a/extra/libavif/PKGBUILD b/extra/libavif/PKGBUILD
new file mode 100644
index 00000000..10c53c42
--- /dev/null
+++ b/extra/libavif/PKGBUILD
@@ -0,0 +1,20 @@
+# svt-av1 is 64-bit only
+depends=(${depends[@]//svt-av1/})
+eval "$(
+ declare -f build | \
+ sed '
+ s/-DAVIF_CODEC_SVT=ON/-DAVIF_CODEC_SVT=OFF/
+ '
+)"
+
+# on i486 we ignore rav1e for now (needs rust)
+if [ "$CARCH" = 'i486' ]; then
+ depends=(${depends[@]//rav1e/})
+ eval "$(
+ declare -f build | \
+ sed '
+ s/-DAVIF_CODEC_RAV1E=ON/-DAVIF_CODEC_RAV1E=OFF/
+ '
+ )"
+fi
+
diff --git a/extra/libffado/PKGBUILD b/extra/libffado/PKGBUILD
new file mode 100644
index 00000000..c8d846c0
--- /dev/null
+++ b/extra/libffado/PKGBUILD
@@ -0,0 +1,32 @@
+# not available on i486 (yet) - configure seems to automatically handle absence
+makedepends_i686=(
+ $(
+ printf '%s\n' "${makedepends[@]}" \
+ | grep -xF 'python-pyqt5'
+ )
+)
+makedepends_pentium4=("${makedepends_i686[@]}")
+makedepends=(
+ $(
+ printf '%s\n' "${makedepends[@]}" \
+ | grep -vxF 'python-pyqt5'
+ )
+)
+_IFS="${IFS}"
+IFS=''
+optdepends_i686=(
+ $(
+ printf '%s\n' "${optdepends[@]}" \
+ | grep '^python-pyqt5: '
+ )
+)
+optdepends_pentium4=(
+ "${optdepends_i686[@]}"
+)
+optdepends=(
+ $(
+ printf '%s\n' "${optdepends[@]}" \
+ | grep -v '^python-pyqt5: '
+ )
+)
+IFS="${_IFS}"
diff --git a/extra/libffi33/PKGBUILD b/extra/libffi33/PKGBUILD
new file mode 100644
index 00000000..0c19a6a6
--- /dev/null
+++ b/extra/libffi33/PKGBUILD
@@ -0,0 +1,50 @@
+# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
+# Contributor: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
+# Contributor: Stéphane Gaudreault <stephane@archlinux.org>
+# Contributor: Jan de Groot <jgc@archlinux.org>
+
+pkgname=libffi33
+_pkgname=libffi
+pkgver=3.3
+pkgrel=5
+pkgdesc='Portable foreign function interface library'
+arch=(i486 i686 pentium4 'x86_64')
+url='https://sourceware.org/libffi/'
+license=('MIT')
+depends=('glibc')
+checkdepends=('dejagnu')
+provides=('libffi.so')
+source=(https://github.com/libffi/libffi/releases/download/v$pkgver/libffi-$pkgver.tar.gz)
+sha256sums=('72fba7922703ddfa7a028d513ac15a85c8d54c8d67f55fa5a4802885dc652056')
+b2sums=('cddc40729a30a9bd34d675809f51f8d1b4ccaffa54bc6dd6f7e965f4e260edd34754719f9f6247c8957aeb7cf154d56ce1fe16a54c3f1ad39afbebdf41d23caa')
+
+build() {
+ cd $_pkgname-$pkgver
+ # remove --disable-exec-static-tramp once ghc and gobject-introspection
+ # work fine with it enabled (https://github.com/libffi/libffi/pull/647)
+ ./configure \
+ --prefix=/usr \
+ --disable-static \
+ --disable-multi-os-directory \
+ --disable-exec-static-tramp \
+ --enable-pax_emutramp
+ make
+}
+
+check() {
+ true
+# make -C $_pkgname-$pkgver check
+}
+
+package() {
+ cd $_pkgname-$pkgver
+ make DESTDIR="$pkgdir" install
+ install -Dm 644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname
+ install -Dm 644 README.md -t "$pkgdir"/usr/share/doc/$pkgname
+ rm -rf "$pkgdir"/usr/lib/libffi.so
+ rm -rf "$pkgdir"/usr/include
+ rm -rf "$pkgdir"/usr/lib/pkgconfig
+ rm -rf "$pkgdir"/usr/share
+}
+
+# vim: ts=2 sw=2 et:
diff --git a/extra/libfilezilla/PKGBUILD b/extra/libfilezilla/PKGBUILD
new file mode 100644
index 00000000..d2ceb105
--- /dev/null
+++ b/extra/libfilezilla/PKGBUILD
@@ -0,0 +1,11 @@
+# atomic for i486
+if [ "$CARCH" = 'i486' ]; then
+ eval "$(
+ declare -f build | \
+ sed '
+ /export CC=/ a \
+ export LDFLAGS=-latomic
+ '
+ )
+ "
+fi
diff --git a/extra/libgda/PKGBUILD b/extra/libgda/PKGBUILD
new file mode 100644
index 00000000..8ec2208e
--- /dev/null
+++ b/extra/libgda/PKGBUILD
@@ -0,0 +1,26 @@
+# backported java probing patch for i386
+source+=('java.patch')
+sha256sums+=('e28ea88d49bcb91fa6907440a6785a508fb681c463188b3805509773f5d0fc22')
+
+eval "$(
+ declare -f prepare | \
+ sed '
+ /autogen/ i \
+ patch -Np1 -i "$srcdir/java.patch" \
+ javac getsp.java
+ '
+)"
+
+# no firebird
+eval "$(
+ declare -f package_libgda | \
+ sed '
+ /provider/s/firebird//
+ '
+ declare -f package_libgda-firebird | \
+ sed '
+ 3 i if false; then
+ $ i fi
+ '
+)
+"
diff --git a/extra/libgda/java.patch b/extra/libgda/java.patch
new file mode 100644
index 00000000..7f12c5ad
--- /dev/null
+++ b/extra/libgda/java.patch
@@ -0,0 +1,36 @@
+diff -u -r libgda-5.2.4/getsp.java libgda-5.2.4-java/getsp.java
+--- libgda-5.2.4/getsp.java 2014-02-05 21:28:20.000000000 +0100
++++ libgda-5.2.4-java/getsp.java 2015-06-14 20:27:35.770310228 +0200
+@@ -25,7 +25,7 @@
+ while (i<=j) {
+ if (i==j || lp.charAt(i)==ps) {
+ String lib=lp.substring(k,i);
+- String suffix="/lib/amd64/server";
++ String suffix="/lib/"+System.getProperty("os.arch")+"/server";
+ k=i+1;
+ if (lib.compareTo(".")!=0)
+ r=(r==null)?(prefix+lib+suffix):(r+" "+prefix+lib+suffix);
+@@ -50,7 +50,7 @@
+
+ if (r!=null) System.out.println(r);
+ } else if (args[0].compareTo("-ldpath")==0) {
+- String lp1=System.getProperty("java.home")+"/lib/amd64/server";
++ String lp1=System.getProperty("java.home")+"/lib/"+System.getProperty("os.arch")+"/server";
+ String lp2=System.getProperty("java.library.path");
+ System.out.println(lp1+":"+lp2);
+ }
+diff -u -r libgda-5.2.4/m4/java.m4 libgda-5.2.4-java/m4/java.m4
+--- libgda-5.2.4/m4/java.m4 2015-06-13 10:36:25.000000000 +0200
++++ libgda-5.2.4-java/m4/java.m4 2015-06-14 20:16:59.865581930 +0200
+@@ -175,6 +175,11 @@
+ JTYPE="Sun JRE 1.7"
+ JFLAGS="-Xlint:unchecked -Xlint:deprecation"
+ ;;
++ JRE1.8.*)
++ try_java=true
++ JTYPE="Sun JRE 1.8"
++ JFLAGS="-Xlint:unchecked -Xlint:deprecation"
++ ;;
+ JREgcj-4*)
+ try_java=true
+ JTYPE="GCJ"
diff --git a/extra/libjxl/PKGBUILD b/extra/libjxl/PKGBUILD
new file mode 100644
index 00000000..29fb0241
--- /dev/null
+++ b/extra/libjxl/PKGBUILD
@@ -0,0 +1,20 @@
+if [ "${CARCH}" = "i486" ]; then
+ # Java broken on i486 temporarily
+ makedepends=(${makedepends[@]//java-environment/})
+ eval "$(
+ declare -f build | \
+ sed '
+ s/-DJPEGXL_INSTALL_JARDIR='.*'//
+ '
+ )"
+
+ # break circle with gimp
+ makedepends=(${makedepends[@]//gimp/})
+fi
+
+# blacklisted on i486 and i686 as I don't really know how to switch
+# off SSE2 in this mess. It builds on i686 in a chroot on AMD64 but
+# wrongly tests positive for SSE2.
+
+# they fail in various waus
+unset check
diff --git a/extra/libkeccak/PKGBUILD b/extra/libkeccak/PKGBUILD
new file mode 100644
index 00000000..5f1e25a0
--- /dev/null
+++ b/extra/libkeccak/PKGBUILD
@@ -0,0 +1,19 @@
+# valgrind no longer supports i486 (configuire tests for the binary,
+# no explicit configure option available)
+if [ "$CARCH" = 'i486' ]; then
+ checkdepends=(${checkdepends[@]//valgrind/})
+
+ source+=('libkeccak-1.2.2-no-valgrind.patch')
+ b2sums+=('8c8b23d104e19f1d4431e0f11e6e5995721fe1ed5a8e94ddcd28e8a09e2b11b89e7d7fec896d8b028a77560c4dbcae8f887c0d2fc1ce6f8e0c52e2f1de7a8c09')
+
+ eval "$(
+ {
+ declare -f prepare || \
+ printf 'prepare() {\n}\n'
+ } \
+ | sed '
+ $i cd "${srcdir}/${pkgbase}-${pkgver}" \
+ patch -Np1 -i "$srcdir/libkeccak-1.2.2-no-valgrind.patch"
+ '
+ )"
+fi
diff --git a/extra/libkeccak/libkeccak-1.2.2-no-valgrind.patch b/extra/libkeccak/libkeccak-1.2.2-no-valgrind.patch
new file mode 100644
index 00000000..c8e5d977
--- /dev/null
+++ b/extra/libkeccak/libkeccak-1.2.2-no-valgrind.patch
@@ -0,0 +1,15 @@
+diff -rauN libkeccak-1.2.2/Makefile libkeccak-1.2.2-no-valgrind-patch/Makefile
+--- libkeccak-1.2.2/Makefile 2021-07-30 18:59:01.000000000 +0200
++++ libkeccak-1.2.2-no-valgrind-patch/Makefile 2021-08-20 08:33:43.677087692 +0200
+@@ -159,10 +159,7 @@
+ @test $$(sha256sum .testfile | cut -d ' ' -f 1) = \
+ e21d814d21ca269246849cc105faec1a71ac7d1cdb1a86023254f49d51b47231 || \
+ ( echo 'The file .testfile is incorrect, test will fail!' ; false )
+- valgrind --leak-check=full ./test
+- test $$(valgrind ./test 2>&1 >/dev/null | wc -l) = 14
+-# Using valgrind 3.10.0, its output to standard error should consist of 14 lines,
+-# the test itself never prints to standard error.
++ ./test 2>&1 >/dev/null
+
+ benchfile:
+ dd if=/dev/urandom bs=1000 count=50 > $@
diff --git a/extra/libmysofa/PKGBUILD b/extra/libmysofa/PKGBUILD
new file mode 100644
index 00000000..6b978deb
--- /dev/null
+++ b/extra/libmysofa/PKGBUILD
@@ -0,0 +1,5 @@
+# no nodejs on i486, used only in tests
+if [ "$CARCH" == 'i486' ]; then
+ checkdepends=(${checkdepends[@]//nodejs/})
+ unset check
+fi
diff --git a/extra/libnids/PKGBUILD b/extra/libnids/PKGBUILD
new file mode 100644
index 00000000..7a510454
--- /dev/null
+++ b/extra/libnids/PKGBUILD
@@ -0,0 +1,17 @@
+# libndis defines some functions inline, so they are not in the shared library,
+# needed for instance for dsniff
+# see https://src.fedoraproject.org/cgit/rpms/libnids.git/commit/?id=ecafb692f20e0acad555f66c3cc1646997a82dae
+
+source+=('libnids-1.24-inline.patch')
+sha256sums+=('3aea2351877c2a789d753ac66f1323a3d575dead9fb04c559e221dbebdfc7e3e')
+
+eval "$(
+ {
+ declare -f prepare || \
+ printf 'prepare() {\n}\n'
+ } \
+ | sed '
+ $i cd "$srcdir/$pkgname-$pkgver" \
+ patch -Np1 -i "$srcdir/libnids-1.24-inline.patch"
+ '
+)"
diff --git a/extra/libnids/libnids-1.24-inline.patch b/extra/libnids/libnids-1.24-inline.patch
new file mode 100644
index 00000000..b17b73e9
--- /dev/null
+++ b/extra/libnids/libnids-1.24-inline.patch
@@ -0,0 +1,46 @@
+diff -rauN libnids-1.24/src/checksum.c libnids-1.24-inline-patch/src/checksum.c
+--- libnids-1.24/src/checksum.c 2010-02-26 11:58:41.000000000 +0100
++++ libnids-1.24-inline-patch/src/checksum.c 2018-05-03 07:53:10.552320792 +0200
+@@ -120,7 +120,7 @@
+ By Jorge Cwik <jorge@laser.satlink.net>, adapted for linux by Arnt
+ Gulbrandsen.
+ */
+-inline u_short ip_fast_csum(u_char * iph, u_int ihl)
++u_short ip_fast_csum(u_char * iph, u_int ihl)
+ {
+ u_int sum;
+ if (dontchksum(((struct ip*)iph)->ip_src.s_addr))
+@@ -172,7 +172,7 @@
+ computes the checksum of the TCP/UDP pseudo-header
+ returns a 16-bit checksum, already complemented
+ */
+-static inline u_short
++static u_short
+ csum_tcpudp_magic(u_int saddr, u_int daddr, u_short len,
+ u_short proto, u_int sum)
+ {
+@@ -191,13 +191,13 @@
+ this routine is used for miscellaneous IP-like checksums, mainly in
+ icmp.c
+ */
+-inline u_short
++u_short
+ ip_compute_csum(u_char * buff, int len)
+ {
+ return (csum_fold(csum_partial(buff, len, 0)));
+ }
+
+-inline u_short
++u_short
+ my_tcp_check(struct tcphdr *th, int len, u_int saddr, u_int daddr)
+ {
+ if (dontchksum(saddr))
+@@ -205,7 +205,7 @@
+ return csum_tcpudp_magic(saddr, daddr, len, IPPROTO_TCP,
+ csum_partial((u_char *)th, len, 0));
+ }
+-inline u_short
++u_short
+ my_udp_check(void *u, int len, u_int saddr, u_int daddr)
+ {
+ if (dontchksum(saddr))
diff --git a/extra/libretro-blastem/PKGBUILD b/extra/libretro-blastem/PKGBUILD
new file mode 100644
index 00000000..7be65252
--- /dev/null
+++ b/extra/libretro-blastem/PKGBUILD
@@ -0,0 +1,6 @@
+eval "$(
+ declare -f build | \
+ sed '
+ s/x86_64/x86/
+ '
+)"
diff --git a/extra/libretro-pcsx-rearmed/PKGBUILD b/extra/libretro-pcsx-rearmed/PKGBUILD
new file mode 100644
index 00000000..bdd1f6a7
--- /dev/null
+++ b/extra/libretro-pcsx-rearmed/PKGBUILD
@@ -0,0 +1 @@
+sha256sums[1]='9daf71445b3cf0e7f9292fa8617d540f5d624eaf8dcf36a89e5a1e0c319acc36'
diff --git a/extra/libvirt/PKGBUILD b/extra/libvirt/PKGBUILD
new file mode 100644
index 00000000..ac9207d7
--- /dev/null
+++ b/extra/libvirt/PKGBUILD
@@ -0,0 +1,36 @@
+# ceph doesn't run on 32-bit currently (see FS32#21)
+depends=(${depends[@]/ceph-libs/})
+makedepends=(${makedepends[@]/ceph-libs/})
+
+# remove qemu-rdb (configure doesn't see rdb, does it depend on ceph?)
+pkgname=(${pkgname[@]/libvirt-storage-rbd/})
+unset -f 'libvirt-storage-rbd'
+
+eval "$(
+ declare -f package_libvirt | \
+ sed '
+ s/libvirt_storage_backend_{rbd,gluster}.so/libvirt_storage_backend_gluster.so/
+ '
+)"
+
+eval "$(
+ declare -f build | \
+ sed '
+ s/-Dstorage_rbd=enabled/-Dstorage_rbd=disabled/
+ '
+)"
+
+# ignore some failing tests (look like races or/and timeout issues, on different
+# sub-architecture and runs different tests fail)
+# 108/148 virnettlscontexttest FAIL 0.14s exit status 1
+# 109/148 virnettlscontexttest FAIL 0.61s exit status 1
+# 111/148 virnettlscontexttest FAIL 0.16s exit status 1
+# 117/148 virnettlssessiontest FAIL 0.34s exit status 1
+# 118/148 virnettlssessiontest FAIL 0.34s exit status 1
+# 121/148 virnettlssessiontest FAIL 1.41s exit status 1
+eval "$(
+ declare -f check | \
+ sed '
+ s/\(ninja -C build test\)/\1 || true/
+ '
+)"
diff --git a/extra/linux-tools/PKGBUILD b/extra/linux-tools/PKGBUILD
new file mode 100644
index 00000000..acbe071a
--- /dev/null
+++ b/extra/linux-tools/PKGBUILD
@@ -0,0 +1,60 @@
+# use our tarballer instead of cloning from git
+for ((i=0; i<${#source[@]}; i++)); do
+ infos=$(
+ printf '%s\n' "${source[${i}]}" | \
+ sed '
+ s@^\(\([^:]\+\)::\)\?\(git\|hg\)+\([^#?]\+\)\(?signed\)\?#\(\(tag\|commit\)=[^?]\+\)$@\3 \2 \4 \5 \6@
+ t
+ s@^\(\([^:]\+\)::\)\?\(git\|hg\)+\([^#?]\+\)#\(\(tag\|commit\)=[^?]\+\)\(?signed\)\?$@\3 \2 \4 \7 \5@
+ t
+ d
+ '
+ )
+ if [ -n "${infos}" ]; then
+ source[${i}]=$(
+ type="${infos%% *}"
+ infos="${infos#* }"
+ if [ -n "${infos%% *}" ]; then
+ prefix="${infos%% *}"
+ else
+ prefix=''
+ fi
+ infos="${infos#* }"
+ repo="${infos%% *}"
+ repo64=$(
+ printf '%s' "${repo}" | \
+ base64 -w0 | \
+ sed 's/=/%3D/g'
+ )
+ infos="${infos#* }"
+ if [ "${infos%% *}" = '?signed' ]; then
+ key_check=$(
+ printf '&valid_keys='
+ printf '%s,' "${validpgpkeys[@]}" | \
+ sed 's/,$//'
+ )
+ else
+ key_check=''
+ fi
+ infos="${infos#* }"
+ if [ -z "${prefix}" ]; then
+ prefix="${repo%.git}"
+ prefix="${prefix##*/}"
+ fi
+ prefix_64=$(
+ printf '%s/' "${prefix}" | \
+ base64 -w0 | \
+ sed 's/=/%3D/g'
+ )
+
+ printf '%s-%s.tar.gz::https://archive-server.archlinux32.org/?t=%s&p=%s&r=%s%s&%s\n' \
+ "${prefix}" \
+ "${pkgver}" \
+ "${type}" \
+ "${prefix_64}" \
+ "${repo64}" \
+ "${key_check}" \
+ "${infos}"
+ )
+ fi
+done
diff --git a/extra/luajit/PKGBUILD b/extra/luajit/PKGBUILD
new file mode 100644
index 00000000..a0d9c9af
--- /dev/null
+++ b/extra/luajit/PKGBUILD
@@ -0,0 +1,69 @@
+# Maintainer: Daurnimator <daurnimator@archlinux.org>
+# Maintainer: Lukas Fleischer <lfleischer@archlinux.org>
+# Contributor: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
+# Contributor: Chris Brannon <chris@the-brannons.com>
+# Contributor: Paulo Matias <matiasΘarchlinux-br·org>
+# Contributor: Anders Bergh <anders1@gmail.com>
+
+pkgname=luajit
+# LuaJIT has abandoned versioned releases and now advises using git HEAD
+# https://github.com/LuaJIT/LuaJIT/issues/665#issuecomment-784452583
+_commit=505e2c03de35e2718eef0d2d3660712e06dadf1f
+pkgver="2.1.0.beta3.r471.g${_commit::8}"
+pkgrel=1
+pkgdesc='Just-in-time compiler and drop-in replacement for Lua 5.1'
+arch=(i486 i686 pentium4 'x86_64')
+url='https://luajit.org/'
+license=('MIT')
+depends=('gcc-libs')
+source=("LuaJIT-${_commit}.tar.gz::https://repo.or.cz/luajit-2.0.git/snapshot/${_commit}.tar.gz")
+md5sums=('0847dc535736846a9a1436e18d8c509d')
+sha256sums=('b89d081aac4189a06b736c667f47cc60e0cc4591933b7ed50db38cf58496386e')
+b2sums=('89bed923ff34d2de813dee17f130496ffeaa6bc5caf9252be1df7d35e87fa7398930f1fe35f95650694d344bc99d5b2c0c4abc4568f1dac318822a832d44c3a4')
+
+build() {
+ cd "luajit-2.0-${_commit::7}"
+ # Avoid early stripping
+ make amalg PREFIX=/usr BUILDMODE=dynamic TARGET_STRIP=" @:"
+}
+
+package() {
+ cd "luajit-2.0-${_commit::7}"
+
+ make install DESTDIR="$pkgdir" PREFIX=/usr
+ install -Dm644 COPYRIGHT "$pkgdir/usr/share/licenses/$pkgname/COPYRIGHT"
+
+ ln -sf luajit-2.1.0-beta3 "$pkgdir/usr/bin/luajit"
+}
+# Re-enable x87 support for i686 CPUs (fix from KitsuWhooa)
+if [ "$CARCH" = 'i486' ]; then
+ source+=('luajit-2.0-505e2c0-i486.patch')
+ md5sums+=('44317c2d006d45b0970cee8b55a4c05e')
+ sha256sums+=('6a758da52d9ddd0162ba342276c4aa4454662b2fe8b89c8a7aa987677679fd30')
+ b2sums+=('4a467db526fa550942dee7da7dd599f5976f519573773afab74c372bbb2aa243d60384699c50695dadf0be086fc5b54253692d0836c22da4b079a73b0eb7a822')
+ eval "$(
+ {
+ declare -f prepare \
+ || printf 'prepare ()\n{\ncd "luajit-2.0-${_commit::7}"\n}\n'
+ } \
+ | sed '
+ $ i patch -p1 -i "$srcdir/luajit-2.0-505e2c0-i486.patch"
+ '
+ )"
+
+fi
+if [ "$CARCH" = 'i686' ]; then
+ source+=('c7815e1a1b49871e645252bb12e722fb4879df11.patch')
+ md5sums+=('25a3483026a359e06ec828bc666dc853')
+ sha256sums+=('a711e1d7ad7a16d0e6ba044fedc284cc0c4bee710c2d910fd9f0f0af8765c1a7')
+ b2sums+=('2d79b2dad25ba3a771348cfd38883334f511de703d2ccfdd00b808867ecf53201d680388c730aaf8941cb5159f6b819020c2da04b75346bc42428973c7f27420')
+ eval "$(
+ {
+ declare -f prepare \
+ || printf 'prepare ()\n{\ncd "luajit-2.0-${_commit::7}"\n}\n'
+ } \
+ | sed '
+ $ i patch -p1 -i "$srcdir/c7815e1a1b49871e645252bb12e722fb4879df11.patch"
+ '
+ )"
+fi
diff --git a/extra/luajit/c7815e1a1b49871e645252bb12e722fb4879df11.patch b/extra/luajit/c7815e1a1b49871e645252bb12e722fb4879df11.patch
new file mode 100644
index 00000000..13048730
--- /dev/null
+++ b/extra/luajit/c7815e1a1b49871e645252bb12e722fb4879df11.patch
@@ -0,0 +1,1668 @@
+From c7815e1a1b49871e645252bb12e722fb4879df11 Mon Sep 17 00:00:00 2001
+From: Tasos Sahanidis <tasos@tasossah.com>
+Date: Mon, 30 Jan 2023 22:57:23 +0200
+Subject: [PATCH] Revert "x86: Remove x87 support from interpreter."
+
+This reverts commit 57768cd5882eb8d39c673d9dd8598946ef7c1843.
+JIT is disabled by default and untested
+---
+ src/Makefile | 13 +-
+ src/lib_jit.c | 44 ++-
+ src/lj_asm.c | 16 +
+ src/lj_jit.h | 18 +-
+ src/lj_vm.h | 3 +-
+ src/msvcbuild.bat | 1 -
+ src/vm_x86.dasc | 798 +++++++++++++++++++++++++++++++++++++++++-----
+ 7 files changed, 793 insertions(+), 100 deletions(-)
+
+diff --git a/src/Makefile b/src/Makefile
+index 30d64be2ab..f226cc2dba 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -44,10 +44,13 @@ CCOPT= -O2 -fomit-frame-pointer
+ #
+ # Target-specific compiler options:
+ #
++# x86 only: it's recommended to compile at least for i686. Better yet,
++# compile for an architecture that has SSE2, too (-msse -msse2).
++#
+ # x86/x64 only: For GCC 4.2 or higher and if you don't intend to distribute
+ # the binaries to a different machine you could also use: -march=native
+ #
+-CCOPT_x86= -march=i686 -msse -msse2 -mfpmath=sse
++CCOPT_x86= -march=i686 -msse -mfpmath=sse
+ CCOPT_x64=
+ CCOPT_arm=
+ CCOPT_arm64=
+@@ -102,7 +105,7 @@ XCFLAGS=
+ #XCFLAGS+= -DLUAJIT_ENABLE_LUA52COMPAT
+ #
+ # Disable the JIT compiler, i.e. turn LuaJIT into a pure interpreter.
+-#XCFLAGS+= -DLUAJIT_DISABLE_JIT
++XCFLAGS+= -DLUAJIT_DISABLE_JIT
+ #
+ # Some architectures (e.g. PPC) can use either single-number (1) or
+ # dual-number (2) mode. Uncomment one of these lines to override the
+@@ -437,6 +440,11 @@ DASM_AFLAGS+= -D VER=$(subst LJ_ARCH_VERSION_,,$(filter LJ_ARCH_VERSION_%,$(subs
+ ifeq (Windows,$(TARGET_SYS))
+ DASM_AFLAGS+= -D WIN
+ endif
++ifeq (x86,$(TARGET_LJARCH))
++ ifneq (,$(findstring __SSE2__ 1,$(TARGET_TESTARCH)))
++ DASM_AFLAGS+= -D SSE
++ endif
++else
+ ifeq (x64,$(TARGET_LJARCH))
+ ifeq (,$(findstring LJ_FR2 1,$(TARGET_TESTARCH)))
+ DASM_ARCH= x86
+@@ -466,6 +474,7 @@ ifeq (ppc,$(TARGET_LJARCH))
+ endif
+ endif
+ endif
++endif
+
+ DASM_FLAGS= $(DASM_XFLAGS) $(DASM_AFLAGS)
+ DASM_DASC= vm_$(DASM_ARCH).dasc
+diff --git a/src/lib_jit.c b/src/lib_jit.c
+index 2867d4206a..2edecfcc25 100644
+--- a/src/lib_jit.c
++++ b/src/lib_jit.c
+@@ -649,7 +649,7 @@ JIT_PARAMDEF(JIT_PARAMINIT)
+ #endif
+
+ /* Arch-dependent CPU feature detection. */
+-static uint32_t jit_cpudetect(void)
++static uint32_t jit_cpudetect(lua_State *L)
+ {
+ uint32_t flags = 0;
+ #if LJ_TARGET_X86ORX64
+@@ -657,16 +657,45 @@ static uint32_t jit_cpudetect(void)
+ uint32_t vendor[4];
+ uint32_t features[4];
+ if (lj_vm_cpuid(0, vendor) && lj_vm_cpuid(1, features)) {
++#if !LJ_HASJIT
++#define JIT_F_CMOV 1
++#define JIT_F_SSE2 2
++#endif
++ flags |= ((features[3] >> 15)&1) * JIT_F_CMOV;
++ flags |= ((features[3] >> 26)&1) * JIT_F_SSE2;
++#if LJ_HASJIT
+ flags |= ((features[2] >> 0)&1) * JIT_F_SSE3;
+ flags |= ((features[2] >> 19)&1) * JIT_F_SSE4_1;
++ if (vendor[2] == 0x6c65746e) { /* Intel. */
++ if ((features[0] & 0x0ff00f00) == 0x00000f00) /* P4. */
++ flags |= JIT_F_P4; /* Currently unused. */
++ else if ((features[0] & 0x0fff0ff0) == 0x000106c0) /* Atom. */
++ flags |= JIT_F_LEA_AGU;
++ } else if (vendor[2] == 0x444d4163) { /* AMD. */
++ uint32_t fam = (features[0] & 0x0ff00f00);
++ if (fam == 0x00000f00) /* K8. */
++ flags |= JIT_F_SPLIT_XMM;
++ if (fam >= 0x00000f00) /* K8, K10. */
++ flags |= JIT_F_PREFER_IMUL;
++ }
+ if (vendor[0] >= 7) {
+ uint32_t xfeatures[4];
+ lj_vm_cpuid(7, xfeatures);
+ flags |= ((xfeatures[1] >> 8)&1) * JIT_F_BMI2;
+ }
++#endif
+ }
+- /* Don't bother checking for SSE2 -- the VM will crash before getting here. */
+-
++ /* Check for required instruction set support on x86 (unnecessary on x64). */
++#if LJ_TARGET_X86
++#if !defined(LUAJIT_CPU_NOCMOV)
++ if (!(flags & JIT_F_CMOV))
++ luaL_error(L, "CPU not supported");
++#endif
++#if defined(LUAJIT_CPU_SSE2)
++ if (!(flags & JIT_F_SSE2))
++ luaL_error(L, "CPU does not support SSE2 (recompile without -DLUAJIT_CPU_SSE2)");
++#endif
++#endif
+ #elif LJ_TARGET_ARM
+
+ int ver = LJ_ARCH_VERSION; /* Compile-time ARM CPU detection. */
+@@ -729,7 +758,12 @@ static uint32_t jit_cpudetect(void)
+ static void jit_init(lua_State *L)
+ {
+ jit_State *J = L2J(L);
+- J->flags = jit_cpudetect() | JIT_F_ON | JIT_F_OPT_DEFAULT;
++ uint32_t flags = jit_cpudetect(L);
++#if LJ_TARGET_X86
++ /* Silently turn off the JIT compiler on CPUs without SSE2. */
++ if ((flags & JIT_F_SSE2))
++#endif
++ J->flags = flags | JIT_F_ON | JIT_F_OPT_DEFAULT;
+ memcpy(J->param, jit_param_default, sizeof(J->param));
+ lj_dispatch_update(G(L));
+ }
+@@ -738,7 +772,7 @@ static void jit_init(lua_State *L)
+ LUALIB_API int luaopen_jit(lua_State *L)
+ {
+ #if LJ_HASJIT
+- jit_init(L);
++ jit_init(L); // FIXME should this be moved back to the bottom?
+ #endif
+ lua_pushliteral(L, LJ_OS_NAME);
+ lua_pushliteral(L, LJ_ARCH_NAME);
+diff --git a/src/lj_asm.c b/src/lj_asm.c
+index 6f5e0c45b1..eda81f1e51 100644
+--- a/src/lj_asm.c
++++ b/src/lj_asm.c
+@@ -2340,6 +2340,22 @@ static void asm_setup_regsp(ASMState *as)
+ }
+ break;
+ #endif
++/*
++ case IR_FPMATH:
++#if LJ_TARGET_X86ORX64
++ if (ir->op2 == IRFPM_EXP2) { // May be joined to lj_vm_pow_sse.
++ ir->prev = REGSP_HINT(RID_XMM0);
++#if !LJ_64
++ if (as->evenspill < 4) // Leave room for 16 byte scratch area.
++ as->evenspill = 4;
++#endif
++ if (inloop)
++ as->modset |= RSET_RANGE(RID_XMM0, RID_XMM2+1)|RID2RSET(RID_EAX);
++ continue;
++ } else if (ir->op2 <= IRFPM_TRUNC && !(as->flags & JIT_F_SSE4_1)) {
++ ir->prev = REGSP_HINT(RID_XMM0);
++>>>>>>> parent of 57768cd5... x86: Remove x87 support from interpreter.
++ */
+ case IR_FPMATH:
+ #if LJ_TARGET_X86ORX64
+ if (ir->op2 <= IRFPM_TRUNC) {
+diff --git a/src/lj_jit.h b/src/lj_jit.h
+index 7f081730e4..85916b8342 100644
+--- a/src/lj_jit.h
++++ b/src/lj_jit.h
+@@ -20,12 +20,18 @@
+
+ #if LJ_TARGET_X86ORX64
+
+-#define JIT_F_SSE3 (JIT_F_CPU << 0)
+-#define JIT_F_SSE4_1 (JIT_F_CPU << 1)
+-#define JIT_F_BMI2 (JIT_F_CPU << 2)
+-
+-
+-#define JIT_F_CPUSTRING "\4SSE3\6SSE4.1\4BMI2"
++#define JIT_F_CMOV (JIT_F_CPU << 0)
++#define JIT_F_SSE2 (JIT_F_CPU << 1)
++#define JIT_F_SSE3 (JIT_F_CPU << 2)
++#define JIT_F_SSE4_1 (JIT_F_CPU << 3)
++#define JIT_F_P4 (JIT_F_CPU << 4)
++#define JIT_F_PREFER_IMUL (JIT_F_CPU << 5)
++#define JIT_F_SPLIT_XMM (JIT_F_CPU << 6)
++#define JIT_F_LEA_AGU (JIT_F_CPU << 7)
++#define JIT_F_BMI2 (JIT_F_CPU << 8)
++
++
++#define JIT_F_CPUSTRING "\4CMOV\4SSE2\4SSE3\6SSE4.1\2P4\3AMD\2K8\4ATOM\4BMI2"
+
+ #elif LJ_TARGET_ARM
+
+diff --git a/src/lj_vm.h b/src/lj_vm.h
+index c66db0049f..9bc6d62fab 100644
+--- a/src/lj_vm.h
++++ b/src/lj_vm.h
+@@ -58,7 +58,8 @@ LJ_ASMF void lj_vm_exit_handler(void);
+ LJ_ASMF void lj_vm_exit_interp(void);
+
+ /* Internal math helper functions. */
+-#if LJ_TARGET_PPC || LJ_TARGET_ARM64 || (LJ_TARGET_MIPS && LJ_ABI_SOFTFP)
++// FIXME: is this correct?
++#if LJ_TARGET_X86ORX64 || LJ_TARGET_PPC || LJ_TARGET_ARM64 || (LJ_TARGET_MIPS && LJ_ABI_SOFTFP)
+ #define lj_vm_floor floor
+ #define lj_vm_ceil ceil
+ #else
+diff --git a/src/msvcbuild.bat b/src/msvcbuild.bat
+index d323d8d44d..67e53574de 100644
+--- a/src/msvcbuild.bat
++++ b/src/msvcbuild.bat
+@@ -41,7 +41,6 @@ if exist minilua.exe.manifest^
+ @set DASC=vm_x86.dasc
+ @set DASMFLAGS=-D WIN -D JIT -D FFI
+ @set LJARCH=x86
+-@set LJCOMPILE=%LJCOMPILE% /arch:SSE2
+ :X64
+ @if "%1" neq "nogc64" goto :GC64
+ @shift
+diff --git a/src/vm_x86.dasc b/src/vm_x86.dasc
+index 18ca87b545..3efbba6cdd 100644
+--- a/src/vm_x86.dasc
++++ b/src/vm_x86.dasc
+@@ -18,6 +18,7 @@
+ |
+ |.if P64
+ |.define X64, 1
++|.define SSE, 1
+ |.if WIN
+ |.define X64WIN, 1
+ |.endif
+@@ -439,6 +440,7 @@
+ | fpop
+ |.endmacro
+ |
++|.macro fdup; fld st0; .endmacro
+ |.macro fpop1; fstp st1; .endmacro
+ |
+ |// Synthesize SSE FP constants.
+@@ -464,6 +466,9 @@
+ |.macro sseconst_1, reg, tmp // Synthesize 1.0.
+ | sseconst_hi reg, tmp, 3ff00000
+ |.endmacro
++|.macro sseconst_m1, reg, tmp // Synthesize -1.0.
++| sseconst_hi reg, tmp, bff00000
++|.endmacro
+ |.macro sseconst_2p52, reg, tmp // Synthesize 2^52.
+ | sseconst_hi reg, tmp, 43300000
+ |.endmacro
+@@ -943,9 +948,13 @@ static void build_subroutines(BuildCtx *ctx)
+ |.if DUALNUM
+ | mov TMP2, LJ_TISNUM
+ | mov TMP1, RC
+- |.else
++ |.elif SSE
+ | cvtsi2sd xmm0, RC
+ | movsd TMPQ, xmm0
++ |.else
++ | mov ARG4, RC
++ | fild ARG4
++ | fstp TMPQ
+ |.endif
+ | lea RCa, TMPQ // Store temp. TValue in TMPQ.
+ | jmp >1
+@@ -1031,9 +1040,13 @@ static void build_subroutines(BuildCtx *ctx)
+ |.if DUALNUM
+ | mov TMP2, LJ_TISNUM
+ | mov TMP1, RC
+- |.else
++ |.elif SSE
+ | cvtsi2sd xmm0, RC
+ | movsd TMPQ, xmm0
++ |.else
++ | mov ARG4, RC
++ | fild ARG4
++ | fstp TMPQ
+ |.endif
+ | lea RCa, TMPQ // Store temp. TValue in TMPQ.
+ | jmp >1
+@@ -1416,6 +1429,19 @@ static void build_subroutines(BuildCtx *ctx)
+ | cmp NARGS:RD, 2+1; jb ->fff_fallback
+ |.endmacro
+ |
++ |.macro .ffunc_n, name
++ | .ffunc_1 name
++ | cmp dword [BASE+4], LJ_TISNUM; jae ->fff_fallback
++ | fld qword [BASE]
++ |.endmacro
++ |
++ |.macro .ffunc_n, name, op
++ | .ffunc_1 name
++ | cmp dword [BASE+4], LJ_TISNUM; jae ->fff_fallback
++ | op
++ | fld qword [BASE]
++ |.endmacro
++ |
+ |.macro .ffunc_nsse, name, op
+ | .ffunc_1 name
+ | cmp dword [BASE+4], LJ_TISNUM; jae ->fff_fallback
+@@ -1426,6 +1452,14 @@ static void build_subroutines(BuildCtx *ctx)
+ | .ffunc_nsse name, movsd
+ |.endmacro
+ |
++ |.macro .ffunc_nn, name
++ | .ffunc_2 name
++ | cmp dword [BASE+4], LJ_TISNUM; jae ->fff_fallback
++ | cmp dword [BASE+12], LJ_TISNUM; jae ->fff_fallback
++ | fld qword [BASE]
++ | fld qword [BASE+8]
++ |.endmacro
++ |
+ |.macro .ffunc_nnsse, name
+ | .ffunc_2 name
+ | cmp dword [BASE+4], LJ_TISNUM; jae ->fff_fallback
+@@ -1631,7 +1665,11 @@ static void build_subroutines(BuildCtx *ctx)
+ |.else
+ | jae ->fff_fallback
+ |.endif
++ |.if SSE
+ | movsd xmm0, qword [BASE]; jmp ->fff_resxmm0
++ |.else
++ | fld qword [BASE]; jmp ->fff_resn
++ |.endif
+ |
+ |.ffunc_1 tostring
+ | // Only handles the string or number case inline.
+@@ -1729,12 +1767,19 @@ static void build_subroutines(BuildCtx *ctx)
+ | add RD, 1
+ | mov dword [BASE-4], LJ_TISNUM
+ | mov dword [BASE-8], RD
+- |.else
++ |.elif SSE
+ | movsd xmm0, qword [BASE+8]
+ | sseconst_1 xmm1, RBa
+ | addsd xmm0, xmm1
+ | cvttsd2si RD, xmm0
+ | movsd qword [BASE-8], xmm0
++ |.else
++ | fld qword [BASE+8]
++ | fld1
++ | faddp st1
++ | fist ARG1
++ | fstp qword [BASE-8]
++ | mov RD, ARG1
+ |.endif
+ | mov TAB:RB, [BASE]
+ | cmp RD, TAB:RB->asize; jae >2 // Not in array part?
+@@ -1783,9 +1828,12 @@ static void build_subroutines(BuildCtx *ctx)
+ |.if DUALNUM
+ | mov dword [BASE+12], LJ_TISNUM
+ | mov dword [BASE+8], 0
+- |.else
++ |.elif SSE
+ | xorps xmm0, xmm0
+ | movsd qword [BASE+8], xmm0
++ |.else
++ | fldz
++ | fstp qword [BASE+8]
+ |.endif
+ | mov RD, 1+3
+ | jmp ->fff_res
+@@ -2017,11 +2065,6 @@ static void build_subroutines(BuildCtx *ctx)
+ |->fff_resi: // Dummy.
+ |.endif
+ |
+- |->fff_resn:
+- | mov PC, [BASE-4]
+- | fstp qword [BASE-8]
+- | jmp ->fff_res1
+- |
+ | .ffunc_1 math_abs
+ |.if DUALNUM
+ | cmp dword [BASE+4], LJ_TISNUM; jne >2
+@@ -2044,6 +2087,8 @@ static void build_subroutines(BuildCtx *ctx)
+ |.else
+ | cmp dword [BASE+4], LJ_TISNUM; jae ->fff_fallback
+ |.endif
++ |
++ |.if SSE
+ | movsd xmm0, qword [BASE]
+ | sseconst_abs xmm1, RDa
+ | andps xmm0, xmm1
+@@ -2051,6 +2096,15 @@ static void build_subroutines(BuildCtx *ctx)
+ | mov PC, [BASE-4]
+ | movsd qword [BASE-8], xmm0
+ | // fallthrough
++ |.else
++ | fld qword [BASE]
++ | fabs
++ | // fallthrough
++ |->fff_resxmm0: // Dummy.
++ |->fff_resn:
++ | mov PC, [BASE-4]
++ | fstp qword [BASE-8]
++ |.endif
+ |
+ |->fff_res1:
+ | mov RD, 1+1
+@@ -2093,8 +2147,9 @@ static void build_subroutines(BuildCtx *ctx)
+ |.else
+ | cmp dword [BASE+4], LJ_TISNUM; jae ->fff_fallback
+ |.endif
++ |.if SSE
+ | movsd xmm0, qword [BASE]
+- | call ->vm_ .. func .. _sse
++ | call ->vm_ .. func
+ |.if DUALNUM
+ | cvttsd2si RB, xmm0
+ | cmp RB, 0x80000000
+@@ -2105,29 +2160,61 @@ static void build_subroutines(BuildCtx *ctx)
+ | je ->fff_resi
+ |.endif
+ | jmp ->fff_resxmm0
++ |.else
++ | fld qword [BASE]
++ | call ->vm_ .. func
++ | .if DUALNUM
++ | fist ARG1
++ | mov RB, ARG1
++ | cmp RB, 0x80000000; jne >2
++ | fdup
++ | fild ARG1
++ | fcomparepp
++ | jp ->fff_resn
++ | jne ->fff_resn
++ |2:
++ | fpop
++ | jmp ->fff_resi
++ | .else
++ | jmp ->fff_resn
++ | .endif
++ |.endif
+ |.endmacro
+ |
+ | math_round floor
+ | math_round ceil
+ |
++ |.if SSE
+ |.ffunc_nsse math_sqrt, sqrtsd; jmp ->fff_resxmm0
++ |.else
++ |.ffunc_n math_sqrt; fsqrt; jmp ->fff_resn
++ |.endif
+ |
+ |.ffunc math_log
+ | cmp NARGS:RD, 1+1; jne ->fff_fallback // Exactly one argument.
+ | cmp dword [BASE+4], LJ_TISNUM; jae ->fff_fallback
++ |.if SSE
+ | movsd xmm0, qword [BASE]
+- |.if not X64
+- | movsd FPARG1, xmm0
+- |.endif
++ | .if not X64
++ | movsd FPARG1, xmm0
++ | .endif
+ | mov RB, BASE
+ | call extern log
+ | mov BASE, RB
+ | jmp ->fff_resfp
++ |.else
++ | fldln2; fld qword [BASE]; fyl2x; jmp ->fff_resn
++ |.endif
+ |
+ |.macro math_extern, func
++ |.if SSE
+ | .ffunc_nsse math_ .. func
+- |.if not X64
+- | movsd FPARG1, xmm0
++ | .if not X64
++ | movsd FPARG1, xmm0
++ | .endif
++ |.else
++ | .ffunc_n math_ .. func
++ | fstp FPARG1
+ |.endif
+ | mov RB, BASE
+ | call extern func
+@@ -2136,10 +2223,16 @@ static void build_subroutines(BuildCtx *ctx)
+ |.endmacro
+ |
+ |.macro math_extern2, func
+- | .ffunc_nnsse math_ .. func
+ |.if not X64
+- | movsd FPARG1, xmm0
+- | movsd FPARG3, xmm1
++ | .if SSE
++ | .ffunc_nnsse math_ .. func
++ | movsd FPARG1, xmm0
++ | movsd FPARG3, xmm1
++ | .else
++ | .ffunc_nn math_ .. func
++ | fstp FPARG3
++ | fstp FPARG1
++ | .endif
+ |.endif
+ | mov RB, BASE
+ | call extern func
+@@ -2176,34 +2269,65 @@ static void build_subroutines(BuildCtx *ctx)
+ | cmp RB, 0x00200000; jb >4
+ |1:
+ | shr RB, 21; sub RB, RC // Extract and unbias exponent.
++ |.if SSE
+ | cvtsi2sd xmm0, RB
++ |.else
++ | mov TMP1, RB; fild TMP1
++ |.endif
+ | mov RB, [BASE-4]
+ | and RB, 0x800fffff // Mask off exponent.
+ | or RB, 0x3fe00000 // Put mantissa in range [0.5,1) or 0.
+ | mov [BASE-4], RB
+ |2:
++ |.if SSE
+ | movsd qword [BASE], xmm0
++ |.else
++ | fstp qword [BASE]
++ |.endif
+ | mov RD, 1+2
+ | jmp ->fff_res
+ |3: // Return +-0, +-Inf, NaN unmodified and an exponent of 0.
++ |.if SSE
+ | xorps xmm0, xmm0; jmp <2
++ |.else
++ | fldz; jmp <2
++ |.endif
+ |4: // Handle denormals by multiplying with 2^54 and adjusting the bias.
++ |.if SSE
+ | movsd xmm0, qword [BASE]
+ | sseconst_hi xmm1, RBa, 43500000 // 2^54.
+ | mulsd xmm0, xmm1
+ | movsd qword [BASE-8], xmm0
++ |.else
++ | fld qword [BASE]
++ | mov TMP1, 0x5a800000; fmul TMP1 // x = x*2^54
++ | fstp qword [BASE-8]
++ |.endif
+ | mov RB, [BASE-4]; mov RC, 1076; shl RB, 1; jmp <1
+ |
++ |.if SSE
+ |.ffunc_nsse math_modf
++ |.else
++ |.ffunc_n math_modf
++ |.endif
+ | mov RB, [BASE+4]
+ | mov PC, [BASE-4]
+ | shl RB, 1; cmp RB, 0xffe00000; je >4 // +-Inf?
++ |.if SSE
+ | movaps xmm4, xmm0
+- | call ->vm_trunc_sse
++ | call ->vm_trunc
+ | subsd xmm4, xmm0
+ |1:
+ | movsd qword [BASE-8], xmm0
+ | movsd qword [BASE], xmm4
++ |.else
++ | fdup
++ | call ->vm_trunc
++ | fsub st1, st0
++ |1:
++ | fstp qword [BASE-8]
++ | fstp qword [BASE]
++ |.endif
+ | mov RC, [BASE-4]; mov RB, [BASE+4]
+ | xor RC, RB; js >3 // Need to adjust sign?
+ |2:
+@@ -2213,9 +2337,24 @@ static void build_subroutines(BuildCtx *ctx)
+ | xor RB, 0x80000000; mov [BASE+4], RB // Flip sign of fraction.
+ | jmp <2
+ |4:
++ |.if SSE
+ | xorps xmm4, xmm4; jmp <1 // Return +-Inf and +-0.
++ |.else
++ | fldz; fxch; jmp <1 // Return +-Inf and +-0.
++ |.endif
++ |
++ |.ffunc_nnr math_fmod
++ |1: ; fprem; fnstsw ax; sahf; jp <1
++ | fpop1
++ | jmp ->fff_resn
++ |
++ |.if SSE
++ |.ffunc_nnsse math_pow; call ->vm_pow; jmp ->fff_resxmm0
++ |.else
++ |.ffunc_nn math_pow; call ->vm_pow; jmp ->fff_resn
++ |.endif
+ |
+- |.macro math_minmax, name, cmovop, sseop
++ |.macro math_minmax, name, cmovop, fcmovop, sseop
+ | .ffunc_1 name
+ | mov RA, 2
+ | cmp dword [BASE+4], LJ_TISNUM
+@@ -2232,7 +2371,12 @@ static void build_subroutines(BuildCtx *ctx)
+ |3:
+ | ja ->fff_fallback
+ | // Convert intermediate result to number and continue below.
++ |.if SSE
+ | cvtsi2sd xmm0, RB
++ |.else
++ | mov TMP1, RB
++ | fild TMP1
++ |.endif
+ | jmp >6
+ |4:
+ | ja ->fff_fallback
+@@ -2240,6 +2384,7 @@ static void build_subroutines(BuildCtx *ctx)
+ | jae ->fff_fallback
+ |.endif
+ |
++ |.if SSE
+ | movsd xmm0, qword [BASE]
+ |5: // Handle numbers or integers.
+ | cmp RA, RD; jae ->fff_resxmm0
+@@ -2258,10 +2403,34 @@ static void build_subroutines(BuildCtx *ctx)
+ | sseop xmm0, xmm1
+ | add RA, 1
+ | jmp <5
++ |.else
++ | fld qword [BASE]
++ |5: // Handle numbers or integers.
++ | cmp RA, RD; jae ->fff_resn
++ | cmp dword [BASE+RA*8-4], LJ_TISNUM
++ |.if DUALNUM
++ | jb >6
++ | ja >9
++ | fild dword [BASE+RA*8-8]
++ | jmp >7
++ |.else
++ | jae >9
++ |.endif
++ |6:
++ | fld qword [BASE+RA*8-8]
++ |7:
++ | fucomi st1; fcmovop st1; fpop1
++ | add RA, 1
++ | jmp <5
++ |.endif
+ |.endmacro
+ |
+- | math_minmax math_min, cmovg, minsd
+- | math_minmax math_max, cmovl, maxsd
++ | math_minmax math_min, cmovg, fcmovnbe, minsd
++ | math_minmax math_max, cmovl, fcmovbe, maxsd
++ |.if not SSE
++ |9:
++ | fpop; jmp ->fff_fallback
++ |.endif
+ |
+ |//-- String library -----------------------------------------------------
+ |
+@@ -2275,8 +2444,10 @@ static void build_subroutines(BuildCtx *ctx)
+ | movzx RB, byte STR:RB[1]
+ |.if DUALNUM
+ | jmp ->fff_resi
+- |.else
++ |.elif SSE
+ | cvtsi2sd xmm0, RB; jmp ->fff_resxmm0
++ |.else
++ | mov TMP1, RB; fild TMP1; jmp ->fff_resn
+ |.endif
+ |
+ |.ffunc string_char // Only handle the 1-arg case here.
+@@ -2288,11 +2459,16 @@ static void build_subroutines(BuildCtx *ctx)
+ | mov RB, dword [BASE]
+ | cmp RB, 255; ja ->fff_fallback
+ | mov TMP2, RB
+- |.else
++ |.elif SSE
+ | jae ->fff_fallback
+ | cvttsd2si RB, qword [BASE]
+ | cmp RB, 255; ja ->fff_fallback
+ | mov TMP2, RB
++ |.else
++ | jae ->fff_fallback
++ | fld qword [BASE]
++ | fistp TMP2
++ | cmp TMP2, 255; ja ->fff_fallback
+ |.endif
+ |.if X64
+ | mov TMP3, 1
+@@ -2331,10 +2507,14 @@ static void build_subroutines(BuildCtx *ctx)
+ | jne ->fff_fallback
+ | mov RB, dword [BASE+16]
+ | mov TMP2, RB
+- |.else
++ |.elif SSE
+ | jae ->fff_fallback
+ | cvttsd2si RB, qword [BASE+16]
+ | mov TMP2, RB
++ |.else
++ | jae ->fff_fallback
++ | fld qword [BASE+16]
++ | fistp TMP2
+ |.endif
+ |1:
+ | cmp dword [BASE+4], LJ_TSTR; jne ->fff_fallback
+@@ -2349,8 +2529,12 @@ static void build_subroutines(BuildCtx *ctx)
+ | mov RB, STR:RB->len
+ |.if DUALNUM
+ | mov RA, dword [BASE+8]
+- |.else
++ |.elif SSE
+ | cvttsd2si RA, qword [BASE+8]
++ |.else
++ | fld qword [BASE+8]
++ | fistp ARG3
++ | mov RA, ARG3
+ |.endif
+ | mov RC, TMP2
+ | cmp RB, RC // len < end? (unsigned compare)
+@@ -2418,10 +2602,16 @@ static void build_subroutines(BuildCtx *ctx)
+ |
+ |//-- Bit library --------------------------------------------------------
+ |
++ |.define TOBIT_BIAS, 0x59c00000 // 2^52 + 2^51 (float, not double!).
++ |
+ |.macro .ffunc_bit, name, kind, fdef
+ | fdef name
+ |.if kind == 2
++ |.if SSE
+ | sseconst_tobit xmm1, RBa
++ |.else
++ | mov TMP1, TOBIT_BIAS
++ |.endif
+ |.endif
+ | cmp dword [BASE+4], LJ_TISNUM
+ |.if DUALNUM
+@@ -2437,12 +2627,24 @@ static void build_subroutines(BuildCtx *ctx)
+ |.else
+ | jae ->fff_fallback
+ |.endif
++ |.if SSE
+ | movsd xmm0, qword [BASE]
+ |.if kind < 2
+ | sseconst_tobit xmm1, RBa
+ |.endif
+ | addsd xmm0, xmm1
+ | movd RB, xmm0
++ |.else
++ | fld qword [BASE]
++ |.if kind < 2
++ | mov TMP1, TOBIT_BIAS
++ |.endif
++ | fadd TMP1
++ | fstp FPARG1
++ |.if kind > 0
++ | mov RB, ARG1
++ |.endif
++ |.endif
+ |2:
+ |.endmacro
+ |
+@@ -2451,7 +2653,15 @@ static void build_subroutines(BuildCtx *ctx)
+ |.endmacro
+ |
+ |.ffunc_bit bit_tobit, 0
++ |.if DUALNUM or SSE
++ |.if not SSE
++ | mov RB, ARG1
++ |.endif
+ | jmp ->fff_resbit
++ |.else
++ | fild ARG1
++ | jmp ->fff_resn
++ |.endif
+ |
+ |.macro .ffunc_bit_op, name, ins
+ | .ffunc_bit name, 2
+@@ -2471,10 +2681,17 @@ static void build_subroutines(BuildCtx *ctx)
+ |.else
+ | jae ->fff_fallback_bit_op
+ |.endif
++ |.if SSE
+ | movsd xmm0, qword [RD]
+ | addsd xmm0, xmm1
+ | movd RA, xmm0
+ | ins RB, RA
++ |.else
++ | fld qword [RD]
++ | fadd TMP1
++ | fstp FPARG1
++ | ins RB, ARG1
++ |.endif
+ | sub RD, 8
+ | jmp <1
+ |.endmacro
+@@ -2491,10 +2708,15 @@ static void build_subroutines(BuildCtx *ctx)
+ | not RB
+ |.if DUALNUM
+ | jmp ->fff_resbit
+- |.else
++ |.elif SSE
+ |->fff_resbit:
+ | cvtsi2sd xmm0, RB
+ | jmp ->fff_resxmm0
++ |.else
++ |->fff_resbit:
++ | mov ARG1, RB
++ | fild ARG1
++ | jmp ->fff_resn
+ |.endif
+ |
+ |->fff_fallback_bit_op:
+@@ -2507,13 +2729,22 @@ static void build_subroutines(BuildCtx *ctx)
+ | // Note: no inline conversion from number for 2nd argument!
+ | cmp dword [BASE+12], LJ_TISNUM; jne ->fff_fallback
+ | mov RA, dword [BASE+8]
+- |.else
++ |.elif SSE
+ | .ffunc_nnsse name
+ | sseconst_tobit xmm2, RBa
+ | addsd xmm0, xmm2
+ | addsd xmm1, xmm2
+ | movd RB, xmm0
+ | movd RA, xmm1
++ |.else
++ | .ffunc_nn name
++ | mov TMP1, TOBIT_BIAS
++ | fadd TMP1
++ | fstp FPARG3
++ | fadd TMP1
++ | fstp FPARG1
++ | mov RA, ARG3
++ | mov RB, ARG1
+ |.endif
+ | ins RB, cl // Assumes RA is ecx.
+ | jmp ->fff_resbit
+@@ -2954,18 +3185,27 @@ static void build_subroutines(BuildCtx *ctx)
+ |//-----------------------------------------------------------------------
+ |
+ |// FP value rounding. Called by math.floor/math.ceil fast functions
+- |// and from JIT code. arg/ret is xmm0. xmm0-xmm3 and RD (eax) modified.
+- |.macro vm_round, name, mode, cond
+- |->name:
+- |.if not X64 and cond
+- | movsd xmm0, qword [esp+4]
+- | call ->name .. _sse
+- | movsd qword [esp+4], xmm0 // Overwrite callee-owned arg.
+- | fld qword [esp+4]
++ |// and from JIT code.
++ |
++ |// x87 variant: Arg/ret on x87 stack. No int/xmm registers modified.
++ |.macro vm_round_x87, mode1, mode2
++ | fnstcw word [esp+4] // Caveat: overwrites ARG1 and ARG2.
++ | mov [esp+8], eax
++ | mov ax, mode1
++ | or ax, [esp+4]
++ |.if mode2 ~= 0xffff
++ | and ax, mode2
++ |.endif
++ | mov [esp+6], ax
++ | fldcw word [esp+6]
++ | frndint
++ | fldcw word [esp+4]
++ | mov eax, [esp+8]
+ | ret
+- |.endif
++ |.endmacro
+ |
+- |->name .. _sse:
++ |// SSE variant: arg/ret is xmm0. xmm0-xmm3 and RD (eax) modified.
++ |.macro vm_round_sse, mode
+ | sseconst_abs xmm2, RDa
+ | sseconst_2p52 xmm3, RDa
+ | movaps xmm1, xmm0
+@@ -2986,29 +3226,37 @@ static void build_subroutines(BuildCtx *ctx)
+ | addsd xmm1, xmm3 // (|x| + 2^52) - 2^52
+ | subsd xmm1, xmm3
+ | orpd xmm1, xmm2 // Merge sign bit back in.
+- | sseconst_1 xmm3, RDa
+ | .if mode == 1 // ceil(x)?
++ | sseconst_m1 xmm2, RDa // Must subtract -1 to preserve -0.
+ | cmpsd xmm0, xmm1, 6 // x > result?
+- | andpd xmm0, xmm3
+- | addsd xmm1, xmm0 // If yes, add 1.
+- | orpd xmm1, xmm2 // Merge sign bit back in (again).
+ | .else // floor(x)?
++ | sseconst_1 xmm2, RDa
+ | cmpsd xmm0, xmm1, 1 // x < result?
+- | andpd xmm0, xmm3
+- | subsd xmm1, xmm0 // If yes, subtract 1.
+ | .endif
++ | andpd xmm0, xmm2
++ | subsd xmm1, xmm0 // If yes, subtract +-1.
+ |.endif
+ | movaps xmm0, xmm1
+ |1:
+ | ret
+ |.endmacro
+ |
+- | vm_round vm_floor, 0, 1
+- | vm_round vm_ceil, 1, JIT
+- | vm_round vm_trunc, 2, JIT
++ |.macro vm_round, name, ssemode, mode1, mode2, extra // FIXME: EXTRA NOT USED
++ |->name:
++ |.if not SSE
++ | vm_round_x87 mode1, mode2
++ |.endif
++ |->name .. _sse:
++ | vm_round_sse ssemode
++ |.endmacro
++ |
++ | vm_round vm_floor, 0, 0x0400, 0xf7ff, 1
++ | vm_round vm_ceil, 1, 0x0800, 0xfbff, JIT
++ | vm_round vm_trunc, 2, 0x0c00, 0xffff, JIT
+ |
+ |// FP modulo x%y. Called by BC_MOD* and vm_arith.
+ |->vm_mod:
++ |.if SSE
+ |// Args in xmm0/xmm1, return value in xmm0.
+ |// Caveat: xmm0-xmm5 and RC (eax) modified!
+ | movaps xmm5, xmm0
+@@ -3036,6 +3284,243 @@ static void build_subroutines(BuildCtx *ctx)
+ | movaps xmm0, xmm5
+ | subsd xmm0, xmm1
+ | ret
++ |.else
++ |// Args/ret on x87 stack (y on top). No xmm registers modified.
++ |// Caveat: needs 3 slots on x87 stack! RC (eax) modified!
++ | fld st1
++ | fdiv st1
++ | fnstcw word [esp+4]
++ | mov ax, 0x0400
++ | or ax, [esp+4]
++ | and ax, 0xf7ff
++ | mov [esp+6], ax
++ | fldcw word [esp+6]
++ | frndint
++ | fldcw word [esp+4]
++ | fmulp st1
++ | fsubp st1
++ | ret
++ |.endif
++ |
++ |->vm_exp2raw: // Entry point for vm_pow. Without +-Inf check.
++ | fdup; frndint; fsub st1, st0; fxch // Split into frac/int part.
++ | f2xm1; fld1; faddp st1; fscale; fpop1 // ==> (2^frac-1 +1) << int
++ |1:
++ | ret
++ |2:
++ | fpop; fldz; ret
++ |
++ |// Generic power function x^y. Called by BC_POW, math.pow fast function,
++ |// and vm_arith.
++ |// Args/ret on x87 stack (y on top). RC (eax) modified.
++ |// Caveat: needs 3 slots on x87 stack!
++ |->vm_pow:
++ |.if not SSE
++ | fist dword [esp+4] // Store/reload int before comparison.
++ | fild dword [esp+4] // Integral exponent used in vm_powi.
++ | fucomip st1
++ | jnz >8 // Branch for FP exponents.
++ | jp >9 // Branch for NaN exponent.
++ | fpop // Pop y and fallthrough to vm_powi.
++ |
++ |// FP/int power function x^i. Arg1/ret on x87 stack.
++ |// Arg2 (int) on C stack. RC (eax) modified.
++ |// Caveat: needs 2 slots on x87 stack!
++ | mov eax, [esp+4]
++ | cmp eax, 1; jle >6 // i<=1?
++ | // Now 1 < (unsigned)i <= 0x80000000.
++ |1: // Handle leading zeros.
++ | test eax, 1; jnz >2
++ | fmul st0
++ | shr eax, 1
++ | jmp <1
++ |2:
++ | shr eax, 1; jz >5
++ | fdup
++ |3: // Handle trailing bits.
++ | fmul st0
++ | shr eax, 1; jz >4
++ | jnc <3
++ | fmul st1, st0
++ | jmp <3
++ |4:
++ | fmulp st1
++ |5:
++ | ret
++ |6:
++ | je <5 // x^1 ==> x
++ | jb >7
++ | fld1; fdivrp st1
++ | neg eax
++ | cmp eax, 1; je <5 // x^-1 ==> 1/x
++ | jmp <1 // x^-i ==> (1/x)^i
++ |7:
++ | fpop; fld1 // x^0 ==> 1
++ | ret
++ |
++ |8: // FP/FP power function x^y.
++ | fst dword [esp+4]
++ | fxch
++ | fst dword [esp+8]
++ | mov eax, [esp+4]; shl eax, 1
++ | cmp eax, 0xff000000; je >2 // x^+-Inf?
++ | mov eax, [esp+8]; shl eax, 1; je >4 // +-0^y?
++ | cmp eax, 0xff000000; je >4 // +-Inf^y?
++ | fyl2x
++ | jmp ->vm_exp2raw
++ |
++ |9: // Handle x^NaN.
++ | fld1
++ | fucomip st2
++ | je >1 // 1^NaN ==> 1
++ | fxch // x^NaN ==> NaN
++ |1:
++ | fpop
++ | ret
++ |
++ |2: // Handle x^+-Inf.
++ | fabs
++ | fld1
++ | fucomip st1
++ | je >3 // +-1^+-Inf ==> 1
++ | fpop; fabs; fldz; mov eax, 0; setc al
++ | ror eax, 1; xor eax, [esp+4]; jns >3 // |x|<>1, x^+-Inf ==> +Inf/0
++ | fxch
++ |3:
++ | fpop1; fabs
++ | ret
++ |
++ |4: // Handle +-0^y or +-Inf^y.
++ | cmp dword [esp+4], 0; jge <3 // y >= 0, x^y ==> |x|
++ | fpop; fpop
++ | test eax, eax; jz >5 // y < 0, +-0^y ==> +Inf
++ | fldz // y < 0, +-Inf^y ==> 0
++ | ret
++ |5:
++ | mov dword [esp+4], 0x7f800000 // Return +Inf.
++ | fld dword [esp+4]
++ | ret
++ |.endif
++ |
++ |// Args in xmm0/xmm1. Ret in xmm0. xmm0-xmm2 and RC (eax) modified.
++ |// Needs 16 byte scratch area for x86. Also called from JIT code.
++ |->vm_pow_sse:
++ | cvtsd2si eax, xmm1
++ | cvtsi2sd xmm2, eax
++ | ucomisd xmm1, xmm2
++ | jnz >8 // Branch for FP exponents.
++ | jp >9 // Branch for NaN exponent.
++ | // Fallthrough to vm_powi_sse.
++ |
++ |// Args in xmm0/eax. Ret in xmm0. xmm0-xmm1 and eax modified.
++ |->vm_powi_sse:
++ | cmp eax, 1; jle >6 // i<=1?
++ | // Now 1 < (unsigned)i <= 0x80000000.
++ |1: // Handle leading zeros.
++ | test eax, 1; jnz >2
++ | mulsd xmm0, xmm0
++ | shr eax, 1
++ | jmp <1
++ |2:
++ | shr eax, 1; jz >5
++ | movaps xmm1, xmm0
++ |3: // Handle trailing bits.
++ | mulsd xmm0, xmm0
++ | shr eax, 1; jz >4
++ | jnc <3
++ | mulsd xmm1, xmm0
++ | jmp <3
++ |4:
++ | mulsd xmm0, xmm1
++ |5:
++ | ret
++ |6:
++ | je <5 // x^1 ==> x
++ | jb >7 // x^0 ==> 1
++ | neg eax
++ | call <1
++ | sseconst_1 xmm1, RDa
++ | divsd xmm1, xmm0
++ | movaps xmm0, xmm1
++ | ret
++ |7:
++ | sseconst_1 xmm0, RDa
++ | ret
++ |
++ |8: // FP/FP power function x^y.
++ |.if X64
++ | movd rax, xmm1; shl rax, 1
++ | rol rax, 12; cmp rax, 0xffe; je >2 // x^+-Inf?
++ | movd rax, xmm0; shl rax, 1; je >4 // +-0^y?
++ | rol rax, 12; cmp rax, 0xffe; je >5 // +-Inf^y?
++ | .if X64WIN
++ | movsd qword [rsp+16], xmm1 // Use scratch area.
++ | movsd qword [rsp+8], xmm0
++ | fld qword [rsp+16]
++ | fld qword [rsp+8]
++ | .else
++ | movsd qword [rsp-16], xmm1 // Use red zone.
++ | movsd qword [rsp-8], xmm0
++ | fld qword [rsp-16]
++ | fld qword [rsp-8]
++ | .endif
++ |.else
++ | movsd qword [esp+12], xmm1 // Needs 16 byte scratch area.
++ | movsd qword [esp+4], xmm0
++ | cmp dword [esp+12], 0; jne >1
++ | mov eax, [esp+16]; shl eax, 1
++ | cmp eax, 0xffe00000; je >2 // x^+-Inf?
++ |1:
++ | cmp dword [esp+4], 0; jne >1
++ | mov eax, [esp+8]; shl eax, 1; je >4 // +-0^y?
++ | cmp eax, 0xffe00000; je >5 // +-Inf^y?
++ |1:
++ | fld qword [esp+12]
++ | fld qword [esp+4]
++ |.endif
++ | fyl2x // y*log2(x)
++ | fdup; frndint; fsub st1, st0; fxch // Split into frac/int part.
++ | f2xm1; fld1; faddp st1; fscale; fpop1 // ==> (2^frac-1 +1) << int
++ |.if X64WIN
++ | fstp qword [rsp+8] // Use scratch area.
++ | movsd xmm0, qword [rsp+8]
++ |.elif X64
++ | fstp qword [rsp-8] // Use red zone.
++ | movsd xmm0, qword [rsp-8]
++ |.else
++ | fstp qword [esp+4] // Needs 8 byte scratch area.
++ | movsd xmm0, qword [esp+4]
++ |.endif
++ | ret
++ |
++ |9: // Handle x^NaN.
++ | sseconst_1 xmm2, RDa
++ | ucomisd xmm0, xmm2; je >1 // 1^NaN ==> 1
++ | movaps xmm0, xmm1 // x^NaN ==> NaN
++ |1:
++ | ret
++ |
++ |2: // Handle x^+-Inf.
++ | sseconst_abs xmm2, RDa
++ | andpd xmm0, xmm2 // |x|
++ | sseconst_1 xmm2, RDa
++ | ucomisd xmm0, xmm2; je <1 // +-1^+-Inf ==> 1
++ | movmskpd eax, xmm1
++ | xorps xmm0, xmm0
++ | mov ah, al; setc al; xor al, ah; jne <1 // |x|<>1, x^+-Inf ==> +Inf/0
++ |3:
++ | sseconst_hi xmm0, RDa, 7ff00000 // +Inf
++ | ret
++ |
++ |4: // Handle +-0^y.
++ | movmskpd eax, xmm1; test eax, eax; jnz <3 // y < 0, +-0^y ==> +Inf
++ | xorps xmm0, xmm0 // y >= 0, +-0^y ==> 0
++ | ret
++ |
++ |5: // Handle +-Inf^y.
++ | movmskpd eax, xmm1; test eax, eax; jz <3 // y >= 0, +-Inf^y ==> +Inf
++ | xorps xmm0, xmm0 // y < 0, +-Inf^y ==> 0
++ | ret
+ |
+ |//-----------------------------------------------------------------------
+ |//-- Miscellaneous functions --------------------------------------------
+@@ -3429,12 +3914,19 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
+ | // RA is a number.
+ | cmp dword [BASE+RD*8+4], LJ_TISNUM; jb >1; jne ->vmeta_comp
+ | // RA is a number, RD is an integer.
++ |.if SSE
+ | cvtsi2sd xmm0, dword [BASE+RD*8]
+ | jmp >2
++ |.else
++ | fld qword [BASE+RA*8]
++ | fild dword [BASE+RD*8]
++ | jmp >3
++ |.endif
+ |
+ |8: // RA is an integer, RD is not an integer.
+ | ja ->vmeta_comp
+ | // RA is an integer, RD is a number.
++ |.if SSE
+ | cvtsi2sd xmm1, dword [BASE+RA*8]
+ | movsd xmm0, qword [BASE+RD*8]
+ | add PC, 4
+@@ -3442,15 +3934,29 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
+ | jmp_comp jbe, ja, jb, jae, <9
+ | jmp <6
+ |.else
++ | fild dword [BASE+RA*8]
++ | jmp >2
++ |.endif
++ |.else
+ | checknum RA, ->vmeta_comp
+ | checknum RD, ->vmeta_comp
+ |.endif
++ |.if SSE
+ |1:
+ | movsd xmm0, qword [BASE+RD*8]
+ |2:
+ | add PC, 4
+ | ucomisd xmm0, qword [BASE+RA*8]
+ |3:
++ |.else
++ |1:
++ | fld qword [BASE+RA*8] // Reverse order, i.e like cmp D, A.
++ |2:
++ | fld qword [BASE+RD*8]
++ |3:
++ | add PC, 4
++ | fcomparepp
++ |.endif
+ | // Unordered: all of ZF CF PF set, ordered: PF clear.
+ | // To preserve NaN semantics GE/GT branch on unordered, but LT/LE don't.
+ |.if DUALNUM
+@@ -3490,25 +3996,43 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
+ | // RD is a number.
+ | cmp dword [BASE+RA*8+4], LJ_TISNUM; jb >1; jne >5
+ | // RD is a number, RA is an integer.
++ |.if SSE
+ | cvtsi2sd xmm0, dword [BASE+RA*8]
++ |.else
++ | fild dword [BASE+RA*8]
++ |.endif
+ | jmp >2
+ |
+ |8: // RD is an integer, RA is not an integer.
+ | ja >5
+ | // RD is an integer, RA is a number.
++ |.if SSE
+ | cvtsi2sd xmm0, dword [BASE+RD*8]
+ | ucomisd xmm0, qword [BASE+RA*8]
++ |.else
++ | fild dword [BASE+RD*8]
++ | fld qword [BASE+RA*8]
++ |.endif
+ | jmp >4
+ |
+ |.else
+ | cmp RB, LJ_TISNUM; jae >5
+ | checknum RA, >5
+ |.endif
++ |.if SSE
+ |1:
+ | movsd xmm0, qword [BASE+RA*8]
+ |2:
+ | ucomisd xmm0, qword [BASE+RD*8]
+ |4:
++ |.else
++ |1:
++ | fld qword [BASE+RA*8]
++ |2:
++ | fld qword [BASE+RD*8]
++ |4:
++ | fcomparepp
++ |.endif
+ iseqne_fp:
+ if (vk) {
+ | jp >2 // Unordered means not equal.
+@@ -3631,21 +4155,39 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
+ | // RA is a number.
+ | cmp dword [KBASE+RD*8+4], LJ_TISNUM; jb >1
+ | // RA is a number, RD is an integer.
++ |.if SSE
+ | cvtsi2sd xmm0, dword [KBASE+RD*8]
++ |.else
++ | fild dword [KBASE+RD*8]
++ |.endif
+ | jmp >2
+ |
+ |8: // RA is an integer, RD is a number.
++ |.if SSE
+ | cvtsi2sd xmm0, dword [BASE+RA*8]
+ | ucomisd xmm0, qword [KBASE+RD*8]
++ |.else
++ | fild dword [BASE+RA*8]
++ | fld qword [KBASE+RD*8]
++ |.endif
+ | jmp >4
+ |.else
+ | cmp RB, LJ_TISNUM; jae >3
+ |.endif
++ |.if SSE
+ |1:
+ | movsd xmm0, qword [KBASE+RD*8]
+ |2:
+ | ucomisd xmm0, qword [BASE+RA*8]
+ |4:
++ |.else
++ |1:
++ | fld qword [KBASE+RD*8]
++ |2:
++ | fld qword [BASE+RA*8]
++ |4:
++ | fcomparepp
++ |.endif
+ goto iseqne_fp;
+ case BC_ISEQP: case BC_ISNEP:
+ vk = op == BC_ISEQP;
+@@ -3751,10 +4293,16 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
+ |.else
+ | checknum RD, ->vmeta_unm
+ |.endif
++ |.if SSE
+ | movsd xmm0, qword [BASE+RD*8]
+ | sseconst_sign xmm1, RDa
+ | xorps xmm0, xmm1
+ | movsd qword [BASE+RA*8], xmm0
++ |.else
++ | fld qword [BASE+RD*8]
++ | fchs
++ | fstp qword [BASE+RA*8]
++ |.endif
+ |.if DUALNUM
+ | jmp <9
+ |.else
+@@ -3770,11 +4318,15 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
+ |1:
+ | mov dword [BASE+RA*8+4], LJ_TISNUM
+ | mov dword [BASE+RA*8], RD
+- |.else
++ |.elif SSE
+ | xorps xmm0, xmm0
+ | cvtsi2sd xmm0, dword STR:RD->len
+ |1:
+ | movsd qword [BASE+RA*8], xmm0
++ |.else
++ | fild dword STR:RD->len
++ |1:
++ | fstp qword [BASE+RA*8]
+ |.endif
+ | ins_next
+ |2:
+@@ -3792,8 +4344,11 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
+ | // Length of table returned in eax (RD).
+ |.if DUALNUM
+ | // Nothing to do.
+- |.else
++ |.elif SSE
+ | cvtsi2sd xmm0, RD
++ |.else
++ | mov ARG1, RD
++ | fild ARG1
+ |.endif
+ | mov BASE, RB // Restore BASE.
+ | movzx RA, PC_RA
+@@ -3808,7 +4363,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
+
+ /* -- Binary ops -------------------------------------------------------- */
+
+- |.macro ins_arithpre, sseins, ssereg
++ |.macro ins_arithpre, x87ins, sseins, ssereg
+ | ins_ABC
+ ||vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
+ ||switch (vk) {
+@@ -3817,22 +4372,37 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
+ | .if DUALNUM
+ | cmp dword [KBASE+RC*8+4], LJ_TISNUM; jae ->vmeta_arith_vn
+ | .endif
+- | movsd xmm0, qword [BASE+RB*8]
+- | sseins ssereg, qword [KBASE+RC*8]
++ | .if SSE
++ | movsd xmm0, qword [BASE+RB*8]
++ | sseins ssereg, qword [KBASE+RC*8]
++ | .else
++ | fld qword [BASE+RB*8]
++ | x87ins qword [KBASE+RC*8]
++ | .endif
+ || break;
+ ||case 1:
+ | checknum RB, ->vmeta_arith_nv
+ | .if DUALNUM
+ | cmp dword [KBASE+RC*8+4], LJ_TISNUM; jae ->vmeta_arith_nv
+ | .endif
+- | movsd xmm0, qword [KBASE+RC*8]
+- | sseins ssereg, qword [BASE+RB*8]
++ | .if SSE
++ | movsd xmm0, qword [KBASE+RC*8]
++ | sseins ssereg, qword [BASE+RB*8]
++ | .else
++ | fld qword [KBASE+RC*8]
++ | x87ins qword [BASE+RB*8]
++ | .endif
+ || break;
+ ||default:
+ | checknum RB, ->vmeta_arith_vv
+ | checknum RC, ->vmeta_arith_vv
+- | movsd xmm0, qword [BASE+RB*8]
+- | sseins ssereg, qword [BASE+RC*8]
++ | .if SSE
++ | movsd xmm0, qword [BASE+RB*8]
++ | sseins ssereg, qword [BASE+RC*8]
++ | .else
++ | fld qword [BASE+RB*8]
++ | x87ins qword [BASE+RC*8]
++ | .endif
+ || break;
+ ||}
+ |.endmacro
+@@ -3870,62 +4440,55 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
+ |.endmacro
+ |
+ |.macro ins_arithpost
++ |.if SSE
+ | movsd qword [BASE+RA*8], xmm0
++ |.else
++ | fstp qword [BASE+RA*8]
++ |.endif
+ |.endmacro
+ |
+- |.macro ins_arith, sseins
+- | ins_arithpre sseins, xmm0
++ |.macro ins_arith, x87ins, sseins
++ | ins_arithpre x87ins, sseins, xmm0
+ | ins_arithpost
+ | ins_next
+ |.endmacro
+ |
+- |.macro ins_arith, intins, sseins
++ |.macro ins_arith, intins, x87ins, sseins
+ |.if DUALNUM
+ | ins_arithdn intins
+ |.else
+- | ins_arith, sseins
++ | ins_arith, x87ins, sseins
+ |.endif
+ |.endmacro
+
+ | // RA = dst, RB = src1 or num const, RC = src2 or num const
+ case BC_ADDVN: case BC_ADDNV: case BC_ADDVV:
+- | ins_arith add, addsd
++ | ins_arith add, fadd, addsd
+ break;
+ case BC_SUBVN: case BC_SUBNV: case BC_SUBVV:
+- | ins_arith sub, subsd
++ | ins_arith sub, fsub, subsd
+ break;
+ case BC_MULVN: case BC_MULNV: case BC_MULVV:
+- | ins_arith imul, mulsd
++ | ins_arith imul, fmul, mulsd
+ break;
+ case BC_DIVVN: case BC_DIVNV: case BC_DIVVV:
+- | ins_arith divsd
++ | ins_arith fdiv, divsd
+ break;
+ case BC_MODVN:
+- | ins_arithpre movsd, xmm1
++ | ins_arithpre fld, movsd, xmm1
+ |->BC_MODVN_Z:
+ | call ->vm_mod
+ | ins_arithpost
+ | ins_next
+ break;
+ case BC_MODNV: case BC_MODVV:
+- | ins_arithpre movsd, xmm1
++ | ins_arithpre fld, movsd, xmm1
+ | jmp ->BC_MODVN_Z // Avoid 3 copies. It's slow anyway.
+ break;
+ case BC_POW:
+- | ins_arithpre movsd, xmm1
+- | mov RB, BASE
+- |.if not X64
+- | movsd FPARG1, xmm0
+- | movsd FPARG3, xmm1
+- |.endif
+- | call extern pow
+- | movzx RA, PC_RA
+- | mov BASE, RB
+- |.if X64
++ | ins_arithpre fld, movsd, xmm1 // FIXME: THIS SHOULD NOT BE FLD. Whole thing is broken
++ | call ->vm_pow
+ | ins_arithpost
+- |.else
+- | fstp qword [BASE+RA*8]
+- |.endif
+ | ins_next
+ break;
+
+@@ -3993,17 +4556,25 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
+ | movsx RD, RDW
+ | mov dword [BASE+RA*8+4], LJ_TISNUM
+ | mov dword [BASE+RA*8], RD
+- |.else
++ |.elif SSE
+ | movsx RD, RDW // Sign-extend literal.
+ | cvtsi2sd xmm0, RD
+ | movsd qword [BASE+RA*8], xmm0
++ |.else
++ | fild PC_RD // Refetch signed RD from instruction.
++ | fstp qword [BASE+RA*8]
+ |.endif
+ | ins_next
+ break;
+ case BC_KNUM:
+ | ins_AD // RA = dst, RD = num const
++ |.if SSE
+ | movsd xmm0, qword [KBASE+RD*8]
+ | movsd qword [BASE+RA*8], xmm0
++ |.else
++ | fld qword [KBASE+RD*8]
++ | fstp qword [BASE+RA*8]
++ |.endif
+ | ins_next
+ break;
+ case BC_KPRI:
+@@ -4110,10 +4681,18 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
+ case BC_USETN:
+ | ins_AD // RA = upvalue #, RD = num const
+ | mov LFUNC:RB, [BASE-8]
++ |.if SSE
+ | movsd xmm0, qword [KBASE+RD*8]
++ |.else
++ | fld qword [KBASE+RD*8]
++ |.endif
+ | mov UPVAL:RB, [LFUNC:RB+RA*4+offsetof(GCfuncL, uvptr)]
+ | mov RA, UPVAL:RB->v
++ |.if SSE
+ | movsd qword [RA], xmm0
++ |.else
++ | fstp qword [RA]
++ |.endif
+ | ins_next
+ break;
+ case BC_USETP:
+@@ -4267,10 +4846,18 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
+ |.else
+ | // Convert number to int and back and compare.
+ | checknum RC, >5
++ |.if SSE
+ | movsd xmm0, qword [BASE+RC*8]
+ | cvttsd2si RC, xmm0
+ | cvtsi2sd xmm1, RC
+ | ucomisd xmm0, xmm1
++ |.else
++ | fld qword [BASE+RC*8]
++ | fist ARG1
++ | fild ARG1
++ | fcomparepp
++ | mov RC, ARG1
++ |.endif
+ | jne ->vmeta_tgetv // Generic numeric key? Use fallback.
+ |.endif
+ | cmp RC, TAB:RB->asize // Takes care of unordered, too.
+@@ -4399,8 +4986,12 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
+ | mov TAB:RB, [BASE+RB*8]
+ |.if DUALNUM
+ | mov RC, dword [BASE+RC*8]
+- |.else
++ |.elif SSE
+ | cvttsd2si RC, qword [BASE+RC*8]
++ |.else
++ | fld qword [BASE+RC*8]
++ | fistp TMP1
++ | mov RC, TMP1
+ |.endif
+ | cmp RC, TAB:RB->asize
+ | jae ->vmeta_tgetr // Not in array part? Use fallback.
+@@ -4433,10 +5024,18 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
+ |.else
+ | // Convert number to int and back and compare.
+ | checknum RC, >5
++ |.if SSE
+ | movsd xmm0, qword [BASE+RC*8]
+ | cvttsd2si RC, xmm0
+ | cvtsi2sd xmm1, RC
+ | ucomisd xmm0, xmm1
++ |.else
++ | fld qword [BASE+RC*8]
++ | fist ARG1
++ | fild ARG1
++ | fcomparepp
++ | mov RC, ARG1
++ |.endif
+ | jne ->vmeta_tsetv // Generic numeric key? Use fallback.
+ |.endif
+ | cmp RC, TAB:RB->asize // Takes care of unordered, too.
+@@ -4611,8 +5210,12 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
+ | mov TAB:RB, [BASE+RB*8]
+ |.if DUALNUM
+ | mov RC, dword [BASE+RC*8]
+- |.else
++ |.elif SSE
+ | cvttsd2si RC, qword [BASE+RC*8]
++ |.else
++ | fld qword [BASE+RC*8]
++ | fistp TMP1
++ | mov RC, TMP1
+ |.endif
+ | test byte TAB:RB->marked, LJ_GC_BLACK // isblack(table)
+ | jnz >7
+@@ -4833,8 +5436,10 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
+ |.if DUALNUM
+ | mov dword [BASE+RA*8+4], LJ_TISNUM
+ | mov dword [BASE+RA*8], RC
+- |.else
++ |.elif SSE
+ | cvtsi2sd xmm0, RC
++ |.else
++ | fild dword [BASE+RA*8-8]
+ |.endif
+ | // Copy array slot to returned value.
+ |.if X64
+@@ -4850,8 +5455,10 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
+ | // Return array index as a numeric key.
+ |.if DUALNUM
+ | // See above.
+- |.else
++ |.elif SSE
+ | movsd qword [BASE+RA*8], xmm0
++ |.else
++ | fstp qword [BASE+RA*8]
+ |.endif
+ | mov [BASE+RA*8-8], RC // Update control var.
+ |2:
+@@ -4864,6 +5471,9 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
+ |
+ |4: // Skip holes in array part.
+ | add RC, 1
++ |.if not (DUALNUM or SSE)
++ | mov [BASE+RA*8-8], RC
++ |.endif
+ | jmp <1
+ |
+ |5: // Traverse hash part.
+@@ -5211,6 +5821,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
+ if (!vk) {
+ | cmp RB, LJ_TISNUM; jae ->vmeta_for
+ }
++ |.if SSE
+ | movsd xmm0, qword FOR_IDX
+ | movsd xmm1, qword FOR_STOP
+ if (vk) {
+@@ -5223,6 +5834,22 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
+ | ucomisd xmm1, xmm0
+ |1:
+ | movsd qword FOR_EXT, xmm0
++ |.else
++ | fld qword FOR_STOP
++ | fld qword FOR_IDX
++ if (vk) {
++ | fadd qword FOR_STEP // nidx = idx + step
++ | fst qword FOR_IDX
++ | fst qword FOR_EXT
++ | test RB, RB; js >1
++ } else {
++ | fst qword FOR_EXT
++ | jl >1
++ }
++ | fxch // Swap lim/(n)idx if step non-negative.
++ |1:
++ | fcomparepp
++ |.endif
+ if (op == BC_FORI) {
+ |.if DUALNUM
+ | jnb <7
+@@ -5250,10 +5877,11 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
+ |2:
+ | ins_next
+ |.endif
+- |
++ |.if SSE
+ |3: // Invert comparison if step is negative.
+ | ucomisd xmm0, xmm1
+ | jmp <1
++ |.endif
+ break;
+
+ case BC_ITERL:
diff --git a/extra/luajit/luajit-2.0-505e2c0-i486.patch b/extra/luajit/luajit-2.0-505e2c0-i486.patch
new file mode 100644
index 00000000..dd6cf5a1
--- /dev/null
+++ b/extra/luajit/luajit-2.0-505e2c0-i486.patch
@@ -0,0 +1,2366 @@
+diff -rauN luajit-2.0-505e2c0/src/lib_jit.c luajit-2.0-505e2c0-i486-patch/src/lib_jit.c
+--- luajit-2.0-505e2c0/src/lib_jit.c 2023-02-21 17:07:37.000000000 +0100
++++ luajit-2.0-505e2c0-i486-patch/src/lib_jit.c 2023-03-26 18:16:32.558477950 +0200
+@@ -649,7 +649,7 @@
+ #endif
+
+ /* Arch-dependent CPU feature detection. */
+-static uint32_t jit_cpudetect(void)
++static uint32_t jit_cpudetect(lua_State *L)
+ {
+ uint32_t flags = 0;
+ #if LJ_TARGET_X86ORX64
+@@ -657,16 +657,45 @@
+ uint32_t vendor[4];
+ uint32_t features[4];
+ if (lj_vm_cpuid(0, vendor) && lj_vm_cpuid(1, features)) {
++#if !LJ_HASJIT
++#define JIT_F_CMOV 1
++#define JIT_F_SSE2 2
++#endif
++ flags |= ((features[3] >> 15)&1) * JIT_F_CMOV;
++ flags |= ((features[3] >> 26)&1) * JIT_F_SSE2;
++#if LJ_HASJIT
+ flags |= ((features[2] >> 0)&1) * JIT_F_SSE3;
+ flags |= ((features[2] >> 19)&1) * JIT_F_SSE4_1;
++ if (vendor[2] == 0x6c65746e) { /* Intel. */
++ if ((features[0] & 0x0ff00f00) == 0x00000f00) /* P4. */
++ flags |= JIT_F_P4; /* Currently unused. */
++ else if ((features[0] & 0x0fff0ff0) == 0x000106c0) /* Atom. */
++ flags |= JIT_F_LEA_AGU;
++ } else if (vendor[2] == 0x444d4163) { /* AMD. */
++ uint32_t fam = (features[0] & 0x0ff00f00);
++ if (fam == 0x00000f00) /* K8. */
++ flags |= JIT_F_SPLIT_XMM;
++ if (fam >= 0x00000f00) /* K8, K10. */
++ flags |= JIT_F_PREFER_IMUL;
++ }
+ if (vendor[0] >= 7) {
+ uint32_t xfeatures[4];
+ lj_vm_cpuid(7, xfeatures);
+ flags |= ((xfeatures[1] >> 8)&1) * JIT_F_BMI2;
+ }
++#endif
+ }
+- /* Don't bother checking for SSE2 -- the VM will crash before getting here. */
+-
++ /* Check for required instruction set support on x86 (unnecessary on x64). */
++#if LJ_TARGET_X86
++#if !defined(LUAJIT_CPU_NOCMOV)
++ if (!(flags & JIT_F_CMOV))
++ luaL_error(L, "CPU not supported");
++#endif
++#if defined(LUAJIT_CPU_SSE2)
++ if (!(flags & JIT_F_SSE2))
++ luaL_error(L, "CPU does not support SSE2 (recompile without -DLUAJIT_CPU_SSE2)");
++#endif
++#endif
+ #elif LJ_TARGET_ARM
+
+ int ver = LJ_ARCH_VERSION; /* Compile-time ARM CPU detection. */
+@@ -729,7 +758,12 @@
+ static void jit_init(lua_State *L)
+ {
+ jit_State *J = L2J(L);
+- J->flags = jit_cpudetect() | JIT_F_ON | JIT_F_OPT_DEFAULT;
++ uint32_t flags = jit_cpudetect(L);
++#if LJ_TARGET_X86
++ /* Silently turn off the JIT compiler on CPUs without SSE2. */
++ if ((flags & JIT_F_SSE2))
++#endif
++ J->flags = flags | JIT_F_ON | JIT_F_OPT_DEFAULT;
+ memcpy(J->param, jit_param_default, sizeof(J->param));
+ lj_dispatch_update(G(L));
+ }
+@@ -738,7 +772,7 @@
+ LUALIB_API int luaopen_jit(lua_State *L)
+ {
+ #if LJ_HASJIT
+- jit_init(L);
++ jit_init(L); // FIXME should this be moved back to the bottom?
+ #endif
+ lua_pushliteral(L, LJ_OS_NAME);
+ lua_pushliteral(L, LJ_ARCH_NAME);
+diff -rauN luajit-2.0-505e2c0/src/lj_asm.c luajit-2.0-505e2c0-i486-patch/src/lj_asm.c
+--- luajit-2.0-505e2c0/src/lj_asm.c 2023-02-21 17:07:37.000000000 +0100
++++ luajit-2.0-505e2c0-i486-patch/src/lj_asm.c 2023-03-26 18:16:32.558477950 +0200
+@@ -2340,6 +2340,22 @@
+ }
+ break;
+ #endif
++/*
++ case IR_FPMATH:
++#if LJ_TARGET_X86ORX64
++ if (ir->op2 == IRFPM_EXP2) { // May be joined to lj_vm_pow_sse.
++ ir->prev = REGSP_HINT(RID_XMM0);
++#if !LJ_64
++ if (as->evenspill < 4) // Leave room for 16 byte scratch area.
++ as->evenspill = 4;
++#endif
++ if (inloop)
++ as->modset |= RSET_RANGE(RID_XMM0, RID_XMM2+1)|RID2RSET(RID_EAX);
++ continue;
++ } else if (ir->op2 <= IRFPM_TRUNC && !(as->flags & JIT_F_SSE4_1)) {
++ ir->prev = REGSP_HINT(RID_XMM0);
++>>>>>>> parent of 57768cd5... x86: Remove x87 support from interpreter.
++ */
+ case IR_FPMATH:
+ #if LJ_TARGET_X86ORX64
+ if (ir->op2 <= IRFPM_TRUNC) {
+diff -rauN luajit-2.0-505e2c0/src/lj_jit.h luajit-2.0-505e2c0-i486-patch/src/lj_jit.h
+--- luajit-2.0-505e2c0/src/lj_jit.h 2023-02-21 17:07:37.000000000 +0100
++++ luajit-2.0-505e2c0-i486-patch/src/lj_jit.h 2023-03-26 18:16:32.558477950 +0200
+@@ -20,12 +20,18 @@
+
+ #if LJ_TARGET_X86ORX64
+
+-#define JIT_F_SSE3 (JIT_F_CPU << 0)
+-#define JIT_F_SSE4_1 (JIT_F_CPU << 1)
+-#define JIT_F_BMI2 (JIT_F_CPU << 2)
++#define JIT_F_CMOV (JIT_F_CPU << 0)
++#define JIT_F_SSE2 (JIT_F_CPU << 1)
++#define JIT_F_SSE3 (JIT_F_CPU << 2)
++#define JIT_F_SSE4_1 (JIT_F_CPU << 3)
++#define JIT_F_P4 (JIT_F_CPU << 4)
++#define JIT_F_PREFER_IMUL (JIT_F_CPU << 5)
++#define JIT_F_SPLIT_XMM (JIT_F_CPU << 6)
++#define JIT_F_LEA_AGU (JIT_F_CPU << 7)
++#define JIT_F_BMI2 (JIT_F_CPU << 8)
+
+
+-#define JIT_F_CPUSTRING "\4SSE3\6SSE4.1\4BMI2"
++#define JIT_F_CPUSTRING "\4CMOV\4SSE2\4SSE3\6SSE4.1\2P4\3AMD\2K8\4ATOM\4BMI2"
+
+ #elif LJ_TARGET_ARM
+
+diff -rauN luajit-2.0-505e2c0/src/lj_vm.h luajit-2.0-505e2c0-i486-patch/src/lj_vm.h
+--- luajit-2.0-505e2c0/src/lj_vm.h 2023-02-21 17:07:37.000000000 +0100
++++ luajit-2.0-505e2c0-i486-patch/src/lj_vm.h 2023-03-26 18:16:32.558477950 +0200
+@@ -58,7 +58,8 @@
+ LJ_ASMF void lj_vm_exit_interp(void);
+
+ /* Internal math helper functions. */
+-#if LJ_TARGET_PPC || LJ_TARGET_ARM64 || (LJ_TARGET_MIPS && LJ_ABI_SOFTFP)
++// FIXME: is this correct?
++#if LJ_TARGET_X86ORX64 || LJ_TARGET_PPC || LJ_TARGET_ARM64 || (LJ_TARGET_MIPS && LJ_ABI_SOFTFP)
+ #define lj_vm_floor floor
+ #define lj_vm_ceil ceil
+ #else
+diff -rauN luajit-2.0-505e2c0/src/Makefile luajit-2.0-505e2c0-i486-patch/src/Makefile
+--- luajit-2.0-505e2c0/src/Makefile 2023-02-21 17:07:37.000000000 +0100
++++ luajit-2.0-505e2c0-i486-patch/src/Makefile 2023-03-26 18:16:32.558477950 +0200
+@@ -47,7 +47,7 @@
+ # x86/x64 only: For GCC 4.2 or higher and if you don't intend to distribute
+ # the binaries to a different machine you could also use: -march=native
+ #
+-CCOPT_x86= -march=i686 -msse -msse2 -mfpmath=sse
++CCOPT_x86= -march=i486 -mfpmath=387
+ CCOPT_x64=
+ CCOPT_arm=
+ CCOPT_arm64=
+@@ -102,7 +102,7 @@
+ #XCFLAGS+= -DLUAJIT_ENABLE_LUA52COMPAT
+ #
+ # Disable the JIT compiler, i.e. turn LuaJIT into a pure interpreter.
+-#XCFLAGS+= -DLUAJIT_DISABLE_JIT
++XCFLAGS+= -DLUAJIT_DISABLE_JIT
+ #
+ # Some architectures (e.g. PPC) can use either single-number (1) or
+ # dual-number (2) mode. Uncomment one of these lines to override the
+@@ -437,6 +437,11 @@
+ ifeq (Windows,$(TARGET_SYS))
+ DASM_AFLAGS+= -D WIN
+ endif
++ifeq (x86,$(TARGET_LJARCH))
++ ifneq (,$(findstring __SSE2__ 1,$(TARGET_TESTARCH)))
++ DASM_AFLAGS+= -D SSE
++ endif
++else
+ ifeq (x64,$(TARGET_LJARCH))
+ ifeq (,$(findstring LJ_FR2 1,$(TARGET_TESTARCH)))
+ DASM_ARCH= x86
+@@ -466,6 +471,7 @@
+ endif
+ endif
+ endif
++endif
+
+ DASM_FLAGS= $(DASM_XFLAGS) $(DASM_AFLAGS)
+ DASM_DASC= vm_$(DASM_ARCH).dasc
+diff -rauN luajit-2.0-505e2c0/src/Makefile.orig luajit-2.0-505e2c0-i486-patch/src/Makefile.orig
+--- luajit-2.0-505e2c0/src/Makefile.orig 1970-01-01 01:00:00.000000000 +0100
++++ luajit-2.0-505e2c0-i486-patch/src/Makefile.orig 2023-03-26 18:05:15.245707757 +0200
+@@ -0,0 +1,726 @@
++##############################################################################
++# LuaJIT Makefile. Requires GNU Make.
++#
++# Please read doc/install.html before changing any variables!
++#
++# Suitable for POSIX platforms (Linux, *BSD, OSX etc.).
++# Also works with MinGW and Cygwin on Windows.
++# Please check msvcbuild.bat for building with MSVC on Windows.
++#
++# Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h
++##############################################################################
++
++MAJVER= 2
++MINVER= 1
++RELVER= 0
++ABIVER= 5.1
++NODOTABIVER= 51
++
++##############################################################################
++############################# COMPILER OPTIONS #############################
++##############################################################################
++# These options mainly affect the speed of the JIT compiler itself, not the
++# speed of the JIT-compiled code. Turn any of the optional settings on by
++# removing the '#' in front of them. Make sure you force a full recompile
++# with "make clean", followed by "make" if you change any options.
++#
++DEFAULT_CC = gcc
++#
++# LuaJIT builds as a native 32 or 64 bit binary by default.
++CC= $(DEFAULT_CC)
++#
++# Use this if you want to force a 32 bit build on a 64 bit multilib OS.
++#CC= $(DEFAULT_CC) -m32
++#
++# Since the assembler part does NOT maintain a frame pointer, it's pointless
++# to slow down the C part by not omitting it. Debugging, tracebacks and
++# unwinding are not affected -- the assembler part has frame unwind
++# information and GCC emits it where needed (x64) or with -g (see CCDEBUG).
++CCOPT= -O2 -fomit-frame-pointer
++# Use this if you want to generate a smaller binary (but it's slower):
++#CCOPT= -Os -fomit-frame-pointer
++# Note: it's no longer recommended to use -O3 with GCC 4.x.
++# The I-Cache bloat usually outweighs the benefits from aggressive inlining.
++#
++# Target-specific compiler options:
++#
++# x86/x64 only: For GCC 4.2 or higher and if you don't intend to distribute
++# the binaries to a different machine you could also use: -march=native
++#
++CCOPT_x86= -march=i486 -mfpmath=387
++CCOPT_x64=
++CCOPT_arm=
++CCOPT_arm64=
++CCOPT_ppc=
++CCOPT_mips=
++#
++CCDEBUG=
++# Uncomment the next line to generate debug information:
++#CCDEBUG= -g
++#
++CCWARN= -Wall
++# Uncomment the next line to enable more warnings:
++#CCWARN+= -Wextra -Wdeclaration-after-statement -Wredundant-decls -Wshadow -Wpointer-arith
++#
++##############################################################################
++
++##############################################################################
++################################ BUILD MODE ################################
++##############################################################################
++# The default build mode is mixed mode on POSIX. On Windows this is the same
++# as dynamic mode.
++#
++# Mixed mode creates a static + dynamic library and a statically linked luajit.
++BUILDMODE= mixed
++#
++# Static mode creates a static library and a statically linked luajit.
++#BUILDMODE= static
++#
++# Dynamic mode creates a dynamic library and a dynamically linked luajit.
++# Note: this executable will only run when the library is installed!
++#BUILDMODE= dynamic
++#
++##############################################################################
++
++##############################################################################
++################################# FEATURES #################################
++##############################################################################
++# Enable/disable these features as needed, but make sure you force a full
++# recompile with "make clean", followed by "make".
++XCFLAGS=
++#
++# Permanently disable the FFI extension to reduce the size of the LuaJIT
++# executable. But please consider that the FFI library is compiled-in,
++# but NOT loaded by default. It only allocates any memory, if you actually
++# make use of it.
++#XCFLAGS+= -DLUAJIT_DISABLE_FFI
++#
++# Features from Lua 5.2 that are unlikely to break existing code are
++# enabled by default. Some other features that *might* break some existing
++# code (e.g. __pairs or os.execute() return values) can be enabled here.
++# Note: this does not provide full compatibility with Lua 5.2 at this time.
++#XCFLAGS+= -DLUAJIT_ENABLE_LUA52COMPAT
++#
++# Disable the JIT compiler, i.e. turn LuaJIT into a pure interpreter.
++#XCFLAGS+= -DLUAJIT_DISABLE_JIT
++#
++# Some architectures (e.g. PPC) can use either single-number (1) or
++# dual-number (2) mode. Uncomment one of these lines to override the
++# default mode. Please see LJ_ARCH_NUMMODE in lj_arch.h for details.
++#XCFLAGS+= -DLUAJIT_NUMMODE=1
++#XCFLAGS+= -DLUAJIT_NUMMODE=2
++#
++# Disable LJ_GC64 mode for x64.
++#XCFLAGS+= -DLUAJIT_DISABLE_GC64
++#
++##############################################################################
++
++##############################################################################
++############################ DEBUGGING SUPPORT #############################
++##############################################################################
++# Enable these options as needed, but make sure you force a full recompile
++# with "make clean", followed by "make".
++# Note that most of these are NOT suitable for benchmarking or release mode!
++#
++# Use the system provided memory allocator (realloc) instead of the
++# bundled memory allocator. This is slower, but sometimes helpful for
++# debugging. This option cannot be enabled on x64 without GC64, since
++# realloc usually doesn't return addresses in the right address range.
++# OTOH this option is mandatory for Valgrind's memcheck tool on x64 and
++# the only way to get useful results from it for all other architectures.
++#XCFLAGS+= -DLUAJIT_USE_SYSMALLOC
++#
++# This define is required to run LuaJIT under Valgrind. The Valgrind
++# header files must be installed. You should enable debug information, too.
++#XCFLAGS+= -DLUAJIT_USE_VALGRIND
++#
++# This is the client for the GDB JIT API. GDB 7.0 or higher is required
++# to make use of it. See lj_gdbjit.c for details. Enabling this causes
++# a non-negligible overhead, even when not running under GDB.
++#XCFLAGS+= -DLUAJIT_USE_GDBJIT
++#
++# Turn on assertions for the Lua/C API to debug problems with lua_* calls.
++# This is rather slow -- use only while developing C libraries/embeddings.
++#XCFLAGS+= -DLUA_USE_APICHECK
++#
++# Turn on assertions for the whole LuaJIT VM. This significantly slows down
++# everything. Use only if you suspect a problem with LuaJIT itself.
++#XCFLAGS+= -DLUA_USE_ASSERT
++#
++##############################################################################
++# You probably don't need to change anything below this line!
++##############################################################################
++
++##############################################################################
++# Host system detection.
++##############################################################################
++
++ifeq (Windows,$(findstring Windows,$(OS))$(MSYSTEM)$(TERM))
++ HOST_SYS= Windows
++else
++ HOST_SYS:= $(shell uname -s)
++ ifneq (,$(findstring MINGW,$(HOST_SYS)))
++ HOST_SYS= Windows
++ HOST_MSYS= mingw
++ endif
++ ifneq (,$(findstring MSYS,$(HOST_SYS)))
++ HOST_SYS= Windows
++ HOST_MSYS= mingw
++ endif
++ ifneq (,$(findstring CYGWIN,$(HOST_SYS)))
++ HOST_SYS= Windows
++ HOST_MSYS= cygwin
++ endif
++endif
++
++##############################################################################
++# Flags and options for host and target.
++##############################################################################
++
++# You can override the following variables at the make command line:
++# CC HOST_CC STATIC_CC DYNAMIC_CC
++# CFLAGS HOST_CFLAGS TARGET_CFLAGS
++# LDFLAGS HOST_LDFLAGS TARGET_LDFLAGS TARGET_SHLDFLAGS
++# LIBS HOST_LIBS TARGET_LIBS
++# CROSS HOST_SYS TARGET_SYS TARGET_FLAGS
++#
++# Cross-compilation examples:
++# make HOST_CC="gcc -m32" CROSS=i586-mingw32msvc- TARGET_SYS=Windows
++# make HOST_CC="gcc -m32" CROSS=powerpc-linux-gnu-
++
++ASOPTIONS= $(CCOPT) $(CCWARN) $(XCFLAGS) $(CFLAGS)
++CCOPTIONS= $(CCDEBUG) $(ASOPTIONS)
++LDOPTIONS= $(CCDEBUG) $(LDFLAGS)
++
++HOST_CC= $(CC)
++HOST_RM?= rm -f
++# If left blank, minilua is built and used. You can supply an installed
++# copy of (plain) Lua 5.1 or 5.2, plus Lua BitOp. E.g. with: HOST_LUA=lua
++HOST_LUA=
++
++HOST_XCFLAGS= -I.
++HOST_XLDFLAGS=
++HOST_XLIBS=
++HOST_ACFLAGS= $(CCOPTIONS) $(HOST_XCFLAGS) $(TARGET_ARCH) $(HOST_CFLAGS)
++HOST_ALDFLAGS= $(LDOPTIONS) $(HOST_XLDFLAGS) $(HOST_LDFLAGS)
++HOST_ALIBS= $(HOST_XLIBS) $(LIBS) $(HOST_LIBS)
++
++STATIC_CC = $(CROSS)$(CC)
++DYNAMIC_CC = $(CROSS)$(CC) -fPIC
++TARGET_CC= $(STATIC_CC)
++TARGET_STCC= $(STATIC_CC)
++TARGET_DYNCC= $(DYNAMIC_CC)
++TARGET_LD= $(CROSS)$(CC)
++TARGET_AR= $(CROSS)ar rcus
++TARGET_STRIP= $(CROSS)strip
++
++TARGET_LIBPATH= $(or $(PREFIX),/usr/local)/$(or $(MULTILIB),lib)
++TARGET_SONAME= libluajit-$(ABIVER).so.$(MAJVER)
++TARGET_DYLIBNAME= libluajit-$(ABIVER).$(MAJVER).dylib
++TARGET_DYLIBPATH= $(TARGET_LIBPATH)/$(TARGET_DYLIBNAME)
++TARGET_DLLNAME= lua$(NODOTABIVER).dll
++TARGET_DLLDOTANAME= libluajit-$(ABIVER).dll.a
++TARGET_XSHLDFLAGS= -shared -fPIC -Wl,-soname,$(TARGET_SONAME)
++TARGET_DYNXLDOPTS=
++
++TARGET_LFSFLAGS= -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
++TARGET_XCFLAGS= $(TARGET_LFSFLAGS) -U_FORTIFY_SOURCE
++TARGET_XLDFLAGS=
++TARGET_XLIBS= -lm
++TARGET_TCFLAGS= $(CCOPTIONS) $(TARGET_XCFLAGS) $(TARGET_FLAGS) $(TARGET_CFLAGS)
++TARGET_ACFLAGS= $(CCOPTIONS) $(TARGET_XCFLAGS) $(TARGET_FLAGS) $(TARGET_CFLAGS)
++TARGET_ASFLAGS= $(ASOPTIONS) $(TARGET_XCFLAGS) $(TARGET_FLAGS) $(TARGET_CFLAGS)
++TARGET_ALDFLAGS= $(LDOPTIONS) $(TARGET_XLDFLAGS) $(TARGET_FLAGS) $(TARGET_LDFLAGS)
++TARGET_ASHLDFLAGS= $(LDOPTIONS) $(TARGET_XSHLDFLAGS) $(TARGET_FLAGS) $(TARGET_SHLDFLAGS)
++TARGET_ALIBS= $(TARGET_XLIBS) $(LIBS) $(TARGET_LIBS)
++
++TARGET_TESTARCH=$(shell $(TARGET_CC) $(TARGET_TCFLAGS) -E lj_arch.h -dM)
++ifneq (,$(findstring LJ_TARGET_X64 ,$(TARGET_TESTARCH)))
++ TARGET_LJARCH= x64
++else
++ifneq (,$(findstring LJ_TARGET_X86 ,$(TARGET_TESTARCH)))
++ TARGET_LJARCH= x86
++else
++ifneq (,$(findstring LJ_TARGET_ARM ,$(TARGET_TESTARCH)))
++ TARGET_LJARCH= arm
++else
++ifneq (,$(findstring LJ_TARGET_ARM64 ,$(TARGET_TESTARCH)))
++ ifneq (,$(findstring __AARCH64EB__ ,$(TARGET_TESTARCH)))
++ TARGET_ARCH= -D__AARCH64EB__=1
++ endif
++ TARGET_LJARCH= arm64
++else
++ifneq (,$(findstring LJ_TARGET_PPC ,$(TARGET_TESTARCH)))
++ ifneq (,$(findstring LJ_LE 1,$(TARGET_TESTARCH)))
++ TARGET_ARCH= -DLJ_ARCH_ENDIAN=LUAJIT_LE
++ else
++ TARGET_ARCH= -DLJ_ARCH_ENDIAN=LUAJIT_BE
++ endif
++ TARGET_LJARCH= ppc
++else
++ifneq (,$(findstring LJ_TARGET_MIPS ,$(TARGET_TESTARCH)))
++ ifneq (,$(findstring MIPSEL ,$(TARGET_TESTARCH)))
++ TARGET_ARCH= -D__MIPSEL__=1
++ endif
++ ifneq (,$(findstring LJ_TARGET_MIPS64 ,$(TARGET_TESTARCH)))
++ TARGET_LJARCH= mips64
++ else
++ TARGET_LJARCH= mips
++ endif
++else
++ $(error Unsupported target architecture)
++endif
++endif
++endif
++endif
++endif
++endif
++
++ifneq (,$(findstring LJ_TARGET_PS3 1,$(TARGET_TESTARCH)))
++ TARGET_SYS= PS3
++ TARGET_ARCH+= -D__CELLOS_LV2__
++ TARGET_XCFLAGS+= -DLUAJIT_USE_SYSMALLOC
++ TARGET_XLIBS+= -lpthread
++endif
++
++TARGET_XCFLAGS+= $(CCOPT_$(TARGET_LJARCH))
++TARGET_ARCH+= $(patsubst %,-DLUAJIT_TARGET=LUAJIT_ARCH_%,$(TARGET_LJARCH))
++
++ifneq (,$(PREFIX))
++ifneq (/usr/local,$(PREFIX))
++ TARGET_XCFLAGS+= -DLUA_ROOT=\"$(PREFIX)\"
++ ifneq (/usr,$(PREFIX))
++ TARGET_DYNXLDOPTS= -Wl,-rpath,$(TARGET_LIBPATH)
++ endif
++endif
++endif
++ifneq (,$(MULTILIB))
++ TARGET_XCFLAGS+= -DLUA_MULTILIB=\"$(MULTILIB)\"
++endif
++ifneq (,$(LMULTILIB))
++ TARGET_XCFLAGS+= -DLUA_LMULTILIB=\"$(LMULTILIB)\"
++endif
++
++##############################################################################
++# Target system detection.
++##############################################################################
++
++TARGET_SYS?= $(HOST_SYS)
++ifeq (Windows,$(TARGET_SYS))
++ TARGET_STRIP+= --strip-unneeded
++ TARGET_XSHLDFLAGS= -shared -Wl,--out-implib,$(TARGET_DLLDOTANAME)
++ TARGET_DYNXLDOPTS=
++else
++ TARGET_AR+= 2>/dev/null
++ifeq (,$(shell $(TARGET_CC) -o /dev/null -c -x c /dev/null -fno-stack-protector 2>/dev/null || echo 1))
++ TARGET_XCFLAGS+= -fno-stack-protector
++endif
++ifeq (Darwin,$(TARGET_SYS))
++ ifeq (,$(MACOSX_DEPLOYMENT_TARGET))
++ $(error missing: export MACOSX_DEPLOYMENT_TARGET=XX.YY)
++ endif
++ TARGET_STRIP+= -x
++ TARGET_XCFLAGS+= -DLUAJIT_UNWIND_EXTERNAL
++ TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC
++ TARGET_DYNXLDOPTS=
++ TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).$(RELVER)
++else
++ifeq (iOS,$(TARGET_SYS))
++ TARGET_STRIP+= -x
++ TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC
++ TARGET_DYNXLDOPTS=
++ TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).$(RELVER)
++ ifeq (arm64,$(TARGET_LJARCH))
++ TARGET_XCFLAGS+= -fno-omit-frame-pointer
++ endif
++else
++ ifeq (,$(findstring LJ_NO_UNWIND 1,$(TARGET_TESTARCH)))
++ # Find out whether the target toolchain always generates unwind tables.
++ TARGET_TESTUNWIND=$(shell exec 2>/dev/null; echo 'extern void b(void);int a(void){b();return 0;}' | $(TARGET_CC) -c -x c - -o tmpunwind.o && { grep -qa -e eh_frame -e __unwind_info tmpunwind.o || grep -qU -e eh_frame -e __unwind_info tmpunwind.o; } && echo E; rm -f tmpunwind.o)
++ ifneq (,$(findstring E,$(TARGET_TESTUNWIND)))
++ TARGET_XCFLAGS+= -DLUAJIT_UNWIND_EXTERNAL
++ endif
++ endif
++ ifneq (SunOS,$(TARGET_SYS))
++ ifneq (PS3,$(TARGET_SYS))
++ TARGET_XLDFLAGS+= -Wl,-E
++ endif
++ endif
++ ifeq (Linux,$(TARGET_SYS))
++ TARGET_XLIBS+= -ldl
++ endif
++ ifeq (GNU/kFreeBSD,$(TARGET_SYS))
++ TARGET_XLIBS+= -ldl
++ endif
++endif
++endif
++endif
++
++ifneq ($(HOST_SYS),$(TARGET_SYS))
++ ifeq (Windows,$(TARGET_SYS))
++ HOST_XCFLAGS+= -malign-double -DLUAJIT_OS=LUAJIT_OS_WINDOWS
++ else
++ ifeq (Linux,$(TARGET_SYS))
++ HOST_XCFLAGS+= -DLUAJIT_OS=LUAJIT_OS_LINUX
++ else
++ ifeq (Darwin,$(TARGET_SYS))
++ HOST_XCFLAGS+= -DLUAJIT_OS=LUAJIT_OS_OSX
++ else
++ ifeq (iOS,$(TARGET_SYS))
++ HOST_XCFLAGS+= -DLUAJIT_OS=LUAJIT_OS_OSX -DTARGET_OS_IPHONE=1
++ else
++ HOST_XCFLAGS+= -DLUAJIT_OS=LUAJIT_OS_OTHER
++ endif
++ endif
++ endif
++ endif
++endif
++
++ifneq (,$(CCDEBUG))
++ TARGET_STRIP= @:
++endif
++
++##############################################################################
++# Files and pathnames.
++##############################################################################
++
++MINILUA_O= host/minilua.o
++MINILUA_LIBS= -lm
++MINILUA_T= host/minilua
++MINILUA_X= $(MINILUA_T)
++
++ifeq (,$(HOST_LUA))
++ HOST_LUA= $(MINILUA_X)
++ DASM_DEP= $(MINILUA_T)
++endif
++
++DASM_DIR= ../dynasm
++DASM= $(HOST_LUA) $(DASM_DIR)/dynasm.lua
++DASM_XFLAGS=
++DASM_AFLAGS=
++DASM_ARCH= $(TARGET_LJARCH)
++
++ifneq (,$(findstring LJ_LE 1,$(TARGET_TESTARCH)))
++ DASM_AFLAGS+= -D ENDIAN_LE
++else
++ DASM_AFLAGS+= -D ENDIAN_BE
++endif
++ifneq (,$(findstring LJ_ARCH_BITS 64,$(TARGET_TESTARCH)))
++ DASM_AFLAGS+= -D P64
++endif
++ifneq (,$(findstring LJ_HASJIT 1,$(TARGET_TESTARCH)))
++ DASM_AFLAGS+= -D JIT
++endif
++ifneq (,$(findstring LJ_HASFFI 1,$(TARGET_TESTARCH)))
++ DASM_AFLAGS+= -D FFI
++endif
++ifneq (,$(findstring LJ_DUALNUM 1,$(TARGET_TESTARCH)))
++ DASM_AFLAGS+= -D DUALNUM
++endif
++ifneq (,$(findstring LJ_ARCH_HASFPU 1,$(TARGET_TESTARCH)))
++ DASM_AFLAGS+= -D FPU
++ TARGET_ARCH+= -DLJ_ARCH_HASFPU=1
++else
++ TARGET_ARCH+= -DLJ_ARCH_HASFPU=0
++endif
++ifeq (,$(findstring LJ_ABI_SOFTFP 1,$(TARGET_TESTARCH)))
++ DASM_AFLAGS+= -D HFABI
++ TARGET_ARCH+= -DLJ_ABI_SOFTFP=0
++else
++ TARGET_ARCH+= -DLJ_ABI_SOFTFP=1
++endif
++ifneq (,$(findstring LJ_NO_UNWIND 1,$(TARGET_TESTARCH)))
++ DASM_AFLAGS+= -D NO_UNWIND
++ TARGET_ARCH+= -DLUAJIT_NO_UNWIND
++endif
++DASM_AFLAGS+= -D VER=$(subst LJ_ARCH_VERSION_,,$(filter LJ_ARCH_VERSION_%,$(subst LJ_ARCH_VERSION ,LJ_ARCH_VERSION_,$(TARGET_TESTARCH))))
++ifeq (Windows,$(TARGET_SYS))
++ DASM_AFLAGS+= -D WIN
++endif
++ifeq (x64,$(TARGET_LJARCH))
++ ifeq (,$(findstring LJ_FR2 1,$(TARGET_TESTARCH)))
++ DASM_ARCH= x86
++ endif
++else
++ifeq (arm,$(TARGET_LJARCH))
++ ifeq (iOS,$(TARGET_SYS))
++ DASM_AFLAGS+= -D IOS
++ endif
++else
++ifneq (,$(findstring LJ_TARGET_MIPSR6 ,$(TARGET_TESTARCH)))
++ DASM_AFLAGS+= -D MIPSR6
++endif
++ifeq (ppc,$(TARGET_LJARCH))
++ ifneq (,$(findstring LJ_ARCH_SQRT 1,$(TARGET_TESTARCH)))
++ DASM_AFLAGS+= -D SQRT
++ endif
++ ifneq (,$(findstring LJ_ARCH_ROUND 1,$(TARGET_TESTARCH)))
++ DASM_AFLAGS+= -D ROUND
++ endif
++ ifneq (,$(findstring LJ_ARCH_PPC32ON64 1,$(TARGET_TESTARCH)))
++ DASM_AFLAGS+= -D GPR64
++ endif
++ ifeq (PS3,$(TARGET_SYS))
++ DASM_AFLAGS+= -D PPE -D TOC
++ endif
++endif
++endif
++endif
++
++DASM_FLAGS= $(DASM_XFLAGS) $(DASM_AFLAGS)
++DASM_DASC= vm_$(DASM_ARCH).dasc
++
++BUILDVM_O= host/buildvm.o host/buildvm_asm.o host/buildvm_peobj.o \
++ host/buildvm_lib.o host/buildvm_fold.o
++BUILDVM_T= host/buildvm
++BUILDVM_X= $(BUILDVM_T)
++
++HOST_O= $(MINILUA_O) $(BUILDVM_O)
++HOST_T= $(MINILUA_T) $(BUILDVM_T)
++
++LJVM_S= lj_vm.S
++LJVM_O= lj_vm.o
++LJVM_BOUT= $(LJVM_S)
++LJVM_MODE= elfasm
++
++LJLIB_O= lib_base.o lib_math.o lib_bit.o lib_string.o lib_table.o \
++ lib_io.o lib_os.o lib_package.o lib_debug.o lib_jit.o lib_ffi.o \
++ lib_buffer.o
++LJLIB_C= $(LJLIB_O:.o=.c)
++
++LJCORE_O= lj_assert.o lj_gc.o lj_err.o lj_char.o lj_bc.o lj_obj.o lj_buf.o \
++ lj_str.o lj_tab.o lj_func.o lj_udata.o lj_meta.o lj_debug.o \
++ lj_prng.o lj_state.o lj_dispatch.o lj_vmevent.o lj_vmmath.o \
++ lj_strscan.o lj_strfmt.o lj_strfmt_num.o lj_serialize.o \
++ lj_api.o lj_profile.o \
++ lj_lex.o lj_parse.o lj_bcread.o lj_bcwrite.o lj_load.o \
++ lj_ir.o lj_opt_mem.o lj_opt_fold.o lj_opt_narrow.o \
++ lj_opt_dce.o lj_opt_loop.o lj_opt_split.o lj_opt_sink.o \
++ lj_mcode.o lj_snap.o lj_record.o lj_crecord.o lj_ffrecord.o \
++ lj_asm.o lj_trace.o lj_gdbjit.o \
++ lj_ctype.o lj_cdata.o lj_cconv.o lj_ccall.o lj_ccallback.o \
++ lj_carith.o lj_clib.o lj_cparse.o \
++ lj_lib.o lj_alloc.o lib_aux.o \
++ $(LJLIB_O) lib_init.o
++
++LJVMCORE_O= $(LJVM_O) $(LJCORE_O)
++LJVMCORE_DYNO= $(LJVMCORE_O:.o=_dyn.o)
++
++LIB_VMDEF= jit/vmdef.lua
++LIB_VMDEFP= $(LIB_VMDEF)
++
++LUAJIT_O= luajit.o
++LUAJIT_A= libluajit.a
++LUAJIT_SO= libluajit.so
++LUAJIT_T= luajit
++
++ALL_T= $(LUAJIT_T) $(LUAJIT_A) $(LUAJIT_SO) $(HOST_T)
++ALL_HDRGEN= lj_bcdef.h lj_ffdef.h lj_libdef.h lj_recdef.h lj_folddef.h \
++ host/buildvm_arch.h
++ALL_GEN= $(LJVM_S) $(ALL_HDRGEN) $(LIB_VMDEFP)
++WIN_RM= *.obj *.lib *.exp *.dll *.exe *.manifest *.pdb *.ilk
++ALL_RM= $(ALL_T) $(ALL_GEN) *.o host/*.o $(WIN_RM)
++
++##############################################################################
++# Build mode handling.
++##############################################################################
++
++# Mixed mode defaults.
++TARGET_O= $(LUAJIT_A)
++TARGET_T= $(LUAJIT_T) $(LUAJIT_SO)
++TARGET_DEP= $(LIB_VMDEF) $(LUAJIT_SO)
++
++ifeq (Windows,$(TARGET_SYS))
++ TARGET_DYNCC= $(STATIC_CC)
++ LJVM_MODE= peobj
++ LJVM_BOUT= $(LJVM_O)
++ LUAJIT_T= luajit.exe
++ ifeq (cygwin,$(HOST_MSYS))
++ LUAJIT_SO= cyg$(TARGET_DLLNAME)
++ else
++ LUAJIT_SO= $(TARGET_DLLNAME)
++ endif
++ # Mixed mode is not supported on Windows. And static mode doesn't work well.
++ # C modules cannot be loaded, because they bind to lua51.dll.
++ ifneq (static,$(BUILDMODE))
++ BUILDMODE= dynamic
++ TARGET_XCFLAGS+= -DLUA_BUILD_AS_DLL
++ endif
++endif
++ifeq (Darwin,$(TARGET_SYS))
++ LJVM_MODE= machasm
++endif
++ifeq (iOS,$(TARGET_SYS))
++ LJVM_MODE= machasm
++endif
++ifeq (SunOS,$(TARGET_SYS))
++ BUILDMODE= static
++endif
++ifeq (PS3,$(TARGET_SYS))
++ BUILDMODE= static
++endif
++
++ifeq (Windows,$(HOST_SYS))
++ MINILUA_T= host/minilua.exe
++ BUILDVM_T= host/buildvm.exe
++ ifeq (,$(HOST_MSYS))
++ MINILUA_X= host\minilua
++ BUILDVM_X= host\buildvm
++ ALL_RM:= $(subst /,\,$(ALL_RM))
++ HOST_RM= del
++ endif
++endif
++
++ifeq (static,$(BUILDMODE))
++ TARGET_DYNCC= @:
++ TARGET_T= $(LUAJIT_T)
++ TARGET_DEP= $(LIB_VMDEF)
++else
++ifeq (dynamic,$(BUILDMODE))
++ ifneq (Windows,$(TARGET_SYS))
++ TARGET_CC= $(DYNAMIC_CC)
++ endif
++ TARGET_DYNCC= @:
++ LJVMCORE_DYNO= $(LJVMCORE_O)
++ TARGET_O= $(LUAJIT_SO)
++ TARGET_XLDFLAGS+= $(TARGET_DYNXLDOPTS)
++else
++ifeq (Darwin,$(TARGET_SYS))
++ TARGET_DYNCC= @:
++ LJVMCORE_DYNO= $(LJVMCORE_O)
++endif
++ifeq (iOS,$(TARGET_SYS))
++ TARGET_DYNCC= @:
++ LJVMCORE_DYNO= $(LJVMCORE_O)
++endif
++endif
++endif
++
++Q= @
++E= @echo
++#Q=
++#E= @:
++
++##############################################################################
++# Make targets.
++##############################################################################
++
++default all: $(TARGET_T)
++
++amalg:
++ $(MAKE) all "LJCORE_O=ljamalg.o"
++
++clean:
++ $(HOST_RM) $(ALL_RM)
++
++libbc:
++ ./$(LUAJIT_T) host/genlibbc.lua -o host/buildvm_libbc.h $(LJLIB_C)
++ $(MAKE) all
++
++depend:
++ @for file in $(ALL_HDRGEN); do \
++ test -f $$file || touch $$file; \
++ done
++ @$(HOST_CC) $(HOST_ACFLAGS) -MM *.c host/*.c | \
++ sed -e "s| [^ ]*/dasm_\S*\.h||g" \
++ -e "s|^\([^l ]\)|host/\1|" \
++ -e "s| lj_target_\S*\.h| lj_target_*.h|g" \
++ -e "s| lj_emit_\S*\.h| lj_emit_*.h|g" \
++ -e "s| lj_asm_\S*\.h| lj_asm_*.h|g" >Makefile.dep
++ @for file in $(ALL_HDRGEN); do \
++ test -s $$file || $(HOST_RM) $$file; \
++ done
++
++.PHONY: default all amalg clean libbc depend
++
++##############################################################################
++# Rules for generated files.
++##############################################################################
++
++$(MINILUA_T): $(MINILUA_O)
++ $(E) "HOSTLINK $@"
++ $(Q)$(HOST_CC) $(HOST_ALDFLAGS) -o $@ $(MINILUA_O) $(MINILUA_LIBS) $(HOST_ALIBS)
++
++host/buildvm_arch.h: $(DASM_DASC) $(DASM_DEP) $(DASM_DIR)/*.lua lj_arch.h lua.h luaconf.h
++ $(E) "DYNASM $@"
++ $(Q)$(DASM) $(DASM_FLAGS) -o $@ $(DASM_DASC)
++
++host/buildvm.o: $(DASM_DIR)/dasm_*.h
++
++$(BUILDVM_T): $(BUILDVM_O)
++ $(E) "HOSTLINK $@"
++ $(Q)$(HOST_CC) $(HOST_ALDFLAGS) -o $@ $(BUILDVM_O) $(HOST_ALIBS)
++
++$(LJVM_BOUT): $(BUILDVM_T)
++ $(E) "BUILDVM $@"
++ $(Q)$(BUILDVM_X) -m $(LJVM_MODE) -o $@
++
++lj_bcdef.h: $(BUILDVM_T) $(LJLIB_C)
++ $(E) "BUILDVM $@"
++ $(Q)$(BUILDVM_X) -m bcdef -o $@ $(LJLIB_C)
++
++lj_ffdef.h: $(BUILDVM_T) $(LJLIB_C)
++ $(E) "BUILDVM $@"
++ $(Q)$(BUILDVM_X) -m ffdef -o $@ $(LJLIB_C)
++
++lj_libdef.h: $(BUILDVM_T) $(LJLIB_C)
++ $(E) "BUILDVM $@"
++ $(Q)$(BUILDVM_X) -m libdef -o $@ $(LJLIB_C)
++
++lj_recdef.h: $(BUILDVM_T) $(LJLIB_C)
++ $(E) "BUILDVM $@"
++ $(Q)$(BUILDVM_X) -m recdef -o $@ $(LJLIB_C)
++
++$(LIB_VMDEF): $(BUILDVM_T) $(LJLIB_C)
++ $(E) "BUILDVM $@"
++ $(Q)$(BUILDVM_X) -m vmdef -o $(LIB_VMDEFP) $(LJLIB_C)
++
++lj_folddef.h: $(BUILDVM_T) lj_opt_fold.c
++ $(E) "BUILDVM $@"
++ $(Q)$(BUILDVM_X) -m folddef -o $@ lj_opt_fold.c
++
++##############################################################################
++# Object file rules.
++##############################################################################
++
++%.o: %.c
++ $(E) "CC $@"
++ $(Q)$(TARGET_DYNCC) $(TARGET_ACFLAGS) -c -o $(@:.o=_dyn.o) $<
++ $(Q)$(TARGET_CC) $(TARGET_ACFLAGS) -c -o $@ $<
++
++%.o: %.S
++ $(E) "ASM $@"
++ $(Q)$(TARGET_DYNCC) $(TARGET_ASFLAGS) -c -o $(@:.o=_dyn.o) $<
++ $(Q)$(TARGET_CC) $(TARGET_ASFLAGS) -c -o $@ $<
++
++$(LUAJIT_O):
++ $(E) "CC $@"
++ $(Q)$(TARGET_STCC) $(TARGET_ACFLAGS) -c -o $@ $<
++
++$(HOST_O): %.o: %.c
++ $(E) "HOSTCC $@"
++ $(Q)$(HOST_CC) $(HOST_ACFLAGS) -c -o $@ $<
++
++include Makefile.dep
++
++##############################################################################
++# Target file rules.
++##############################################################################
++
++$(LUAJIT_A): $(LJVMCORE_O)
++ $(E) "AR $@"
++ $(Q)$(TARGET_AR) $@ $(LJVMCORE_O)
++
++# The dependency on _O, but linking with _DYNO is intentional.
++$(LUAJIT_SO): $(LJVMCORE_O)
++ $(E) "DYNLINK $@"
++ $(Q)$(TARGET_LD) $(TARGET_ASHLDFLAGS) -o $@ $(LJVMCORE_DYNO) $(TARGET_ALIBS)
++ $(Q)$(TARGET_STRIP) $@
++
++$(LUAJIT_T): $(TARGET_O) $(LUAJIT_O) $(TARGET_DEP)
++ $(E) "LINK $@"
++ $(Q)$(TARGET_LD) $(TARGET_ALDFLAGS) -o $@ $(LUAJIT_O) $(TARGET_O) $(TARGET_ALIBS)
++ $(Q)$(TARGET_STRIP) $@
++ $(E) "OK Successfully built LuaJIT"
++
++##############################################################################
+diff -rauN luajit-2.0-505e2c0/src/msvcbuild.bat luajit-2.0-505e2c0-i486-patch/src/msvcbuild.bat
+--- luajit-2.0-505e2c0/src/msvcbuild.bat 2023-02-21 17:07:37.000000000 +0100
++++ luajit-2.0-505e2c0-i486-patch/src/msvcbuild.bat 2023-03-26 18:16:32.558477950 +0200
+@@ -41,7 +41,6 @@
+ @set DASC=vm_x86.dasc
+ @set DASMFLAGS=-D WIN -D JIT -D FFI
+ @set LJARCH=x86
+-@set LJCOMPILE=%LJCOMPILE% /arch:SSE2
+ :X64
+ @if "%1" neq "nogc64" goto :GC64
+ @shift
+diff -rauN luajit-2.0-505e2c0/src/vm_x86.dasc luajit-2.0-505e2c0-i486-patch/src/vm_x86.dasc
+--- luajit-2.0-505e2c0/src/vm_x86.dasc 2023-02-21 17:07:37.000000000 +0100
++++ luajit-2.0-505e2c0-i486-patch/src/vm_x86.dasc 2023-03-26 18:16:32.561811273 +0200
+@@ -18,6 +18,7 @@
+ |
+ |.if P64
+ |.define X64, 1
++|.define SSE, 1
+ |.if WIN
+ |.define X64WIN, 1
+ |.endif
+@@ -439,6 +440,7 @@
+ | fpop
+ |.endmacro
+ |
++|.macro fdup; fld st0; .endmacro
+ |.macro fpop1; fstp st1; .endmacro
+ |
+ |// Synthesize SSE FP constants.
+@@ -464,6 +466,9 @@
+ |.macro sseconst_1, reg, tmp // Synthesize 1.0.
+ | sseconst_hi reg, tmp, 3ff00000
+ |.endmacro
++|.macro sseconst_m1, reg, tmp // Synthesize -1.0.
++| sseconst_hi reg, tmp, bff00000
++|.endmacro
+ |.macro sseconst_2p52, reg, tmp // Synthesize 2^52.
+ | sseconst_hi reg, tmp, 43300000
+ |.endmacro
+@@ -943,9 +948,13 @@
+ |.if DUALNUM
+ | mov TMP2, LJ_TISNUM
+ | mov TMP1, RC
+- |.else
++ |.elif SSE
+ | cvtsi2sd xmm0, RC
+ | movsd TMPQ, xmm0
++ |.else
++ | mov ARG4, RC
++ | fild ARG4
++ | fstp TMPQ
+ |.endif
+ | lea RCa, TMPQ // Store temp. TValue in TMPQ.
+ | jmp >1
+@@ -1031,9 +1040,13 @@
+ |.if DUALNUM
+ | mov TMP2, LJ_TISNUM
+ | mov TMP1, RC
+- |.else
++ |.elif SSE
+ | cvtsi2sd xmm0, RC
+ | movsd TMPQ, xmm0
++ |.else
++ | mov ARG4, RC
++ | fild ARG4
++ | fstp TMPQ
+ |.endif
+ | lea RCa, TMPQ // Store temp. TValue in TMPQ.
+ | jmp >1
+@@ -1416,6 +1429,19 @@
+ | cmp NARGS:RD, 2+1; jb ->fff_fallback
+ |.endmacro
+ |
++ |.macro .ffunc_n, name
++ | .ffunc_1 name
++ | cmp dword [BASE+4], LJ_TISNUM; jae ->fff_fallback
++ | fld qword [BASE]
++ |.endmacro
++ |
++ |.macro .ffunc_n, name, op
++ | .ffunc_1 name
++ | cmp dword [BASE+4], LJ_TISNUM; jae ->fff_fallback
++ | op
++ | fld qword [BASE]
++ |.endmacro
++ |
+ |.macro .ffunc_nsse, name, op
+ | .ffunc_1 name
+ | cmp dword [BASE+4], LJ_TISNUM; jae ->fff_fallback
+@@ -1426,6 +1452,14 @@
+ | .ffunc_nsse name, movsd
+ |.endmacro
+ |
++ |.macro .ffunc_nn, name
++ | .ffunc_2 name
++ | cmp dword [BASE+4], LJ_TISNUM; jae ->fff_fallback
++ | cmp dword [BASE+12], LJ_TISNUM; jae ->fff_fallback
++ | fld qword [BASE]
++ | fld qword [BASE+8]
++ |.endmacro
++ |
+ |.macro .ffunc_nnsse, name
+ | .ffunc_2 name
+ | cmp dword [BASE+4], LJ_TISNUM; jae ->fff_fallback
+@@ -1631,7 +1665,11 @@
+ |.else
+ | jae ->fff_fallback
+ |.endif
++ |.if SSE
+ | movsd xmm0, qword [BASE]; jmp ->fff_resxmm0
++ |.else
++ | fld qword [BASE]; jmp ->fff_resn
++ |.endif
+ |
+ |.ffunc_1 tostring
+ | // Only handles the string or number case inline.
+@@ -1729,12 +1767,19 @@
+ | add RD, 1
+ | mov dword [BASE-4], LJ_TISNUM
+ | mov dword [BASE-8], RD
+- |.else
++ |.elif SSE
+ | movsd xmm0, qword [BASE+8]
+ | sseconst_1 xmm1, RBa
+ | addsd xmm0, xmm1
+ | cvttsd2si RD, xmm0
+ | movsd qword [BASE-8], xmm0
++ |.else
++ | fld qword [BASE+8]
++ | fld1
++ | faddp st1
++ | fist ARG1
++ | fstp qword [BASE-8]
++ | mov RD, ARG1
+ |.endif
+ | mov TAB:RB, [BASE]
+ | cmp RD, TAB:RB->asize; jae >2 // Not in array part?
+@@ -1783,9 +1828,12 @@
+ |.if DUALNUM
+ | mov dword [BASE+12], LJ_TISNUM
+ | mov dword [BASE+8], 0
+- |.else
++ |.elif SSE
+ | xorps xmm0, xmm0
+ | movsd qword [BASE+8], xmm0
++ |.else
++ | fldz
++ | fstp qword [BASE+8]
+ |.endif
+ | mov RD, 1+3
+ | jmp ->fff_res
+@@ -2017,11 +2065,6 @@
+ |->fff_resi: // Dummy.
+ |.endif
+ |
+- |->fff_resn:
+- | mov PC, [BASE-4]
+- | fstp qword [BASE-8]
+- | jmp ->fff_res1
+- |
+ | .ffunc_1 math_abs
+ |.if DUALNUM
+ | cmp dword [BASE+4], LJ_TISNUM; jne >2
+@@ -2044,6 +2087,8 @@
+ |.else
+ | cmp dword [BASE+4], LJ_TISNUM; jae ->fff_fallback
+ |.endif
++ |
++ |.if SSE
+ | movsd xmm0, qword [BASE]
+ | sseconst_abs xmm1, RDa
+ | andps xmm0, xmm1
+@@ -2051,6 +2096,15 @@
+ | mov PC, [BASE-4]
+ | movsd qword [BASE-8], xmm0
+ | // fallthrough
++ |.else
++ | fld qword [BASE]
++ | fabs
++ | // fallthrough
++ |->fff_resxmm0: // Dummy.
++ |->fff_resn:
++ | mov PC, [BASE-4]
++ | fstp qword [BASE-8]
++ |.endif
+ |
+ |->fff_res1:
+ | mov RD, 1+1
+@@ -2093,8 +2147,9 @@
+ |.else
+ | cmp dword [BASE+4], LJ_TISNUM; jae ->fff_fallback
+ |.endif
++ |.if SSE
+ | movsd xmm0, qword [BASE]
+- | call ->vm_ .. func .. _sse
++ | call ->vm_ .. func
+ |.if DUALNUM
+ | cvttsd2si RB, xmm0
+ | cmp RB, 0x80000000
+@@ -2105,29 +2160,61 @@
+ | je ->fff_resi
+ |.endif
+ | jmp ->fff_resxmm0
++ |.else
++ | fld qword [BASE]
++ | call ->vm_ .. func
++ | .if DUALNUM
++ | fist ARG1
++ | mov RB, ARG1
++ | cmp RB, 0x80000000; jne >2
++ | fdup
++ | fild ARG1
++ | fcomparepp
++ | jp ->fff_resn
++ | jne ->fff_resn
++ |2:
++ | fpop
++ | jmp ->fff_resi
++ | .else
++ | jmp ->fff_resn
++ | .endif
++ |.endif
+ |.endmacro
+ |
+ | math_round floor
+ | math_round ceil
+ |
++ |.if SSE
+ |.ffunc_nsse math_sqrt, sqrtsd; jmp ->fff_resxmm0
++ |.else
++ |.ffunc_n math_sqrt; fsqrt; jmp ->fff_resn
++ |.endif
+ |
+ |.ffunc math_log
+ | cmp NARGS:RD, 1+1; jne ->fff_fallback // Exactly one argument.
+ | cmp dword [BASE+4], LJ_TISNUM; jae ->fff_fallback
++ |.if SSE
+ | movsd xmm0, qword [BASE]
+- |.if not X64
+- | movsd FPARG1, xmm0
+- |.endif
++ | .if not X64
++ | movsd FPARG1, xmm0
++ | .endif
+ | mov RB, BASE
+ | call extern log
+ | mov BASE, RB
+ | jmp ->fff_resfp
++ |.else
++ | fldln2; fld qword [BASE]; fyl2x; jmp ->fff_resn
++ |.endif
+ |
+ |.macro math_extern, func
++ |.if SSE
+ | .ffunc_nsse math_ .. func
+- |.if not X64
+- | movsd FPARG1, xmm0
++ | .if not X64
++ | movsd FPARG1, xmm0
++ | .endif
++ |.else
++ | .ffunc_n math_ .. func
++ | fstp FPARG1
+ |.endif
+ | mov RB, BASE
+ | call extern func
+@@ -2136,10 +2223,16 @@
+ |.endmacro
+ |
+ |.macro math_extern2, func
+- | .ffunc_nnsse math_ .. func
+ |.if not X64
+- | movsd FPARG1, xmm0
+- | movsd FPARG3, xmm1
++ | .if SSE
++ | .ffunc_nnsse math_ .. func
++ | movsd FPARG1, xmm0
++ | movsd FPARG3, xmm1
++ | .else
++ | .ffunc_nn math_ .. func
++ | fstp FPARG3
++ | fstp FPARG1
++ | .endif
+ |.endif
+ | mov RB, BASE
+ | call extern func
+@@ -2176,34 +2269,65 @@
+ | cmp RB, 0x00200000; jb >4
+ |1:
+ | shr RB, 21; sub RB, RC // Extract and unbias exponent.
++ |.if SSE
+ | cvtsi2sd xmm0, RB
++ |.else
++ | mov TMP1, RB; fild TMP1
++ |.endif
+ | mov RB, [BASE-4]
+ | and RB, 0x800fffff // Mask off exponent.
+ | or RB, 0x3fe00000 // Put mantissa in range [0.5,1) or 0.
+ | mov [BASE-4], RB
+ |2:
++ |.if SSE
+ | movsd qword [BASE], xmm0
++ |.else
++ | fstp qword [BASE]
++ |.endif
+ | mov RD, 1+2
+ | jmp ->fff_res
+ |3: // Return +-0, +-Inf, NaN unmodified and an exponent of 0.
++ |.if SSE
+ | xorps xmm0, xmm0; jmp <2
++ |.else
++ | fldz; jmp <2
++ |.endif
+ |4: // Handle denormals by multiplying with 2^54 and adjusting the bias.
++ |.if SSE
+ | movsd xmm0, qword [BASE]
+ | sseconst_hi xmm1, RBa, 43500000 // 2^54.
+ | mulsd xmm0, xmm1
+ | movsd qword [BASE-8], xmm0
++ |.else
++ | fld qword [BASE]
++ | mov TMP1, 0x5a800000; fmul TMP1 // x = x*2^54
++ | fstp qword [BASE-8]
++ |.endif
+ | mov RB, [BASE-4]; mov RC, 1076; shl RB, 1; jmp <1
+ |
++ |.if SSE
+ |.ffunc_nsse math_modf
++ |.else
++ |.ffunc_n math_modf
++ |.endif
+ | mov RB, [BASE+4]
+ | mov PC, [BASE-4]
+ | shl RB, 1; cmp RB, 0xffe00000; je >4 // +-Inf?
++ |.if SSE
+ | movaps xmm4, xmm0
+- | call ->vm_trunc_sse
++ | call ->vm_trunc
+ | subsd xmm4, xmm0
+ |1:
+ | movsd qword [BASE-8], xmm0
+ | movsd qword [BASE], xmm4
++ |.else
++ | fdup
++ | call ->vm_trunc
++ | fsub st1, st0
++ |1:
++ | fstp qword [BASE-8]
++ | fstp qword [BASE]
++ |.endif
+ | mov RC, [BASE-4]; mov RB, [BASE+4]
+ | xor RC, RB; js >3 // Need to adjust sign?
+ |2:
+@@ -2213,9 +2337,24 @@
+ | xor RB, 0x80000000; mov [BASE+4], RB // Flip sign of fraction.
+ | jmp <2
+ |4:
++ |.if SSE
+ | xorps xmm4, xmm4; jmp <1 // Return +-Inf and +-0.
++ |.else
++ | fldz; fxch; jmp <1 // Return +-Inf and +-0.
++ |.endif
++ |
++ |.ffunc_nnr math_fmod
++ |1: ; fprem; fnstsw ax; sahf; jp <1
++ | fpop1
++ | jmp ->fff_resn
++ |
++ |.if SSE
++ |.ffunc_nnsse math_pow; call ->vm_pow; jmp ->fff_resxmm0
++ |.else
++ |.ffunc_nn math_pow; call ->vm_pow; jmp ->fff_resn
++ |.endif
+ |
+- |.macro math_minmax, name, cmovop, sseop
++ |.macro math_minmax, name, cmovop, fcmovop, sseop
+ | .ffunc_1 name
+ | mov RA, 2
+ | cmp dword [BASE+4], LJ_TISNUM
+@@ -2232,7 +2371,12 @@
+ |3:
+ | ja ->fff_fallback
+ | // Convert intermediate result to number and continue below.
++ |.if SSE
+ | cvtsi2sd xmm0, RB
++ |.else
++ | mov TMP1, RB
++ | fild TMP1
++ |.endif
+ | jmp >6
+ |4:
+ | ja ->fff_fallback
+@@ -2240,6 +2384,7 @@
+ | jae ->fff_fallback
+ |.endif
+ |
++ |.if SSE
+ | movsd xmm0, qword [BASE]
+ |5: // Handle numbers or integers.
+ | cmp RA, RD; jae ->fff_resxmm0
+@@ -2258,10 +2403,34 @@
+ | sseop xmm0, xmm1
+ | add RA, 1
+ | jmp <5
++ |.else
++ | fld qword [BASE]
++ |5: // Handle numbers or integers.
++ | cmp RA, RD; jae ->fff_resn
++ | cmp dword [BASE+RA*8-4], LJ_TISNUM
++ |.if DUALNUM
++ | jb >6
++ | ja >9
++ | fild dword [BASE+RA*8-8]
++ | jmp >7
++ |.else
++ | jae >9
++ |.endif
++ |6:
++ | fld qword [BASE+RA*8-8]
++ |7:
++ | fucomi st1; fcmovop st1; fpop1
++ | add RA, 1
++ | jmp <5
++ |.endif
+ |.endmacro
+ |
+- | math_minmax math_min, cmovg, minsd
+- | math_minmax math_max, cmovl, maxsd
++ | math_minmax math_min, cmovg, fcmovnbe, minsd
++ | math_minmax math_max, cmovl, fcmovbe, maxsd
++ |.if not SSE
++ |9:
++ | fpop; jmp ->fff_fallback
++ |.endif
+ |
+ |//-- String library -----------------------------------------------------
+ |
+@@ -2275,8 +2444,10 @@
+ | movzx RB, byte STR:RB[1]
+ |.if DUALNUM
+ | jmp ->fff_resi
+- |.else
++ |.elif SSE
+ | cvtsi2sd xmm0, RB; jmp ->fff_resxmm0
++ |.else
++ | mov TMP1, RB; fild TMP1; jmp ->fff_resn
+ |.endif
+ |
+ |.ffunc string_char // Only handle the 1-arg case here.
+@@ -2288,11 +2459,16 @@
+ | mov RB, dword [BASE]
+ | cmp RB, 255; ja ->fff_fallback
+ | mov TMP2, RB
+- |.else
++ |.elif SSE
+ | jae ->fff_fallback
+ | cvttsd2si RB, qword [BASE]
+ | cmp RB, 255; ja ->fff_fallback
+ | mov TMP2, RB
++ |.else
++ | jae ->fff_fallback
++ | fld qword [BASE]
++ | fistp TMP2
++ | cmp TMP2, 255; ja ->fff_fallback
+ |.endif
+ |.if X64
+ | mov TMP3, 1
+@@ -2331,10 +2507,14 @@
+ | jne ->fff_fallback
+ | mov RB, dword [BASE+16]
+ | mov TMP2, RB
+- |.else
++ |.elif SSE
+ | jae ->fff_fallback
+ | cvttsd2si RB, qword [BASE+16]
+ | mov TMP2, RB
++ |.else
++ | jae ->fff_fallback
++ | fld qword [BASE+16]
++ | fistp TMP2
+ |.endif
+ |1:
+ | cmp dword [BASE+4], LJ_TSTR; jne ->fff_fallback
+@@ -2349,8 +2529,12 @@
+ | mov RB, STR:RB->len
+ |.if DUALNUM
+ | mov RA, dword [BASE+8]
+- |.else
++ |.elif SSE
+ | cvttsd2si RA, qword [BASE+8]
++ |.else
++ | fld qword [BASE+8]
++ | fistp ARG3
++ | mov RA, ARG3
+ |.endif
+ | mov RC, TMP2
+ | cmp RB, RC // len < end? (unsigned compare)
+@@ -2418,10 +2602,16 @@
+ |
+ |//-- Bit library --------------------------------------------------------
+ |
++ |.define TOBIT_BIAS, 0x59c00000 // 2^52 + 2^51 (float, not double!).
++ |
+ |.macro .ffunc_bit, name, kind, fdef
+ | fdef name
+ |.if kind == 2
++ |.if SSE
+ | sseconst_tobit xmm1, RBa
++ |.else
++ | mov TMP1, TOBIT_BIAS
++ |.endif
+ |.endif
+ | cmp dword [BASE+4], LJ_TISNUM
+ |.if DUALNUM
+@@ -2437,12 +2627,24 @@
+ |.else
+ | jae ->fff_fallback
+ |.endif
++ |.if SSE
+ | movsd xmm0, qword [BASE]
+ |.if kind < 2
+ | sseconst_tobit xmm1, RBa
+ |.endif
+ | addsd xmm0, xmm1
+ | movd RB, xmm0
++ |.else
++ | fld qword [BASE]
++ |.if kind < 2
++ | mov TMP1, TOBIT_BIAS
++ |.endif
++ | fadd TMP1
++ | fstp FPARG1
++ |.if kind > 0
++ | mov RB, ARG1
++ |.endif
++ |.endif
+ |2:
+ |.endmacro
+ |
+@@ -2451,7 +2653,15 @@
+ |.endmacro
+ |
+ |.ffunc_bit bit_tobit, 0
++ |.if DUALNUM or SSE
++ |.if not SSE
++ | mov RB, ARG1
++ |.endif
+ | jmp ->fff_resbit
++ |.else
++ | fild ARG1
++ | jmp ->fff_resn
++ |.endif
+ |
+ |.macro .ffunc_bit_op, name, ins
+ | .ffunc_bit name, 2
+@@ -2471,10 +2681,17 @@
+ |.else
+ | jae ->fff_fallback_bit_op
+ |.endif
++ |.if SSE
+ | movsd xmm0, qword [RD]
+ | addsd xmm0, xmm1
+ | movd RA, xmm0
+ | ins RB, RA
++ |.else
++ | fld qword [RD]
++ | fadd TMP1
++ | fstp FPARG1
++ | ins RB, ARG1
++ |.endif
+ | sub RD, 8
+ | jmp <1
+ |.endmacro
+@@ -2491,10 +2708,15 @@
+ | not RB
+ |.if DUALNUM
+ | jmp ->fff_resbit
+- |.else
++ |.elif SSE
+ |->fff_resbit:
+ | cvtsi2sd xmm0, RB
+ | jmp ->fff_resxmm0
++ |.else
++ |->fff_resbit:
++ | mov ARG1, RB
++ | fild ARG1
++ | jmp ->fff_resn
+ |.endif
+ |
+ |->fff_fallback_bit_op:
+@@ -2507,13 +2729,22 @@
+ | // Note: no inline conversion from number for 2nd argument!
+ | cmp dword [BASE+12], LJ_TISNUM; jne ->fff_fallback
+ | mov RA, dword [BASE+8]
+- |.else
++ |.elif SSE
+ | .ffunc_nnsse name
+ | sseconst_tobit xmm2, RBa
+ | addsd xmm0, xmm2
+ | addsd xmm1, xmm2
+ | movd RB, xmm0
+ | movd RA, xmm1
++ |.else
++ | .ffunc_nn name
++ | mov TMP1, TOBIT_BIAS
++ | fadd TMP1
++ | fstp FPARG3
++ | fadd TMP1
++ | fstp FPARG1
++ | mov RA, ARG3
++ | mov RB, ARG1
+ |.endif
+ | ins RB, cl // Assumes RA is ecx.
+ | jmp ->fff_resbit
+@@ -2954,18 +3185,27 @@
+ |//-----------------------------------------------------------------------
+ |
+ |// FP value rounding. Called by math.floor/math.ceil fast functions
+- |// and from JIT code. arg/ret is xmm0. xmm0-xmm3 and RD (eax) modified.
+- |.macro vm_round, name, mode, cond
+- |->name:
+- |.if not X64 and cond
+- | movsd xmm0, qword [esp+4]
+- | call ->name .. _sse
+- | movsd qword [esp+4], xmm0 // Overwrite callee-owned arg.
+- | fld qword [esp+4]
++ |// and from JIT code.
++ |
++ |// x87 variant: Arg/ret on x87 stack. No int/xmm registers modified.
++ |.macro vm_round_x87, mode1, mode2
++ | fnstcw word [esp+4] // Caveat: overwrites ARG1 and ARG2.
++ | mov [esp+8], eax
++ | mov ax, mode1
++ | or ax, [esp+4]
++ |.if mode2 ~= 0xffff
++ | and ax, mode2
++ |.endif
++ | mov [esp+6], ax
++ | fldcw word [esp+6]
++ | frndint
++ | fldcw word [esp+4]
++ | mov eax, [esp+8]
+ | ret
+- |.endif
++ |.endmacro
+ |
+- |->name .. _sse:
++ |// SSE variant: arg/ret is xmm0. xmm0-xmm3 and RD (eax) modified.
++ |.macro vm_round_sse, mode
+ | sseconst_abs xmm2, RDa
+ | sseconst_2p52 xmm3, RDa
+ | movaps xmm1, xmm0
+@@ -2986,29 +3226,37 @@
+ | addsd xmm1, xmm3 // (|x| + 2^52) - 2^52
+ | subsd xmm1, xmm3
+ | orpd xmm1, xmm2 // Merge sign bit back in.
+- | sseconst_1 xmm3, RDa
+ | .if mode == 1 // ceil(x)?
++ | sseconst_m1 xmm2, RDa // Must subtract -1 to preserve -0.
+ | cmpsd xmm0, xmm1, 6 // x > result?
+- | andpd xmm0, xmm3
+- | addsd xmm1, xmm0 // If yes, add 1.
+- | orpd xmm1, xmm2 // Merge sign bit back in (again).
+ | .else // floor(x)?
++ | sseconst_1 xmm2, RDa
+ | cmpsd xmm0, xmm1, 1 // x < result?
+- | andpd xmm0, xmm3
+- | subsd xmm1, xmm0 // If yes, subtract 1.
+ | .endif
++ | andpd xmm0, xmm2
++ | subsd xmm1, xmm0 // If yes, subtract +-1.
+ |.endif
+ | movaps xmm0, xmm1
+ |1:
+ | ret
+ |.endmacro
+ |
+- | vm_round vm_floor, 0, 1
+- | vm_round vm_ceil, 1, JIT
+- | vm_round vm_trunc, 2, JIT
++ |.macro vm_round, name, ssemode, mode1, mode2, extra // FIXME: EXTRA NOT USED
++ |->name:
++ |.if not SSE
++ | vm_round_x87 mode1, mode2
++ |.endif
++ |->name .. _sse:
++ | vm_round_sse ssemode
++ |.endmacro
++ |
++ | vm_round vm_floor, 0, 0x0400, 0xf7ff, 1
++ | vm_round vm_ceil, 1, 0x0800, 0xfbff, JIT
++ | vm_round vm_trunc, 2, 0x0c00, 0xffff, JIT
+ |
+ |// FP modulo x%y. Called by BC_MOD* and vm_arith.
+ |->vm_mod:
++ |.if SSE
+ |// Args in xmm0/xmm1, return value in xmm0.
+ |// Caveat: xmm0-xmm5 and RC (eax) modified!
+ | movaps xmm5, xmm0
+@@ -3036,6 +3284,243 @@
+ | movaps xmm0, xmm5
+ | subsd xmm0, xmm1
+ | ret
++ |.else
++ |// Args/ret on x87 stack (y on top). No xmm registers modified.
++ |// Caveat: needs 3 slots on x87 stack! RC (eax) modified!
++ | fld st1
++ | fdiv st1
++ | fnstcw word [esp+4]
++ | mov ax, 0x0400
++ | or ax, [esp+4]
++ | and ax, 0xf7ff
++ | mov [esp+6], ax
++ | fldcw word [esp+6]
++ | frndint
++ | fldcw word [esp+4]
++ | fmulp st1
++ | fsubp st1
++ | ret
++ |.endif
++ |
++ |->vm_exp2raw: // Entry point for vm_pow. Without +-Inf check.
++ | fdup; frndint; fsub st1, st0; fxch // Split into frac/int part.
++ | f2xm1; fld1; faddp st1; fscale; fpop1 // ==> (2^frac-1 +1) << int
++ |1:
++ | ret
++ |2:
++ | fpop; fldz; ret
++ |
++ |// Generic power function x^y. Called by BC_POW, math.pow fast function,
++ |// and vm_arith.
++ |// Args/ret on x87 stack (y on top). RC (eax) modified.
++ |// Caveat: needs 3 slots on x87 stack!
++ |->vm_pow:
++ |.if not SSE
++ | fist dword [esp+4] // Store/reload int before comparison.
++ | fild dword [esp+4] // Integral exponent used in vm_powi.
++ | fucomip st1
++ | jnz >8 // Branch for FP exponents.
++ | jp >9 // Branch for NaN exponent.
++ | fpop // Pop y and fallthrough to vm_powi.
++ |
++ |// FP/int power function x^i. Arg1/ret on x87 stack.
++ |// Arg2 (int) on C stack. RC (eax) modified.
++ |// Caveat: needs 2 slots on x87 stack!
++ | mov eax, [esp+4]
++ | cmp eax, 1; jle >6 // i<=1?
++ | // Now 1 < (unsigned)i <= 0x80000000.
++ |1: // Handle leading zeros.
++ | test eax, 1; jnz >2
++ | fmul st0
++ | shr eax, 1
++ | jmp <1
++ |2:
++ | shr eax, 1; jz >5
++ | fdup
++ |3: // Handle trailing bits.
++ | fmul st0
++ | shr eax, 1; jz >4
++ | jnc <3
++ | fmul st1, st0
++ | jmp <3
++ |4:
++ | fmulp st1
++ |5:
++ | ret
++ |6:
++ | je <5 // x^1 ==> x
++ | jb >7
++ | fld1; fdivrp st1
++ | neg eax
++ | cmp eax, 1; je <5 // x^-1 ==> 1/x
++ | jmp <1 // x^-i ==> (1/x)^i
++ |7:
++ | fpop; fld1 // x^0 ==> 1
++ | ret
++ |
++ |8: // FP/FP power function x^y.
++ | fst dword [esp+4]
++ | fxch
++ | fst dword [esp+8]
++ | mov eax, [esp+4]; shl eax, 1
++ | cmp eax, 0xff000000; je >2 // x^+-Inf?
++ | mov eax, [esp+8]; shl eax, 1; je >4 // +-0^y?
++ | cmp eax, 0xff000000; je >4 // +-Inf^y?
++ | fyl2x
++ | jmp ->vm_exp2raw
++ |
++ |9: // Handle x^NaN.
++ | fld1
++ | fucomip st2
++ | je >1 // 1^NaN ==> 1
++ | fxch // x^NaN ==> NaN
++ |1:
++ | fpop
++ | ret
++ |
++ |2: // Handle x^+-Inf.
++ | fabs
++ | fld1
++ | fucomip st1
++ | je >3 // +-1^+-Inf ==> 1
++ | fpop; fabs; fldz; mov eax, 0; setc al
++ | ror eax, 1; xor eax, [esp+4]; jns >3 // |x|<>1, x^+-Inf ==> +Inf/0
++ | fxch
++ |3:
++ | fpop1; fabs
++ | ret
++ |
++ |4: // Handle +-0^y or +-Inf^y.
++ | cmp dword [esp+4], 0; jge <3 // y >= 0, x^y ==> |x|
++ | fpop; fpop
++ | test eax, eax; jz >5 // y < 0, +-0^y ==> +Inf
++ | fldz // y < 0, +-Inf^y ==> 0
++ | ret
++ |5:
++ | mov dword [esp+4], 0x7f800000 // Return +Inf.
++ | fld dword [esp+4]
++ | ret
++ |.endif
++ |
++ |// Args in xmm0/xmm1. Ret in xmm0. xmm0-xmm2 and RC (eax) modified.
++ |// Needs 16 byte scratch area for x86. Also called from JIT code.
++ |->vm_pow_sse:
++ | cvtsd2si eax, xmm1
++ | cvtsi2sd xmm2, eax
++ | ucomisd xmm1, xmm2
++ | jnz >8 // Branch for FP exponents.
++ | jp >9 // Branch for NaN exponent.
++ | // Fallthrough to vm_powi_sse.
++ |
++ |// Args in xmm0/eax. Ret in xmm0. xmm0-xmm1 and eax modified.
++ |->vm_powi_sse:
++ | cmp eax, 1; jle >6 // i<=1?
++ | // Now 1 < (unsigned)i <= 0x80000000.
++ |1: // Handle leading zeros.
++ | test eax, 1; jnz >2
++ | mulsd xmm0, xmm0
++ | shr eax, 1
++ | jmp <1
++ |2:
++ | shr eax, 1; jz >5
++ | movaps xmm1, xmm0
++ |3: // Handle trailing bits.
++ | mulsd xmm0, xmm0
++ | shr eax, 1; jz >4
++ | jnc <3
++ | mulsd xmm1, xmm0
++ | jmp <3
++ |4:
++ | mulsd xmm0, xmm1
++ |5:
++ | ret
++ |6:
++ | je <5 // x^1 ==> x
++ | jb >7 // x^0 ==> 1
++ | neg eax
++ | call <1
++ | sseconst_1 xmm1, RDa
++ | divsd xmm1, xmm0
++ | movaps xmm0, xmm1
++ | ret
++ |7:
++ | sseconst_1 xmm0, RDa
++ | ret
++ |
++ |8: // FP/FP power function x^y.
++ |.if X64
++ | movd rax, xmm1; shl rax, 1
++ | rol rax, 12; cmp rax, 0xffe; je >2 // x^+-Inf?
++ | movd rax, xmm0; shl rax, 1; je >4 // +-0^y?
++ | rol rax, 12; cmp rax, 0xffe; je >5 // +-Inf^y?
++ | .if X64WIN
++ | movsd qword [rsp+16], xmm1 // Use scratch area.
++ | movsd qword [rsp+8], xmm0
++ | fld qword [rsp+16]
++ | fld qword [rsp+8]
++ | .else
++ | movsd qword [rsp-16], xmm1 // Use red zone.
++ | movsd qword [rsp-8], xmm0
++ | fld qword [rsp-16]
++ | fld qword [rsp-8]
++ | .endif
++ |.else
++ | movsd qword [esp+12], xmm1 // Needs 16 byte scratch area.
++ | movsd qword [esp+4], xmm0
++ | cmp dword [esp+12], 0; jne >1
++ | mov eax, [esp+16]; shl eax, 1
++ | cmp eax, 0xffe00000; je >2 // x^+-Inf?
++ |1:
++ | cmp dword [esp+4], 0; jne >1
++ | mov eax, [esp+8]; shl eax, 1; je >4 // +-0^y?
++ | cmp eax, 0xffe00000; je >5 // +-Inf^y?
++ |1:
++ | fld qword [esp+12]
++ | fld qword [esp+4]
++ |.endif
++ | fyl2x // y*log2(x)
++ | fdup; frndint; fsub st1, st0; fxch // Split into frac/int part.
++ | f2xm1; fld1; faddp st1; fscale; fpop1 // ==> (2^frac-1 +1) << int
++ |.if X64WIN
++ | fstp qword [rsp+8] // Use scratch area.
++ | movsd xmm0, qword [rsp+8]
++ |.elif X64
++ | fstp qword [rsp-8] // Use red zone.
++ | movsd xmm0, qword [rsp-8]
++ |.else
++ | fstp qword [esp+4] // Needs 8 byte scratch area.
++ | movsd xmm0, qword [esp+4]
++ |.endif
++ | ret
++ |
++ |9: // Handle x^NaN.
++ | sseconst_1 xmm2, RDa
++ | ucomisd xmm0, xmm2; je >1 // 1^NaN ==> 1
++ | movaps xmm0, xmm1 // x^NaN ==> NaN
++ |1:
++ | ret
++ |
++ |2: // Handle x^+-Inf.
++ | sseconst_abs xmm2, RDa
++ | andpd xmm0, xmm2 // |x|
++ | sseconst_1 xmm2, RDa
++ | ucomisd xmm0, xmm2; je <1 // +-1^+-Inf ==> 1
++ | movmskpd eax, xmm1
++ | xorps xmm0, xmm0
++ | mov ah, al; setc al; xor al, ah; jne <1 // |x|<>1, x^+-Inf ==> +Inf/0
++ |3:
++ | sseconst_hi xmm0, RDa, 7ff00000 // +Inf
++ | ret
++ |
++ |4: // Handle +-0^y.
++ | movmskpd eax, xmm1; test eax, eax; jnz <3 // y < 0, +-0^y ==> +Inf
++ | xorps xmm0, xmm0 // y >= 0, +-0^y ==> 0
++ | ret
++ |
++ |5: // Handle +-Inf^y.
++ | movmskpd eax, xmm1; test eax, eax; jz <3 // y >= 0, +-Inf^y ==> +Inf
++ | xorps xmm0, xmm0 // y < 0, +-Inf^y ==> 0
++ | ret
+ |
+ |//-----------------------------------------------------------------------
+ |//-- Miscellaneous functions --------------------------------------------
+@@ -3429,12 +3914,19 @@
+ | // RA is a number.
+ | cmp dword [BASE+RD*8+4], LJ_TISNUM; jb >1; jne ->vmeta_comp
+ | // RA is a number, RD is an integer.
++ |.if SSE
+ | cvtsi2sd xmm0, dword [BASE+RD*8]
+ | jmp >2
++ |.else
++ | fld qword [BASE+RA*8]
++ | fild dword [BASE+RD*8]
++ | jmp >3
++ |.endif
+ |
+ |8: // RA is an integer, RD is not an integer.
+ | ja ->vmeta_comp
+ | // RA is an integer, RD is a number.
++ |.if SSE
+ | cvtsi2sd xmm1, dword [BASE+RA*8]
+ | movsd xmm0, qword [BASE+RD*8]
+ | add PC, 4
+@@ -3442,15 +3934,29 @@
+ | jmp_comp jbe, ja, jb, jae, <9
+ | jmp <6
+ |.else
++ | fild dword [BASE+RA*8]
++ | jmp >2
++ |.endif
++ |.else
+ | checknum RA, ->vmeta_comp
+ | checknum RD, ->vmeta_comp
+ |.endif
++ |.if SSE
+ |1:
+ | movsd xmm0, qword [BASE+RD*8]
+ |2:
+ | add PC, 4
+ | ucomisd xmm0, qword [BASE+RA*8]
+ |3:
++ |.else
++ |1:
++ | fld qword [BASE+RA*8] // Reverse order, i.e like cmp D, A.
++ |2:
++ | fld qword [BASE+RD*8]
++ |3:
++ | add PC, 4
++ | fcomparepp
++ |.endif
+ | // Unordered: all of ZF CF PF set, ordered: PF clear.
+ | // To preserve NaN semantics GE/GT branch on unordered, but LT/LE don't.
+ |.if DUALNUM
+@@ -3490,25 +3996,43 @@
+ | // RD is a number.
+ | cmp dword [BASE+RA*8+4], LJ_TISNUM; jb >1; jne >5
+ | // RD is a number, RA is an integer.
++ |.if SSE
+ | cvtsi2sd xmm0, dword [BASE+RA*8]
++ |.else
++ | fild dword [BASE+RA*8]
++ |.endif
+ | jmp >2
+ |
+ |8: // RD is an integer, RA is not an integer.
+ | ja >5
+ | // RD is an integer, RA is a number.
++ |.if SSE
+ | cvtsi2sd xmm0, dword [BASE+RD*8]
+ | ucomisd xmm0, qword [BASE+RA*8]
++ |.else
++ | fild dword [BASE+RD*8]
++ | fld qword [BASE+RA*8]
++ |.endif
+ | jmp >4
+ |
+ |.else
+ | cmp RB, LJ_TISNUM; jae >5
+ | checknum RA, >5
+ |.endif
++ |.if SSE
+ |1:
+ | movsd xmm0, qword [BASE+RA*8]
+ |2:
+ | ucomisd xmm0, qword [BASE+RD*8]
+ |4:
++ |.else
++ |1:
++ | fld qword [BASE+RA*8]
++ |2:
++ | fld qword [BASE+RD*8]
++ |4:
++ | fcomparepp
++ |.endif
+ iseqne_fp:
+ if (vk) {
+ | jp >2 // Unordered means not equal.
+@@ -3631,21 +4155,39 @@
+ | // RA is a number.
+ | cmp dword [KBASE+RD*8+4], LJ_TISNUM; jb >1
+ | // RA is a number, RD is an integer.
++ |.if SSE
+ | cvtsi2sd xmm0, dword [KBASE+RD*8]
++ |.else
++ | fild dword [KBASE+RD*8]
++ |.endif
+ | jmp >2
+ |
+ |8: // RA is an integer, RD is a number.
++ |.if SSE
+ | cvtsi2sd xmm0, dword [BASE+RA*8]
+ | ucomisd xmm0, qword [KBASE+RD*8]
++ |.else
++ | fild dword [BASE+RA*8]
++ | fld qword [KBASE+RD*8]
++ |.endif
+ | jmp >4
+ |.else
+ | cmp RB, LJ_TISNUM; jae >3
+ |.endif
++ |.if SSE
+ |1:
+ | movsd xmm0, qword [KBASE+RD*8]
+ |2:
+ | ucomisd xmm0, qword [BASE+RA*8]
+ |4:
++ |.else
++ |1:
++ | fld qword [KBASE+RD*8]
++ |2:
++ | fld qword [BASE+RA*8]
++ |4:
++ | fcomparepp
++ |.endif
+ goto iseqne_fp;
+ case BC_ISEQP: case BC_ISNEP:
+ vk = op == BC_ISEQP;
+@@ -3751,10 +4293,16 @@
+ |.else
+ | checknum RD, ->vmeta_unm
+ |.endif
++ |.if SSE
+ | movsd xmm0, qword [BASE+RD*8]
+ | sseconst_sign xmm1, RDa
+ | xorps xmm0, xmm1
+ | movsd qword [BASE+RA*8], xmm0
++ |.else
++ | fld qword [BASE+RD*8]
++ | fchs
++ | fstp qword [BASE+RA*8]
++ |.endif
+ |.if DUALNUM
+ | jmp <9
+ |.else
+@@ -3770,11 +4318,15 @@
+ |1:
+ | mov dword [BASE+RA*8+4], LJ_TISNUM
+ | mov dword [BASE+RA*8], RD
+- |.else
++ |.elif SSE
+ | xorps xmm0, xmm0
+ | cvtsi2sd xmm0, dword STR:RD->len
+ |1:
+ | movsd qword [BASE+RA*8], xmm0
++ |.else
++ | fild dword STR:RD->len
++ |1:
++ | fstp qword [BASE+RA*8]
+ |.endif
+ | ins_next
+ |2:
+@@ -3792,8 +4344,11 @@
+ | // Length of table returned in eax (RD).
+ |.if DUALNUM
+ | // Nothing to do.
+- |.else
++ |.elif SSE
+ | cvtsi2sd xmm0, RD
++ |.else
++ | mov ARG1, RD
++ | fild ARG1
+ |.endif
+ | mov BASE, RB // Restore BASE.
+ | movzx RA, PC_RA
+@@ -3808,7 +4363,7 @@
+
+ /* -- Binary ops -------------------------------------------------------- */
+
+- |.macro ins_arithpre, sseins, ssereg
++ |.macro ins_arithpre, x87ins, sseins, ssereg
+ | ins_ABC
+ ||vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
+ ||switch (vk) {
+@@ -3817,22 +4372,37 @@
+ | .if DUALNUM
+ | cmp dword [KBASE+RC*8+4], LJ_TISNUM; jae ->vmeta_arith_vn
+ | .endif
+- | movsd xmm0, qword [BASE+RB*8]
+- | sseins ssereg, qword [KBASE+RC*8]
++ | .if SSE
++ | movsd xmm0, qword [BASE+RB*8]
++ | sseins ssereg, qword [KBASE+RC*8]
++ | .else
++ | fld qword [BASE+RB*8]
++ | x87ins qword [KBASE+RC*8]
++ | .endif
+ || break;
+ ||case 1:
+ | checknum RB, ->vmeta_arith_nv
+ | .if DUALNUM
+ | cmp dword [KBASE+RC*8+4], LJ_TISNUM; jae ->vmeta_arith_nv
+ | .endif
+- | movsd xmm0, qword [KBASE+RC*8]
+- | sseins ssereg, qword [BASE+RB*8]
++ | .if SSE
++ | movsd xmm0, qword [KBASE+RC*8]
++ | sseins ssereg, qword [BASE+RB*8]
++ | .else
++ | fld qword [KBASE+RC*8]
++ | x87ins qword [BASE+RB*8]
++ | .endif
+ || break;
+ ||default:
+ | checknum RB, ->vmeta_arith_vv
+ | checknum RC, ->vmeta_arith_vv
+- | movsd xmm0, qword [BASE+RB*8]
+- | sseins ssereg, qword [BASE+RC*8]
++ | .if SSE
++ | movsd xmm0, qword [BASE+RB*8]
++ | sseins ssereg, qword [BASE+RC*8]
++ | .else
++ | fld qword [BASE+RB*8]
++ | x87ins qword [BASE+RC*8]
++ | .endif
+ || break;
+ ||}
+ |.endmacro
+@@ -3870,62 +4440,55 @@
+ |.endmacro
+ |
+ |.macro ins_arithpost
++ |.if SSE
+ | movsd qword [BASE+RA*8], xmm0
++ |.else
++ | fstp qword [BASE+RA*8]
++ |.endif
+ |.endmacro
+ |
+- |.macro ins_arith, sseins
+- | ins_arithpre sseins, xmm0
++ |.macro ins_arith, x87ins, sseins
++ | ins_arithpre x87ins, sseins, xmm0
+ | ins_arithpost
+ | ins_next
+ |.endmacro
+ |
+- |.macro ins_arith, intins, sseins
++ |.macro ins_arith, intins, x87ins, sseins
+ |.if DUALNUM
+ | ins_arithdn intins
+ |.else
+- | ins_arith, sseins
++ | ins_arith, x87ins, sseins
+ |.endif
+ |.endmacro
+
+ | // RA = dst, RB = src1 or num const, RC = src2 or num const
+ case BC_ADDVN: case BC_ADDNV: case BC_ADDVV:
+- | ins_arith add, addsd
++ | ins_arith add, fadd, addsd
+ break;
+ case BC_SUBVN: case BC_SUBNV: case BC_SUBVV:
+- | ins_arith sub, subsd
++ | ins_arith sub, fsub, subsd
+ break;
+ case BC_MULVN: case BC_MULNV: case BC_MULVV:
+- | ins_arith imul, mulsd
++ | ins_arith imul, fmul, mulsd
+ break;
+ case BC_DIVVN: case BC_DIVNV: case BC_DIVVV:
+- | ins_arith divsd
++ | ins_arith fdiv, divsd
+ break;
+ case BC_MODVN:
+- | ins_arithpre movsd, xmm1
++ | ins_arithpre fld, movsd, xmm1
+ |->BC_MODVN_Z:
+ | call ->vm_mod
+ | ins_arithpost
+ | ins_next
+ break;
+ case BC_MODNV: case BC_MODVV:
+- | ins_arithpre movsd, xmm1
++ | ins_arithpre fld, movsd, xmm1
+ | jmp ->BC_MODVN_Z // Avoid 3 copies. It's slow anyway.
+ break;
+ case BC_POW:
+- | ins_arithpre movsd, xmm1
+- | mov RB, BASE
+- |.if not X64
+- | movsd FPARG1, xmm0
+- | movsd FPARG3, xmm1
+- |.endif
+- | call extern pow
+- | movzx RA, PC_RA
+- | mov BASE, RB
+- |.if X64
++ | ins_arithpre fld, movsd, xmm1 // FIXME: THIS SHOULD NOT BE FLD. Whole thing is broken
++ | call ->vm_pow
+ | ins_arithpost
+- |.else
+- | fstp qword [BASE+RA*8]
+- |.endif
+ | ins_next
+ break;
+
+@@ -3993,17 +4556,25 @@
+ | movsx RD, RDW
+ | mov dword [BASE+RA*8+4], LJ_TISNUM
+ | mov dword [BASE+RA*8], RD
+- |.else
++ |.elif SSE
+ | movsx RD, RDW // Sign-extend literal.
+ | cvtsi2sd xmm0, RD
+ | movsd qword [BASE+RA*8], xmm0
++ |.else
++ | fild PC_RD // Refetch signed RD from instruction.
++ | fstp qword [BASE+RA*8]
+ |.endif
+ | ins_next
+ break;
+ case BC_KNUM:
+ | ins_AD // RA = dst, RD = num const
++ |.if SSE
+ | movsd xmm0, qword [KBASE+RD*8]
+ | movsd qword [BASE+RA*8], xmm0
++ |.else
++ | fld qword [KBASE+RD*8]
++ | fstp qword [BASE+RA*8]
++ |.endif
+ | ins_next
+ break;
+ case BC_KPRI:
+@@ -4110,10 +4681,18 @@
+ case BC_USETN:
+ | ins_AD // RA = upvalue #, RD = num const
+ | mov LFUNC:RB, [BASE-8]
++ |.if SSE
+ | movsd xmm0, qword [KBASE+RD*8]
++ |.else
++ | fld qword [KBASE+RD*8]
++ |.endif
+ | mov UPVAL:RB, [LFUNC:RB+RA*4+offsetof(GCfuncL, uvptr)]
+ | mov RA, UPVAL:RB->v
++ |.if SSE
+ | movsd qword [RA], xmm0
++ |.else
++ | fstp qword [RA]
++ |.endif
+ | ins_next
+ break;
+ case BC_USETP:
+@@ -4267,10 +4846,18 @@
+ |.else
+ | // Convert number to int and back and compare.
+ | checknum RC, >5
++ |.if SSE
+ | movsd xmm0, qword [BASE+RC*8]
+ | cvttsd2si RC, xmm0
+ | cvtsi2sd xmm1, RC
+ | ucomisd xmm0, xmm1
++ |.else
++ | fld qword [BASE+RC*8]
++ | fist ARG1
++ | fild ARG1
++ | fcomparepp
++ | mov RC, ARG1
++ |.endif
+ | jne ->vmeta_tgetv // Generic numeric key? Use fallback.
+ |.endif
+ | cmp RC, TAB:RB->asize // Takes care of unordered, too.
+@@ -4399,8 +4986,12 @@
+ | mov TAB:RB, [BASE+RB*8]
+ |.if DUALNUM
+ | mov RC, dword [BASE+RC*8]
+- |.else
++ |.elif SSE
+ | cvttsd2si RC, qword [BASE+RC*8]
++ |.else
++ | fld qword [BASE+RC*8]
++ | fistp TMP1
++ | mov RC, TMP1
+ |.endif
+ | cmp RC, TAB:RB->asize
+ | jae ->vmeta_tgetr // Not in array part? Use fallback.
+@@ -4433,10 +5024,18 @@
+ |.else
+ | // Convert number to int and back and compare.
+ | checknum RC, >5
++ |.if SSE
+ | movsd xmm0, qword [BASE+RC*8]
+ | cvttsd2si RC, xmm0
+ | cvtsi2sd xmm1, RC
+ | ucomisd xmm0, xmm1
++ |.else
++ | fld qword [BASE+RC*8]
++ | fist ARG1
++ | fild ARG1
++ | fcomparepp
++ | mov RC, ARG1
++ |.endif
+ | jne ->vmeta_tsetv // Generic numeric key? Use fallback.
+ |.endif
+ | cmp RC, TAB:RB->asize // Takes care of unordered, too.
+@@ -4611,8 +5210,12 @@
+ | mov TAB:RB, [BASE+RB*8]
+ |.if DUALNUM
+ | mov RC, dword [BASE+RC*8]
+- |.else
++ |.elif SSE
+ | cvttsd2si RC, qword [BASE+RC*8]
++ |.else
++ | fld qword [BASE+RC*8]
++ | fistp TMP1
++ | mov RC, TMP1
+ |.endif
+ | test byte TAB:RB->marked, LJ_GC_BLACK // isblack(table)
+ | jnz >7
+@@ -4833,8 +5436,10 @@
+ |.if DUALNUM
+ | mov dword [BASE+RA*8+4], LJ_TISNUM
+ | mov dword [BASE+RA*8], RC
+- |.else
++ |.elif SSE
+ | cvtsi2sd xmm0, RC
++ |.else
++ | fild dword [BASE+RA*8-8]
+ |.endif
+ | // Copy array slot to returned value.
+ |.if X64
+@@ -4850,8 +5455,10 @@
+ | // Return array index as a numeric key.
+ |.if DUALNUM
+ | // See above.
+- |.else
++ |.elif SSE
+ | movsd qword [BASE+RA*8], xmm0
++ |.else
++ | fstp qword [BASE+RA*8]
+ |.endif
+ | mov [BASE+RA*8-8], RC // Update control var.
+ |2:
+@@ -4864,6 +5471,9 @@
+ |
+ |4: // Skip holes in array part.
+ | add RC, 1
++ |.if not (DUALNUM or SSE)
++ | mov [BASE+RA*8-8], RC
++ |.endif
+ | jmp <1
+ |
+ |5: // Traverse hash part.
+@@ -5211,6 +5821,7 @@
+ if (!vk) {
+ | cmp RB, LJ_TISNUM; jae ->vmeta_for
+ }
++ |.if SSE
+ | movsd xmm0, qword FOR_IDX
+ | movsd xmm1, qword FOR_STOP
+ if (vk) {
+@@ -5223,6 +5834,22 @@
+ | ucomisd xmm1, xmm0
+ |1:
+ | movsd qword FOR_EXT, xmm0
++ |.else
++ | fld qword FOR_STOP
++ | fld qword FOR_IDX
++ if (vk) {
++ | fadd qword FOR_STEP // nidx = idx + step
++ | fst qword FOR_IDX
++ | fst qword FOR_EXT
++ | test RB, RB; js >1
++ } else {
++ | fst qword FOR_EXT
++ | jl >1
++ }
++ | fxch // Swap lim/(n)idx if step non-negative.
++ |1:
++ | fcomparepp
++ |.endif
+ if (op == BC_FORI) {
+ |.if DUALNUM
+ | jnb <7
+@@ -5250,10 +5877,11 @@
+ |2:
+ | ins_next
+ |.endif
+- |
++ |.if SSE
+ |3: // Invert comparison if step is negative.
+ | ucomisd xmm0, xmm1
+ | jmp <1
++ |.endif
+ break;
+
+ case BC_ITERL:
diff --git a/extra/mame/PKGBUILD b/extra/mame/PKGBUILD
new file mode 100644
index 00000000..7d5c4410
--- /dev/null
+++ b/extra/mame/PKGBUILD
@@ -0,0 +1,6 @@
+eval "$(
+ declare -f package | \
+ sed '
+ s/mame64/mame/
+ '
+)"
diff --git a/extra/mate-sensors-applet/PKGBUILD b/extra/mate-sensors-applet/PKGBUILD
new file mode 100644
index 00000000..b398bc88
--- /dev/null
+++ b/extra/mate-sensors-applet/PKGBUILD
@@ -0,0 +1,3 @@
+# libxnvctrl is Nvidia only, so sorry, there is no 32-bit version for
+# it, then we will not build support for it..
+depends=(${depends[@]//libxnvctrl/})
diff --git a/extra/midori/PKGBUILD b/extra/midori/PKGBUILD
new file mode 100644
index 00000000..2e60fb26
--- /dev/null
+++ b/extra/midori/PKGBUILD
@@ -0,0 +1,2 @@
+# zeitgeist appears broken
+depends=(${depends[@]//zeitgeist/})
diff --git a/extra/mixxx/PKGBUILD b/extra/mixxx/PKGBUILD
new file mode 100644
index 00000000..096adfb9
--- /dev/null
+++ b/extra/mixxx/PKGBUILD
@@ -0,0 +1,7 @@
+# check 32-bit binaries
+eval "$(
+ declare -f check | \
+ sed '
+ s/lin64_build/lin32_build/
+ '
+)"
diff --git a/extra/mongo-c-driver/PKGBUILD b/extra/mongo-c-driver/PKGBUILD
new file mode 100644
index 00000000..ac8a6eb7
--- /dev/null
+++ b/extra/mongo-c-driver/PKGBUILD
@@ -0,0 +1 @@
+checkdepends=(${checkdepends[@]/mongodb/})
diff --git a/extra/mpv/PKGBUILD b/extra/mpv/PKGBUILD
new file mode 100644
index 00000000..26ffbe51
--- /dev/null
+++ b/extra/mpv/PKGBUILD
@@ -0,0 +1,5 @@
+# luajit uses hard-coded SSE2, disabling it on non-pentium4
+if [ "$CARCH" = 'i486' -o "$CARCH" = 'i686' ]; then
+ depends=(${depends[@]//luajit/})
+ depends+=('lua52')
+fi
diff --git a/extra/mupdf/PKGBUILD b/extra/mupdf/PKGBUILD
new file mode 100644
index 00000000..efc73526
--- /dev/null
+++ b/extra/mupdf/PKGBUILD
@@ -0,0 +1,4 @@
+# avoid linking issues with freeglut on i486 (don't know why this is needed?)
+if [ "$CARCH" == 'i486' ]; then
+ makedepends+=(libxxf86vm)
+fi
diff --git a/extra/mysql-workbench/PKGBUILD b/extra/mysql-workbench/PKGBUILD
new file mode 100644
index 00000000..8d8cf3b3
--- /dev/null
+++ b/extra/mysql-workbench/PKGBUILD
@@ -0,0 +1,16 @@
+# see https://github.com/mysql/mysql-workbench/pull/14/files
+
+source+=('mysql-workbench-community-6.3.10-32bit.patch')
+sha256sums+=('285dd5899c625a5d9091f8f178a6a58c86508dacd033435ba2dab4938cb238f9')
+
+eval "$(
+ declare -f prepare | \
+ sed '
+ /0005-gdal-use-CPLFree.patch/ {
+ a \
+ \
+ # 32-bit compilation bug in jsonview \
+ patch -Np1 < "${srcdir}"/mysql-workbench-community-6.3.10-32bit.patch
+ }
+ '
+)"
diff --git a/extra/mysql-workbench/mysql-workbench-community-6.3.10-32bit.patch b/extra/mysql-workbench/mysql-workbench-community-6.3.10-32bit.patch
new file mode 100644
index 00000000..5aadcff8
--- /dev/null
+++ b/extra/mysql-workbench/mysql-workbench-community-6.3.10-32bit.patch
@@ -0,0 +1,123 @@
+diff -rauN mysql-workbench-community-6.3.10-src/library/base/jsonparser.cpp mysql-workbench-community-6.3.10-src-32bit-patch/library/base/jsonparser.cpp
+--- mysql-workbench-community-6.3.10-src/library/base/jsonparser.cpp 2017-11-09 17:11:42.000000000 +0100
++++ mysql-workbench-community-6.3.10-src-32bit-patch/library/base/jsonparser.cpp 2017-11-20 19:27:01.973630756 +0100
+@@ -912,6 +912,8 @@
+ return _uinteger64;
+ }
+
++#ifdef DEFINE_UINT64_T_FUNCTIONS
++
+ //--------------------------------------------------------------------------------------------------
+
+ int64_t JsonValue::operator=(int64_t other) {
+@@ -929,6 +931,7 @@
+ _uinteger64 = other;
+ return other;
+ }
++#endif // DEFINE_UINT64_T_FUNCTIONS
+
+ #endif
+
+@@ -1668,12 +1671,14 @@
+ case VDouble:
+ _output += std::to_string((double)value);
+ break;
++#ifdef DEFINE_UINT64_T_FUNCTIONS
+ case VInt64:
+ _output += std::to_string((int64_t)value);
+ break;
+ case VUint64:
+ _output += std::to_string((uint64_t)value);
+ break;
++#endif
+ case VObject:
+ write((JsonObject)value);
+ break;
+diff -rauN mysql-workbench-community-6.3.10-src/library/forms/jsonview.cpp mysql-workbench-community-6.3.10-src-32bit-patch/library/forms/jsonview.cpp
+--- mysql-workbench-community-6.3.10-src/library/forms/jsonview.cpp 2017-11-09 17:11:42.000000000 +0100
++++ mysql-workbench-community-6.3.10-src-32bit-patch/library/forms/jsonview.cpp 2017-11-20 19:26:16.963100986 +0100
+@@ -651,8 +651,10 @@
+ if (data != nullptr) {
+ std::stringstream buffer;
+ double number = 0;
++#ifdef DEFINE_UINT64_T_FUNCTIONS
+ int64_t number2 = 0;
+ uint64_t number3 = 0;
++#endif
+ bool retBool = false;
+ auto &storedValue = data->getData();
+ switch (storedValue.getType()) {
+@@ -664,6 +666,7 @@
+ storedValue = number;
+ setData = true;
+ break;
++#ifdef DEFINE_UINT64_T_FUNCTIONS
+ case VInt64:
+ if (!base::is_number(value))
+ break;
+@@ -680,6 +683,7 @@
+ storedValue = number3;
+ setData = true;
+ break;
++#endif
+ case VBoolean:
+ if (!base::isBool(value))
+ break;
+@@ -1073,6 +1077,7 @@
+ node->set_string(1, std::to_string((double)value));
+ node->set_string(2, "Double");
+ break;
++#ifdef DEFINE_UINT64_T_FUNCTIONS
+ case VInt64:
+ node->set_string(1, std::to_string((int64_t)value));
+ node->set_string(2, "Long Integer");
+@@ -1081,6 +1086,7 @@
+ node->set_string(1, std::to_string((uint64_t)value));
+ node->set_string(2, "Unsigned Long Integer");
+ break;
++#endif
+ default:
+ break;
+ }
+@@ -1322,8 +1328,10 @@
+ if (data != NULL) {
+ std::stringstream buffer;
+ double number = 0;
++#ifdef DEFINE_UINT64_T_FUNCTIONS
+ int64_t number2 = 0;
+ uint64_t number3 = 0;
++#endif
+ bool retBool = false;
+ switch (storedValue.getType()) {
+ case VDouble:
+@@ -1335,6 +1343,7 @@
+ node->set_float(column, number);
+ _dataChanged(false);
+ break;
++#ifdef DEFINE_UINT64_T_FUNCTIONS
+ case VInt64:
+ if (!base::is_number(value))
+ break;
+@@ -1353,6 +1362,7 @@
+ node->set_float(column, (double)number3);
+ _dataChanged(false);
+ break;
++#endif
+ case VBoolean:
+ if (!base::isBool(value))
+ break;
+@@ -1612,12 +1622,14 @@
+ case VDouble:
+ node->set_float(columnId, (double)value);
+ break;
++#ifdef DEFINE_UINT64_T_FUNCTIONS
+ case VInt64:
+ node->set_long(columnId, (int64_t)value);
+ break;
+ case VUint64:
+ node->set_long(columnId, (uint64_t)value);
+ break;
++#endif
+ default:
+ break;
+ }
diff --git a/extra/netcdf-openmpi/PKGBUILD b/extra/netcdf-openmpi/PKGBUILD
new file mode 100644
index 00000000..e18dbf41
--- /dev/null
+++ b/extra/netcdf-openmpi/PKGBUILD
@@ -0,0 +1,11 @@
+# breaking a cycle with pnetcdf-openmpi
+depends=(${depends[@]//"pnetcdf-${_mpi}"/})
+
+# "Unable to support CDF5 feature because size_t is less than 8 bytes"
+eval "$(
+ declare -f build | \
+ sed '
+ s/-DENABLE_CDF5=ON/-DENABLE_CDF5=OFF/g
+ s/-DENABLE_PNETCDF=ON/-DENABLE_PNETCDF=OFF/g
+ '
+)"
diff --git a/extra/netcdf/PKGBUILD b/extra/netcdf/PKGBUILD
new file mode 100644
index 00000000..bfae80ed
--- /dev/null
+++ b/extra/netcdf/PKGBUILD
@@ -0,0 +1,19 @@
+# "Unable to support CDF5 feature because size_t is less than 8 bytes"
+eval "$(
+ declare -f build | \
+ sed '
+ s/-DENABLE_CDF5=ON/-DENABLE_CDF5=OFF/g
+ '
+)"
+
+# ignore failing test for now
+#The following tests FAILED:
+# 74 - nc_test (Failed)
+# 156 - nc_test4_tst_large2 (Timeout)
+# 161 - tst_h_atts3 (Failed)
+eval "$(
+ declare -f check | \
+ sed '
+ s/\(.*make.*test.*\)/\1 || true/
+ '
+)"
diff --git a/extra/netplan/PKGBUILD b/extra/netplan/PKGBUILD
new file mode 100644
index 00000000..3bd27377
--- /dev/null
+++ b/extra/netplan/PKGBUILD
@@ -0,0 +1,13 @@
+# currently Haskell is broken
+makedepends=(${makedepends[@]//pandoc/})
+source+=('netplan-0.102-no-pandoc.patch')
+sha256sums+=('0ab919601e4a30585f0e3e3dc224fd598d2183e2df9250c1e6e4bc894d0ace95')
+eval "$(
+ {
+ declare -f prepare || \
+ printf 'prepare() { cd "${pkgname}-${pkgver}"\n}\n'
+ } \
+ | sed '
+ $i patch -Np1 -i "$srcdir/netplan-0.102-no-pandoc.patch"
+ '
+)"
diff --git a/extra/netplan/netplan-0.102-no-pandoc.patch b/extra/netplan/netplan-0.102-no-pandoc.patch
new file mode 100644
index 00000000..a1ed598d
--- /dev/null
+++ b/extra/netplan/netplan-0.102-no-pandoc.patch
@@ -0,0 +1,22 @@
+diff -rauN netplan-0.102/Makefile netplan-0.102-no-pandoc-patch/Makefile
+--- netplan-0.102/Makefile 2022-02-03 12:21:36.988275585 +0100
++++ netplan-0.102-no-pandoc-patch/Makefile 2022-02-03 12:23:01.654960528 +0100
+@@ -133,12 +133,15 @@
+
+
+ %.html: %.md
+- pandoc -s --toc -o $@ $<
++# pandoc -s --toc -o $@ $<
++ echo "no pandoc" > $@
+
+ doc/netplan.5: doc/manpage-header.md doc/netplan.md doc/manpage-footer.md
+- pandoc -s -o $@ $^
++# pandoc -s -o $@ $^
++ echo "no pandoc" > $@
+
+ %.8: %.md
+- pandoc -s -o $@ $^
++# pandoc -s -o $@ $^
++ echo "no pandoc" > $@
+
+ .PHONY: clean
diff --git a/extra/netsurf/PKGBUILD b/extra/netsurf/PKGBUILD
new file mode 100644
index 00000000..0c92b9e3
--- /dev/null
+++ b/extra/netsurf/PKGBUILD
@@ -0,0 +1 @@
+makedepends+=(icu69)
diff --git a/extra/newsboat-og/PKGBUILD b/extra/newsboat-og/PKGBUILD
new file mode 100644
index 00000000..8a9866b5
--- /dev/null
+++ b/extra/newsboat-og/PKGBUILD
@@ -0,0 +1,33 @@
+# Maintainer: Andreas Baumann <mail@andreasbaumann.cc>
+
+pkgname=newsboat-og
+pkgver=2.13.1
+pkgrel=1
+pkgdesc="An RSS/Atom feed reader for text terminals"
+arch=('x86_64' 'i486' 'i686' 'pentium4')
+url="https://newsboat.org/"
+license=('MIT')
+depends=('curl' 'hicolor-icon-theme' 'json-c' 'libxml2' 'sqlite' 'stfl')
+makedepends=('asciidoc')
+optdepends=('perl: for pinboard.pl'
+ 'python: for exportOPMLWithTags.py'
+ 'ruby: for feedgrabber.rb, heise.rb, and slashdot.rb')
+replaces=('newsbeuter')
+conflicts=('newsboat')
+options=('!makeflags')
+source=("https://github.com/andreasbaumann/$pkgname/archive/r$pkgver.tar.gz")
+sha256sums=('074228c0597f20ac72aff0b99685e5af4b28b428adafbbd8a1f207a156eb63c9')
+
+build() {
+ cd $pkgname-r$pkgver
+
+ make prefix=/usr
+ make doc
+}
+
+package() {
+ cd $pkgname-r$pkgver
+
+ make prefix=/usr DESTDIR="$pkgdir" install
+ install -Dm644 -t "$pkgdir"/usr/share/licenses/$pkgname LICENSE
+}
diff --git a/extra/nodejs-lts-fermium/PKGBUILD b/extra/nodejs-lts-fermium/PKGBUILD
new file mode 100644
index 00000000..aa8da4c8
--- /dev/null
+++ b/extra/nodejs-lts-fermium/PKGBUILD
@@ -0,0 +1,3 @@
+# some random timeout
+unset check
+unset checkdepends
diff --git a/extra/nodejs/PKGBUILD b/extra/nodejs/PKGBUILD
new file mode 100644
index 00000000..0a1713cb
--- /dev/null
+++ b/extra/nodejs/PKGBUILD
@@ -0,0 +1,35 @@
+# actually build a 32-bit version
+eval "$(
+ declare -f build | \
+ sed '
+ s|./configure|./configure --dest-cpu x86|g
+ '
+)"
+
+# linker runs out of memory on 32-bit
+eval "$(
+ declare -f build | \
+ sed '
+ 3 i LDFLAGS+=" -Wl,--no-keep-memory"
+ 3 i CFLAGS+=" -g1"
+ 3 i CXXFLAGS+=" -g1"
+ '
+)"
+
+# add -latomic where needed (i486)
+if [ "$CARCH" = 'i486' ]; then
+ source+=('node-17.1.0-atomic.patch')
+ sha512sums+=('a2acca076dc0f65e17ffb5ac0bbf4dc9b8be845a400b66b5f83f5efbfca16e01ecc675a307eb0c28527874dea6464699f3969c3ee9a94226af568fb18feca331')
+ eval "$(
+ declare -f prepare | \
+ sed '
+ $i patch -Np1 -i "../node-17.1.0-atomic.patch"
+ '
+ )"
+ eval "$(
+ declare -f build | \
+ sed '
+ 3 i LDFLAGS+=" -latomic"
+ '
+ )"
+fi
diff --git a/extra/nodejs/node-17.1.0-atomic.patch b/extra/nodejs/node-17.1.0-atomic.patch
new file mode 100644
index 00000000..fce9e21f
--- /dev/null
+++ b/extra/nodejs/node-17.1.0-atomic.patch
@@ -0,0 +1,40 @@
+diff -rauN node-17.1.0/node.gyp node-17.1.0-atomic-patch/node.gyp
+--- node-17.1.0/node.gyp 2021-11-08 16:40:59.000000000 +0100
++++ node-17.1.0-atomic-patch/node.gyp 2021-12-09 09:16:58.041503560 +0100
+@@ -116,6 +116,11 @@
+ '-Wl,-bnoerrmsg',
+ ],
+ }],
++ [ 'target_arch=="ia32"', {
++ 'link_settings': {
++ 'libraries': [ '-latomic' ],
++ },
++ }],
+ ['OS == "linux" and llvm_version != "0.0"', {
+ 'libraries': ['-latomic'],
+ }],
+diff -rauN node-17.1.0/tools/v8_gypfiles/toolchain.gypi node-17.1.0-atomic-patch/tools/v8_gypfiles/toolchain.gypi
+--- node-17.1.0/tools/v8_gypfiles/toolchain.gypi 2021-11-08 16:40:59.000000000 +0100
++++ node-17.1.0-atomic-patch/tools/v8_gypfiles/toolchain.gypi 2021-12-09 09:14:54.281212315 +0100
+@@ -1030,9 +1030,6 @@
+ or OS=="netbsd" or OS=="mac" or OS=="android" or OS=="qnx") and \
+ v8_target_arch=="ia32"', {
+ 'cflags': [
+- '-msse2',
+- '-mfpmath=sse',
+- '-mmmx', # Allows mmintrin.h for MMX intrinsics.
+ ],
+ }],
+ ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
+diff -rauN node-17.1.0/tools/v8_gypfiles/v8.gyp node-17.1.0-atomic-patch/tools/v8_gypfiles/v8.gyp
+--- node-17.1.0/tools/v8_gypfiles/v8.gyp 2021-11-08 16:40:59.000000000 +0100
++++ node-17.1.0-atomic-patch/tools/v8_gypfiles/v8.gyp 2021-12-09 09:10:15.947439079 +0100
+@@ -965,7 +965,7 @@
+ }],
+ # Platforms that don't have Compare-And-Swap (CAS) support need to link atomic library
+ # to implement atomic memory access
+- ['v8_current_cpu in ["mips", "mipsel", "mips64", "mips64el", "ppc", "arm", "riscv64"]', {
++ ['v8_current_cpu in ["mips", "mipsel", "mips64", "mips64el", "ppc", "arm", "riscv64", "x86"]', {
+ 'link_settings': {
+ 'libraries': ['-latomic', ],
+ },
diff --git a/extra/npm/PKGBUILD b/extra/npm/PKGBUILD
new file mode 100644
index 00000000..d15a6a20
--- /dev/null
+++ b/extra/npm/PKGBUILD
@@ -0,0 +1,22 @@
+# we put in libvips though upstream PKGBUILD says:
+# "libvips: for sharp (doc build) (disabled as current version of gatsby imports a broken sharp)"
+# I seem unable to be able to build anything useful if the libvips is absent from the makedepends
+#
+# https://github.com/lovell/sharp/issues/2023
+#
+#ERR! sharp Intel Architecture 32-bit systems require manual installation of libvips >= 8.8.1
+#info sharp Attempting to build from source via node-gyp but this may fail due to the above error
+#info sharp Please see https://sharp.pixelplumbing.com/page/install for required dependencies
+#make[1]: Entering directory '/build/npm/src/cli-6.14.11/docs/node_modules/sharp/build'
+# TOUCH Release/obj.target/libvips-cpp.stamp
+# CXX(target) Release/obj.target/sharp/src/common.o
+#../src/common.cc:25:10: fatal error: vips/vips8: No such file or directory
+# 25 | #include <vips/vips8>
+# | ^~~~~~~~~~~~
+#
+# most likely there is a binary version available, so sharp has not to be rebuilt (as on IA-32)
+makedepends+=(libvips884)
+
+# https://github.com/lovell/sharp/issues/2023
+#gatsby-plugin-manifest ERROR #11321 Error: Input file contains unsupported image format
+#
diff --git a/extra/nvchecker/PKGBUILD b/extra/nvchecker/PKGBUILD
new file mode 100644
index 00000000..6403c888
--- /dev/null
+++ b/extra/nvchecker/PKGBUILD
@@ -0,0 +1,2 @@
+unset check
+unset checkdepends
diff --git a/extra/octave/PKGBUILD b/extra/octave/PKGBUILD
new file mode 100644
index 00000000..406c2a07
--- /dev/null
+++ b/extra/octave/PKGBUILD
@@ -0,0 +1,4 @@
+# qscintilla needs a qt5/qt6 split first, so build without qscintilla on i486 for now
+if [ "$CARCH" = 'i486' ]; then
+ depends=(${depends[@]//qscintilla-qt5/})
+fi
diff --git a/extra/opam/PKGBUILD b/extra/opam/PKGBUILD
new file mode 100644
index 00000000..1e0c0b6b
--- /dev/null
+++ b/extra/opam/PKGBUILD
@@ -0,0 +1,3 @@
+# hotfix for https://bugs.archlinux.org/task/59869
+makedepends=('ocaml-compiler-libs')
+
diff --git a/extra/opencascade/PKGBUILD b/extra/opencascade/PKGBUILD
new file mode 100644
index 00000000..2f913ae9
--- /dev/null
+++ b/extra/opencascade/PKGBUILD
@@ -0,0 +1,2 @@
+# adios2 doesn't build on 32-bit
+makedepends=(${makedepends[@]//adios2/})
diff --git a/extra/openipmi/PKGBUILD b/extra/openipmi/PKGBUILD
new file mode 100644
index 00000000..46c10e69
--- /dev/null
+++ b/extra/openipmi/PKGBUILD
@@ -0,0 +1,2 @@
+# see FS#61289
+depends+=(libedit)
diff --git a/extra/openscenegraph/PKGBUILD b/extra/openscenegraph/PKGBUILD
new file mode 100644
index 00000000..78dcdca7
--- /dev/null
+++ b/extra/openscenegraph/PKGBUILD
@@ -0,0 +1,6 @@
+eval "$(
+ declare -f package | \
+ sed '
+ s@mv "${pkgdir}/usr/lib64" "${pkgdir}/usr/lib"@#\0@
+ '
+)"
diff --git a/extra/opensubdiv/PKGBUILD b/extra/opensubdiv/PKGBUILD
new file mode 100644
index 00000000..7ee1e57b
--- /dev/null
+++ b/extra/opensubdiv/PKGBUILD
@@ -0,0 +1,19 @@
+# no CUDA
+makedepends=(
+ ${makedepends[@]/cuda/}
+)
+pkgdesc+=", without CUDA support"
+
+eval "$(
+ declare -f build | \
+ sed '
+ s/cmake /cmake -DNO_CUDA=ON /
+ '
+)"
+
+eval "$(
+ declare -f prepare | \
+ sed '
+ /cuda.*patch/d
+ '
+)"
diff --git a/extra/openvdb/PKGBUILD b/extra/openvdb/PKGBUILD
new file mode 100644
index 00000000..37857a5d
--- /dev/null
+++ b/extra/openvdb/PKGBUILD
@@ -0,0 +1,23 @@
+# problems with python numpy everywhere
+eval "$(
+ declare -f build | \
+ sed '
+ s/-DUSE_NUMPY=ON/-DUSE_NUMPY=OFF/
+ '
+)"
+
+# -latomic on i486
+if [ "$CARCH" = 'i486' ]; then
+ source+=('openvdb-8.0.1-i486-atomic.patch')
+ sha512sums+=('e539db12513dbc62f7421504ef3751ca8f0b27c33250e80b47b979ba11e949060ebc96667a938d6baad47d0079c95a1714bee970e6627f99aa0790b5dfcfcc9f')
+eval "$(
+ {
+ declare -f prepare || \
+ printf 'prepare() {\n}\n'
+ } \
+ | sed '
+ $i cd "$srcdir/$pkgname-$pkgver" \
+ patch -Np1 -i "$srcdir/openvdb-8.0.1-i486-atomic.patch"
+ '
+)"
+fi
diff --git a/extra/openvdb/openvdb-8.0.1-i486-atomic.patch b/extra/openvdb/openvdb-8.0.1-i486-atomic.patch
new file mode 100644
index 00000000..767111df
--- /dev/null
+++ b/extra/openvdb/openvdb-8.0.1-i486-atomic.patch
@@ -0,0 +1,12 @@
+diff -rauN openvdb-8.0.1/openvdb/openvdb/CMakeLists.txt openvdb-8.0.1-i486-atomic-patch/openvdb/openvdb/CMakeLists.txt
+--- openvdb-8.0.1/openvdb/openvdb/CMakeLists.txt 2021-02-05 20:21:38.000000000 +0100
++++ openvdb-8.0.1-i486-atomic-patch/openvdb/openvdb/CMakeLists.txt 2021-05-04 19:51:06.381394733 +0200
+@@ -166,7 +166,7 @@
+ endif()
+
+ if(USE_BLOSC OR USE_ZLIB)
+- list(APPEND OPENVDB_CORE_DEPENDENT_LIBS ZLIB::ZLIB)
++ list(APPEND OPENVDB_CORE_DEPENDENT_LIBS ZLIB::ZLIB atomic)
+ endif()
+
+ list(APPEND OPENVDB_CORE_DEPENDENT_LIBS
diff --git a/extra/pacman-contrib/PKGBUILD b/extra/pacman-contrib/PKGBUILD
new file mode 100644
index 00000000..5e28a760
--- /dev/null
+++ b/extra/pacman-contrib/PKGBUILD
@@ -0,0 +1,9 @@
+source+=('rankmirror.sh.diff')
+b2sums+=('170770a9fc250fd917c409289f6bf06f889265d20324f50083d0a97e8772dc971c302c8a81a857b433015feb8d3fec6cf48231fdc57fc320d7d3f18aa0aa6ca7')
+
+eval "$(
+ declare -f prepare \
+ | sed '
+ $ i patch -p1 -i "${srcdir}/rankmirror.sh.diff"
+ '
+)"
diff --git a/extra/pacman-contrib/rankmirror.sh.diff b/extra/pacman-contrib/rankmirror.sh.diff
new file mode 100644
index 00000000..c7ea00a1
--- /dev/null
+++ b/extra/pacman-contrib/rankmirror.sh.diff
@@ -0,0 +1,16 @@
+diff --git a/src/rankmirrors.sh.in b/src/rankmirrors.sh.in
+index 08f7e28..8f9143f 100644
+--- a/src/rankmirrors.sh.in
++++ b/src/rankmirrors.sh.in
+@@ -79,10 +79,8 @@ getfetchurl() {
+ local replacedurl="${strippedurl//'$arch'/$ARCH}"
+ if [[ ! $TARGETREPO ]]; then
+ replacedurl="${replacedurl//'$repo'/core}"
+- local tmp="${replacedurl%/*}"
+- tmp="${tmp%/*}"
+
+- local reponame="${tmp##*/}"
++ local reponame="${replacedurl##*/}"
+ else
+ replacedurl="${replacedurl//'$repo'/$TARGETREPO}"
+ local reponame="$TARGETREPO"
diff --git a/extra/pacutils/PKGBUILD b/extra/pacutils/PKGBUILD
new file mode 100644
index 00000000..8d11e5cc
--- /dev/null
+++ b/extra/pacutils/PKGBUILD
@@ -0,0 +1,10 @@
+# see https://bugs.archlinux32.org/index.php?do=details&task_id=317
+# see https://github.com/andrewgregory/pacutils/pull/51
+# see https://github.com/CyberShadow/aconfmgr/issues/159
+eval "$(
+ declare -f build | \
+ sed '
+ /make CFLAGS/ i \
+ CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64"
+ '
+)"
diff --git a/extra/pandoc-cli/PKGBUILD b/extra/pandoc-cli/PKGBUILD
new file mode 100644
index 00000000..d2ddff60
--- /dev/null
+++ b/extra/pandoc-cli/PKGBUILD
@@ -0,0 +1,2 @@
+# the check runs out of memory
+unset check
diff --git a/extra/percona-server/LF_PINS-size.patch b/extra/percona-server/LF_PINS-size.patch
new file mode 100644
index 00000000..49518579
--- /dev/null
+++ b/extra/percona-server/LF_PINS-size.patch
@@ -0,0 +1,11 @@
+--- a/include/lf.h 2019-01-23 14:23:40.167072246 +0000
++++ b/include/lf.h 2019-01-23 14:20:59.600689484 +0000
+@@ -88,7 +88,7 @@
+ std::atomic<uint64> link;
+ /* we want sizeof(LF_PINS) to be 64 to avoid false sharing */
+ #if 2 * 8 + SIZEOF_CHARP * (LF_PINBOX_PINS + 2) != 64
+- char pad[64 - sizeof(uint32) * 2 - sizeof(void *) * (LF_PINBOX_PINS + 2)];
++ char pad[64 - (2 * 8 + SIZEOF_CHARP * (LF_PINBOX_PINS + 2))];
+ #endif
+ };
+
diff --git a/extra/percona-server/PKGBUILD b/extra/percona-server/PKGBUILD
new file mode 100644
index 00000000..d4ca9e87
--- /dev/null
+++ b/extra/percona-server/PKGBUILD
@@ -0,0 +1,36 @@
+source+=('LF_PINS-size.patch')
+sha256sums+=('c77f581059ee6a9b248c45194d392f45f311b3b755a9de20c274e13bb1a4d28c')
+
+eval "$(
+ declare -f prepare | \
+ sed '
+ $ i patch -p1 -i "$srcdir/LF_PINS-size.patch"
+ '
+)"
+
+# disable maintainer mode (-Werror)
+eval "$(
+ declare -f build | \
+ sed '
+ s/-Wno-dev/-Wno-dev -DMYSQL_MAINTAINER_MODE=OFF/
+ '
+)"
+
+# do not build storage backends which are only available on 64-bit
+eval "$(
+ declare -f build | \
+ sed '
+ s/-DWITH_ROCKSDB=ON/-DWITH_ROCKSDB=OFF/
+ s/-DTOKU_DEBUG_PARANOID=OFF/-DWITH_TOKUDB=OFF/
+ '
+)"
+
+# https://bugs.mysql.com/bug.php?id=67898
+# is very old and on WONTFIX, so the error message generator break
+# on 32-bit with optimization, we enable debug mode with no optimizations, sorry
+eval "$(
+ declare -f build | \
+ sed '
+ s/-Wno-dev/-Wno-dev -DWITH_DEBUG=YES/
+ '
+)"
diff --git a/extra/perl-cgi/PKGBUILD b/extra/perl-cgi/PKGBUILD
new file mode 100644
index 00000000..c8d3b267
--- /dev/null
+++ b/extra/perl-cgi/PKGBUILD
@@ -0,0 +1,9 @@
+# temporary workaround for not having the locale set in build chroots
+# (is fixed upstream in devtools, but must update all build slaves first,
+# otherwise the whole Perl rebuild fails!)
+eval "$(
+ declare -f check | \
+ sed '
+ s/make test/LC_ALL=C LANGUAGE=C make test/
+ '
+)"
diff --git a/extra/perl-image-sane/PKGBUILD b/extra/perl-image-sane/PKGBUILD
new file mode 100644
index 00000000..a90dd146
--- /dev/null
+++ b/extra/perl-image-sane/PKGBUILD
@@ -0,0 +1,2 @@
+# testing hangs slaves => no testing
+unset check
diff --git a/extra/perl-term-readline-gnu/PKGBUILD b/extra/perl-term-readline-gnu/PKGBUILD
new file mode 100644
index 00000000..a94e6219
--- /dev/null
+++ b/extra/perl-term-readline-gnu/PKGBUILD
@@ -0,0 +1,3 @@
+# ignoring failing tests for now
+# Failed 6/8 test programs. 11/47 subtests failed.
+unset check
diff --git a/extra/pifpaf/PKGBUILD b/extra/pifpaf/PKGBUILD
new file mode 100644
index 00000000..f0d201e3
--- /dev/null
+++ b/extra/pifpaf/PKGBUILD
@@ -0,0 +1,6 @@
+# remove mongodb from checkdepends - it's not available for i686 and apparently not needed either
+checkdepends=(${checkdepends[@]/mongodb})
+checkdepends=(${checkdepends[@]/consul})
+
+# ceph doesn't run on 32-bit currently (see FS32#21)
+checkdepends=(${checkdepends[@]/ceph})
diff --git a/extra/ponyc/PKGBUILD b/extra/ponyc/PKGBUILD
new file mode 100644
index 00000000..2e505e1e
--- /dev/null
+++ b/extra/ponyc/PKGBUILD
@@ -0,0 +1,19 @@
+# It seems, compiling for i686 is as simple as specifying you want i686.
+
+eval "$(
+ declare -f build check | \
+ sed '
+ s|x86-64|i686|
+ s|make |make default_pic=true|
+ '
+)"
+
+# the compiler seems fine, but the test frameworks seems to break with
+# newer LLVM, for now, ignoring the tests:
+# https://github.com/ponylang/ponyc/issues/2875
+eval "$(
+ declare -f check | \
+ sed '
+ s/\(make.*\)/\1 || true/
+ '
+)"
diff --git a/extra/postgrest/PKGBUILD b/extra/postgrest/PKGBUILD
new file mode 100644
index 00000000..dfb0c7c6
--- /dev/null
+++ b/extra/postgrest/PKGBUILD
@@ -0,0 +1,9 @@
+# See FS32#28, problems running the postgresql server with pifpaf and
+# running system tests against it.
+
+eval "$(
+ declare -f check | \
+ sed '
+ /cd/ i return
+ '
+)"
diff --git a/extra/prjtrellis/PKGBUILD b/extra/prjtrellis/PKGBUILD
new file mode 100644
index 00000000..a316c167
--- /dev/null
+++ b/extra/prjtrellis/PKGBUILD
@@ -0,0 +1,18 @@
+# git missing
+makedepends+=(git)
+
+# sphinx themes broken, don't build documentation
+eval "$(
+ declare -f build | \
+ sed '
+ /make html/d
+ '
+)"
+
+eval "$(
+ declare -f package | \
+ sed '
+ /docs\/_build/d
+ /html\/.doctrees/d
+ '
+)"
diff --git a/extra/prusa-slicer/PKGBUILD b/extra/prusa-slicer/PKGBUILD
new file mode 100644
index 00000000..18aa77e7
--- /dev/null
+++ b/extra/prusa-slicer/PKGBUILD
@@ -0,0 +1,2 @@
+# failing tests hang slaves
+unset check
diff --git a/extra/psensor/PKGBUILD b/extra/psensor/PKGBUILD
new file mode 100644
index 00000000..b398bc88
--- /dev/null
+++ b/extra/psensor/PKGBUILD
@@ -0,0 +1,3 @@
+# libxnvctrl is Nvidia only, so sorry, there is no 32-bit version for
+# it, then we will not build support for it..
+depends=(${depends[@]//libxnvctrl/})
diff --git a/extra/pypy/PKGBUILD b/extra/pypy/PKGBUILD
new file mode 100644
index 00000000..e7388a20
--- /dev/null
+++ b/extra/pypy/PKGBUILD
@@ -0,0 +1,5 @@
+# i486-specific
+if [ "${CARCH}" = "i486" ]; then
+ # testing deterministically kills build slaves..
+ unset check
+fi
diff --git a/extra/pypy3/PKGBUILD b/extra/pypy3/PKGBUILD
new file mode 100644
index 00000000..e7388a20
--- /dev/null
+++ b/extra/pypy3/PKGBUILD
@@ -0,0 +1,5 @@
+# i486-specific
+if [ "${CARCH}" = "i486" ]; then
+ # testing deterministically kills build slaves..
+ unset check
+fi
diff --git a/extra/python-apipkg/PKGBUILD b/extra/python-apipkg/PKGBUILD
new file mode 100644
index 00000000..3167ec8f
--- /dev/null
+++ b/extra/python-apipkg/PKGBUILD
@@ -0,0 +1,7 @@
+#usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
+# or: setup.py --help [cmd1 cmd2 ...]
+# or: setup.py --help-commands
+# or: setup.py cmd --help
+#error: invalid command 'pytest'
+unset check
+unset checkdepends
diff --git a/extra/python-autobahn/PKGBUILD b/extra/python-autobahn/PKGBUILD
new file mode 100644
index 00000000..d6a1bbd5
--- /dev/null
+++ b/extra/python-autobahn/PKGBUILD
@@ -0,0 +1,3 @@
+# testing hangs the build slaves, so no testing
+unset check
+
diff --git a/extra/python-babel/PKGBUILD b/extra/python-babel/PKGBUILD
new file mode 100644
index 00000000..51c7956d
--- /dev/null
+++ b/extra/python-babel/PKGBUILD
@@ -0,0 +1,10 @@
+#/build/python-babel/src/babel-2.9.1/setup.py:5: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
+# from distutils.cmd import Command
+#usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
+# or: setup.py --help [cmd1 cmd2 ...]
+# or: setup.py --help-commands
+# or: setup.py cmd --help
+#
+#error: invalid command 'pytest'
+unset check
+unset checkdepends
diff --git a/extra/python-build/PKGBUILD b/extra/python-build/PKGBUILD
new file mode 100644
index 00000000..125d6731
--- /dev/null
+++ b/extra/python-build/PKGBUILD
@@ -0,0 +1,25 @@
+# disable documentation (needs sphinx, sphinx-furo)
+# python-sphinx-furo needs npm, which is broken on archlinux32
+# most likely since years..
+makedepends=(${makedepends[@]//python-sphinx-furo/})
+makedepends=(${makedepends[@]//python-sphinx-argparse-cli/})
+makedepends=(${makedepends[@]//python-sphinx-autodoc-typehints/})
+makedepends=(${makedepends[@]//python-sphinx/})
+eval "$(
+ declare -f build | \
+ sed '
+ /.*sphinx-build.*/d
+ '
+ declare -f package | \
+ sed '
+ /.*\/share\/doc.*/d
+ '
+)"
+
+# temporary to build python-build with python-bootstrap (breaking cycles)
+makedepends=(${makedepends[@]//python-installer/})
+makedepends=(${makedepends[@]//python-build/})
+makedepends=(${makedepends[@]//python-flit-core/})
+makedepends+=('python-bootstrap')
+unset checkdepends
+unset check
diff --git a/extra/python-cairocffi/PKGBUILD b/extra/python-cairocffi/PKGBUILD
new file mode 100644
index 00000000..e8214a5c
--- /dev/null
+++ b/extra/python-cairocffi/PKGBUILD
@@ -0,0 +1,9 @@
+#cairocffi/test_cairo.py:258: AssertionError
+# =========================== short test summary info ============================
+# FAILED cairocffi/test_cairo.py::test_metadata - assert b"/CreationDate (20130...
+eval "$(
+ declare -f check | \
+ sed '
+ s/\(.*python setup.py pytest\)/\1 || true/
+ '
+)"
diff --git a/extra/python-commonmark/PKGBUILD b/extra/python-commonmark/PKGBUILD
new file mode 100644
index 00000000..549815ac
--- /dev/null
+++ b/extra/python-commonmark/PKGBUILD
@@ -0,0 +1,17 @@
+# cycle breaking for python-sphinx
+eval "$(
+ declare -f build | \
+ sed '
+ /make.*docs.*/d
+ '
+ declare -f package | \
+ sed '
+ /install.*docs.*/d
+ '
+)"
+
+# python-sphinx_rtd_theme neds npm, which is broken on archlinux32
+# most likely since years..
+makedepends=(${makedepends[@]//python-sphinx_rtd_theme/})
+
+makedepends=(${makedepends[@]//python-sphinx/})
diff --git a/extra/python-debugpy/PKGBUILD b/extra/python-debugpy/PKGBUILD
new file mode 100644
index 00000000..f3266163
--- /dev/null
+++ b/extra/python-debugpy/PKGBUILD
@@ -0,0 +1,11 @@
+# patch 64-bit mode compilation to 32-bit mode (and naming of
+# resulting library)
+# why we would not just ommit the mode and omit the naming in
+# the library is beyond me..
+eval "$(
+ declare -f build | \
+ sed '
+ s/-m64/-m32/g
+ s/attach_linux_amd64.so/attach_linux_i686.so/
+ '
+)"
diff --git a/extra/python-docs/PKGBUILD b/extra/python-docs/PKGBUILD
new file mode 100644
index 00000000..93396a46
--- /dev/null
+++ b/extra/python-docs/PKGBUILD
@@ -0,0 +1 @@
+sha256sums=('SKIP')
diff --git a/extra/python-factory-boy/PKGBUILD b/extra/python-factory-boy/PKGBUILD
new file mode 100644
index 00000000..5fd9f075
--- /dev/null
+++ b/extra/python-factory-boy/PKGBUILD
@@ -0,0 +1,2 @@
+# remove mongodb from checkdepends - it's not available for i686 and apparently not needed either
+checkdepends=(${checkdepends[@]/mongodb})
diff --git a/extra/python-faker/PKGBUILD b/extra/python-faker/PKGBUILD
new file mode 100644
index 00000000..4568a027
--- /dev/null
+++ b/extra/python-faker/PKGBUILD
@@ -0,0 +1,18 @@
+# https://github.com/joke2k/faker/issues/408
+# time-tests requiring 64 bit fail on i686 - obviously (year 2100 is not representable with 32 bits)
+
+eval "$(
+ declare -f prepare | \
+ sed '
+ /^{\s*$/a \
+ sed -i '"'"'/\\.date_\\(time_\\)\\?this_century(.*) >=/d'"'"' "$srcdir/faker-$pkgver/tests/providers/test_date_time.py" \
+ sed -i '"'"' \
+ $! N; \
+ /^\\(.\\+\\)\\n\\1$/ ! { \
+ P; \
+ D; \
+ } \
+ D; \
+ '"'"' "$srcdir/faker-$pkgver/tests/providers/test_date_time.py" \
+ '
+)"
diff --git a/extra/python-flit-core/PKGBUILD b/extra/python-flit-core/PKGBUILD
new file mode 100644
index 00000000..b8a84aa2
--- /dev/null
+++ b/extra/python-flit-core/PKGBUILD
@@ -0,0 +1,6 @@
+# temporary to build python-build with python-bootstrap (breaking cycles)
+makedepends=(${makedepends[@]//python-installer/})
+makedepends=(${makedepends[@]//python-build/})
+makedepends+=('python-bootstrap')
+unset checkdepends
+unset check
diff --git a/extra/python-flit/PKGBUILD b/extra/python-flit/PKGBUILD
new file mode 100644
index 00000000..602d5f1f
--- /dev/null
+++ b/extra/python-flit/PKGBUILD
@@ -0,0 +1,10 @@
+# temporary to build python-build with python-bootstrap (breaking cycles)
+makedepends=(${makedepends[@]//python-installer/})
+makedepends=(${makedepends[@]//python-build/})
+depends=(${depends[@]//python-docutils/})
+depends=(${depends[@]//python-flit-core/})
+depends=(${depends[@]//python-requests/})
+depends=(${depends[@]//python-tomli-w/})
+makedepends+=('python-bootstrap')
+unset checkdepends
+unset check
diff --git a/extra/python-fsspec/PKGBUILD b/extra/python-fsspec/PKGBUILD
new file mode 100644
index 00000000..02981ee5
--- /dev/null
+++ b/extra/python-fsspec/PKGBUILD
@@ -0,0 +1,4 @@
+# check() hangs for multiple days:
+# fsspec/implementations/tests/test_dask.py
+unset check
+unset checkdepends
diff --git a/extra/python-hglib/PKGBUILD b/extra/python-hglib/PKGBUILD
new file mode 100644
index 00000000..2064f1d3
--- /dev/null
+++ b/extra/python-hglib/PKGBUILD
@@ -0,0 +1,11 @@
+#Traceback (most recent call last):
+# File "/build/python-hglib/src/python-hglib-2.6.2/test.py", line 3, in <module>
+# import nose
+# File "/usr/lib/python3.10/site-packages/nose/__init__.py", line 1, in <module>
+# from nose.core import collector, main, run, run_exit, runmodule
+# File "/usr/lib/python3.10/site-packages/nose/core.py", line 153
+# print "%s version %s" % (os.path.basename(sys.argv[0]), __version__)
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+#SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
+unset check
+unset checkdepends
diff --git a/extra/python-httpcore/PKGBUILD b/extra/python-httpcore/PKGBUILD
new file mode 100644
index 00000000..98fc9fd5
--- /dev/null
+++ b/extra/python-httpcore/PKGBUILD
@@ -0,0 +1,2 @@
+# tests just hang on the build slaves
+unset check
diff --git a/extra/python-httpx/PKGBUILD b/extra/python-httpx/PKGBUILD
new file mode 100644
index 00000000..6403c888
--- /dev/null
+++ b/extra/python-httpx/PKGBUILD
@@ -0,0 +1,2 @@
+unset check
+unset checkdepends
diff --git a/extra/python-hypothesis/PKGBUILD b/extra/python-hypothesis/PKGBUILD
new file mode 100644
index 00000000..3432dd64
--- /dev/null
+++ b/extra/python-hypothesis/PKGBUILD
@@ -0,0 +1,8 @@
+eval "$(
+ declare -f prepare | \
+ sed '
+ 2 a \
+ find hypothesis-hypothesis-python-$pkgver/hypothesis-python/tests -type f -name '"'"'*.py'"'"' \\\
+ -exec sed -i '"'"'/^\\s*@settings(suppress_health_check=/s/HealthCheck\\.too_slow/\\0, HealthCheck.hung_test/g'"'"' {} \\;
+ '
+)"
diff --git a/extra/python-installer/PKGBUILD b/extra/python-installer/PKGBUILD
new file mode 100644
index 00000000..6dd1a147
--- /dev/null
+++ b/extra/python-installer/PKGBUILD
@@ -0,0 +1,23 @@
+# breaking the cycle with python-spinx
+makedepends=(${makedepends[@]//python-sphinx-furo})
+makedepends=(${makedepends[@]//python-sphinx-argparse})
+makedepends=(${makedepends[@]//python-sphinx})
+makedepends=(${makedepends[@]//python-myst-parser/})
+eval "$(
+ declare -f build | \
+ sed '
+ /sphinx-build/d
+ '
+ declare -f package | \
+ sed '
+ /docs\/build\/html/d
+ '
+)"
+
+# temporary to build python-build with python-bootstrap (breaking cycles)
+makedepends=(${makedepends[@]//python-installer/})
+makedepends=(${makedepends[@]//python-build/})
+makedepends=(${makedepends[@]//python-flit-core/})
+makedepends+=('python-bootstrap')
+unset checkdepends
+unset check
diff --git a/extra/python-iwlib/PKGBUILD b/extra/python-iwlib/PKGBUILD
new file mode 100644
index 00000000..d504c3e6
--- /dev/null
+++ b/extra/python-iwlib/PKGBUILD
@@ -0,0 +1,8 @@
+# pathes to find built python module contains architecture
+
+eval "$(
+ declare -f check | \
+ sed '
+ /export PYTHONPATH=/s/x86_64/${CARCH}/
+ '
+)"
diff --git a/extra/python-jaraco.context/PKGBUILD b/extra/python-jaraco.context/PKGBUILD
new file mode 100644
index 00000000..b0d7bd85
--- /dev/null
+++ b/extra/python-jaraco.context/PKGBUILD
@@ -0,0 +1,18 @@
+# temporary to build python-build with python-bootstrap (breaking cycles)
+makedepends=(${makedepends[@]//python-build/})
+makedepends=(${makedepends[@]//python-installer/})
+makedepends=(${makedepends[@]//python-wheel/})
+makedepends+=('python-bootstrap')
+depends=(${depends[@]//python-jaraco.functools/})
+depends=(${depends[@]//python-jaraco.context/})
+depends=(${depends[@]//python-jaraco.context/})
+depends=(${depends[@]//python-autocommand/})
+depends=(${depends[@]//python-inflect/})
+unset checkdepends
+unset check
+eval "$(
+ declare -f build | \
+ sed '
+ s/python -m build -wn/python -m build -wn -x/g
+ '
+)"
diff --git a/extra/python-jaraco.functools/PKGBUILD b/extra/python-jaraco.functools/PKGBUILD
new file mode 100644
index 00000000..d95ca919
--- /dev/null
+++ b/extra/python-jaraco.functools/PKGBUILD
@@ -0,0 +1,13 @@
+# temporary to build python-build with python-bootstrap (breaking cycles)
+makedepends=(${makedepends[@]//python-build/})
+makedepends=(${makedepends[@]//python-installer/})
+makedepends=(${makedepends[@]//python-wheel/})
+makedepends+=('python-bootstrap')
+unset checkdepends
+unset check
+eval "$(
+ declare -f build | \
+ sed '
+ s/python -m build --wheel --no-isolation/python -m build --wheel --no-isolation -x/g
+ '
+)"
diff --git a/extra/python-jaraco.text/PKGBUILD b/extra/python-jaraco.text/PKGBUILD
new file mode 100644
index 00000000..29e02c8a
--- /dev/null
+++ b/extra/python-jaraco.text/PKGBUILD
@@ -0,0 +1,18 @@
+# temporary to build python-build with python-bootstrap (breaking cycles)
+makedepends=(${makedepends[@]//python-build/})
+makedepends=(${makedepends[@]//python-installer/})
+makedepends=(${makedepends[@]//python-wheel/})
+makedepends+=('python-bootstrap')
+depends=(${depends[@]//python-jaraco.functools/})
+depends=(${depends[@]//python-jaraco.context/})
+depends=(${depends[@]//python-jaraco.context/})
+depends=(${depends[@]//python-autocommand/})
+depends=(${depends[@]//python-inflect/})
+unset checkdepends
+unset check
+eval "$(
+ declare -f build | \
+ sed '
+ s/python -m build --wheel --no-isolation/python -m build --wheel --no-isolation -x/g
+ '
+)"
diff --git a/extra/python-jedi/PKGBUILD b/extra/python-jedi/PKGBUILD
new file mode 100644
index 00000000..ff062da3
--- /dev/null
+++ b/extra/python-jedi/PKGBUILD
@@ -0,0 +1,15 @@
+# no python-sphinx_rtd_theme, needs nodejs which is currently broken
+makedepends=(${makedepends[@]//python-sphinx_rtd_theme/})
+makedepends=(${makedepends[@]//python-sphinx/})
+eval "$(
+ declare -f build | \
+ sed '
+ /sphinx-build/d
+ '
+)"
+eval "$(
+ declare -f package | \
+ sed '
+ /install.*docs\/_build.*/d
+ '
+)"
diff --git a/extra/python-libevdev/PKGBUILD b/extra/python-libevdev/PKGBUILD
new file mode 100644
index 00000000..ba9c762c
--- /dev/null
+++ b/extra/python-libevdev/PKGBUILD
@@ -0,0 +1,11 @@
+# temporarily disabled documentation due to sphinx_rtd_theme (FS32#163)
+eval "$(
+ declare -f build | \
+ sed '
+ /make doc/d
+ '
+ declare -f package | \
+ sed '
+ /\/share\/doc/d
+ '
+)"
diff --git a/extra/python-libnacl/PKGBUILD b/extra/python-libnacl/PKGBUILD
new file mode 100644
index 00000000..6eda5b5e
--- /dev/null
+++ b/extra/python-libnacl/PKGBUILD
@@ -0,0 +1,15 @@
+# see https://bbs.archlinux32.org/viewtopic.php?pid=224
+# and https://github.com/saltstack/libnacl/issues/103
+
+eval "$(
+ {
+ declare -f prepare || \
+ printf 'prepare() {\n}\n'
+ } \
+ | sed '
+ $i sed -i '"'"' \
+ s/m, mlen,/m, ctypes.byref(mlen),/ \
+ '"'"' "libnacl-${pkgver}/libnacl/__init__.py" \
+ cp -r libnacl-$pkgver{,-py2}
+ '
+)"
diff --git a/extra/python-matplotlib/PKGBUILD b/extra/python-matplotlib/PKGBUILD
new file mode 100644
index 00000000..51633f41
--- /dev/null
+++ b/extra/python-matplotlib/PKGBUILD
@@ -0,0 +1,14 @@
+checkdepends=(${checkdepends[@]//pyside2/})
+checkdepends_i686+=(pyside2)
+checkdepends_pentium4=("${checkdepends_i686[@]}")
+
+checkdepends=(${checkdepends[@]//python-pyqt6/})
+checkdepends_i686+=(python-pyqt6)
+checkdepends_pentium4=("${checkdepends_i686[@]}")
+
+checkdepends=(${checkdepends[@]//pyside6/})
+checkdepends_i686+=(pyside6)
+checkdepends_pentium4=("${checkdepends_i686[@]}")
+
+# tests fails in various ways
+unset check
diff --git a/extra/python-mongoengine/PKGBUILD b/extra/python-mongoengine/PKGBUILD
new file mode 100644
index 00000000..f2878a8a
--- /dev/null
+++ b/extra/python-mongoengine/PKGBUILD
@@ -0,0 +1 @@
+unset check checkdepends
diff --git a/extra/python-more-itertools/PKGBUILD b/extra/python-more-itertools/PKGBUILD
new file mode 100644
index 00000000..94928e1c
--- /dev/null
+++ b/extra/python-more-itertools/PKGBUILD
@@ -0,0 +1,8 @@
+# temporary to build python-build with python-bootstrap (breaking cycles)
+makedepends=(${makedepends[@]//python-installer/})
+makedepends=(${makedepends[@]//python-build/})
+makedepends=(${makedepends[@]//python-wheel/})
+makedepends=(${makedepends[@]//python-flit-core/})
+makedepends+=('python-bootstrap')
+unset checkdepends
+unset check
diff --git a/extra/python-networkx/PKGBUILD b/extra/python-networkx/PKGBUILD
new file mode 100644
index 00000000..521151c1
--- /dev/null
+++ b/extra/python-networkx/PKGBUILD
@@ -0,0 +1,7 @@
+# python-matplotlib fails with stack smashes on i486, must disable it on all
+# architectures, because it's of architecture 'any' thus drawing in the module
+# again on i486
+depends=(${depends[@]//python-matplotlib/})
+
+# tests fails in various ways
+unset check
diff --git a/extra/python-pluggy/PKGBUILD b/extra/python-pluggy/PKGBUILD
new file mode 100644
index 00000000..5906d9c8
--- /dev/null
+++ b/extra/python-pluggy/PKGBUILD
@@ -0,0 +1,7 @@
+#==> Starting check()...
+#usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
+# or: setup.py --help [cmd1 cmd2 ...]
+# or: setup.py --help-commands
+# or: setup.py cmd --help
+unset checkdepends
+unset check
diff --git a/extra/python-pyproject-hooks/PKGBUILD b/extra/python-pyproject-hooks/PKGBUILD
new file mode 100644
index 00000000..13a5299b
--- /dev/null
+++ b/extra/python-pyproject-hooks/PKGBUILD
@@ -0,0 +1,8 @@
+# temporary to build python-build with python-bootstrap (breaking cycles)
+makedepends=(${makedepends[@]//python-flit-core/})
+makedepends=(${makedepends[@]//python-build/})
+makedepends=(${makedepends[@]//python-installer/})
+makedepends=(${makedepends[@]//python-wheel/})
+makedepends+=('python-bootstrap')
+unset checkdepends
+unset check
diff --git a/extra/python-pytest/PKGBUILD b/extra/python-pytest/PKGBUILD
new file mode 100644
index 00000000..85fbc035
--- /dev/null
+++ b/extra/python-pytest/PKGBUILD
@@ -0,0 +1,7 @@
+# some tests fail also upstream (nose)
+eval "$(
+ declare -f check | \
+ sed '
+ s/\(test-env\/bin\/python -m pytest\)/\1 || true/
+ '
+)"
diff --git a/extra/python-pyudev/PKGBUILD b/extra/python-pyudev/PKGBUILD
new file mode 100644
index 00000000..022fe3c4
--- /dev/null
+++ b/extra/python-pyudev/PKGBUILD
@@ -0,0 +1,15 @@
+# disable documentation (needs sphinx), building it currently leaves
+# the documentation in the package and the module broken (seen in
+# libwacom)
+makedepends=(${makedepends[@]//python-sphinx/})
+eval "$(
+ declare -f build | \
+ sed '
+ /.*sphinx.*/d
+ '
+ declare -f package | \
+ sed '
+ /.*doc\/html.*/d
+ /.*\/usr\/share\/doc.*/d
+ '
+)"
diff --git a/extra/python-pyvirtualdisplay/PKGBUILD b/extra/python-pyvirtualdisplay/PKGBUILD
new file mode 100644
index 00000000..aa51437a
--- /dev/null
+++ b/extra/python-pyvirtualdisplay/PKGBUILD
@@ -0,0 +1,2 @@
+# tests use framebuffer X and hang, so disable them
+unset check
diff --git a/extra/python-scipy/PKGBUILD b/extra/python-scipy/PKGBUILD
new file mode 100644
index 00000000..1036c3f0
--- /dev/null
+++ b/extra/python-scipy/PKGBUILD
@@ -0,0 +1,11 @@
+# increase standard relative tolerance of verify_gauss_quad
+
+eval "$(
+ declare -f prepare | \
+ sed '
+ 2 a sed -i '"'"'/def verify_gauss_quad/ { N; s/rtol=[^,]\+,/rtol=2e-15,/; } '"'"' "scipy-${pkgver}/scipy/special/tests/test_orthogonal.py"
+ '
+)"
+
+# kill slaves, so disabled for now
+unset check
diff --git a/extra/python-setuptools-scm/PKGBUILD b/extra/python-setuptools-scm/PKGBUILD
new file mode 100644
index 00000000..5057a55f
--- /dev/null
+++ b/extra/python-setuptools-scm/PKGBUILD
@@ -0,0 +1,9 @@
+# temporary to build python-build with python-bootstrap (breaking cycles)
+makedepends=(${makedepends[@]//python-build/})
+makedepends=(${makedepends[@]//python-installer/})
+makedepends=(${makedepends[@]//python-wheel/})
+makedepends+=('python-bootstrap')
+depends=(${depends[@]//python-packaging/})
+depends=(${depends[@]//python-setuptools/})
+unset checkdepends
+unset check
diff --git a/extra/python-shapely/PKGBUILD b/extra/python-shapely/PKGBUILD
new file mode 100644
index 00000000..14ce07a9
--- /dev/null
+++ b/extra/python-shapely/PKGBUILD
@@ -0,0 +1,23 @@
+# temporary fix for:
+# - https://github.com/Toblerity/Shapely/pull/762
+#
+# which caused:
+# - https://community.ultimaker.com/topic/29721-archlinux32-cura-341/?_fromLogin=1#replyForm
+#
+source+=(load_dll_c.patch)
+sha512sums+=('6dee4823b76d5057beaed09e9ed529d03a9f76141598a4038f3c51cbca828b1f3e9203a25dab91ee1ff31fee2bf2781d6171dc662f5aa1715c9d5296f8607c60')
+
+eval "$(
+ declare -f prepare | \
+ sed '
+ $ i cd Shapely-$pkgver && patch -p1 -i "$srcdir/load_dll_c.patch"
+ '
+)"
+
+# patch CARCH to always use i686 build directory during testing
+eval "$(
+ declare -f check | \
+ sed '
+ /.*py.test/s/\$CARCH/i686/
+ '
+)"
diff --git a/extra/python-shapely/load_dll_c.patch b/extra/python-shapely/load_dll_c.patch
new file mode 100644
index 00000000..8efc8ec5
--- /dev/null
+++ b/extra/python-shapely/load_dll_c.patch
@@ -0,0 +1,13 @@
+diff -rauN Shapely-1.7.0/shapely/geos.py Shapely-1.7.0-load_dll-patch/shapely/geos.py
+--- Shapely-1.7.0/shapely/geos.py 2019-12-31 18:31:44.000000000 +0100
++++ Shapely-1.7.0-load_dll-patch/shapely/geos.py 2020-04-23 08:46:30.677274478 +0200
+@@ -87,7 +87,8 @@
+ _lgeos = load_dll('geos_c', fallbacks=alt_paths)
+ # Necessary for environments with only libc.musl
+ c_alt_paths = [
+- 'libc.musl-x86_64.so.1'
++ 'libc.musl-x86_64.so.1',
++ 'libc.so.6'
+ ]
+ free = load_dll('c', fallbacks=c_alt_paths).free
+ free.argtypes = [c_void_p]
diff --git a/extra/python-simplejson/PKGBUILD b/extra/python-simplejson/PKGBUILD
new file mode 100644
index 00000000..947b2a88
--- /dev/null
+++ b/extra/python-simplejson/PKGBUILD
@@ -0,0 +1,4 @@
+# temporary
+source=('https://github.com/simplejson/simplejson/archive/refs/tags/v3.17.6.tar.gz')
+sha512sums=('48b74388cd3a5cf0acf46a9aa050d628513d842297625f791c7ae07a7c9289afcb0be8d374f77af3bebd50f4c200844bc69f5b77a67220fee357cdfc0d913726')
+
diff --git a/extra/python-sphinxcontrib-applehelp/PKGBUILD b/extra/python-sphinxcontrib-applehelp/PKGBUILD
new file mode 100644
index 00000000..6403c888
--- /dev/null
+++ b/extra/python-sphinxcontrib-applehelp/PKGBUILD
@@ -0,0 +1,2 @@
+unset check
+unset checkdepends
diff --git a/extra/python-sphinxcontrib-devhelp/PKGBUILD b/extra/python-sphinxcontrib-devhelp/PKGBUILD
new file mode 100644
index 00000000..6403c888
--- /dev/null
+++ b/extra/python-sphinxcontrib-devhelp/PKGBUILD
@@ -0,0 +1,2 @@
+unset check
+unset checkdepends
diff --git a/extra/python-sphinxcontrib-htmlhelp/PKGBUILD b/extra/python-sphinxcontrib-htmlhelp/PKGBUILD
new file mode 100644
index 00000000..3e723efb
--- /dev/null
+++ b/extra/python-sphinxcontrib-htmlhelp/PKGBUILD
@@ -0,0 +1,3 @@
+# fails in all tests currently
+unset check
+unset checkdepends
diff --git a/extra/python-sphinxcontrib-jsmath/PKGBUILD b/extra/python-sphinxcontrib-jsmath/PKGBUILD
new file mode 100644
index 00000000..6403c888
--- /dev/null
+++ b/extra/python-sphinxcontrib-jsmath/PKGBUILD
@@ -0,0 +1,2 @@
+unset check
+unset checkdepends
diff --git a/extra/python-sphinxcontrib-serializinghtml/PKGBUILD b/extra/python-sphinxcontrib-serializinghtml/PKGBUILD
new file mode 100644
index 00000000..6403c888
--- /dev/null
+++ b/extra/python-sphinxcontrib-serializinghtml/PKGBUILD
@@ -0,0 +1,2 @@
+unset check
+unset checkdepends
diff --git a/extra/python-tqdm/PKGBUILD b/extra/python-tqdm/PKGBUILD
new file mode 100644
index 00000000..b7329924
--- /dev/null
+++ b/extra/python-tqdm/PKGBUILD
@@ -0,0 +1,11 @@
+# https://github.com/tqdm/tqdm/issues/538
+
+source+=('tqdm-4.22.0-sleep-test-workaround.patch')
+sha512sums+=('ac09e7578ad380f55f9371a067061bd1f23be6a799ec82c3abf2471d7d780bd435b423d0ab1f989cf7039b467d5adfa38e324cb887b0b27f52218fa3753956fa')
+
+eval "$(
+ declare -f prepare | \
+ sed '
+ /cp/ i pushd ${srcdir}/tqdm-$pkgver && patch -Np1 -i "${srcdir}"/tqdm-4.22.0-sleep-test-workaround.patch && popd
+ '
+)"
diff --git a/extra/python-tqdm/tqdm-4.22.0-sleep-test-workaround.patch b/extra/python-tqdm/tqdm-4.22.0-sleep-test-workaround.patch
new file mode 100644
index 00000000..ac9caae3
--- /dev/null
+++ b/extra/python-tqdm/tqdm-4.22.0-sleep-test-workaround.patch
@@ -0,0 +1,12 @@
+diff -rauN tqdm-4.22.0/tqdm/tests/tests_synchronisation.py tqdm-4.22.0-sleep-test-workaround-patch/tqdm/tests/tests_synchronisation.py
+--- tqdm-4.22.0/tqdm/tests/tests_synchronisation.py 2018-04-12 01:27:25.000000000 +0200
++++ tqdm-4.22.0-sleep-test-workaround-patch/tqdm/tests/tests_synchronisation.py 2018-05-03 08:42:28.204036417 +0200
+@@ -155,7 +155,7 @@
+ timeend = timer.time()
+ while not (t1.monitor.woken >= timeend and t1.miniters == 1):
+ timer.sleep(1)
+- sleep(0.000001)
++ sleep(0.001)
+ assert t1.miniters == 1 # check that monitor corrected miniters
+ assert t2.miniters == 500 # check that t2 was not adjusted
+
diff --git a/extra/python-wheel/PKGBUILD b/extra/python-wheel/PKGBUILD
new file mode 100644
index 00000000..bf6e3996
--- /dev/null
+++ b/extra/python-wheel/PKGBUILD
@@ -0,0 +1,9 @@
+# temporary to build python-build with python-bootstrap (breaking cycles)
+depends=(${depends[@]//python-packaging/})
+makedepends=(${makedepends[@]//python-flit-core/})
+makedepends=(${makedepends[@]//python-setuptools/})
+makedepends=(${makedepends[@]//python-build/})
+makedepends=(${makedepends[@]//python-installer/})
+makedepends+=('python-bootstrap')
+unset checkdepends
+unset check
diff --git a/extra/python-xarray/PKGBUILD b/extra/python-xarray/PKGBUILD
new file mode 100644
index 00000000..97c39ba7
--- /dev/null
+++ b/extra/python-xarray/PKGBUILD
@@ -0,0 +1,2 @@
+# scipi tests hang forever and hang build slaves
+unset check
diff --git a/extra/qcad/PKGBUILD b/extra/qcad/PKGBUILD
new file mode 100644
index 00000000..e847139a
--- /dev/null
+++ b/extra/qcad/PKGBUILD
@@ -0,0 +1,8 @@
+# If they ever change their release artifacts again, whoever reads this
+# has my permission to put 'SKIP' into these checksum arrays.
+# deep42thought - 2019-03-28
+
+# ok, thanks, SKIPped it :-)
+# deep42thought - 2020-07-31
+
+sha512sums[0]='SKIP'
diff --git a/extra/qtile/PKGBUILD b/extra/qtile/PKGBUILD
new file mode 100644
index 00000000..ccc1819c
--- /dev/null
+++ b/extra/qtile/PKGBUILD
@@ -0,0 +1,10 @@
+#Errors from xkbcomp are not fatal to the X server
+#=========================== short test summary info ============================
+#ERROR test/test_manager.py::test_toggle_min[xephyr0-ManagerConfig] - Assertio...
+#============= 436 passed, 6 skipped, 1 error in 143.74s (0:02:23) ==============
+eval "$(
+ declare -f check | \
+ sed '
+ s/\(pytest -v\)/\1 || true/
+ '
+)"
diff --git a/extra/rathole/PKGBUILD b/extra/rathole/PKGBUILD
new file mode 100644
index 00000000..82610227
--- /dev/null
+++ b/extra/rathole/PKGBUILD
@@ -0,0 +1,3 @@
+# stalls build slaves with:
+# "May 01 21:45:56.117 ERROR rathole::server: Failed to do transport handshake: error:0A000415:SSL routines:ssl3_read_bytes:sslv3 alert certificate expired:ssl/record/rec_layer_s3.c:1605:SSL alert number 45: error:0A000415:SSL routines:ssl3_read_bytes:sslv3 alert certificate expired:ssl/record/rec_layer_s3.c:1605:SSL alert number 45"
+unset check
diff --git a/extra/redis/PKGBUILD b/extra/redis/PKGBUILD
new file mode 100644
index 00000000..02ba0304
--- /dev/null
+++ b/extra/redis/PKGBUILD
@@ -0,0 +1,9 @@
+# add -latomic where needed (i486)
+if [ "$CARCH" = 'i486' ]; then
+ eval "$(
+ declare -f build | \
+ sed '
+ s/make/LDFLAGS='-latomic' make/
+ '
+ )"
+fi
diff --git a/extra/reflector/PKGBUILD b/extra/reflector/PKGBUILD
new file mode 100644
index 00000000..c3e73ed8
--- /dev/null
+++ b/extra/reflector/PKGBUILD
@@ -0,0 +1,15 @@
+source=(
+ "https://sources.archlinux32.org/sources/reflector32-${pkgver}.tar.gz"{,.sig}
+)
+md5sums=('7f6100188a8d8340dcc6d470bbe5e179'
+ 'SKIP')
+sha512sums=('9186c66152d20e6c52b7a2f2cd8fb9e5c122f23ec70afc358bfa01dd196a94cb4ae96a7fc8974524ef632e6d591d7889e1128e1c7e0f300562b1372ca61716ed'
+ 'SKIP')
+
+validpgpkeys=('DE9F7688CACF04FEB81A6C590AEEC90755DA7B5A' '38ACA6A026D25CDD227D24832F6399DCD2212195' '16194A82231E9EF823562181C8E8F5A0AF9BA7E7')
+eval "$(
+ declare -f package | \
+ sed '
+ s/\$pkgname/${pkgname}32/
+ '
+)"
diff --git a/extra/ruby-bigdecimal/PKGBUILD b/extra/ruby-bigdecimal/PKGBUILD
new file mode 100644
index 00000000..71221b41
--- /dev/null
+++ b/extra/ruby-bigdecimal/PKGBUILD
@@ -0,0 +1,8 @@
+# move native code to proper place (where ruby expects it)
+eval "$(
+ declare -f package | \
+ sed '
+ /local _gemdir.*/ a local _install_platform="$(ruby --disable-all -e '"'"'puts RUBY_PLATFORM'"'"')"
+ s|${pkgdir}/usr/lib/ruby/${_extension_api_version}/${_platform}|${pkgdir}/usr/lib/ruby/${_extension_api_version}/${_install_platform}|g
+ '
+)"
diff --git a/extra/ruby-cgi/PKGBUILD b/extra/ruby-cgi/PKGBUILD
new file mode 100644
index 00000000..71221b41
--- /dev/null
+++ b/extra/ruby-cgi/PKGBUILD
@@ -0,0 +1,8 @@
+# move native code to proper place (where ruby expects it)
+eval "$(
+ declare -f package | \
+ sed '
+ /local _gemdir.*/ a local _install_platform="$(ruby --disable-all -e '"'"'puts RUBY_PLATFORM'"'"')"
+ s|${pkgdir}/usr/lib/ruby/${_extension_api_version}/${_platform}|${pkgdir}/usr/lib/ruby/${_extension_api_version}/${_install_platform}|g
+ '
+)"
diff --git a/extra/ruby-date/PKGBUILD b/extra/ruby-date/PKGBUILD
new file mode 100644
index 00000000..71221b41
--- /dev/null
+++ b/extra/ruby-date/PKGBUILD
@@ -0,0 +1,8 @@
+# move native code to proper place (where ruby expects it)
+eval "$(
+ declare -f package | \
+ sed '
+ /local _gemdir.*/ a local _install_platform="$(ruby --disable-all -e '"'"'puts RUBY_PLATFORM'"'"')"
+ s|${pkgdir}/usr/lib/ruby/${_extension_api_version}/${_platform}|${pkgdir}/usr/lib/ruby/${_extension_api_version}/${_install_platform}|g
+ '
+)"
diff --git a/extra/ruby-digest/PKGBUILD b/extra/ruby-digest/PKGBUILD
new file mode 100644
index 00000000..71221b41
--- /dev/null
+++ b/extra/ruby-digest/PKGBUILD
@@ -0,0 +1,8 @@
+# move native code to proper place (where ruby expects it)
+eval "$(
+ declare -f package | \
+ sed '
+ /local _gemdir.*/ a local _install_platform="$(ruby --disable-all -e '"'"'puts RUBY_PLATFORM'"'"')"
+ s|${pkgdir}/usr/lib/ruby/${_extension_api_version}/${_platform}|${pkgdir}/usr/lib/ruby/${_extension_api_version}/${_install_platform}|g
+ '
+)"
diff --git a/extra/ruby-etc/PKGBUILD b/extra/ruby-etc/PKGBUILD
new file mode 100644
index 00000000..71221b41
--- /dev/null
+++ b/extra/ruby-etc/PKGBUILD
@@ -0,0 +1,8 @@
+# move native code to proper place (where ruby expects it)
+eval "$(
+ declare -f package | \
+ sed '
+ /local _gemdir.*/ a local _install_platform="$(ruby --disable-all -e '"'"'puts RUBY_PLATFORM'"'"')"
+ s|${pkgdir}/usr/lib/ruby/${_extension_api_version}/${_platform}|${pkgdir}/usr/lib/ruby/${_extension_api_version}/${_install_platform}|g
+ '
+)"
diff --git a/extra/ruby-fcntl/PKGBUILD b/extra/ruby-fcntl/PKGBUILD
new file mode 100644
index 00000000..71221b41
--- /dev/null
+++ b/extra/ruby-fcntl/PKGBUILD
@@ -0,0 +1,8 @@
+# move native code to proper place (where ruby expects it)
+eval "$(
+ declare -f package | \
+ sed '
+ /local _gemdir.*/ a local _install_platform="$(ruby --disable-all -e '"'"'puts RUBY_PLATFORM'"'"')"
+ s|${pkgdir}/usr/lib/ruby/${_extension_api_version}/${_platform}|${pkgdir}/usr/lib/ruby/${_extension_api_version}/${_install_platform}|g
+ '
+)"
diff --git a/extra/ruby-fiddle/PKGBUILD b/extra/ruby-fiddle/PKGBUILD
new file mode 100644
index 00000000..71221b41
--- /dev/null
+++ b/extra/ruby-fiddle/PKGBUILD
@@ -0,0 +1,8 @@
+# move native code to proper place (where ruby expects it)
+eval "$(
+ declare -f package | \
+ sed '
+ /local _gemdir.*/ a local _install_platform="$(ruby --disable-all -e '"'"'puts RUBY_PLATFORM'"'"')"
+ s|${pkgdir}/usr/lib/ruby/${_extension_api_version}/${_platform}|${pkgdir}/usr/lib/ruby/${_extension_api_version}/${_install_platform}|g
+ '
+)"
diff --git a/extra/ruby-io-console/PKGBUILD b/extra/ruby-io-console/PKGBUILD
new file mode 100644
index 00000000..71221b41
--- /dev/null
+++ b/extra/ruby-io-console/PKGBUILD
@@ -0,0 +1,8 @@
+# move native code to proper place (where ruby expects it)
+eval "$(
+ declare -f package | \
+ sed '
+ /local _gemdir.*/ a local _install_platform="$(ruby --disable-all -e '"'"'puts RUBY_PLATFORM'"'"')"
+ s|${pkgdir}/usr/lib/ruby/${_extension_api_version}/${_platform}|${pkgdir}/usr/lib/ruby/${_extension_api_version}/${_install_platform}|g
+ '
+)"
diff --git a/extra/ruby-io-nonblock/PKGBUILD b/extra/ruby-io-nonblock/PKGBUILD
new file mode 100644
index 00000000..71221b41
--- /dev/null
+++ b/extra/ruby-io-nonblock/PKGBUILD
@@ -0,0 +1,8 @@
+# move native code to proper place (where ruby expects it)
+eval "$(
+ declare -f package | \
+ sed '
+ /local _gemdir.*/ a local _install_platform="$(ruby --disable-all -e '"'"'puts RUBY_PLATFORM'"'"')"
+ s|${pkgdir}/usr/lib/ruby/${_extension_api_version}/${_platform}|${pkgdir}/usr/lib/ruby/${_extension_api_version}/${_install_platform}|g
+ '
+)"
diff --git a/extra/ruby-io-wait/PKGBUILD b/extra/ruby-io-wait/PKGBUILD
new file mode 100644
index 00000000..71221b41
--- /dev/null
+++ b/extra/ruby-io-wait/PKGBUILD
@@ -0,0 +1,8 @@
+# move native code to proper place (where ruby expects it)
+eval "$(
+ declare -f package | \
+ sed '
+ /local _gemdir.*/ a local _install_platform="$(ruby --disable-all -e '"'"'puts RUBY_PLATFORM'"'"')"
+ s|${pkgdir}/usr/lib/ruby/${_extension_api_version}/${_platform}|${pkgdir}/usr/lib/ruby/${_extension_api_version}/${_install_platform}|g
+ '
+)"
diff --git a/extra/ruby-json/PKGBUILD b/extra/ruby-json/PKGBUILD
new file mode 100644
index 00000000..71221b41
--- /dev/null
+++ b/extra/ruby-json/PKGBUILD
@@ -0,0 +1,8 @@
+# move native code to proper place (where ruby expects it)
+eval "$(
+ declare -f package | \
+ sed '
+ /local _gemdir.*/ a local _install_platform="$(ruby --disable-all -e '"'"'puts RUBY_PLATFORM'"'"')"
+ s|${pkgdir}/usr/lib/ruby/${_extension_api_version}/${_platform}|${pkgdir}/usr/lib/ruby/${_extension_api_version}/${_install_platform}|g
+ '
+)"
diff --git a/extra/ruby-psych/PKGBUILD b/extra/ruby-psych/PKGBUILD
new file mode 100644
index 00000000..71221b41
--- /dev/null
+++ b/extra/ruby-psych/PKGBUILD
@@ -0,0 +1,8 @@
+# move native code to proper place (where ruby expects it)
+eval "$(
+ declare -f package | \
+ sed '
+ /local _gemdir.*/ a local _install_platform="$(ruby --disable-all -e '"'"'puts RUBY_PLATFORM'"'"')"
+ s|${pkgdir}/usr/lib/ruby/${_extension_api_version}/${_platform}|${pkgdir}/usr/lib/ruby/${_extension_api_version}/${_install_platform}|g
+ '
+)"
diff --git a/extra/ruby-racc/PKGBUILD b/extra/ruby-racc/PKGBUILD
new file mode 100644
index 00000000..71221b41
--- /dev/null
+++ b/extra/ruby-racc/PKGBUILD
@@ -0,0 +1,8 @@
+# move native code to proper place (where ruby expects it)
+eval "$(
+ declare -f package | \
+ sed '
+ /local _gemdir.*/ a local _install_platform="$(ruby --disable-all -e '"'"'puts RUBY_PLATFORM'"'"')"
+ s|${pkgdir}/usr/lib/ruby/${_extension_api_version}/${_platform}|${pkgdir}/usr/lib/ruby/${_extension_api_version}/${_install_platform}|g
+ '
+)"
diff --git a/extra/ruby-stringio/PKGBUILD b/extra/ruby-stringio/PKGBUILD
new file mode 100644
index 00000000..71221b41
--- /dev/null
+++ b/extra/ruby-stringio/PKGBUILD
@@ -0,0 +1,8 @@
+# move native code to proper place (where ruby expects it)
+eval "$(
+ declare -f package | \
+ sed '
+ /local _gemdir.*/ a local _install_platform="$(ruby --disable-all -e '"'"'puts RUBY_PLATFORM'"'"')"
+ s|${pkgdir}/usr/lib/ruby/${_extension_api_version}/${_platform}|${pkgdir}/usr/lib/ruby/${_extension_api_version}/${_install_platform}|g
+ '
+)"
diff --git a/extra/ruby/PKGBUILD b/extra/ruby/PKGBUILD
new file mode 100644
index 00000000..2ee10842
--- /dev/null
+++ b/extra/ruby/PKGBUILD
@@ -0,0 +1,17 @@
+# patch architecture in helper shared libs
+if [ "${CARCH}" = "pentium4" -o "${CARCH}" = "i686" ]; then
+ eval "$(
+ declare -f package_ruby | \
+ sed '
+ s|x86_64-linux|i686-linux|g
+ '
+ )"
+fi
+if [ "${CARCH}" = "i486" ]; then
+ eval "$(
+ declare -f package_ruby | \
+ sed '
+ s|x86_64-linux|i486-linux|g
+ '
+ )"
+fi
diff --git a/extra/rxvt-unicode/PKGBUILD b/extra/rxvt-unicode/PKGBUILD
new file mode 100644
index 00000000..65dfc88f
--- /dev/null
+++ b/extra/rxvt-unicode/PKGBUILD
@@ -0,0 +1,13 @@
+eval "$(
+ declare -f package_rxvt-unicode | \
+ sed '
+ 2 a arch=('"${arch[*]}"')
+ '
+ declare -f package_rxvt-unicode-terminfo | \
+ sed '
+ 2 a arch=(any)
+ '
+)"
+
+# temporary
+source[0]="http://dist.schmorp.de/rxvt-unicode/Attic/${pkgname}-${pkgver}.tar.bz2"
diff --git a/extra/s2n-tls/PKGBUILD b/extra/s2n-tls/PKGBUILD
new file mode 100644
index 00000000..f96f9937
--- /dev/null
+++ b/extra/s2n-tls/PKGBUILD
@@ -0,0 +1,7 @@
+# ignore test results, see FS32#166
+eval "$(
+ declare -f check | \
+ sed '
+ s/\(cmake.*--target.*test.*\)/\1 || true/
+ '
+)"
diff --git a/extra/sarg/PKGBUILD b/extra/sarg/PKGBUILD
new file mode 100644
index 00000000..6c188a3b
--- /dev/null
+++ b/extra/sarg/PKGBUILD
@@ -0,0 +1,8 @@
+source+=(no-werror.patch)
+sha256sums+=(42744656ddc442d7823859f170750c4b69e5dc599230218dd3016f7a74809a4d)
+eval "$(
+ declare -f prepare \
+ | sed '
+ $ i patch -p1 -i "$srcdir"/no-werror.patch
+ '
+)"
diff --git a/extra/sarg/no-werror.patch b/extra/sarg/no-werror.patch
new file mode 100644
index 00000000..7d04349b
--- /dev/null
+++ b/extra/sarg/no-werror.patch
@@ -0,0 +1,23 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index aac6933..aa784ea 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -71,18 +71,6 @@ IF(HAVE_WEXTRA)
+ SET_TARGET_PROPERTIES(sarg PROPERTIES COMPILE_FLAGS "${TMPCFLAGS} -Wextra -Wno-unused-parameter")
+ ENDIF(HAVE_WEXTRA)
+
+-CHECK_C_COMPILER_FLAG("-Werror=implicit-function-declaration" HAVE_WERROR_IMPLICIT_FUNCTION)
+-IF(HAVE_WERROR_IMPLICIT_FUNCTION)
+- GET_TARGET_PROPERTY(TMPCFLAGS sarg COMPILE_FLAGS)
+- SET_TARGET_PROPERTIES(sarg PROPERTIES COMPILE_FLAGS "${TMPCFLAGS} -Werror=implicit-function-declaration")
+-ENDIF(HAVE_WERROR_IMPLICIT_FUNCTION)
+-
+-CHECK_C_COMPILER_FLAG("-Werror=format" HAVE_WERROR_FORMAT)
+-IF(HAVE_WERROR_FORMAT)
+- GET_TARGET_PROPERTY(TMPCFLAGS sarg COMPILE_FLAGS)
+- SET_TARGET_PROPERTIES(sarg PROPERTIES COMPILE_FLAGS "${TMPCFLAGS} -Werror=format")
+-ENDIF(HAVE_WERROR_FORMAT)
+-
+ # Required header files
+ CHECK_INCLUDE_FILE(stdio.h HAVE_STDIO_H)
+ CHECK_INCLUDE_FILE(stdlib.h HAVE_STDLIB_H)
diff --git a/extra/sensors-applet/PKGBUILD b/extra/sensors-applet/PKGBUILD
new file mode 100644
index 00000000..b398bc88
--- /dev/null
+++ b/extra/sensors-applet/PKGBUILD
@@ -0,0 +1,3 @@
+# libxnvctrl is Nvidia only, so sorry, there is no 32-bit version for
+# it, then we will not build support for it..
+depends=(${depends[@]//libxnvctrl/})
diff --git a/extra/serialdv/PKGBUILD b/extra/serialdv/PKGBUILD
new file mode 100644
index 00000000..e63c7670
--- /dev/null
+++ b/extra/serialdv/PKGBUILD
@@ -0,0 +1,6 @@
+eval "$(
+ declare -f package | \
+ sed '
+ s|/usr/lib64|/usr/lib|g
+ '
+)"
diff --git a/extra/skim/PKGBUILD b/extra/skim/PKGBUILD
new file mode 100644
index 00000000..2f1d05f4
--- /dev/null
+++ b/extra/skim/PKGBUILD
@@ -0,0 +1,11 @@
+# test fails, because 8589934592 does not fit in 32 bit
+
+eval "$(
+ {
+ declare -f prepare \
+ || printf 'prepare()\n{\n:\n}\n'
+ } \
+ | sed '
+ 2 a sed -i "s/8589934592\(.*\)8589934592/12345\112345/" "skim-$pkgver/src/util.rs"
+ '
+)"
diff --git a/extra/smbnetfs/PKGBUILD b/extra/smbnetfs/PKGBUILD
new file mode 100644
index 00000000..75ed9722
--- /dev/null
+++ b/extra/smbnetfs/PKGBUILD
@@ -0,0 +1,10 @@
+# https://sourceforge.net/p/smbnetfs/git/ci/f0e109dcc9e14b914d8f5877b4482e79d24a0ad6/
+eval "$(
+ {
+ declare -f prepare || \
+ printf 'prepare() {\n}\n'
+ } \
+ | sed '
+ $i sed -i '"'"'\\,^#include <attr/xattr.h>$,d'"'"' "$srcdir"/$pkgname-$pkgver/src/function.c
+ '
+)"
diff --git a/extra/sonic-visualiser/PKGBUILD b/extra/sonic-visualiser/PKGBUILD
new file mode 100644
index 00000000..201e561e
--- /dev/null
+++ b/extra/sonic-visualiser/PKGBUILD
@@ -0,0 +1,6 @@
+eval "$(
+ declare -f prepare | \
+ sed '
+ 3 a sed '"'"'285 s/-1, 1, 10/-1.01, 1, 10/'"'"' -i svcore/base/test/TestScaleTickIntervals.h
+ '
+)"
diff --git a/extra/spiped/PKGBUILD b/extra/spiped/PKGBUILD
new file mode 100644
index 00000000..191380c4
--- /dev/null
+++ b/extra/spiped/PKGBUILD
@@ -0,0 +1,2 @@
+# hangs clients on i486
+unset check
diff --git a/extra/spirv-llvm-translator/PKGBUILD b/extra/spirv-llvm-translator/PKGBUILD
new file mode 100644
index 00000000..f00a3a39
--- /dev/null
+++ b/extra/spirv-llvm-translator/PKGBUILD
@@ -0,0 +1,15 @@
+# ignore failing tests around debug info
+# Failed Tests (7):
+# LLVM_SPIRV :: DebugInfo/X86/dbg-declare-alloca.ll
+# LLVM_SPIRV :: DebugInfo/X86/dbg-declare-arg.ll
+# LLVM_SPIRV :: DebugInfo/X86/dbg-value-const-byref.ll
+# LLVM_SPIRV :: DebugInfo/X86/dw_op_minus_direct.ll
+# LLVM_SPIRV :: DebugInfo/X86/dwarf-aranges-no-dwarf-labels.ll
+# LLVM_SPIRV :: DebugInfo/X86/frame-register.ll
+# LLVM_SPIRV :: DebugInfo/X86/this-stack_value.ll
+eval "$(
+ declare -f check | \
+ sed '
+ s/\(.*make.*test\)/\1 || true/
+ '
+)"
diff --git a/extra/spring/PKGBUILD b/extra/spring/PKGBUILD
new file mode 100644
index 00000000..4759b375
--- /dev/null
+++ b/extra/spring/PKGBUILD
@@ -0,0 +1,14 @@
+# https://springrts.com/mantis/view.php?id=5413
+
+source+=('gold-linker.patch')
+sha512sums+=('7d29099f589f4ab70262ebb307f905bdaa7e20606421ca2efaf69d391b271d3e1015f44087161106546ebe1ef197dc758c5de0120feff3f473e69ec96555d3a8')
+
+eval "$(
+ declare -f prepare | \
+ sed '
+ 2 a \
+ cd spring_$pkgver \
+ patch -Np1 -i ../gold-linker.patch \
+ cd ..
+ '
+)"
diff --git a/extra/spring/gold-linker.patch b/extra/spring/gold-linker.patch
new file mode 100644
index 00000000..aac5e7d9
--- /dev/null
+++ b/extra/spring/gold-linker.patch
@@ -0,0 +1,26 @@
+--- a/rts/build/cmake/TestCXXFlags.cmake 2017-09-24 20:01:29.000000000 +0200
++++ b/rts/build/cmake/TestCXXFlags.cmake 2018-01-09 14:16:55.894197136 +0100
+@@ -161,23 +161,8 @@
+ ERROR_VARIABLE linkerVersion
+ )
+ set(hasGold FALSE)
+- if ("${linkerVersion}" MATCHES "gold")
+- set(hasGold TRUE)
+- endif()
+
+
+- if (NOT hasGold AND NOT WIN32) #FIND_PROGRAM fails in crosscompile environments (it detects the native ld.gold)
+- # since gcc 4.8 it is possible to switch the linker via that argument
+- CHECK_CXX_ACCEPTS_FLAG("-fuse-ld=gold" HAS_USE_LD)
+- IF (HAS_USE_LD)
+- FIND_PROGRAM(LD_GOLD ld.gold)
+- if (LD_GOLD)
+- set(hasGold TRUE)
+- set(LDGOLD_CXX_FLAGS "-fuse-ld=gold")
+- endif ()
+- EndIf ()
+- endif ()
+-
+ if (hasGold)
+ set(LDGOLD_FOUND TRUE)
+ set(LDGOLD_LINKER_FLAGS "")
diff --git a/extra/squid/PKGBUILD b/extra/squid/PKGBUILD
new file mode 100644
index 00000000..1a2bcc45
--- /dev/null
+++ b/extra/squid/PKGBUILD
@@ -0,0 +1,13 @@
+# testing libatomic for __atomic_load_8 fails in configure.ac, following the idea in
+# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=830942
+# TODO: report upstream in squid project
+
+# i486-specific
+if [ "${CARCH}" = "i486" ]; then
+ eval "$(
+ declare -f build | \
+ sed '
+ s|make|make LDFLAGS="-Wl,--as-needed -latomic -Wl,--no-as-needed"|g
+ ';
+ )"
+fi
diff --git a/extra/stratisd/PKGBUILD b/extra/stratisd/PKGBUILD
new file mode 100644
index 00000000..b0518fe7
--- /dev/null
+++ b/extra/stratisd/PKGBUILD
@@ -0,0 +1,6 @@
+eval "$(
+ declare -f build | \
+ sed '
+ 2 a export TARGET="${CARCH}-unknown-linux-gnu"
+ '
+)"
diff --git a/extra/swi-prolog/PKGBUILD b/extra/swi-prolog/PKGBUILD
new file mode 100644
index 00000000..78308eb8
--- /dev/null
+++ b/extra/swi-prolog/PKGBUILD
@@ -0,0 +1,11 @@
+# do not execute tests in parallel with -j 8!
+
+eval "$(
+ declare -f build check | \
+ sed '
+ s|ctest -j 8|ctest|
+ '
+)"
+
+# takes far too long! disabling tests
+unset check
diff --git a/extra/teamspeak3-server/PKGBUILD b/extra/teamspeak3-server/PKGBUILD
new file mode 100644
index 00000000..cdeed180
--- /dev/null
+++ b/extra/teamspeak3-server/PKGBUILD
@@ -0,0 +1,14 @@
+sha256sums_i686=('78b6fe92c51d68f86baee36fd45dda9602a609a2493c04f65125b5bfeee9df59')
+source_pentium4=("${source_i686[@]}")
+sha256sums_pentium4=("${sha256sums_i686[@]}")
+
+# set _TSARCH for pentium4 directly instead of trying to patch the
+# if CARCH -> _TSRACH=...
+if [ "${CARCH}" = "pentium4" ]; then
+ eval "$(
+ declare -f package | \
+ sed '
+ s/${_TSARCH}/x86/g
+ '
+ )"
+fi
diff --git a/extra/teamspeak3/PKGBUILD b/extra/teamspeak3/PKGBUILD
new file mode 100644
index 00000000..96b32bd7
--- /dev/null
+++ b/extra/teamspeak3/PKGBUILD
@@ -0,0 +1,15 @@
+for ((i=0; i<${#source[@]}; i++)); do
+ if [ "${source[${i}]}" = "https://files.teamspeak-services.com/releases/client/${pkgver}/TeamSpeak3-Client-linux_amd64-${pkgver}.run" ]; then
+ source[${i}]="https://files.teamspeak-services.com/releases/client/${pkgver}/TeamSpeak3-Client-linux_x86-${pkgver}.run"
+ sha512sums[${i}]='54a6d7ad03a357a78be71710e7878b9b5c0a54d175bf4242a35ba82df1abfa692dc4d4c921099677c5d163caf18b68db73a87b8637b216ef5c72eaa25b6deab7'
+ fi
+done
+
+
+
+eval "$(
+ declare -f prepare | \
+ sed '
+ s|TeamSpeak3-Client-linux_amd64|TeamSpeak3-Client-linux_x86|
+ '
+)"
diff --git a/extra/teeworlds/PKGBUILD b/extra/teeworlds/PKGBUILD
new file mode 100644
index 00000000..2dc03c3f
--- /dev/null
+++ b/extra/teeworlds/PKGBUILD
@@ -0,0 +1,6 @@
+eval "$(
+ declare -f package | \
+ sed '
+ s@x86_64@x86@g
+ '
+)"
diff --git a/extra/tensorflow/PKGBUILD b/extra/tensorflow/PKGBUILD
new file mode 100644
index 00000000..61820fe9
--- /dev/null
+++ b/extra/tensorflow/PKGBUILD
@@ -0,0 +1,13 @@
+eval "$(
+ declare -f prepare | \
+ sed '
+ s|export CC_OPT_FLAGS="-march=x86-64"|export CC_OPT_FLAGS="-march=${CARCH}"|
+ '
+)"
+
+makedepends=(
+ $(
+ printf '%s\n' "${makedepends[@]}" | \
+ sed 's/cuda//' | sed 's/cudnn//'
+ )
+)
diff --git a/extra/terraform/PKGBUILD b/extra/terraform/PKGBUILD
new file mode 100644
index 00000000..3692e5fe
--- /dev/null
+++ b/extra/terraform/PKGBUILD
@@ -0,0 +1 @@
+unset check
diff --git a/extra/testssl.sh/PKGBUILD b/extra/testssl.sh/PKGBUILD
new file mode 100644
index 00000000..c4a6b219
--- /dev/null
+++ b/extra/testssl.sh/PKGBUILD
@@ -0,0 +1,2 @@
+# disable tests, take forever or hang slaves
+unset check
diff --git a/extra/thrift/PKGBUILD b/extra/thrift/PKGBUILD
new file mode 100644
index 00000000..e4eebdec
--- /dev/null
+++ b/extra/thrift/PKGBUILD
@@ -0,0 +1,8 @@
+# somehow, the directory of boost is wrongly determined during configure
+
+eval "$(
+ declare -f build | \
+ sed '
+ 4 a sed -i '"'"'/^\\s*libsubdirs=/{ :a; /\\*)/{ s/$/\\nlibsubdirs=lib/; b; }; N; ba; }'"'"' configure
+ '
+)"
diff --git a/extra/tinyemu/PKGBUILD b/extra/tinyemu/PKGBUILD
new file mode 100644
index 00000000..b7af84e1
--- /dev/null
+++ b/extra/tinyemu/PKGBUILD
@@ -0,0 +1,11 @@
+# disable 128 bit RISCV on 32-bit targets, not supported
+eval "$(
+ {
+ declare -f prepare || \
+ printf 'prepare() {\n}\n'
+ } \
+ | sed '
+ $i sed -i s/^CONFIG_INT128=.*/#CONFIG_INT128=n/ "$m"
+ '
+)"
+
diff --git a/extra/tpm2-tools/PKGBUILD b/extra/tpm2-tools/PKGBUILD
new file mode 100644
index 00000000..12056bad
--- /dev/null
+++ b/extra/tpm2-tools/PKGBUILD
@@ -0,0 +1,3 @@
+# check() is calling full regression testing for days! this kills
+# slaves and has thus been disabled..
+unset check
diff --git a/extra/tpm2-tss-engine/PKGBUILD b/extra/tpm2-tss-engine/PKGBUILD
new file mode 100644
index 00000000..612ef265
--- /dev/null
+++ b/extra/tpm2-tss-engine/PKGBUILD
@@ -0,0 +1,3 @@
+# tests hanging slaves
+# shasum for tpm2-tss-engine_check.sh (which skips the test)
+sha512sums[2]='0071a0bb54af9bcb95df724bc774a1b96b4142f91c45dc9e9ae7cf51d409b74a96c644bfa89e59ceb13f1249e36dfdcd4f0a607388d9e68a8ff5347bf7758a3e'
diff --git a/extra/tpm2-tss-engine/tpm2-tss-engine_check.sh b/extra/tpm2-tss-engine/tpm2-tss-engine_check.sh
new file mode 100644
index 00000000..7bcff090
--- /dev/null
+++ b/extra/tpm2-tss-engine/tpm2-tss-engine_check.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+echo 'we skip the tests'
diff --git a/extra/v2ray/PKGBUILD b/extra/v2ray/PKGBUILD
new file mode 100644
index 00000000..6d55fcd6
--- /dev/null
+++ b/extra/v2ray/PKGBUILD
@@ -0,0 +1,9 @@
+eval "$(
+ declare -f package | \
+ sed '
+ s@/v2ray-custom-linux-64/@/v2ray-custom-linux-32/@
+ '
+)"
+
+# tests hang or last forever
+unset check
diff --git a/extra/vamp-aubio-plugins/PKGBUILD b/extra/vamp-aubio-plugins/PKGBUILD
new file mode 100644
index 00000000..7d884b2e
--- /dev/null
+++ b/extra/vamp-aubio-plugins/PKGBUILD
@@ -0,0 +1,11 @@
+eval "$(
+ {
+ declare -f prepare || \
+ printf 'prepare() {\n}\n'
+ } \
+ | sed '
+ $i sed -i '"'"' \
+ 48 s/x86_64/i686/ \
+ '"'"' vamp-aubio-plugins-0.5.1/wscript
+ '
+)"
diff --git a/extra/vault/PKGBUILD b/extra/vault/PKGBUILD
new file mode 100644
index 00000000..ef7e780c
--- /dev/null
+++ b/extra/vault/PKGBUILD
@@ -0,0 +1,6 @@
+eval "$(
+ declare -f build | \
+ sed '
+ s,amd64,386,
+ '
+)"
diff --git a/extra/vbam/PKGBUILD b/extra/vbam/PKGBUILD
new file mode 100644
index 00000000..c96133dc
--- /dev/null
+++ b/extra/vbam/PKGBUILD
@@ -0,0 +1 @@
+makedepends+=('nasm')
diff --git a/extra/virtualbox/PKGBUILD b/extra/virtualbox/PKGBUILD
new file mode 100644
index 00000000..037684be
--- /dev/null
+++ b/extra/virtualbox/PKGBUILD
@@ -0,0 +1,49 @@
+# set manually sysctl vm.mmap_min_addr=0 before building this package
+
+# linker runs out of memory on 32-bit
+eval "$(
+ declare -f build | \
+ sed '
+ 3 i LDFLAGS+=" -Wl,--no-keep-memory"
+ 3 i CFLAGS+=" -g1"
+ 3 i CXXFLAGS+=" -g1"
+ '
+)"
+
+# Parallel builds lead to "virtual memory exhausted"?
+# not sure, if still needed (or in fact, working)
+eval "$(
+ declare -f build | \
+ sed '
+ \@^\s*echo @ {
+ N
+ \@\n\s*kmk @ d
+ }
+ s|kmk|kmk -j 1|
+ ' | \
+ sed '
+ \@^\s*\./configure @ {
+ s@--disable-\S\+@@g
+ s@--enable-\S\+@@g
+ s@configure @\0--only-additions --disable-kmods @
+ }
+ ';
+)"
+
+pkgname=(
+ $(
+ printf '%s\n' "${pkgname[@]}" \
+ | grep '^virtualbox-guest-' \
+ | grep -v -- '-nox$'
+ )
+)
+
+# let's not use too much memory, gcc tmpfiles can in this
+# case also be put on a real /tmp (instead of tmpfs) to reduce
+# preasure on the RAM
+eval "$(
+ declare -f build | \
+ sed '
+ /source/ i \ sed -i 's/-pipe//g' Config.kmk
+ '
+)"
diff --git a/extra/vtk/PKGBUILD b/extra/vtk/PKGBUILD
new file mode 100644
index 00000000..7f6e25a1
--- /dev/null
+++ b/extra/vtk/PKGBUILD
@@ -0,0 +1,4 @@
+# no python-matplotlib on i486
+if [ "$CARCH" = 'i486' ]; then
+ makedepends=(${makedepends[@]//python-matplotlib/})
+fi
diff --git a/extra/wine-gecko/PKGBUILD b/extra/wine-gecko/PKGBUILD
new file mode 100644
index 00000000..1b732d45
--- /dev/null
+++ b/extra/wine-gecko/PKGBUILD
@@ -0,0 +1,6 @@
+eval "$(
+ declare -f package | \
+ sed '
+ s/$pkgname-$pkgver-x86_64.msi//g
+ '
+)"
diff --git a/extra/wine/30-win32-aliases.conf b/extra/wine/30-win32-aliases.conf
new file mode 100644
index 00000000..99ae1f7b
--- /dev/null
+++ b/extra/wine/30-win32-aliases.conf
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+<fontconfig>
+ <alias binding="same">
+ <family>MS Shell Dlg</family>
+ <accept><family>Microsoft Sans Serif</family></accept>
+ <default><family>sans-serif</family></default>
+ </alias>
+ <alias binding="same">
+ <family>MS Shell Dlg 2</family>
+ <accept><family>Tahoma</family></accept>
+ <default><family>sans-serif</family></default>
+ </alias>
+
+ <alias binding="same">
+ <family>MS Sans Serif</family>
+ <prefer><family>Microsoft Sans Serif</family></prefer>
+ <default><family>sans-serif</family></default>
+ </alias>
+</fontconfig>
diff --git a/extra/wine/PKGBUILD b/extra/wine/PKGBUILD
new file mode 100644
index 00000000..2a624290
--- /dev/null
+++ b/extra/wine/PKGBUILD
@@ -0,0 +1,154 @@
+# Maintainer: Sven-Hendrik Haase <sh@lutzhaase.com>
+# Contributor: Jan "heftig" Steffens <jan.steffens@gmail.com>
+# Contributor: Eduardo Romero <eduardo@archlinux.org>
+# Contributor: Giovanni Scafora <giovanni@archlinux.org>
+
+pkgname=wine
+pkgver=8.5
+pkgrel=1
+
+_pkgbasever=${pkgver/rc/-rc}
+
+source=(https://dl.winehq.org/wine/source/8.x/$pkgname-$_pkgbasever.tar.xz{,.sign}
+ 30-win32-aliases.conf
+ wine-binfmt.conf)
+sha512sums=('f6aaab8a32eb7bce7f48d21d99417c9e6e8fe41b3d36320762775ef954db7ddd4fcff01d56475f35038d814557834a41a9e3ae85e5cae8a1b820c5044b42a327'
+ 'SKIP'
+ '6e54ece7ec7022b3c9d94ad64bdf1017338da16c618966e8baf398e6f18f80f7b0576edf1d1da47ed77b96d577e4cbb2bb0156b0b11c183a0accf22654b0a2bb'
+ 'bdde7ae015d8a98ba55e84b86dc05aca1d4f8de85be7e4bd6187054bfe4ac83b5a20538945b63fb073caab78022141e9545685e4e3698c97ff173cf30859e285')
+validpgpkeys=(5AC1A08B03BD7A313E0A955AF5E6E9EEB9461DD7
+ DA23579A74D4AD9AF9D3F945CEFAC8EAAF17519D)
+
+pkgdesc="A compatibility layer for running Windows programs"
+url="https://www.winehq.org"
+arch=(i486 i686 pentium4 x86_64)
+options=(staticlibs !lto)
+license=(LGPL)
+depends=(
+ fontconfig fontconfig
+ libxcursor libxcursor
+ libxrandr libxrandr
+ libxi libxi
+ gettext gettext
+ freetype2 freetype2
+ gcc-libs gcc-libs
+ libpcap libpcap
+ desktop-file-utils
+)
+makedepends=(autoconf bison perl flex
+ giflib giflib
+ gnutls gnutls
+ libxinerama libxinerama
+ libxcomposite libxcomposite
+ libxxf86vm libxxf86vm
+ v4l-utils v4l-utils
+ libpulse libpulse
+ alsa-lib alsa-lib
+ libxcomposite libxcomposite
+ mesa mesa
+ mesa-libgl mesa-libgl
+ opencl-icd-loader opencl-icd-loader
+ gst-plugins-base-libs gst-plugins-base-libs
+ vulkan-icd-loader vulkan-icd-loader
+ sdl2 sdl2
+ libcups libcups
+ libgphoto2
+ sane
+ vulkan-headers
+ samba
+ opencl-headers
+)
+optdepends=(
+ giflib giflib
+ libldap libldap
+ gnutls gnutls
+ v4l-utils v4l-utils
+ libpulse libpulse
+ alsa-plugins alsa-plugins
+ alsa-lib alsa-lib
+ libxcomposite libxcomposite
+ libxinerama libxinerama
+ opencl-icd-loader opencl-icd-loader
+ gst-plugins-base-libs gst-plugins-base-libs
+ sdl2 sdl2
+ libgphoto2
+ sane
+ cups
+ samba dosbox
+)
+makedepends=(${makedepends[@]} ${depends[@]})
+install=wine.install
+
+prepare() {
+ # Allow ccache to work
+ mv $pkgname-$_pkgbasever $pkgname
+
+ # Doesn't compile without remove these flags as of 4.10
+ export CFLAGS="${CFLAGS/-fno-plt/} -ffat-lto-objects"
+ export LDFLAGS="${LDFLAGS/,-z,now/}"
+
+ # Get rid of old build dirs
+ rm -rf $pkgname-{32,64}-build
+ mkdir $pkgname-32-build
+}
+
+build() {
+ cd "$srcdir"
+
+ msg2 "Building Wine-64..."
+
+ mkdir $pkgname-64-build
+ cd "$srcdir/$pkgname-64-build"
+ ../$pkgname/configure \
+ --prefix=/usr \
+ --libdir=/usr/lib \
+ --with-x \
+ --with-gstreamer \
+ --enable-win64
+ # Gstreamer was disabled for FS#33655
+
+ make
+
+ _wine32opts=(
+ --libdir=/usr/lib32
+ --with-wine64="$srcdir/$pkgname-64-build"
+ )
+
+ export PKG_CONFIG_PATH="/usr/lib32/pkgconfig"
+
+ msg2 "Building Wine-32..."
+ cd "$srcdir/$pkgname-32-build"
+ ../$pkgname/configure \
+ --prefix=/usr \
+ --with-x \
+ --with-gstreamer \
+ "${_wine32opts[@]}"
+
+ make
+}
+
+package() {
+ msg2 "Packaging Wine-32..."
+ cd "$srcdir/$pkgname-32-build"
+
+ make prefix="$pkgdir/usr" \
+ libdir="$pkgdir/usr/lib32" \
+ dlldir="$pkgdir/usr/lib32/wine" install
+
+ msg2 "Packaging Wine-64..."
+ cd "$srcdir/$pkgname-64-build"
+ make prefix="$pkgdir/usr" \
+ libdir="$pkgdir/usr/lib" \
+ dlldir="$pkgdir/usr/lib/wine" install
+
+ # Font aliasing settings for Win32 applications
+ install -d "$pkgdir"/usr/share/fontconfig/conf.{avail,default}
+ install -m644 "$srcdir/30-win32-aliases.conf" "$pkgdir/usr/share/fontconfig/conf.avail"
+ ln -s ../conf.avail/30-win32-aliases.conf "$pkgdir/usr/share/fontconfig/conf.default/30-win32-aliases.conf"
+ install -Dm 644 "$srcdir/wine-binfmt.conf" "$pkgdir/usr/lib/binfmt.d/wine.conf"
+
+ i686-w64-mingw32-strip --strip-unneeded "$pkgdir"/usr/lib32/wine/i386-windows/*.dll
+ x86_64-w64-mingw32-strip --strip-unneeded "$pkgdir"/usr/lib/wine/x86_64-windows/*.dll
+}
+
+# vim:set ts=8 sts=2 sw=2 et:
diff --git a/extra/wine/wine-binfmt.conf b/extra/wine/wine-binfmt.conf
new file mode 100644
index 00000000..4d430733
--- /dev/null
+++ b/extra/wine/wine-binfmt.conf
@@ -0,0 +1,2 @@
+# Start WINE on Windows executables
+:DOSWin:M::MZ::/usr/bin/wine:
diff --git a/extra/wine/wine.install b/extra/wine/wine.install
new file mode 100644
index 00000000..cbe10cc5
--- /dev/null
+++ b/extra/wine/wine.install
@@ -0,0 +1,7 @@
+post_install() {
+ echo "Run 'systemctl restart systemd-binfmt' in order to make the wine binfmt available on your system."
+}
+
+post_remove() {
+ echo "binfmt binary formats will be updated at reboot"
+}
diff --git a/extra/xaos/PKGBUILD b/extra/xaos/PKGBUILD
new file mode 100644
index 00000000..15dd3e6c
--- /dev/null
+++ b/extra/xaos/PKGBUILD
@@ -0,0 +1,14 @@
+source+=('xaos.patch')
+sha256sums+=('b07cdc88be38a30a40bccc2f999bff50ae8a25fc10ed4f2f7c7e2ff117f085e5')
+
+eval "$(
+ {
+ declare -f prepare || \
+ printf 'prepare() {\n}\n'
+ } \
+ | sed '
+ $i patch -p1 -N -i "$srcdir/xaos.patch" -d "$srcdir/$pkgname-$pkgver" \
+ gendesk -f -n --pkgname=$pkgname --pkgdesc="$pkgdesc" \\\
+ --categories='"'"'Application;Graphics'"'"'
+ '
+)"
diff --git a/extra/xaos/xaos.patch b/extra/xaos/xaos.patch
new file mode 100644
index 00000000..7f29f57a
--- /dev/null
+++ b/extra/xaos/xaos.patch
@@ -0,0 +1,22 @@
+diff --unified --recursive --text xaos-3.6.orig/src/engine/zoom.c xaos-3.6.new/src/engine/zoom.c
+--- xaos-3.6.orig/src/engine/zoom.c 2013-11-01 08:54:21.000000000 +0100
++++ xaos-3.6.new/src/engine/zoom.c 2019-11-03 12:19:31.569988390 +0100
+@@ -933,6 +933,7 @@
+ }
+
+ #ifndef USE_i386ASM
++REGISTERS(0)
+ static /*INLINE */ void
+ moveoldpoints(void /*@unused@ */ *data1,
+ struct taskinfo /*@unused@ */ *task,
+diff --unified --recursive --text xaos-3.6.orig/src/engine/zoomd.c xaos-3.6.new/src/engine/zoomd.c
+--- xaos-3.6.orig/src/engine/zoomd.c 2013-11-01 08:54:21.000000000 +0100
++++ xaos-3.6.new/src/engine/zoomd.c 2019-11-03 12:19:39.910033088 +0100
+@@ -280,6 +280,7 @@
+ #endif
+ #undef bpp1
+
++REGISTERS(0)
+ static INLINE void fillline(int line)
+ {
+ register unsigned char *RESTRICT vbuff = cimage.currlines[line];
diff --git a/extra/yder/PKGBUILD b/extra/yder/PKGBUILD
new file mode 100644
index 00000000..edf9e606
--- /dev/null
+++ b/extra/yder/PKGBUILD
@@ -0,0 +1,2 @@
+# FS#69632
+makedepends+=(systemd)
diff --git a/extra/z3/PKGBUILD b/extra/z3/PKGBUILD
new file mode 100644
index 00000000..7b727e00
--- /dev/null
+++ b/extra/z3/PKGBUILD
@@ -0,0 +1,9 @@
+# LTO on i486 results in out-of-memory
+if [ "$CARCH" == 'i486' ]; then
+ eval "$(
+ declare -f build | \
+ sed '
+ s/-DZ3_LINK_TIME_OPTIMIZATION=1/-DZ3_LINK_TIME_OPTIMIZATION=0/
+ '
+ )"
+fi
diff --git a/extra/zeroc-ice/PKGBUILD b/extra/zeroc-ice/PKGBUILD
new file mode 100644
index 00000000..b82d04eb
--- /dev/null
+++ b/extra/zeroc-ice/PKGBUILD
@@ -0,0 +1,7 @@
+eval "$(
+ declare -f package_zeroc-ice| \
+ sed '
+ s|rm.*/usr/lib.*||
+ s|mv.*/usr/lib64.*/usr/lib.*||
+ '
+)"
diff --git a/extra/zeromq/PKGBUILD b/extra/zeromq/PKGBUILD
new file mode 100644
index 00000000..a86965d9
--- /dev/null
+++ b/extra/zeromq/PKGBUILD
@@ -0,0 +1,9 @@
+# libpgm causes linking issues with intrinsics on 32-bit
+depends=(${depends[@]/libpgm/})
+
+eval "$(
+ declare -f build | \
+ sed '
+ s/--with-pgm //
+ '
+)"
diff --git a/extra/zig/PKGBUILD b/extra/zig/PKGBUILD
new file mode 100644
index 00000000..5dc0b4f4
--- /dev/null
+++ b/extra/zig/PKGBUILD
@@ -0,0 +1,3 @@
+# check() raises OOM-errors
+unset check
+unset checkdepends