Skip to content

Commit

Permalink
Rename SCRCPY_SERVER_JAR to SCRCPY_SERVER_PATH
Browse files Browse the repository at this point in the history
The server is currently a JAR, but it may ba an APK or a DEX, so the
variable name should not contain the type.

Rename the environment variable, the Meson options and the C
definitions.
  • Loading branch information
rom1v committed Feb 16, 2018
1 parent 60f3185 commit 0893789
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ build-portable:
[ -d "$(PORTABLE_BUILD_DIR)" ] || ( mkdir "$(PORTABLE_BUILD_DIR)" && \
meson "$(PORTABLE_BUILD_DIR)" \
--buildtype release --strip -Db_lto=true \
-Doverride_server_jar=scrcpy-server.jar )
-Doverride_server_path=scrcpy-server.jar )
ninja -C "$(PORTABLE_BUILD_DIR)"

release-portable: clean dist-portable-zip sums
Expand Down
12 changes: 6 additions & 6 deletions app/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,19 @@ conf.set_quoted('SCRCPY_VERSION', '0.1')
conf.set_quoted('PREFIX', get_option('prefix'))

# the path of the server, which will be appended to the prefix
# ignored if OVERRIDE_SERVER_JAR if defined
# ignored if OVERRIDE_SERVER_PATH if defined
# must be consistent with the install_dir in server/meson.build
conf.set_quoted('PREFIXED_SERVER_JAR', '/share/scrcpy/scrcpy-server.jar')
conf.set_quoted('PREFIXED_SERVER_PATH', '/share/scrcpy/scrcpy-server.jar')

# the path of the server to be used "as is"
# this is useful for building a "portable" version (with the server in the same
# directory as the client)
override_server_jar = get_option('override_server_jar')
if override_server_jar != ''
conf.set_quoted('OVERRIDE_SERVER_JAR', override_server_jar)
override_server_path = get_option('override_server_path')
if override_server_path != ''
conf.set_quoted('OVERRIDE_SERVER_PATH', override_server_path)
else
# undefine it
conf.set('OVERRIDE_SERVER_JAR', false)
conf.set('OVERRIDE_SERVER_PATH', false)
endif

# the default client TCP port for the "adb reverse" tunnel
Expand Down
10 changes: 5 additions & 5 deletions app/src/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@

#define SOCKET_NAME "scrcpy"

#ifdef OVERRIDE_SERVER_JAR
# define DEFAULT_SERVER_JAR OVERRIDE_SERVER_JAR
#ifdef OVERRIDE_SERVER_PATH
# define DEFAULT_SERVER_PATH OVERRIDE_SERVER_PATH
#else
# define DEFAULT_SERVER_JAR PREFIX PREFIXED_SERVER_JAR
# define DEFAULT_SERVER_PATH PREFIX PREFIXED_SERVER_PATH
#endif

static const char *get_server_path(void) {
const char *server_path = getenv("SCRCPY_SERVER_JAR");
const char *server_path = getenv("SCRCPY_SERVER_PATH");
if (!server_path) {
server_path = DEFAULT_SERVER_JAR;
server_path = DEFAULT_SERVER_PATH;
}
return server_path;
}
Expand Down
2 changes: 1 addition & 1 deletion meson_options.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
option('build_app', type: 'boolean', value: true, description: 'Build the client')
option('build_server', type: 'boolean', value: true, description: 'Build the server')
option('prebuilt_server', type: 'string', description: 'Path of the prebuilt server')
option('override_server_jar', type: 'string', description: 'Hardcoded path to find the server at runtime')
option('override_server_path', type: 'string', description: 'Hardcoded path to find the server at runtime')
option('skip_frames', type: 'boolean', value: true, description: 'Always display the most recent frame')
2 changes: 1 addition & 1 deletion run
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ then
exit 1
fi

SCRCPY_SERVER_JAR="$BUILDDIR/server/scrcpy-server.jar" "$BUILDDIR/app/scrcpy" "$@"
SCRCPY_SERVER_PATH="$BUILDDIR/server/scrcpy-server.jar" "$BUILDDIR/app/scrcpy" "$@"
2 changes: 1 addition & 1 deletion scripts/run-scrcpy.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/bash
SCRCPY_SERVER_JAR="$MESON_BUILD_ROOT/server/scrcpy-server.jar" "$MESON_BUILD_ROOT/app/scrcpy"
SCRCPY_SERVER_PATH="$MESON_BUILD_ROOT/server/scrcpy-server.jar" "$MESON_BUILD_ROOT/app/scrcpy"

0 comments on commit 0893789

Please sign in to comment.