Let mods customize app constants
Mainly via meson_options.txt.
93
.github/build.sh
vendored
@ -3,58 +3,25 @@
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
IFS=$'\n\t'
|
IFS=$'\n\t'
|
||||||
|
|
||||||
if [[ -z ${BSH_BUILD_PLATFORM-} ]]; then
|
if [[ -z ${BSH_BUILD_PLATFORM-} ]]; then >&2 echo "BSH_BUILD_PLATFORM not set"; exit 1; fi
|
||||||
>&2 echo "BSH_BUILD_PLATFORM not set"
|
if [[ -z ${BSH_HOST_ARCH-} ]]; then >&2 echo "BSH_HOST_ARCH not set"; exit 1; fi
|
||||||
exit 1
|
if [[ -z ${BSH_HOST_PLATFORM-} ]]; then >&2 echo "BSH_HOST_PLATFORM not set"; exit 1; fi
|
||||||
fi
|
if [[ -z ${BSH_HOST_LIBC-} ]]; then >&2 echo "BSH_HOST_LIBC not set"; exit 1; fi
|
||||||
if [[ -z ${BSH_HOST_ARCH-} ]]; then
|
if [[ -z ${BSH_STATIC_DYNAMIC-} ]]; then >&2 echo "BSH_STATIC_DYNAMIC not set"; exit 1; fi
|
||||||
>&2 echo "BSH_HOST_ARCH not set"
|
if [[ -z ${BSH_DEBUG_RELEASE-} ]]; then >&2 echo "BSH_DEBUG_RELEASE not set"; exit 1; fi
|
||||||
exit 1
|
if [[ -z ${RELEASE_NAME-} ]]; then >&2 echo "RELEASE_NAME not set"; exit 1; fi
|
||||||
fi
|
if [[ -z ${RELEASE_TYPE-} ]]; then >&2 echo "RELEASE_TYPE not set"; exit 1; fi
|
||||||
if [[ -z ${BSH_HOST_PLATFORM-} ]]; then
|
if [[ -z ${MOD_ID-} ]]; then >&2 echo "MOD_ID not set"; exit 1; fi
|
||||||
>&2 echo "BSH_HOST_PLATFORM not set"
|
if [[ -z ${SEPARATE_DEBUG-} ]]; then >&2 echo "SEPARATE_DEBUG not set"; exit 1; fi
|
||||||
exit 1
|
if [[ -z ${PACKAGE_MODE-} ]]; then >&2 echo "PACKAGE_MODE not set"; exit 1; fi
|
||||||
fi
|
if [[ -z ${ASSET_PATH-} ]]; then >&2 echo "ASSET_PATH not set"; exit 1; fi
|
||||||
if [[ -z ${BSH_HOST_LIBC-} ]]; then
|
if [[ -z ${DEBUG_ASSET_PATH-} ]]; then >&2 echo "DEBUG_ASSET_PATH not set"; exit 1; fi
|
||||||
>&2 echo "BSH_HOST_LIBC not set"
|
if [[ -z ${APP_NAME-} ]]; then >&2 echo "APP_NAME not set"; exit 1; fi
|
||||||
exit 1
|
if [[ -z ${APP_COMMENT-} ]]; then >&2 echo "APP_COMMENT not set"; exit 1; fi
|
||||||
fi
|
if [[ -z ${APP_EXE-} ]]; then >&2 echo "APP_EXE not set"; exit 1; fi
|
||||||
if [[ -z ${BSH_STATIC_DYNAMIC-} ]]; then
|
if [[ -z ${APP_ID-} ]]; then >&2 echo "APP_ID not set"; exit 1; fi
|
||||||
>&2 echo "BSH_STATIC_DYNAMIC not set"
|
if [[ -z ${APP_DATA-} ]]; then >&2 echo "APP_DATA not set"; exit 1; fi
|
||||||
exit 1
|
if [[ -z ${APP_VENDOR-} ]]; then >&2 echo "APP_VENDOR not set"; exit 1; fi
|
||||||
fi
|
|
||||||
if [[ -z ${BSH_DEBUG_RELEASE-} ]]; then
|
|
||||||
>&2 echo "BSH_DEBUG_RELEASE not set"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [[ -z ${RELEASE_NAME-} ]]; then
|
|
||||||
>&2 echo "RELEASE_NAME not set"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [[ -z ${RELEASE_TYPE-} ]]; then
|
|
||||||
>&2 echo "RELEASE_TYPE not set"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [[ -z ${MOD_ID-} ]]; then
|
|
||||||
>&2 echo "MOD_ID not set"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [[ -z ${SEPARATE_DEBUG-} ]]; then
|
|
||||||
>&2 echo "SEPARATE_DEBUG not set"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [[ -z ${PACKAGE_MODE-} ]]; then
|
|
||||||
>&2 echo "PACKAGE_MODE not set"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [[ -z ${ASSET_PATH-} ]]; then
|
|
||||||
>&2 echo "ASSET_PATH not set"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [[ -z ${DEBUG_ASSET_PATH-} ]]; then
|
|
||||||
>&2 echo "DEBUG_ASSET_PATH not set"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
case $BSH_HOST_ARCH-$BSH_HOST_PLATFORM-$BSH_HOST_LIBC-$BSH_STATIC_DYNAMIC in
|
case $BSH_HOST_ARCH-$BSH_HOST_PLATFORM-$BSH_HOST_LIBC-$BSH_STATIC_DYNAMIC in
|
||||||
x86_64-linux-gnu-static) ;;
|
x86_64-linux-gnu-static) ;;
|
||||||
@ -333,19 +300,19 @@ strip_target=$ASSET_PATH
|
|||||||
if [[ $BSH_HOST_PLATFORM == android ]]; then
|
if [[ $BSH_HOST_PLATFORM == android ]]; then
|
||||||
strip=$ANDROID_NDK_LATEST_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-$strip
|
strip=$ANDROID_NDK_LATEST_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-$strip
|
||||||
objcopy=$ANDROID_NDK_LATEST_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-$objcopy
|
objcopy=$ANDROID_NDK_LATEST_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-$objcopy
|
||||||
strip_target=libpowder.so
|
strip_target=lib$APP_EXE.so
|
||||||
fi
|
fi
|
||||||
if [[ $PACKAGE_MODE == appimage ]]; then
|
if [[ $PACKAGE_MODE == appimage ]]; then
|
||||||
# so far this can only happen with $BSH_HOST_PLATFORM-$BSH_HOST_LIBC == linux-gnu, but this may change later
|
# so far this can only happen with $BSH_HOST_PLATFORM-$BSH_HOST_LIBC == linux-gnu, but this may change later
|
||||||
meson configure -Dinstall_check=false -Dignore_updates=true -Dbuild_render=false -Dbuild_font=false
|
meson configure -Dinstall_check=false -Dignore_updates=true -Dbuild_render=false -Dbuild_font=false
|
||||||
strip_target=powder
|
strip_target=$APP_EXE
|
||||||
fi
|
fi
|
||||||
if [[ $BSH_BUILD_PLATFORM == windows ]]; then
|
if [[ $BSH_BUILD_PLATFORM == windows ]]; then
|
||||||
set +e
|
set +e
|
||||||
ninja -v -d keeprsp
|
ninja -v -d keeprsp
|
||||||
ninja_code=$?
|
ninja_code=$?
|
||||||
set -e
|
set -e
|
||||||
cat powder.exe.rsp
|
cat $APP_EXE.exe.rsp
|
||||||
[[ $ninja_code == 0 ]];
|
[[ $ninja_code == 0 ]];
|
||||||
else
|
else
|
||||||
ninja -v
|
ninja -v
|
||||||
@ -360,8 +327,8 @@ fi
|
|||||||
if [[ $BSH_HOST_PLATFORM == android ]]; then
|
if [[ $BSH_HOST_PLATFORM == android ]]; then
|
||||||
$JAVA_HOME_8_X64/bin/keytool -genkeypair -keystore keystore.jks -alias androidkey -validity 10000 -keyalg RSA -keysize 2048 -keypass bagelsbagels -storepass bagelsbagels -dname "CN=nobody"
|
$JAVA_HOME_8_X64/bin/keytool -genkeypair -keystore keystore.jks -alias androidkey -validity 10000 -keyalg RSA -keysize 2048 -keypass bagelsbagels -storepass bagelsbagels -dname "CN=nobody"
|
||||||
meson configure -Dandroid_keystore=$(realpath keystore.jks)
|
meson configure -Dandroid_keystore=$(realpath keystore.jks)
|
||||||
ANDROID_KEYSTORE_PASS=bagelsbagels ninja android/powder.apk
|
ANDROID_KEYSTORE_PASS=bagelsbagels ninja android/$APP_EXE.apk
|
||||||
mv android/powder.apk powder.apk
|
mv android/$APP_EXE.apk $APP_EXE.apk
|
||||||
fi
|
fi
|
||||||
if [[ $PACKAGE_MODE == appimage ]]; then
|
if [[ $PACKAGE_MODE == appimage ]]; then
|
||||||
# so far this can only happen with $BSH_HOST_PLATFORM-$BSH_HOST_LIBC == linux-gnu, but this may change later
|
# so far this can only happen with $BSH_HOST_PLATFORM-$BSH_HOST_LIBC == linux-gnu, but this may change later
|
||||||
@ -385,12 +352,12 @@ if [[ $PACKAGE_MODE == appimage ]]; then
|
|||||||
mkdir -p $appdir/usr/share/metainfo
|
mkdir -p $appdir/usr/share/metainfo
|
||||||
mkdir -p $appdir/usr/share/applications
|
mkdir -p $appdir/usr/share/applications
|
||||||
mkdir -p $appdir/usr/share/icons
|
mkdir -p $appdir/usr/share/icons
|
||||||
cp powder $appdir/usr/bin/powder
|
cp $APP_EXE $appdir/usr/bin/$APP_EXE
|
||||||
mv AppRun $appdir/AppRun
|
mv AppRun $appdir/AppRun
|
||||||
cp ../resources/icon/powder-128.png $appdir/powdertoy-powder.png
|
cp ../resources/icon/icon-128.png $appdir/$APP_VENDOR-$APP_EXE.png
|
||||||
cp resources/powder.desktop $appdir/uk.co.powdertoy.tpt.desktop
|
cp resources/powder.desktop $appdir/$APP_ID.desktop
|
||||||
cp appdata.xml $appdir/usr/share/metainfo/uk.co.powdertoy.tpt.appdata.xml
|
cp appdata.xml $appdir/usr/share/metainfo/$APP_ID.appdata.xml
|
||||||
cp $appdir/powdertoy-powder.png $appdir/usr/share/icons/powdertoy-powder.png
|
cp $appdir/$APP_VENDOR-$APP_EXE.png $appdir/usr/share/icons/$APP_VENDOR-$APP_EXE.png
|
||||||
cp $appdir/uk.co.powdertoy.tpt.desktop $appdir/usr/share/applications/uk.co.powdertoy.tpt.desktop
|
cp $appdir/$APP_ID.desktop $appdir/usr/share/applications/$APP_ID.desktop
|
||||||
./appimagetool $appdir $ASSET_PATH
|
./appimagetool $appdir $ASSET_PATH
|
||||||
fi
|
fi
|
||||||
|
1
.github/mod_id.txt
vendored
@ -1 +0,0 @@
|
|||||||
0
|
|
36
.github/prepare.py
vendored
@ -2,6 +2,7 @@ import datetime
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
ref = os.getenv('GITHUB_REF')
|
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_type', release_type)
|
||||||
set_output('release_name', release_name)
|
set_output('release_name', release_name)
|
||||||
|
|
||||||
with open('.github/mod_id.txt') as f:
|
subprocess.run([ 'meson', 'setup', '-Dprepare=true', 'build-prepare' ], check = True)
|
||||||
set_output('mod_id', f.read())
|
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 = []
|
build_matrix = []
|
||||||
publish_matrix = []
|
publish_matrix = []
|
||||||
@ -97,15 +113,15 @@ for arch, platform, libc, statdyn, bplatform, runson, suff
|
|||||||
if dbgrel != 'release':
|
if dbgrel != 'release':
|
||||||
assert not publish
|
assert not publish
|
||||||
assert not artifact
|
assert not artifact
|
||||||
asset_path = f'powder{suffix}'
|
asset_path = f'{app_exe}{suffix}'
|
||||||
asset_name = f'powder-{release_name}-{arch}-{platform}-{libc}{suffix}'
|
asset_name = f'{app_exe}-{release_name}-{arch}-{platform}-{libc}{suffix}'
|
||||||
debug_asset_path = f'powder{dbgsuffix}'
|
debug_asset_path = f'{app_exe}{dbgsuffix}'
|
||||||
debug_asset_name = f'powder-{release_name}-{arch}-{platform}-{libc}{dbgsuffix}'
|
debug_asset_name = f'{app_exe}-{release_name}-{arch}-{platform}-{libc}{dbgsuffix}'
|
||||||
if mode == 'appimage':
|
if mode == 'appimage':
|
||||||
asset_path = f'The_Powder_Toy-{arch}.AppImage'
|
asset_path = f'{app_name_slug}-{arch}.AppImage'
|
||||||
asset_name = f'The_Powder_Toy-{arch}.AppImage'
|
asset_name = f'{app_name_slug}-{arch}.AppImage'
|
||||||
debug_asset_path = f'The_Powder_Toy-{arch}.AppImage.dbg'
|
debug_asset_path = f'{app_name_slug}-{arch}.AppImage.dbg'
|
||||||
debug_asset_name = f'The_Powder_Toy-{arch}.AppImage.dbg'
|
debug_asset_name = f'{app_name_slug}-{arch}.AppImage.dbg'
|
||||||
starcatcher_name = f'powder-{release_name}-{starcatcher}{suffix}'
|
starcatcher_name = f'powder-{release_name}-{starcatcher}{suffix}'
|
||||||
build_matrix.append({
|
build_matrix.append({
|
||||||
'bsh_build_platform': bplatform, # part of the unique portion of the matrix
|
'bsh_build_platform': bplatform, # part of the unique portion of the matrix
|
||||||
|
13
.github/workflows/build.yaml
vendored
@ -23,12 +23,19 @@ jobs:
|
|||||||
release_type: ${{ steps.prepare.outputs.release_type }}
|
release_type: ${{ steps.prepare.outputs.release_type }}
|
||||||
release_name: ${{ steps.prepare.outputs.release_name }}
|
release_name: ${{ steps.prepare.outputs.release_name }}
|
||||||
mod_id: ${{ steps.prepare.outputs.mod_id }}
|
mod_id: ${{ steps.prepare.outputs.mod_id }}
|
||||||
|
app_name: ${{ steps.prepare.outputs.app_name }}
|
||||||
|
app_comment: ${{ steps.prepare.outputs.app_comment }}
|
||||||
|
app_exe: ${{ steps.prepare.outputs.app_exe }}
|
||||||
|
app_id: ${{ steps.prepare.outputs.app_id }}
|
||||||
|
app_data: ${{ steps.prepare.outputs.app_data }}
|
||||||
|
app_vendor: ${{ steps.prepare.outputs.app_vendor }}
|
||||||
do_publish: ${{ steps.prepare.outputs.do_publish }}
|
do_publish: ${{ steps.prepare.outputs.do_publish }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-python@v4
|
- uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: '3.10'
|
python-version: '3.10'
|
||||||
|
- run: python -m pip install meson ninja
|
||||||
- id: prepare
|
- id: prepare
|
||||||
run: python ./.github/prepare.py
|
run: python ./.github/prepare.py
|
||||||
env:
|
env:
|
||||||
@ -77,6 +84,12 @@ jobs:
|
|||||||
RELEASE_NAME: ${{ needs.prepare.outputs.release_name }}
|
RELEASE_NAME: ${{ needs.prepare.outputs.release_name }}
|
||||||
RELEASE_TYPE: ${{ needs.prepare.outputs.release_type }}
|
RELEASE_TYPE: ${{ needs.prepare.outputs.release_type }}
|
||||||
MOD_ID: ${{ needs.prepare.outputs.mod_id }}
|
MOD_ID: ${{ needs.prepare.outputs.mod_id }}
|
||||||
|
APP_NAME: ${{ needs.prepare.outputs.app_name }}
|
||||||
|
APP_COMMENT: ${{ needs.prepare.outputs.app_comment }}
|
||||||
|
APP_EXE: ${{ needs.prepare.outputs.app_exe }}
|
||||||
|
APP_ID: ${{ needs.prepare.outputs.app_id }}
|
||||||
|
APP_DATA: ${{ needs.prepare.outputs.app_data }}
|
||||||
|
APP_VENDOR: ${{ needs.prepare.outputs.app_vendor }}
|
||||||
SEPARATE_DEBUG: ${{ matrix.separate_debug }}
|
SEPARATE_DEBUG: ${{ matrix.separate_debug }}
|
||||||
PACKAGE_MODE: ${{ matrix.package_mode }}
|
PACKAGE_MODE: ${{ matrix.package_mode }}
|
||||||
ASSET_PATH: ${{ matrix.asset_path }}
|
ASSET_PATH: ${{ matrix.asset_path }}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest
|
<manifest
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="uk.co.powdertoy.tpt"
|
package="@APPID@"
|
||||||
android:versionCode="1"
|
android:versionCode="1"
|
||||||
android:versionName="1.0"
|
android:versionName="1.0"
|
||||||
android:installLocation="auto"
|
android:installLocation="auto"
|
@ -1,4 +1,4 @@
|
|||||||
package uk.co.powdertoy.tpt;
|
package @APPID@;
|
||||||
|
|
||||||
import org.libsdl.app.SDLActivity;
|
import org.libsdl.app.SDLActivity;
|
||||||
|
|
@ -32,12 +32,14 @@ if tpt_arch == 'aarch64':
|
|||||||
if tpt_arch == 'x86_64':
|
if tpt_arch == 'x86_64':
|
||||||
android_arch = 'x86_64'
|
android_arch = 'x86_64'
|
||||||
|
|
||||||
|
sha_packaged_name = 'libpowder.so'
|
||||||
|
|
||||||
manifest_path = os.path.join(build_dir, manifest_xml)
|
manifest_path = os.path.join(build_dir, manifest_xml)
|
||||||
sha_path = os.path.join(build_dir, sha_name)
|
sha_path = os.path.join(build_dir, sha_name)
|
||||||
unaligned_path = os.path.join(build_dir, unaligned_name)
|
unaligned_path = os.path.join(build_dir, unaligned_name)
|
||||||
private_dir = os.path.join(build_dir, private_name)
|
private_dir = os.path.join(build_dir, private_name)
|
||||||
arch_dir = os.path.join(private_dir, 'lib', android_arch)
|
arch_dir = os.path.join(private_dir, 'lib', android_arch)
|
||||||
sha_lib_path = os.path.join(arch_dir, sha_name)
|
sha_lib_path = os.path.join(arch_dir, sha_packaged_name)
|
||||||
flat_dir = os.path.join(private_dir, 'flat')
|
flat_dir = os.path.join(private_dir, 'flat')
|
||||||
|
|
||||||
if os.path.exists(arch_dir):
|
if os.path.exists(arch_dir):
|
||||||
@ -79,7 +81,7 @@ if subprocess.run([
|
|||||||
aapt,
|
aapt,
|
||||||
'add',
|
'add',
|
||||||
unaligned_path,
|
unaligned_path,
|
||||||
os.path.join('lib', android_arch, sha_name),
|
os.path.join('lib', android_arch, sha_packaged_name),
|
||||||
], cwd = private_dir).returncode:
|
], cwd = private_dir).returncode:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
android_manifest_xml = files('AndroidManifest.xml')
|
android_manifest_xml = configure_file(
|
||||||
powder_jar_sources = files(
|
input: 'AndroidManifest.template.xml',
|
||||||
'uk/co/powdertoy/tpt/PowderActivity.java',
|
output: 'AndroidManifest.xml',
|
||||||
|
configuration: conf_data,
|
||||||
|
)
|
||||||
|
powder_jar_sources = configure_file(
|
||||||
|
input: 'PowderActivity.template.java',
|
||||||
|
output: 'PowderActivity.java',
|
||||||
|
configuration: conf_data,
|
||||||
)
|
)
|
||||||
|
|
||||||
subdir('res')
|
subdir('res')
|
||||||
@ -12,7 +18,7 @@ android_keystore = get_option('android_keystore')
|
|||||||
sdl_jar = tpt_libs.get_variable('sdl_jar')
|
sdl_jar = tpt_libs.get_variable('sdl_jar')
|
||||||
powder_jar = custom_target(
|
powder_jar = custom_target(
|
||||||
'powder-jar',
|
'powder-jar',
|
||||||
output: 'powder.jar',
|
output: app_exe + '.jar',
|
||||||
command: [
|
command: [
|
||||||
python3,
|
python3,
|
||||||
files('powder-jar.py'),
|
files('powder-jar.py'),
|
||||||
@ -31,7 +37,7 @@ powder_jar = custom_target(
|
|||||||
)
|
)
|
||||||
unaligned_apk = custom_target(
|
unaligned_apk = custom_target(
|
||||||
'build-apk',
|
'build-apk',
|
||||||
output: 'powder.unaligned.apk',
|
output: app_exe + '.unaligned.apk',
|
||||||
input: powder_sha,
|
input: powder_sha,
|
||||||
command: [
|
command: [
|
||||||
python3,
|
python3,
|
||||||
@ -55,7 +61,7 @@ unaligned_apk = custom_target(
|
|||||||
)
|
)
|
||||||
unsigned_apk = custom_target(
|
unsigned_apk = custom_target(
|
||||||
'align-apk',
|
'align-apk',
|
||||||
output: 'powder.unsigned.apk',
|
output: app_exe + '.unsigned.apk',
|
||||||
input: unaligned_apk,
|
input: unaligned_apk,
|
||||||
command: [
|
command: [
|
||||||
python3,
|
python3,
|
||||||
@ -68,7 +74,7 @@ unsigned_apk = custom_target(
|
|||||||
)
|
)
|
||||||
signed_apk = custom_target(
|
signed_apk = custom_target(
|
||||||
'sign-apk',
|
'sign-apk',
|
||||||
output: 'powder.apk',
|
output: app_exe + '.apk',
|
||||||
input: unsigned_apk,
|
input: unsigned_apk,
|
||||||
command: [
|
command: [
|
||||||
python3,
|
python3,
|
||||||
@ -94,6 +100,6 @@ if adb.found()
|
|||||||
input: [ signed_apk, install_apk ],
|
input: [ signed_apk, install_apk ],
|
||||||
build_always_stale: true,
|
build_always_stale: true,
|
||||||
output: 'run-apk',
|
output: 'run-apk',
|
||||||
command: [ python3, files('run-apk.py'), adb, meson.project_build_root(), '@OUTPUT@', '@INPUT0@' ],
|
command: [ python3, files('run-apk.py'), adb, meson.project_build_root(), '@OUTPUT@', '@INPUT0@', app_id ],
|
||||||
)
|
)
|
||||||
endif
|
endif
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
android_resources = files(
|
android_resources = files(
|
||||||
'mipmap-mdpi/ic_launcher.png',
|
'mipmap-mdpi/ic_launcher.png',
|
||||||
'values/colors.xml',
|
'values/colors.xml',
|
||||||
'values/strings.xml',
|
|
||||||
'values/styles.xml',
|
'values/styles.xml',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
subdir('values')
|
||||||
|
5
android/res/values/meson.build
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
android_resources += configure_file(
|
||||||
|
input: 'strings.template.xml',
|
||||||
|
output: 'strings.xml',
|
||||||
|
configuration: conf_data,
|
||||||
|
)
|
3
android/res/values/strings.template.xml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<resources>
|
||||||
|
<string name="app_name">@APPNAME@</string>
|
||||||
|
</resources>
|
@ -1,3 +0,0 @@
|
|||||||
<resources>
|
|
||||||
<string name="app_name">The Powder Toy</string>
|
|
||||||
</resources>
|
|
@ -9,6 +9,7 @@ import sys
|
|||||||
build_dir,
|
build_dir,
|
||||||
phony,
|
phony,
|
||||||
apk_name,
|
apk_name,
|
||||||
|
app_id,
|
||||||
) = sys.argv
|
) = sys.argv
|
||||||
|
|
||||||
apk_path = os.path.join(build_dir, apk_name)
|
apk_path = os.path.join(build_dir, apk_name)
|
||||||
@ -19,6 +20,6 @@ if subprocess.run([
|
|||||||
'am',
|
'am',
|
||||||
'start',
|
'start',
|
||||||
'--activity-clear-top',
|
'--activity-clear-top',
|
||||||
'-n', 'uk.co.powdertoy.tpt/.PowderActivity',
|
'-n', app_id + '/.PowderActivity',
|
||||||
]).returncode:
|
]).returncode:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
16
meson.build
@ -13,6 +13,11 @@ project(
|
|||||||
meson_version: '>=0.61.0',
|
meson_version: '>=0.61.0',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if get_option('prepare')
|
||||||
|
# we're being run by prepare.py in a ghactions workflow only to determine the values of options; exit early
|
||||||
|
subdir_done()
|
||||||
|
endif
|
||||||
|
|
||||||
to_array = generator(
|
to_array = generator(
|
||||||
executable('toarray', sources: 'data/ToArray.cpp', native: true),
|
executable('toarray', sources: 'data/ToArray.cpp', native: true),
|
||||||
output: [ '@PLAINNAME@.cpp', '@PLAINNAME@.h' ],
|
output: [ '@PLAINNAME@.cpp', '@PLAINNAME@.h' ],
|
||||||
@ -308,6 +313,9 @@ else
|
|||||||
ident_platform = 'UNKNOWN'
|
ident_platform = 'UNKNOWN'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
app_exe = get_option('app_exe')
|
||||||
|
app_id = get_option('app_id')
|
||||||
|
|
||||||
conf_data.set('LIN', host_platform == 'linux')
|
conf_data.set('LIN', host_platform == 'linux')
|
||||||
conf_data.set('AND', host_platform == 'android')
|
conf_data.set('AND', host_platform == 'android')
|
||||||
conf_data.set('WIN', host_platform == 'windows')
|
conf_data.set('WIN', host_platform == 'windows')
|
||||||
@ -331,8 +339,8 @@ conf_data.set('IDENT', '"@0@-@1@-@2@"'.format(host_arch, host_platform, host_lib
|
|||||||
conf_data.set('ENFORCE_HTTPS', enforce_https)
|
conf_data.set('ENFORCE_HTTPS', enforce_https)
|
||||||
conf_data.set('APPNAME', get_option('app_name'))
|
conf_data.set('APPNAME', get_option('app_name'))
|
||||||
conf_data.set('APPCOMMENT', get_option('app_comment'))
|
conf_data.set('APPCOMMENT', get_option('app_comment'))
|
||||||
conf_data.set('APPEXE', get_option('app_exe'))
|
conf_data.set('APPEXE', app_exe)
|
||||||
conf_data.set('APPID', get_option('app_id'))
|
conf_data.set('APPID', app_id)
|
||||||
conf_data.set('APPDATA', get_option('app_data'))
|
conf_data.set('APPDATA', get_option('app_data'))
|
||||||
conf_data.set('APPVENDOR', get_option('app_vendor'))
|
conf_data.set('APPVENDOR', get_option('app_vendor'))
|
||||||
|
|
||||||
@ -366,7 +374,7 @@ if get_option('build_powder')
|
|||||||
]
|
]
|
||||||
if host_platform == 'android'
|
if host_platform == 'android'
|
||||||
powder_sha = shared_library(
|
powder_sha = shared_library(
|
||||||
'powder',
|
app_exe,
|
||||||
sources: powder_files,
|
sources: powder_files,
|
||||||
include_directories: [ project_inc, powder_inc ],
|
include_directories: [ project_inc, powder_inc ],
|
||||||
c_args: project_c_args,
|
c_args: project_c_args,
|
||||||
@ -377,7 +385,7 @@ if get_option('build_powder')
|
|||||||
subdir('android')
|
subdir('android')
|
||||||
else
|
else
|
||||||
executable(
|
executable(
|
||||||
'powder',
|
app_exe,
|
||||||
sources: powder_files,
|
sources: powder_files,
|
||||||
include_directories: [ project_inc, powder_inc ],
|
include_directories: [ project_inc, powder_inc ],
|
||||||
c_args: project_c_args,
|
c_args: project_c_args,
|
||||||
|
@ -207,3 +207,9 @@ option(
|
|||||||
value: true,
|
value: true,
|
||||||
description: 'Enforce encrypted HTTP traffic, may be disabled for debugging'
|
description: 'Enforce encrypted HTTP traffic, may be disabled for debugging'
|
||||||
)
|
)
|
||||||
|
option(
|
||||||
|
'prepare',
|
||||||
|
type: 'boolean',
|
||||||
|
value: false,
|
||||||
|
description: 'Used by ghactions workflows, not useful otherwise'
|
||||||
|
)
|
||||||
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 7.8 KiB |
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 68 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
@ -13,7 +13,7 @@ if host_platform == 'linux'
|
|||||||
data_files += to_array.process('cps16.png', extra_args: 'cps16_png')
|
data_files += to_array.process('cps16.png', extra_args: 'cps16_png')
|
||||||
data_files += to_array.process('cps32.png', extra_args: 'cps32_png')
|
data_files += to_array.process('cps32.png', extra_args: 'cps32_png')
|
||||||
data_files += to_array.process('exe48.png', extra_args: 'exe48_png')
|
data_files += to_array.process('exe48.png', extra_args: 'exe48_png')
|
||||||
data_files += to_array.process('icon/powder-128.png', extra_args: 'icon_png')
|
data_files += to_array.process('icon/icon-128.png', extra_args: 'icon_png')
|
||||||
data_files += to_array.process('save.xml', extra_args: 'save_xml')
|
data_files += to_array.process('save.xml', extra_args: 'save_xml')
|
||||||
data_files += to_array.process(configure_file(
|
data_files += to_array.process(configure_file(
|
||||||
input: 'powder.template.desktop',
|
input: 'powder.template.desktop',
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#if defined(LIN)
|
#if defined(LIN)
|
||||||
# include "powder-128.png.h"
|
# include "icon-128.png.h"
|
||||||
#endif
|
#endif
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#if defined(LIN)
|
#if defined(LIN)
|
||||||
# include "powder-128.png.h"
|
# include "icon-128.png.h"
|
||||||
#endif
|
#endif
|
||||||
#include <csignal>
|
#include <csignal>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
@ -137,7 +137,7 @@ void DoRestart()
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
#elif defined(LIN) || defined(MACOSX)
|
#elif defined(LIN) || defined(MACOSX)
|
||||||
execl(exename.c_str(), "powder", NULL);
|
execl(exename.c_str(), exename.c_str(), NULL);
|
||||||
int ret = errno;
|
int ret = errno;
|
||||||
fprintf(stderr, "cannot restart: execl(...) failed: code %i\n", ret);
|
fprintf(stderr, "cannot restart: execl(...) failed: code %i\n", ret);
|
||||||
#endif
|
#endif
|
||||||
|