1
1
diff --git a/tools/ports/sdl2_image.py b/tools/ports/sdl2_image.py
2
- index c72ef576..0c12feba 100644
2
+ index 70fa1499..36be807b 100644
3
3
--- a/tools/ports/sdl2_image.py
4
4
+++ b/tools/ports/sdl2_image.py
5
- @@ -16,15 +16,17 @@ variants = {
5
+ @@ -18,7 +18,8 @@ variants = {
6
6
}
7
7
8
8
OPTIONS = {
@@ -12,46 +12,44 @@ index c72ef576..0c12feba 100644
12
12
}
13
13
14
14
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',
16
16
17
17
# user options (from --use-port)
18
- - opts: Dict[str, Set] = {
18
+ opts: Dict[str, Set] = {
19
19
- 'formats': set()
20
- + opts = {
21
20
+ 'formats': set(),
22
21
+ 'mt': 0
23
22
}
24
23
25
24
26
- @@ -42 ,7 +44 ,7 @@ def get_lib_name(settings):
25
+ @@ -44 ,7 +46 ,7 @@ def get_lib_name(settings):
27
26
libname = 'libSDL2_image'
28
27
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'
36
33
34
+ @@ -75,7 +77,7 @@ def get(ports, settings, shared):
37
35
if 'jpg' in formats:
38
- defs += ['-sUSE_LIBJPEG']
39
- + if opts['mt']:
40
- + defs += ['-pthread']
36
+ flags += ['-sUSE_LIBJPEG']
41
37
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']
43
41
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):
45
44
error_handler(f'{format} is not a supported format')
46
45
else:
47
46
opts['formats'].add(format)
48
- -
49
47
+
50
48
+ mt = options['mt']
51
49
+ if mt not in ["1","0"]:
52
50
+ error_handler(f'{mt} has to be either 0 or 1')
53
51
+ else:
54
52
+ opts['mt'] = int(mt)
55
53
54
+
56
55
def show():
57
- return 'sdl2_image (-sUSE_SDL_IMAGE=2 or --use-port=sdl2_image; zlib license)'
0 commit comments