From 07983d914fe4fc4c3dbf3f84eb42c31ef3d47f86 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Wed, 14 Feb 2018 16:25:13 +0100 Subject: [PATCH] Accept prebuilt server Expose a 'prebuilt_server' option to pass the path of the prebuilt binary, so that the build does not require Android SDK. Usage: meson builddir -Dprebuilt_server=/tmp/my_prebuilt_server.jar --- meson_options.txt | 1 + server/meson.build | 26 +++++++++++++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/meson_options.txt b/meson_options.txt index d02127c6..eb33a01a 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,3 +1,4 @@ option('build_app', type: 'boolean', value: true) option('build_server', type: 'boolean', value: true) +option('prebuilt_server', type: 'string') option('override_server_jar', type: 'string') diff --git a/server/meson.build b/server/meson.build index 7be2c8fd..202ec3a1 100644 --- a/server/meson.build +++ b/server/meson.build @@ -1,7 +1,19 @@ -custom_target('scrcpy-server', - build_always: true, # gradle is responsible for tracking source changes - input: '.', - output: 'scrcpy-server.jar', - command: [find_program('./scripts/build-wrapper.sh'), '@INPUT@', '@OUTPUT@', get_option('buildtype')], - install: true, - install_dir: 'share/scrcpy') +# It may be useful to use a prebuilt server, so that no Android SDK is required +# to build. If the 'prebuilt_server' option is set, just copy the file as is. +prebuilt_server = get_option('prebuilt_server') +if prebuilt_server == '' + custom_target('scrcpy-server', + build_always: true, # gradle is responsible for tracking source changes + input: '.', + output: 'scrcpy-server.jar', + command: [find_program('./scripts/build-wrapper.sh'), '@INPUT@', '@OUTPUT@', get_option('buildtype')], + install: true, + install_dir: 'share/scrcpy') +else + custom_target('scrcpy-server-prebuilt', + input: prebuilt_server, + output: 'scrcpy-server.jar', + command: ['cp', '@INPUT@', '@OUTPUT@'], + install: true, + install_dir: 'share/scrcpy') +endif