Let mods customize app constants

Mainly via meson_options.txt.
This commit is contained in:
Tamás Bálint Misius
2022-12-17 13:53:37 +01:00
parent 2140d6db4b
commit 59f89f9a46
25 changed files with 123 additions and 99 deletions

36
.github/prepare.py vendored
View File

@@ -2,6 +2,7 @@ import datetime
import json
import os
import re
import subprocess
import sys
ref = os.getenv('GITHUB_REF')
@@ -39,8 +40,23 @@ do_publish = publish_hostport and do_release
set_output('release_type', release_type)
set_output('release_name', release_name)
with open('.github/mod_id.txt') as f:
set_output('mod_id', f.read())
subprocess.run([ 'meson', 'setup', '-Dprepare=true', 'build-prepare' ], check = True)
build_options = {}
with open('build-prepare/meson-info/intro-buildoptions.json') as f:
for option in json.loads(f.read()):
build_options[option['name']] = option['value']
set_output('mod_id' , build_options['mod_id' ])
set_output('app_name' , build_options['app_name' ])
set_output('app_comment', build_options['app_comment'])
set_output('app_exe' , build_options['app_exe' ])
set_output('app_id' , build_options['app_id' ])
set_output('app_data' , build_options['app_data' ])
set_output('app_vendor' , build_options['app_vendor' ])
app_exe = build_options['app_exe']
app_name = build_options['app_name']
app_name_slug = re.sub('[^A-Za-z0-9]', '_', app_name)
build_matrix = []
publish_matrix = []
@@ -97,15 +113,15 @@ for arch, platform, libc, statdyn, bplatform, runson, suff
if dbgrel != 'release':
assert not publish
assert not artifact
asset_path = f'powder{suffix}'
asset_name = f'powder-{release_name}-{arch}-{platform}-{libc}{suffix}'
debug_asset_path = f'powder{dbgsuffix}'
debug_asset_name = f'powder-{release_name}-{arch}-{platform}-{libc}{dbgsuffix}'
asset_path = f'{app_exe}{suffix}'
asset_name = f'{app_exe}-{release_name}-{arch}-{platform}-{libc}{suffix}'
debug_asset_path = f'{app_exe}{dbgsuffix}'
debug_asset_name = f'{app_exe}-{release_name}-{arch}-{platform}-{libc}{dbgsuffix}'
if mode == 'appimage':
asset_path = f'The_Powder_Toy-{arch}.AppImage'
asset_name = f'The_Powder_Toy-{arch}.AppImage'
debug_asset_path = f'The_Powder_Toy-{arch}.AppImage.dbg'
debug_asset_name = f'The_Powder_Toy-{arch}.AppImage.dbg'
asset_path = f'{app_name_slug}-{arch}.AppImage'
asset_name = f'{app_name_slug}-{arch}.AppImage'
debug_asset_path = f'{app_name_slug}-{arch}.AppImage.dbg'
debug_asset_name = f'{app_name_slug}-{arch}.AppImage.dbg'
starcatcher_name = f'powder-{release_name}-{starcatcher}{suffix}'
build_matrix.append({
'bsh_build_platform': bplatform, # part of the unique portion of the matrix