Fix building bundled sm-91 with clang-16.
[0ad.git] / libraries / source / spidermonkey / patch.sh
blob876f5de2848563a92afd25df936632cb0aed1225
1 #!/bin/sh
2 set -e
4 OS="${OS:=$(uname -s)}"
5 # Apply patches if needed
6 # This script gets called from build.sh.
8 # The rust code is only linked if the JS Shell is enabled,
9 # which fails now that rust is required in all cases.
10 # https://bugzilla.mozilla.org/show_bug.cgi?id=1588340
11 patch -p1 < ../FixRustLinkage.diff
13 # On windows, we need to differente debug/release library names.
14 patch -p1 < ../FixWindowsLibNames.diff
16 # There is an issue on 32-bit linux builds sometimes.
17 # NB: the patch here is Comment 21 modified by Comment 25
18 # but that seems to imperfectly fix the issue with GCC.
19 # It also won't compile on windows - in doubt, apply only where relevant.
20 # https://bugzilla.mozilla.org/show_bug.cgi?id=1729459
21 if [ "$(uname -m)" = "i686" ] && [ "${OS}" != "Windows_NT" ]
22 then
23 patch -p1 < ../FixFpNormIssue.diff
26 if [ "$OS" = "Darwin" ]
27 then
28 # The bundled virtualenv version is not working on MacOS
29 # with recent homebrew and needs to be upgraded.
30 # Install it locally to not pollute anything.
31 pip3 install --upgrade -t virtualenv virtualenv
32 export PYTHONPATH="$(pwd)/virtualenv:$PYTHONPATH"
33 patch -p1 < ../FixVirtualEnv.diff
36 if [ "$OS" = "Linux" ]
37 then
38 # Use sysconfig instead of distutils with the bundled virtualenv
39 # This fixes an issue with install schemes on recent Debian and Fedora
40 # Furthermore, distutils is going to be deprecated and is replaced
41 # by sysconfig in ESR102
42 patch -p1 < ../FixInstallScheme.diff
44 # Extend the previous fix with a portion of the following commit
45 # https://phabricator.services.mozilla.com/D130410
46 # This will prevent bug 1739486 from happening on Fedora
47 patch -p1 < ../FixFedoraVirtualEnv.diff
50 # Python >= 3.11 support
51 PYTHON_MINOR_VERSION="$(python3 -c 'import sys; print(sys.version_info.minor)')"
52 if [ "$PYTHON_MINOR_VERSION" -ge 11 ];
53 then
54 patch -p1 < ../FixUnicodePython311.diff
57 # fixed in SM102
58 patch -p1 < ../FixClang16Build.diff