513d2cae3e
Also restructure meson.build and the ghactions workflow a bit, and enable -ffunction-sections and -fdata-sections. Note that starcatcher uploads have not been tested and most likely don't work.
100 lines
2.2 KiB
Meson
100 lines
2.2 KiB
Meson
android_manifest_xml = files('AndroidManifest.xml')
|
|
powder_jar_sources = files(
|
|
'uk/co/powdertoy/tpt/PowderActivity.java',
|
|
)
|
|
|
|
subdir('res')
|
|
|
|
python3 = find_program('python3')
|
|
android_platform_jar = meson.get_external_property('android_platform_jar')
|
|
java_runtime_jar = meson.get_external_property('java_runtime_jar')
|
|
android_keystore = get_option('android_keystore')
|
|
sdl_jar = tpt_libs.get_variable('sdl_jar')
|
|
powder_jar = custom_target(
|
|
'powder-jar',
|
|
output: 'powder.jar',
|
|
command: [
|
|
python3,
|
|
files('powder-jar.py'),
|
|
find_program('javac'),
|
|
find_program('jar'),
|
|
meson.current_source_dir(),
|
|
meson.project_build_root(),
|
|
'@PRIVATE_DIR@',
|
|
'@OUTPUT@',
|
|
android_platform_jar,
|
|
java_runtime_jar,
|
|
sdl_jar,
|
|
is_debug ? 'debug' : 'release',
|
|
powder_jar_sources,
|
|
],
|
|
)
|
|
unaligned_apk = custom_target(
|
|
'build-apk',
|
|
output: 'powder.unaligned.apk',
|
|
input: powder_sha,
|
|
command: [
|
|
python3,
|
|
files('build-apk.py'),
|
|
find_program('d8'),
|
|
find_program('aapt'),
|
|
find_program('aapt2'),
|
|
meson.current_source_dir(),
|
|
meson.project_build_root(),
|
|
'@PRIVATE_DIR@',
|
|
'@OUTPUT@',
|
|
'@INPUT@',
|
|
android_platform_jar,
|
|
sdl_jar,
|
|
powder_jar,
|
|
host_arch,
|
|
is_debug ? 'debug' : 'release',
|
|
android_manifest_xml,
|
|
android_resources,
|
|
],
|
|
)
|
|
unsigned_apk = custom_target(
|
|
'align-apk',
|
|
output: 'powder.unsigned.apk',
|
|
input: unaligned_apk,
|
|
command: [
|
|
python3,
|
|
files('align-apk.py'),
|
|
find_program('zipalign'),
|
|
meson.project_build_root(),
|
|
'@OUTPUT@',
|
|
'@INPUT@',
|
|
],
|
|
)
|
|
signed_apk = custom_target(
|
|
'sign-apk',
|
|
output: 'powder.apk',
|
|
input: unsigned_apk,
|
|
command: [
|
|
python3,
|
|
files('sign-apk.py'),
|
|
find_program('apksigner'),
|
|
meson.project_build_root(),
|
|
'@OUTPUT@',
|
|
'@INPUT@',
|
|
android_keystore,
|
|
get_option('android_keyalias'),
|
|
],
|
|
)
|
|
adb = find_program('adb', required: false)
|
|
if adb.found()
|
|
install_apk = custom_target(
|
|
'install-apk',
|
|
input: signed_apk,
|
|
output: 'install-apk',
|
|
command: [ python3, files('install-apk.py'), adb, meson.project_build_root(), '@OUTPUT@', '@INPUT@' ],
|
|
)
|
|
custom_target(
|
|
'run-apk',
|
|
input: [ signed_apk, install_apk ],
|
|
build_always_stale: true,
|
|
output: 'run-apk',
|
|
command: [ python3, files('run-apk.py'), adb, meson.project_build_root(), '@OUTPUT@', '@INPUT0@' ],
|
|
)
|
|
endif
|