diff options
Diffstat (limited to 'os/emscripten/emsdk-liblzma.patch')
-rw-r--r-- | os/emscripten/emsdk-liblzma.patch | 55 |
1 files changed, 23 insertions, 32 deletions
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): |