diff options
author | Patric Stout <truebrain@openttd.org> | 2021-10-03 16:20:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-03 16:20:05 +0200 |
commit | 3046a6ce39d755f50207a2c4a1235069a0eb23fb (patch) | |
tree | d3d6477b628b83765bd1b925b74c9d238eb21f63 /os | |
parent | e404d16929991d1eddd9d37b859d3813be7e18ed (diff) | |
download | openttd-3046a6ce39d755f50207a2c4a1235069a0eb23fb.tar.xz |
Change: upgrade Emscripten to 2.0.31 and enable LZMA by default (#9604)
Diffstat (limited to 'os')
-rw-r--r-- | os/emscripten/Dockerfile | 2 | ||||
-rw-r--r-- | os/emscripten/README.md | 2 | ||||
-rw-r--r-- | os/emscripten/emsdk-liblzma.patch | 55 |
3 files changed, 25 insertions, 34 deletions
diff --git a/os/emscripten/Dockerfile b/os/emscripten/Dockerfile index 5184af643..cbbff38c1 100644 --- a/os/emscripten/Dockerfile +++ b/os/emscripten/Dockerfile @@ -1,4 +1,4 @@ -FROM emscripten/emsdk:2.0.10 +FROM emscripten/emsdk:2.0.31 COPY emsdk-liblzma.patch / RUN cd /emsdk/upstream/emscripten && patch -p1 < /emsdk-liblzma.patch diff --git a/os/emscripten/README.md b/os/emscripten/README.md index 4c5d7508c..59f17c626 100644 --- a/os/emscripten/README.md +++ b/os/emscripten/README.md @@ -1,6 +1,6 @@ ## How to build with Emscripten -Building with Emscripten works with emsdk 2.0.10 and above. +Building with Emscripten works with emsdk 2.0.31 and above. Currently there is no LibLZMA support upstream; for this we suggest to apply the provided patch in this folder to your emsdk installation. diff --git a/os/emscripten/emsdk-liblzma.patch b/os/emscripten/emsdk-liblzma.patch index 103adae0c..aa75fa5a4 100644 --- a/os/emscripten/emsdk-liblzma.patch +++ b/os/emscripten/emsdk-liblzma.patch @@ -10,44 +10,35 @@ Modifed by OpenTTD to have the bare minimum needed to work. Otherwise there are constantly conflicts when trying to apply this patch to different versions of emsdk. -diff --git a/embuilder.py b/embuilder.py -index 818262190ed..ab7d5adb7b2 100755 ---- a/embuilder.py -+++ b/embuilder.py -@@ -60,6 +60,7 @@ - 'harfbuzz', - 'icu', - 'libjpeg', -+ 'liblzma', - 'libpng', - 'ogg', - 'regal', -@@ -197,6 +198,8 @@ def main(): - build_port('ogg', libname('libogg')) - elif what == 'libjpeg': - build_port('libjpeg', libname('libjpeg')) -+ elif what == 'liblzma': -+ build_port('liblzma', libname('liblzma')) - elif what == 'libpng': - build_port('libpng', libname('libpng')) - elif what == 'sdl2': +diff --git a/tools/settings.py b/tools/settings.py +--- a/tools/settings.py ++++ b/tools/settings.py +@@ -38,6 +38,7 @@ + 'USE_SDL_NET', + 'USE_SDL_GFX', + 'USE_LIBJPEG', ++ 'USE_LIBLZMA', + 'USE_OGG', + 'USE_REGAL', + 'USE_BOOST_HEADERS', diff --git a/src/settings.js b/src/settings.js -index 61cd98939ba..be6fcb678c6 100644 --- a/src/settings.js +++ b/src/settings.js -@@ -1197,6 +1197,9 @@ var USE_BZIP2 = 0; +@@ -1382,8 +1382,12 @@ var USE_BZIP2 = 0; // 1 = use libjpeg from emscripten-ports + // [link] var USE_LIBJPEG = 0; +// 1 = use liblzma from emscripten-ports ++// [link] +var USE_LIBLZMA = 0; + // 1 = use libpng from emscripten-ports + // [link] var USE_LIBPNG = 0; diff --git a/tools/ports/liblzma.py b/tools/ports/liblzma.py new file mode 100644 -index 00000000000..e9567ef36ff --- /dev/null +++ b/tools/ports/liblzma.py @@ -0,0 +1,160 @@ @@ -58,6 +49,8 @@ index 00000000000..e9567ef36ff + +import os +import shutil ++import logging ++from pathlib import Path + +VERSION = '5.2.5' +HASH = '7443674247deda2935220fbc4dfc7665e5bb5a260be8ad858c8bd7d7b9f0f868f04ea45e62eb17c0a5e6a2de7c7500ad2d201e2d668c48ca29bd9eea5a73a3ce' @@ -68,10 +61,11 @@ index 00000000000..e9567ef36ff + + +def get(ports, settings, shared): -+ libname = ports.get_lib_name('liblzma') + ports.fetch_project('liblzma', 'https://tukaani.org/xz/xz-' + VERSION + '.tar.gz', 'xz-' + VERSION, sha512hash=HASH) + -+ def create(): ++ def create(final): ++ logging.info('building port: liblzma') ++ + ports.clear_project_build('liblzma') + + source_path = os.path.join(ports.get_dir(), 'liblzma', 'xz-' + VERSION) @@ -88,22 +82,19 @@ index 00000000000..e9567ef36ff + 'tuklib_exit.c', 'tuklib_mbstr_fw.c', 'tuklib_mbstr_width.c', 'tuklib_open_stdxxx.c', 'tuklib_progname.c'] + include_dirs_rel = ['../common', 'api', 'common', 'check', 'lz', 'rangecoder', 'lzma', 'delta', 'simple'] + -+ open(os.path.join(dest_path, 'src', 'config.h'), 'w').write(config_h) ++ Path(dest_path, os.path.join('src', 'config.h')).write_text(config_h) + -+ final = os.path.join(dest_path, libname) + include_dirs = [os.path.join(dest_path, 'src', 'liblzma', p) for p in include_dirs_rel] + ports.build_port(os.path.join(dest_path, 'src'), final, flags=build_flags, exclude_dirs=exclude_dirs, exclude_files=exclude_files, includes=include_dirs) + + ports.install_headers(os.path.join(dest_path, 'src', 'liblzma', 'api'), 'lzma.h') + ports.install_headers(os.path.join(dest_path, 'src', 'liblzma', 'api', 'lzma'), '*.h', 'lzma') + -+ return final -+ -+ return [shared.Cache.get(libname, create, what='port')] ++ return [shared.Cache.get_lib('liblzma.a', create, what='port')] + + +def clear(ports, settings, shared): -+ shared.Cache.erase_file(ports.get_lib_name('liblzma')) ++ shared.Cache.erase_lib('liblzma.a') + + +def process_args(ports): |