From fc5de88eaacfd3ef0af2939f19706d72f9bc427d Mon Sep 17 00:00:00 2001 From: Ray Foss Date: Sun, 28 Mar 2021 23:11:04 -0500 Subject: [PATCH] Clarify the order of operations in BUILD.md PR #2223 Signed-off-by: Romain Vimont --- BUILD.md | 82 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 42 insertions(+), 40 deletions(-) diff --git a/BUILD.md b/BUILD.md index a0c0f868..98837e69 100644 --- a/BUILD.md +++ b/BUILD.md @@ -2,11 +2,6 @@ Here are the instructions to build _scrcpy_ (client and server). -You may want to build only the client: the server binary, which will be pushed -to the Android device, does not depend on your system and architecture. In that -case, use the [prebuilt server] (so you will not need Java or the Android SDK). - -[prebuilt server]: #prebuilt-server ## Branches @@ -188,8 +183,27 @@ See [pierlon/scrcpy-docker](https://github.com/pierlon/scrcpy-docker). ## Common steps -If you want to build the server, install the [Android SDK] (_Android Studio_), -and set `ANDROID_SDK_ROOT` to its directory. For example: +**As a non-root user**, clone the project: + +```bash +git clone https://github.com/Genymobile/scrcpy +cd scrcpy +``` + + +### Build + +You may want to build only the client: the server binary, which will be pushed +to the Android device, does not depend on your system and architecture. In that +case, use the [prebuilt server] (so you will not need Java or the Android SDK). + +[prebuilt server]: #option-2-use-prebuilt-server + + +#### Option 1: Build everything from sources + +Install the [Android SDK] (_Android Studio_), and set `ANDROID_SDK_ROOT` to its +directory. For example: [Android SDK]: https://developer.android.com/studio/index.html @@ -202,20 +216,11 @@ export ANDROID_SDK_ROOT=~/Library/Android/sdk set ANDROID_SDK_ROOT=%LOCALAPPDATA%\Android\sdk ``` -If you don't want to build the server, use the [prebuilt server]. - -Clone the project: - -```bash -git clone https://github.com/Genymobile/scrcpy -cd scrcpy -``` - Then, build: ```bash meson x --buildtype release --strip -Db_lto=true -ninja -Cx +ninja -Cx # DO NOT RUN AS ROOT ``` _Note: `ninja` [must][ninja-user] be run as a non-root user (only `ninja @@ -224,9 +229,27 @@ install` must be run as root)._ [ninja-user]: https://github.com/Genymobile/scrcpy/commit/4c49b27e9f6be02b8e63b508b60535426bd0291a -### Run +#### Option 2: Use prebuilt server -To run without installing: + - [`scrcpy-server-v1.17`][direct-scrcpy-server] + _(SHA-256: 11b5ad2d1bc9b9730fb7254a78efd71a8ff46b1938ff468e47a21b653a1b6725)_ + +[direct-scrcpy-server]: https://github.com/Genymobile/scrcpy/releases/download/v1.17/scrcpy-server-v1.17 + +Download the prebuilt server somewhere, and specify its path during the Meson +configuration: + +```bash +meson x --buildtype release --strip -Db_lto=true \ + -Dprebuilt_server=/path/to/scrcpy-server +ninja -Cx # DO NOT RUN AS ROOT +``` + +The server only works with a matching client version (this server works with the +`master` branch). + + +### Run without installing: ```bash ./run x [options] @@ -249,24 +272,3 @@ This installs two files: Just remove them to "uninstall" the application. You can then [run](README.md#run) _scrcpy_. - - -## Prebuilt server - - - [`scrcpy-server-v1.17`][direct-scrcpy-server] - _(SHA-256: 11b5ad2d1bc9b9730fb7254a78efd71a8ff46b1938ff468e47a21b653a1b6725)_ - -[direct-scrcpy-server]: https://github.com/Genymobile/scrcpy/releases/download/v1.17/scrcpy-server-v1.17 - -Download the prebuilt server somewhere, and specify its path during the Meson -configuration: - -```bash -meson x --buildtype release --strip -Db_lto=true \ - -Dprebuilt_server=/path/to/scrcpy-server -ninja -Cx -sudo ninja -Cx install -``` - -The server only works with a matching client version (this server works with the -`master` branch).