Merge branch 'master' into jgrpp
# Conflicts: # .gitignore # CMakeLists.txt # src/3rdparty/optional/optional.hpp # src/group_cmd.cpp # src/industry_cmd.cpp # src/misc_gui.cpp # src/video/sdl2_v.cpppull/217/head
commit
43980639de
@ -0,0 +1,133 @@
|
||||
name: Preview build
|
||||
|
||||
on:
|
||||
repository_dispatch:
|
||||
types:
|
||||
- Preview*
|
||||
|
||||
jobs:
|
||||
preview:
|
||||
name: Build preview
|
||||
|
||||
runs-on: ubuntu-20.04
|
||||
container:
|
||||
# If you change this version, change the number in the cache step too.
|
||||
image: emscripten/emsdk:2.0.10
|
||||
# uid=1001(runner) gid=121(docker)
|
||||
options: -u 1001:121
|
||||
|
||||
steps:
|
||||
- name: Update deployment status to in progress
|
||||
uses: octokit/request-action@v2.x
|
||||
with:
|
||||
route: POST /repos/{owner}/{repo}/deployments/{deployment_id}/statuses
|
||||
mediaType: |
|
||||
previews:
|
||||
- ant-man
|
||||
- flash
|
||||
owner: ${{ github.event.repository.owner.login }}
|
||||
repo: ${{ github.event.repository.name }}
|
||||
deployment_id: ${{ github.event.client_payload.deployment_id }}
|
||||
state: in_progress
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.PREVIEW_GITHUB_TOKEN }}
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: ${{ github.event.client_payload.sha }}
|
||||
|
||||
- name: Name branch
|
||||
run: |
|
||||
name=$(echo "${{ github.event.client_payload.folder }}")
|
||||
git checkout -b ${name}
|
||||
|
||||
- name: Setup cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: /emsdk/upstream/emscripten/cache
|
||||
key: 2.0.10-${{ runner.os }}
|
||||
|
||||
- name: Build (host tools)
|
||||
run: |
|
||||
mkdir build-host
|
||||
cd build-host
|
||||
|
||||
echo "::group::CMake"
|
||||
cmake .. -DOPTION_TOOLS_ONLY=ON
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Build"
|
||||
echo "Running on $(nproc) cores"
|
||||
make -j$(nproc) tools
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Install GCC problem matcher
|
||||
uses: ammaraskar/gcc-problem-matcher@master
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
echo "::group::CMake"
|
||||
emcmake cmake .. \
|
||||
-DHOST_BINARY_DIR=../build-host \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
# EOF
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Build"
|
||||
echo "Running on $(nproc) cores"
|
||||
emmake make -j$(nproc)
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Publish preview
|
||||
run: |
|
||||
# setuptools is missing in this Docker image, which breaks installing
|
||||
# awscli. So we need to do this in two steps to recover sanity.
|
||||
pip3 install setuptools
|
||||
pip3 install awscli
|
||||
|
||||
~/.local/bin/aws s3 cp --only-show-errors build/openttd.data s3://${{ secrets.PREVIEW_S3_BUCKET }}/${{ github.event.client_payload.folder }}/
|
||||
~/.local/bin/aws s3 cp --only-show-errors build/openttd.html s3://${{ secrets.PREVIEW_S3_BUCKET }}/${{ github.event.client_payload.folder }}/
|
||||
~/.local/bin/aws s3 cp --only-show-errors build/openttd.js s3://${{ secrets.PREVIEW_S3_BUCKET }}/${{ github.event.client_payload.folder }}/
|
||||
~/.local/bin/aws s3 cp --only-show-errors build/openttd.wasm s3://${{ secrets.PREVIEW_S3_BUCKET }}/${{ github.event.client_payload.folder }}/
|
||||
|
||||
# Invalidate the cache of the CloudFront distribution
|
||||
~/.local/bin/aws cloudfront create-invalidation --distribution-id ${{ secrets.PREVIEW_CF_DISTRIBUTION_ID }} --paths "/${{ github.event.client_payload.folder }}/*"
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
|
||||
- name: Update deployment status to success
|
||||
uses: octokit/request-action@v2.x
|
||||
with:
|
||||
route: POST /repos/{owner}/{repo}/deployments/{deployment_id}/statuses
|
||||
mediaType: |
|
||||
previews:
|
||||
- ant-man
|
||||
- flash
|
||||
owner: ${{ github.event.repository.owner.login }}
|
||||
repo: ${{ github.event.repository.name }}
|
||||
deployment_id: ${{ github.event.client_payload.deployment_id }}
|
||||
state: success
|
||||
environment_url: https://preview.openttd.org/${{ github.event.client_payload.folder }}/
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.PREVIEW_GITHUB_TOKEN }}
|
||||
|
||||
- if: failure()
|
||||
name: Update deployment status to failure
|
||||
uses: octokit/request-action@v2.x
|
||||
with:
|
||||
route: POST /repos/{owner}/{repo}/deployments/{deployment_id}/statuses
|
||||
mediaType: |
|
||||
previews:
|
||||
- ant-man
|
||||
- flash
|
||||
owner: ${{ github.event.repository.owner.login }}
|
||||
repo: ${{ github.event.repository.name }}
|
||||
deployment_id: ${{ github.event.client_payload.deployment_id }}
|
||||
state: failure
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.PREVIEW_GITHUB_TOKEN }}
|
@ -0,0 +1,66 @@
|
||||
name: Preview label
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types:
|
||||
- labeled
|
||||
|
||||
env:
|
||||
TEAM_CORE_DEVELOPER: core-developers
|
||||
|
||||
jobs:
|
||||
check_preview_label:
|
||||
name: Check for preview label
|
||||
if: github.event.action == 'labeled' && github.event.label.name == 'preview'
|
||||
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
steps:
|
||||
- name: Check if label was added by core developer
|
||||
id: core_developer
|
||||
continue-on-error: true
|
||||
uses: octokit/request-action@v2.x
|
||||
with:
|
||||
route: GET /orgs/OpenTTD/teams/${{ env.TEAM_CORE_DEVELOPER }}/memberships/${{ github.event.sender.login }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.PREVIEW_GITHUB_TOKEN }}
|
||||
|
||||
- if: steps.core_developer.outcome == 'failure'
|
||||
name: Remove preview label if not core developer
|
||||
uses: octokit/request-action@v2.x
|
||||
with:
|
||||
route: DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels/preview
|
||||
owner: ${{ github.event.repository.owner.login }}
|
||||
repo: ${{ github.event.repository.name }}
|
||||
issue_number: ${{ github.event.number }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.PREVIEW_GITHUB_TOKEN }}
|
||||
|
||||
- if: steps.core_developer.outcome == 'success'
|
||||
name: Create deployment
|
||||
id: deployment
|
||||
uses: octokit/request-action@v2.x
|
||||
with:
|
||||
route: POST /repos/{owner}/{repo}/deployments
|
||||
mediaType: |
|
||||
previews:
|
||||
- ant-man
|
||||
- flash
|
||||
owner: ${{ github.event.repository.owner.login }}
|
||||
repo: ${{ github.event.repository.name }}
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
task: deploy:preview
|
||||
auto_merge: false
|
||||
required_contexts: "[]"
|
||||
environment: preview-pr-${{ github.event.number }}
|
||||
description: "Preview for Pull Request #${{ github.event.number }}"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.PREVIEW_GITHUB_TOKEN }}
|
||||
|
||||
- if: steps.core_developer.outcome == 'success'
|
||||
name: Trigger 'preview build'
|
||||
uses: peter-evans/repository-dispatch@v1
|
||||
with:
|
||||
token: ${{ secrets.PREVIEW_GITHUB_TOKEN }}
|
||||
event-type: "Preview build #${{ github.event.number }}"
|
||||
client-payload: '{"folder": "pr${{ github.event.number }}", "sha": "${{ github.event.pull_request.head.sha }}", "deployment_id": "${{ fromJson(steps.deployment.outputs.data).id }}"}'
|
@ -0,0 +1,66 @@
|
||||
name: Preview push
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types:
|
||||
- synchronize
|
||||
|
||||
jobs:
|
||||
check_new_preview:
|
||||
name: Check preview needs update
|
||||
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
steps:
|
||||
- name: Check if earlier preview exists
|
||||
id: earlier_preview
|
||||
uses: octokit/request-action@v2.x
|
||||
with:
|
||||
route: GET /repos/{owner}/{repo}/deployments
|
||||
owner: ${{ github.event.repository.owner.login }}
|
||||
repo: ${{ github.event.repository.name }}
|
||||
environment: preview-pr-${{ github.event.number }}
|
||||
per_page: 1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.PREVIEW_GITHUB_TOKEN }}
|
||||
|
||||
- if: toJson(fromJson(steps.earlier_preview.outputs.data)) != '[]'
|
||||
name: Check for preview label
|
||||
id: preview_label
|
||||
uses: octokit/request-action@v2.x
|
||||
with:
|
||||
route: GET /repos/{owner}/{repo}/issues/{issue_number}/labels
|
||||
owner: ${{ github.event.repository.owner.login }}
|
||||
repo: ${{ github.event.repository.name }}
|
||||
issue_number: ${{ github.event.number }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.PREVIEW_GITHUB_TOKEN }}
|
||||
|
||||
- if: toJson(fromJson(steps.earlier_preview.outputs.data)) != '[]' && contains(fromJson(steps.preview_label.outputs.data).*.name, 'preview')
|
||||
name: Create deployment
|
||||
id: deployment
|
||||
uses: octokit/request-action@v2.x
|
||||
with:
|
||||
route: POST /repos/{owner}/{repo}/deployments
|
||||
mediaType: |
|
||||
previews:
|
||||
- ant-man
|
||||
- flash
|
||||
owner: ${{ github.event.repository.owner.login }}
|
||||
repo: ${{ github.event.repository.name }}
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
task: deploy:preview
|
||||
auto_merge: false
|
||||
required_contexts: "[]"
|
||||
environment: preview-pr-${{ github.event.number }}
|
||||
description: "Preview for Pull Request #${{ github.event.number }}"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.PREVIEW_GITHUB_TOKEN }}
|
||||
|
||||
- if: toJson(fromJson(steps.earlier_preview.outputs.data)) != '[]' && contains(fromJson(steps.preview_label.outputs.data).*.name, 'preview')
|
||||
name: Trigger 'preview build'
|
||||
uses: peter-evans/repository-dispatch@v1
|
||||
with:
|
||||
token: ${{ secrets.PREVIEW_GITHUB_TOKEN }}
|
||||
event-type: "Preview build #${{ github.event.number }}"
|
||||
client-payload: '{"folder": "pr${{ github.event.number }}", "sha": "${{ github.event.pull_request.head.sha }}", "deployment_id": "${{ fromJson(steps.deployment.outputs.data).id }}"}'
|
@ -0,0 +1,4 @@
|
||||
FROM emscripten/emsdk
|
||||
|
||||
COPY emsdk-liblzma.patch /
|
||||
RUN cd /emsdk/upstream/emscripten && patch -p1 < /emsdk-liblzma.patch
|
@ -0,0 +1,40 @@
|
||||
## How to build with Emscripten
|
||||
|
||||
Building with Emscripten works with emsdk 2.0.10 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.
|
||||
|
||||
For convenience, a Dockerfile is supplied that does this patches for you
|
||||
against upstream emsdk docker. Best way to use it:
|
||||
|
||||
Build the docker image:
|
||||
```
|
||||
docker build -t emsdk-lzma .
|
||||
```
|
||||
|
||||
Build the host tools first:
|
||||
```
|
||||
mkdir build-host
|
||||
docker run -it --rm -v $(pwd):$(pwd) -u $(id -u):$(id -g) --workdir $(pwd)/build-host emsdk-lzma cmake .. -DOPTION_TOOLS_ONLY=ON
|
||||
docker run -it --rm -v $(pwd):$(pwd) -u $(id -u):$(id -g) --workdir $(pwd)/build-host emsdk-lzma make -j5 tools
|
||||
```
|
||||
|
||||
Next, build the game with emscripten:
|
||||
|
||||
```
|
||||
mkdir build
|
||||
docker run -it --rm -v $(pwd):$(pwd) -u $(id -u):$(id -g) --workdir $(pwd)/build emsdk-lzma emcmake cmake .. -DHOST_BINARY_DIR=$(pwd)/build-host -DCMAKE_BUILD_TYPE=RelWithDebInfo -DOPTION_USE_ASSERTS=OFF
|
||||
docker run -it --rm -v $(pwd):$(pwd) -u $(id -u):$(id -g) --workdir $(pwd)/build emsdk-lzma emmake make -j5
|
||||
```
|
||||
|
||||
And now you have in your build folder files like "openttd.html".
|
||||
|
||||
To run it locally, you would have to start a local webserver, like:
|
||||
|
||||
```
|
||||
cd build
|
||||
python3 -m http.server
|
||||
````
|
||||
|
||||
Now you can play the game via http://127.0.0.1:8000/openttd.html .
|
@ -0,0 +1,20 @@
|
||||
# LibLZMA is a recent addition to the emscripten SDK, so it is possible
|
||||
# someone hasn't updated his SDK yet. Test out if the SDK supports LibLZMA.
|
||||
include(CheckCXXSourceCompiles)
|
||||
set(CMAKE_REQUIRED_FLAGS "-sUSE_LIBLZMA=1")
|
||||
|
||||
check_cxx_source_compiles("
|
||||
#include <lzma.h>
|
||||
int main() { return 0; }"
|
||||
LIBLZMA_FOUND
|
||||
)
|
||||
|
||||
if (LIBLZMA_FOUND)
|
||||
add_library(LibLZMA::LibLZMA INTERFACE IMPORTED)
|
||||
set_target_properties(LibLZMA::LibLZMA PROPERTIES
|
||||
INTERFACE_COMPILE_OPTIONS "-sUSE_LIBLZMA=1"
|
||||
INTERFACE_LINK_LIBRARIES "-sUSE_LIBLZMA=1"
|
||||
)
|
||||
else()
|
||||
message(WARNING "You are using an emscripten SDK without LibLZMA support. Many savegames won't be able to load in OpenTTD. Please apply 'emsdk-liblzma.patch' to your local emsdk installation.")
|
||||
endif()
|
@ -0,0 +1,7 @@
|
||||
add_library(PNG::PNG INTERFACE IMPORTED)
|
||||
set_target_properties(PNG::PNG PROPERTIES
|
||||
INTERFACE_COMPILE_OPTIONS "-sUSE_LIBPNG=1"
|
||||
INTERFACE_LINK_LIBRARIES "-sUSE_LIBPNG=1"
|
||||
)
|
||||
|
||||
set(PNG_FOUND on)
|
@ -0,0 +1,7 @@
|
||||
add_library(SDL2::SDL2 INTERFACE IMPORTED)
|
||||
set_target_properties(SDL2::SDL2 PROPERTIES
|
||||
INTERFACE_COMPILE_OPTIONS "-sUSE_SDL=2"
|
||||
INTERFACE_LINK_LIBRARIES "-sUSE_SDL=2"
|
||||
)
|
||||
|
||||
set(SDL2_FOUND on)
|
@ -0,0 +1,7 @@
|
||||
add_library(ZLIB::ZLIB INTERFACE IMPORTED)
|
||||
set_target_properties(ZLIB::ZLIB PROPERTIES
|
||||
INTERFACE_COMPILE_OPTIONS "-sUSE_ZLIB=1"
|
||||
INTERFACE_LINK_LIBRARIES "-sUSE_ZLIB=1"
|
||||
)
|
||||
|
||||
set(ZLIB_FOUND on)
|
@ -0,0 +1,213 @@
|
||||
From 90dd4d4c6b1cedec338ff5b375fffca93700f7bc Mon Sep 17 00:00:00 2001
|
||||
From: milek7 <me@milek7.pl>
|
||||
Date: Tue, 8 Dec 2020 01:03:31 +0100
|
||||
Subject: [PATCH] Add liblzma port
|
||||
|
||||
---
|
||||
Source: https://github.com/emscripten-core/emscripten/pull/12990
|
||||
|
||||
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/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;
|
||||
// 1 = use libjpeg from emscripten-ports
|
||||
var USE_LIBJPEG = 0;
|
||||
|
||||
+// 1 = use liblzma from emscripten-ports
|
||||
+var USE_LIBLZMA = 0;
|
||||
+
|
||||
// 1 = use libpng from emscripten-ports
|
||||
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 @@
|
||||
+# Copyright 2020 The Emscripten Authors. All rights reserved.
|
||||
+# Emscripten is available under two separate licenses, the MIT license and the
|
||||
+# University of Illinois/NCSA Open Source License. Both these licenses can be
|
||||
+# found in the LICENSE file.
|
||||
+
|
||||
+import os
|
||||
+import shutil
|
||||
+
|
||||
+VERSION = '5.2.5'
|
||||
+HASH = '7443674247deda2935220fbc4dfc7665e5bb5a260be8ad858c8bd7d7b9f0f868f04ea45e62eb17c0a5e6a2de7c7500ad2d201e2d668c48ca29bd9eea5a73a3ce'
|
||||
+
|
||||
+
|
||||
+def needed(settings):
|
||||
+ return settings.USE_LIBLZMA
|
||||
+
|
||||
+
|
||||
+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():
|
||||
+ ports.clear_project_build('liblzma')
|
||||
+
|
||||
+ source_path = os.path.join(ports.get_dir(), 'liblzma', 'xz-' + VERSION)
|
||||
+ dest_path = os.path.join(ports.get_build_dir(), 'liblzma')
|
||||
+
|
||||
+ shared.try_delete(dest_path)
|
||||
+ os.makedirs(dest_path)
|
||||
+ shutil.rmtree(dest_path, ignore_errors=True)
|
||||
+ shutil.copytree(source_path, dest_path)
|
||||
+
|
||||
+ build_flags = ['-DHAVE_CONFIG_H', '-DTUKLIB_SYMBOL_PREFIX=lzma_', '-fvisibility=hidden']
|
||||
+ exclude_dirs = ['xzdec', 'xz', 'lzmainfo']
|
||||
+ exclude_files = ['crc32_small.c', 'crc64_small.c', 'crc32_tablegen.c', 'crc64_tablegen.c', 'price_tablegen.c', 'fastpos_tablegen.c'
|
||||
+ '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)
|
||||
+
|
||||
+ 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')]
|
||||
+
|
||||
+
|
||||
+def clear(ports, settings, shared):
|
||||
+ shared.Cache.erase_file(ports.get_lib_name('liblzma'))
|
||||
+
|
||||
+
|
||||
+def process_args(ports):
|
||||
+ return []
|
||||
+
|
||||
+
|
||||
+def show():
|
||||
+ return 'liblzma (USE_LIBLZMA=1; public domain)'
|
||||
+
|
||||
+
|
||||
+config_h = r'''
|
||||
+#define ASSUME_RAM 128
|
||||
+#define ENABLE_NLS 1
|
||||
+#define HAVE_CHECK_CRC32 1
|
||||
+#define HAVE_CHECK_CRC64 1
|
||||
+#define HAVE_CHECK_SHA256 1
|
||||
+#define HAVE_CLOCK_GETTIME 1
|
||||
+#define HAVE_DCGETTEXT 1
|
||||
+#define HAVE_DECL_CLOCK_MONOTONIC 1
|
||||
+#define HAVE_DECL_PROGRAM_INVOCATION_NAME 1
|
||||
+#define HAVE_DECODERS 1
|
||||
+#define HAVE_DECODER_ARM 1
|
||||
+#define HAVE_DECODER_ARMTHUMB 1
|
||||
+#define HAVE_DECODER_DELTA 1
|
||||
+#define HAVE_DECODER_IA64 1
|
||||
+#define HAVE_DECODER_LZMA1 1
|
||||
+#define HAVE_DECODER_LZMA2 1
|
||||
+#define HAVE_DECODER_POWERPC 1
|
||||
+#define HAVE_DECODER_SPARC 1
|
||||
+#define HAVE_DECODER_X86 1
|
||||
+#define HAVE_DLFCN_H 1
|
||||
+#define HAVE_ENCODERS 1
|
||||
+#define HAVE_ENCODER_ARM 1
|
||||
+#define HAVE_ENCODER_ARMTHUMB 1
|
||||
+#define HAVE_ENCODER_DELTA 1
|
||||
+#define HAVE_ENCODER_IA64 1
|
||||
+#define HAVE_ENCODER_LZMA1 1
|
||||
+#define HAVE_ENCODER_LZMA2 1
|
||||
+#define HAVE_ENCODER_POWERPC 1
|
||||
+#define HAVE_ENCODER_SPARC 1
|
||||
+#define HAVE_ENCODER_X86 1
|
||||
+#define HAVE_FCNTL_H 1
|
||||
+#define HAVE_FUTIMENS 1
|
||||
+#define HAVE_GETOPT_H 1
|
||||
+#define HAVE_GETOPT_LONG 1
|
||||
+#define HAVE_GETTEXT 1
|
||||
+#define HAVE_IMMINTRIN_H 1
|
||||
+#define HAVE_INTTYPES_H 1
|
||||
+#define HAVE_LIMITS_H 1
|
||||
+#define HAVE_MBRTOWC 1
|
||||
+#define HAVE_MEMORY_H 1
|
||||
+#define HAVE_MF_BT2 1
|
||||
+#define HAVE_MF_BT3 1
|
||||
+#define HAVE_MF_BT4 1
|
||||
+#define HAVE_MF_HC3 1
|
||||
+#define HAVE_MF_HC4 1
|
||||
+#define HAVE_OPTRESET 1
|
||||
+#define HAVE_POSIX_FADVISE 1
|
||||
+#define HAVE_PTHREAD_CONDATTR_SETCLOCK 1
|
||||
+#define HAVE_PTHREAD_PRIO_INHERIT 1
|
||||
+#define HAVE_STDBOOL_H 1
|
||||
+#define HAVE_STDINT_H 1
|
||||
+#define HAVE_STDLIB_H 1
|
||||
+#define HAVE_STRINGS_H 1
|
||||
+#define HAVE_STRING_H 1
|
||||
+#define HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC 1
|
||||
+#define HAVE_SYS_PARAM_H 1
|
||||
+#define HAVE_SYS_STAT_H 1
|
||||
+#define HAVE_SYS_TIME_H 1
|
||||
+#define HAVE_SYS_TYPES_H 1
|
||||
+#define HAVE_UINTPTR_T 1
|
||||
+#define HAVE_UNISTD_H 1
|
||||
+#define HAVE_VISIBILITY 1
|
||||
+#define HAVE_WCWIDTH 1
|
||||
+#define HAVE__BOOL 1
|
||||
+#define HAVE___BUILTIN_ASSUME_ALIGNED 1
|
||||
+#define HAVE___BUILTIN_BSWAPXX 1
|
||||
+#define MYTHREAD_POSIX 1
|
||||
+#define NDEBUG 1
|
||||
+#define PACKAGE "xz"
|
||||
+#define PACKAGE_BUGREPORT "lasse.collin@tukaani.org"
|
||||
+#define PACKAGE_NAME "XZ Utils"
|
||||
+#define PACKAGE_STRING "XZ Utils 5.2.5"
|
||||
+#define PACKAGE_TARNAME "xz"
|
||||
+#define PACKAGE_VERSION "5.2.5"
|
||||
+#define SIZEOF_SIZE_T 4
|
||||
+#define STDC_HEADERS 1
|
||||
+#define TUKLIB_CPUCORES_SYSCONF 1
|
||||
+#define TUKLIB_FAST_UNALIGNED_ACCESS 1
|
||||
+#define TUKLIB_PHYSMEM_SYSCONF 1
|
||||
+#ifndef _ALL_SOURCE
|
||||
+# define _ALL_SOURCE 1
|
||||
+#endif
|
||||
+#ifndef _GNU_SOURCE
|
||||
+# define _GNU_SOURCE 1
|
||||
+#endif
|
||||
+#ifndef _POSIX_PTHREAD_SEMANTICS
|
||||
+# define _POSIX_PTHREAD_SEMANTICS 1
|
||||
+#endif
|
||||
+#ifndef _TANDEM_SOURCE
|
||||
+# define _TANDEM_SOURCE 1
|
||||
+#endif
|
||||
+#ifndef __EXTENSIONS__
|
||||
+# define __EXTENSIONS__ 1
|
||||
+#endif
|
||||
+#define VERSION "5.2.5"
|
||||
+'''
|
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
@ -0,0 +1,93 @@
|
||||
Module.arguments.push('-mnull', '-snull', '-vsdl:relative_mode');
|
||||
Module['websocket'] = { url: function(host, port, proto) {
|
||||
/* openttd.org hosts a WebSocket proxy for the content service. */
|
||||
if (host == "content.openttd.org" && port == 3978 && proto == "tcp") {
|
||||
return "wss://content.openttd.org/";
|
||||
}
|
||||
|
||||
/* Everything else just tries to make a default WebSocket connection.
|
||||
* If you run your own server you can setup your own WebSocket proxy in
|
||||
* front of it and let people connect to your server via the proxy. You
|
||||
* are best to add another "if" statement as above for this. */
|
||||
return null;
|
||||
} };
|
||||
|
||||
Module.preRun.push(function() {
|
||||
personal_dir = '/home/web_user/.openttd';
|
||||
content_download_dir = personal_dir + '/content_download'
|
||||
|
||||
/* Because of the "-c" above, all user-data is stored in /user_data. */
|
||||
FS.mkdir(personal_dir);
|
||||
FS.mount(IDBFS, {}, personal_dir);
|
||||
|
||||
Module.addRunDependency('syncfs');
|
||||
FS.syncfs(true, function (err) {
|
||||
/* FS.mkdir() tends to fail if parent folders do not exist. */
|
||||
if (!FS.analyzePath(content_download_dir).exists) {
|
||||
FS.mkdir(content_download_dir);
|
||||
}
|
||||
if (!FS.analyzePath(content_download_dir + '/baseset').exists) {
|
||||
FS.mkdir(content_download_dir + '/baseset');
|
||||
}
|
||||
|
||||
/* Check if the OpenGFX baseset is already downloaded. */
|
||||
if (!FS.analyzePath(content_download_dir + '/baseset/opengfx-0.6.0.tar').exists) {
|
||||
window.openttd_downloaded_opengfx = true;
|
||||
FS.createPreloadedFile(content_download_dir + '/baseset', 'opengfx-0.6.0.tar', 'https://installer.cdn.openttd.org/emscripten/opengfx-0.6.0.tar', true, true);
|
||||
} else {
|
||||
/* Fake dependency increase, so the counter is stable. */
|
||||
Module.addRunDependency('opengfx');
|
||||
Module.removeRunDependency('opengfx');
|
||||
}
|
||||
|
||||
Module.removeRunDependency('syncfs');
|
||||
});
|
||||
|
||||
window.openttd_syncfs_shown_warning = false;
|
||||
window.openttd_syncfs = function() {
|
||||
/* Copy the virtual FS to the persistent storage. */
|
||||
FS.syncfs(false, function (err) { });
|
||||
|
||||
/* On first time, warn the user about the volatile behaviour of
|
||||
* persistent storage. */
|
||||
if (!window.openttd_syncfs_shown_warning) {
|
||||
window.openttd_syncfs_shown_warning = true;
|
||||
Module.onWarningFs();
|
||||
}
|
||||
}
|
||||
|
||||
window.openttd_exit = function() {
|
||||
Module.onExit();
|
||||
}
|
||||
|
||||
window.openttd_abort = function() {
|
||||
Module.onAbort();
|
||||
}
|
||||
|
||||
window.openttd_server_list = function() {
|
||||
add_server = Module.cwrap("em_openttd_add_server", null, ["string", "number"]);
|
||||
|
||||
/* Add servers that support WebSocket here. Example:
|
||||
* add_server("localhost", 3979); */
|
||||
}
|
||||
|
||||
/* https://github.com/emscripten-core/emscripten/pull/12995 implements this
|
||||
* properly. Till that time, we use a polyfill. */
|
||||
SOCKFS.websocket_sock_ops.createPeer_ = SOCKFS.websocket_sock_ops.createPeer;
|
||||
SOCKFS.websocket_sock_ops.createPeer = function(sock, addr, port)
|
||||
{
|
||||
let func = Module['websocket']['url'];
|
||||
Module['websocket']['url'] = func(addr, port, (sock.type == 2) ? 'udp' : 'tcp');
|
||||
let ret = SOCKFS.websocket_sock_ops.createPeer_(sock, addr, port);
|
||||
Module['websocket']['url'] = func;
|
||||
return ret;
|
||||
}
|
||||
});
|
||||
|
||||
Module.postRun.push(function() {
|
||||
/* Check if we downloaded OpenGFX; if so, sync the virtual FS back to the
|
||||
* IDBFS so OpenGFX is stored persistent. */
|
||||
if (window['openttd_downloaded_opengfx']) {
|
||||
FS.syncfs(false, function (err) { });
|
||||
}
|
||||
});
|
File diff suppressed because one or more lines are too long
@ -1,23 +0,0 @@
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
File diff suppressed because it is too large
Load Diff
@ -1,33 +0,0 @@
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
|
||||
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** @file ottd_optional.h Header to select between native. */
|
||||
|
||||
#ifndef OTTD_OPTIONAL_H
|
||||
#define OTTD_OPTIONAL_H
|
||||
|
||||
#if defined(__has_include)
|
||||
# if __has_include(<version>)
|
||||
# include <version>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if (__cplusplus >= 201703L) || (defined(__cpp_lib_optional) && __cpp_lib_optional >= 201606L)
|
||||
|
||||
/* Native std::optional. */
|
||||
#include <optional>
|
||||
namespace opt = std;
|
||||
|
||||
#else
|
||||
|
||||
/* No std::optional, use local copy instead. */
|
||||
#include "optional.hpp"
|
||||
namespace opt = std::experimental;
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* OTTD_OPTIONAL_H */
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue