Skip to content

Commit e3a6ca9

Browse files
committed
fix: fix web build
after an upstream patch the local patch files needed to be adjusted
1 parent fc7ee29 commit e3a6ca9

File tree

2 files changed

+19
-20
lines changed

2 files changed

+19
-20
lines changed

platforms/build-web.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ if ! [ -e "$EMSCRIPTEN_PATCH_FILE" ]; then
2525
##TODO: upstream those patches
2626
# see: https://github.com/emscripten-core/emscripten/pull/18379/commits
2727
# and: https://github.com/emscripten-core/emscripten/pull/18379
28+
# and: https://github.com/emscripten-core/emscripten/pull/22946
2829

2930
git apply --unsafe-paths -p1 --directory="$EMSCRIPTEN_UPSTREAM_ROOT" "$PATCH_DIR/sdl2_image_port.diff"
3031
git apply --unsafe-paths -p1 --directory="$EMSCRIPTEN_UPSTREAM_ROOT" "$PATCH_DIR/sdl2_mixer_port.diff"
Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
diff --git a/tools/ports/sdl2_image.py b/tools/ports/sdl2_image.py
2-
index c72ef576..0c12feba 100644
2+
index 70fa1499..36be807b 100644
33
--- a/tools/ports/sdl2_image.py
44
+++ b/tools/ports/sdl2_image.py
5-
@@ -16,15 +16,17 @@ variants = {
5+
@@ -18,7 +18,8 @@ variants = {
66
}
77

88
OPTIONS = {
@@ -12,46 +12,44 @@ index c72ef576..0c12feba 100644
1212
}
1313

1414
SUPPORTED_FORMATS = {'avif', 'bmp', 'gif', 'jpg', 'jxl', 'lbm', 'pcx', 'png',
15-
'pnm', 'qoi', 'svg', 'tga', 'tif', 'webp', 'xcf', 'xpm', 'xv'}
15+
@@ -26,7 +27,8 @@ SUPPORTED_FORMATS = {'avif', 'bmp', 'gif', 'jpg', 'jxl', 'lbm', 'pcx', 'png',
1616

1717
# user options (from --use-port)
18-
-opts: Dict[str, Set] = {
18+
opts: Dict[str, Set] = {
1919
- 'formats': set()
20-
+opts = {
2120
+ 'formats': set(),
2221
+ 'mt': 0
2322
}
2423

2524

26-
@@ -42,7 +44,7 @@ def get_lib_name(settings):
25+
@@ -44,7 +46,7 @@ def get_lib_name(settings):
2726
libname = 'libSDL2_image'
2827
if formats != '':
29-
libname += '_' + formats
30-
- return libname + '.a'
31-
+ return libname + ('-mt' if opts['mt'] else '') + '.a'
32-
33-
34-
def get(ports, settings, shared):
35-
@@ -70,6 +72,8 @@ def get(ports, settings, shared):
28+
libname += '-' + formats
29+
- if settings.PTHREADS:
30+
+ if settings.PTHREADS or opts['mt']:
31+
libname += '-mt'
32+
return libname + '.a'
3633

34+
@@ -75,7 +77,7 @@ def get(ports, settings, shared):
3735
if 'jpg' in formats:
38-
defs += ['-sUSE_LIBJPEG']
39-
+ if opts['mt']:
40-
+ defs += ['-pthread']
36+
flags += ['-sUSE_LIBJPEG']
4137

42-
ports.build_port(src_dir, final, 'sdl2_image', flags=defs, srcs=srcs)
38+
- if settings.PTHREADS:
39+
+ if settings.PTHREADS or opts['mt']:
40+
flags += ['-pthread']
4341

44-
@@ -99,7 +103,12 @@ def handle_options(options, error_handler):
42+
ports.build_port(src_dir, final, 'sdl2_image', flags=flags, srcs=srcs)
43+
@@ -106,6 +108,12 @@ def handle_options(options, error_handler):
4544
error_handler(f'{format} is not a supported format')
4645
else:
4746
opts['formats'].add(format)
48-
-
4947
+
5048
+ mt = options['mt']
5149
+ if mt not in ["1","0"]:
5250
+ error_handler(f'{mt} has to be either 0 or 1')
5351
+ else:
5452
+ opts['mt'] = int(mt)
5553

54+
5655
def show():
57-
return 'sdl2_image (-sUSE_SDL_IMAGE=2 or --use-port=sdl2_image; zlib license)'

0 commit comments

Comments
 (0)