File: patch.sh

package info (click to toggle)
0ad 0.0.26-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 130,460 kB
  • sloc: cpp: 261,824; ansic: 198,392; javascript: 19,067; python: 14,557; sh: 7,629; perl: 4,072; xml: 849; makefile: 741; java: 533; ruby: 229; php: 190; pascal: 30; sql: 21; tcl: 4
file content (90 lines) | stat: -rw-r--r-- 3,886 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/sh
# Apply patches if needed
# This script gets called from build.sh.

# SM78 fails to create virtual envs on macs with python > 3.7
# Unfortunately, 3.7 is mostly unavailable on ARM macs.
# Therefore, replace the custom script with a more up-to-date version from pip
# if python is detected to be newer than 3.7.
if [ "$(uname -s)" = "Darwin" ];
then
    PYTHON_MINOR_VERSION="$(python3 -c 'import sys; print(sys.version_info.minor)')"
    if [ "$PYTHON_MINOR_VERSION" -gt 7 ];
    then
        # SM actually uses features from the full-fledged virtualenv package
        # and not just venv, so install it to be safe.
        # Install it locally to not pollute anything.
        # Install specifically a version that's know to work.
        pip3 install --upgrade -t virtualenv 'virtualenv==20.13.1'
        export PYTHONPATH="$(pwd)/virtualenv:$PYTHONPATH"
        patch -p1 < ../FixVirtualEnv.diff
    fi
else
    # In python 3.10 `sysconfig._get_default_scheme()` was renamed to
    # `sysconfig.get_default_scheme()`. This breaks the version of
    # `virtualenv` bundled with the spidermonkey source code.
    #
    # It is assumed that the updated version fetched for macOS systems
    # above does not have this problem.
    patch -p1 < ../FixVirtualenvForPython310.diff
fi

# Mozglue symbols need to be linked against static builds.
# https://bugzilla.mozilla.org/show_bug.cgi?id=1588340
patch -p1 < ../FixMozglue.diff

# Update library names to have separate debug/release libraries.
patch -p1 < ../RenameLibs.diff

# Fix ~SharedArrayRawBufferRefs symbol not found.
# See https://bugzilla.mozilla.org/show_bug.cgi?id=1644600
# Many thanks to bellaz89 for finding this and reporting it
patch -p1 < ../FixSharedArray.diff

# Fix public export on MSVC (C2487)
# https://bugzilla.mozilla.org/show_bug.cgi?id=1614243
# (mentionned in the comments, no patch/commit found)
patch -p1 < ../FixPublicExport.diff

# Fix Rooted<void*> not working on VS17
# https://bugzilla.mozilla.org/show_bug.cgi?id=1679736
# (Landed in 85)
patch -p1 < ../FixMSVCRootedVoid.diff

# Two SDK-related issues.
# -ftrivial-auto-var-init is clang 8,
# but apple-clang 10.0.0 (the maximum in 10.13)
# doesn't actually have it, so patch it out.
# Secondly, there is a 'max SDK version' in SM,
# which is set to 10.15.4 in SM78.
# Upstream has changed this to 10.11 at the moment,
# so this patches it to an arbitrarily high Mac OS 11
patch -p1 < ../FixMacBuild.diff

# In python 3.3, the Collections' Abstract Base Classes were moved from `collections` to
# `collections.abc`, and aliases were set up for backwards compatibility.
# In python 3.10, these aliases were removed, requiring all code that used them to update.
patch -p1 < ../FixPythonCollectionABC.diff

# Fix FP access breaking compilation on RPI3+
# https://bugzilla.mozilla.org/show_bug.cgi?id=1526653
# https://bugzilla.mozilla.org/show_bug.cgi?id=1536491
patch -p1 < ../FixRpiUnalignedFpAccess.diff

# Bug 1684261 upstreamed from 78.8: https://hg.mozilla.org/releases/mozilla-esr78/rev/0e8f444683cb
# Note that this isn't quite the upstream patch to match our version.
patch -p1 < ../FixRust150.diff

# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1001882
patch -p1 < ../Fix-armhf-build-for-GCC-11-627.patch

# Patch those separately, as they might interfere with normal behaviour.
if [ "$(uname -s)" = "FreeBSD" ];
then
    # https://svnweb.freebsd.org/ports/head/lang/spidermonkey78/files/patch-js_moz.configure?view=log
    patch -p1 < ../FixFreeBSDReadlineDetection.diff
    # https://svnweb.freebsd.org/ports/head/lang/spidermonkey78/files/patch-third__party_rust_cc_.cargo-checksum.json?view=log
    patch -p1 < ../FixFreeBSDCargoChecksum.diff
    # https://svnweb.freebsd.org/ports/head/lang/spidermonkey78/files/patch-third__party_rust_cc_src_lib.rs?view=log
    patch -p1 < ../FixFreeBSDRustThirdPartyOSDetection.diff
fi