diff --git a/Documentation/BuildLinux.md b/Documentation/BuildLinux.md new file mode 100644 index 0000000..ada5cb1 --- /dev/null +++ b/Documentation/BuildLinux.md @@ -0,0 +1,55 @@ +## Building on Linux Mint / Ubuntu + +### Prerequisites + +Install the following tools and dependencies: + +```sh +sudo apt-get install \ + cmake g++ libavahi-compat-libdnssd-dev \ + libcurl4-openssl-dev libegl1-mesa \ + libgl1-mesa-glx libqt5svg5-dev libsodium-dev \ + libssl-dev libsystemd-dev libx11-dev \ + make qtbase5-dev qtcreator qtdeclarative5-dev \ + qttools5-dev xorg-dev +``` + +For building Debian packages: + +```sh +sudo apt-get install build-essential devscripts dh-make lintian +``` + +### Compiling (Easy Mode) + +Run the shell script `buildLinux.sh --all` to build all packages. For other options, run with the `--help` switch. + +### Compiling (Hard Mode) + +Alternatively, you can opt to build the binaries only, as detailed below. We're assuming the current path is in the `Synergy-Binaries` project root. + +```sh +cd Synergy-Core +mkdir build +cd build + +cmake .. -D CMAKE_BUILD_TYPE=MINSIZEREL -D SYNERGY_ENTERPRISE=ON + +cmake --build . --parallel 8 +``` + +Optional, install the application: + +```sh +sudo cmake --install . +``` + +### Launching Automatically + +In Linux Mint we can launch `synergy` client automatically via _System Settings → Startup Applications_, then add an entry with the command: + +```sh +/usr/bin/synergyc --name ClientName --daemon #.#.#.# +``` + +Substitute the `ClientName` with the local machine name, and the Synergy server IP `#.#.#.#` with whatever appropriate for your set-up. diff --git a/Documentation/BuildMacOS.md b/Documentation/BuildMacOS.md new file mode 100644 index 0000000..e1dc80a --- /dev/null +++ b/Documentation/BuildMacOS.md @@ -0,0 +1,24 @@ +## Building on macOS + +### Prerequisites + +1. Install the following tools and dependencies: + + * [Homebrew](http://brew.sh/) + * [XCode](https://developer.apple.com/xcode/download/) + * [Qt 5](https://www.qt.io/download), select the following components: + * Qt 5.12.9, MSVC 2017 64-bit + +2. Use Homebrew to install additional tools and libraries: + + ```sh + brew install cmake libsodium openssl + ``` + +### Compiling (Easy Mode) + +Run the command script `buildMacOS.sh --all` to build all packages. For other options, run with the `--help` switch. + +### Compiling (Hard Mode) + +Alternatively, you can opt to build the binaries only, as detailed below. We're assuming the current path is in the `Synergy-Binaries` project root. diff --git a/Documentation/BuildWindows.md b/Documentation/BuildWindows.md new file mode 100644 index 0000000..a9758c2 --- /dev/null +++ b/Documentation/BuildWindows.md @@ -0,0 +1,45 @@ +## Building on Windows + +### Prerequisites + +1. Install the following tools and dependencies: + + * [Git for Windows](https://gitforwindows.org/) + * [CMake](https://cmake.org/) + * [Visual Studio 2019](https://visualstudio.microsoft.com/downloads/), select the following components: + * VS 2019 C++ x64/x86 build tools + * Windows 10 SDK + * [WiX Toolset](https://wixtoolset.org/releases/), install the following components: + * WiX Toolset Build Tools + * WiX Toolset Visual Studio 2019 Extension + * [Qt 5](https://www.qt.io/download), select the following components: + * Qt 5.12.9, MSVC 2017 64-bit + +2. Edit the `buildWindows.cmd` script and make sure the following script variables are configured properly: + + * `libQtPath` - Path to the Qt library, Visual C++, 64-bit build. + + * `vcvarsallCommand` - Path to Visual Studio's `vcvarsall.bat` command script, which sets compiler environment variables. See [Microsoft C++ toolset documentation](https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=vs-2019) for details. + + * `cmakeGenerator` - Specifies the "generator" setting for cmake. Run `cmake --help` to choose the suitable generator for your current tool chain. + +### Compiling (Easy Mode) + +Run the command script `buildWindows.cmd --all` to build all packages. For other options, run with the `--help` switch. + +### Compiling (Hard Mode) + +Alternatively, you can opt to build the binaries only, as detailed below. We're assuming the current path is in the `Synergy-Binaries` project root. + +```bat +cd Synergy-Core +mkdir build +cd build + +call "c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x64 + +cmake .. -G "Visual Studio 16 2019" -D CMAKE_PREFIX_PATH="c:\Qt\Qt5.12.9\5.12.9\msvc2017_64" -D CMAKE_BUILD_TYPE=MINSIZEREL -D SYNERGY_ENTERPRISE=ON + +msbuild synergy-core.sln /p:Platform="x64" /p:Configuration=Release /m +``` +You may need to use different paths to `vcvarsall.bat` and Qt libraries, whatever is appropriate for your system. Consequently, the generator `-G` switch for `cmake` must also reflect the tool chain environment. See `cmake --help` for details. diff --git a/Documentation/Cloning.md b/Documentation/Cloning.md new file mode 100644 index 0000000..bc42b38 --- /dev/null +++ b/Documentation/Cloning.md @@ -0,0 +1,32 @@ +## Cloning the Repository + +### Preparation + +Before you begin building Synergy, you need to recursively clone this project and its submodules: + +1. Clone the repository: + + ```sh + git clone https://github.com/DEAKSoftware/Synergy-Binaries.git + ``` + +2. Update all submodules: + + ```sh + cd Synergy-Binaries + git submodule update --init --remote --recursive + ``` + +### Project Structure + +The following files or directories should be of interest: + +File / Directory | Description +--- | --- +[`Binaries`](./Binaries) | Output location for the build binaries. +[`Documentation`](./Documentation) | Documentation for various scripts. +[`Synergy-Core`](https://github.com/symless/synergy-core/) | The official Synergy Core submodule. +[`Tools`](./Tools) | Temporary location for build tools. +[`buildLinux.sh`](./buildLinux.sh) | Shell script for building binaries in Linux Mint or Ubuntu. +[`buildMacOS.sh`](./buildMacOS.sh) | Shell script for building binaries in macOS. +[`buildWindows.cmd`](./buildWindows.cmd) | Command script for building binaries in Windows. diff --git a/Documentation/buildLinux.txt b/Documentation/HelpLinux.txt similarity index 100% rename from Documentation/buildLinux.txt rename to Documentation/HelpLinux.txt diff --git a/Documentation/HelpMacOS.txt b/Documentation/HelpMacOS.txt new file mode 100644 index 0000000..af8ed7f --- /dev/null +++ b/Documentation/HelpMacOS.txt @@ -0,0 +1,33 @@ +NAME + + buildMacOS.sh - Build Linux Binaries for Synergy + +SYNOPSIS + + ./buildMacOS.sh [OPTION] + +DESCRIPTION + + This is a utility script for building Synergy binaries and distribution packages. + The script will build the latest snapshot from the Synergy-Core submodule. + + -h, --help + + Display this help message. + + --cmake + + Build binaries only with CMake. + + --dmg + + Build a DMG disk image file. + + --all + + Build all packages. + + --clean + + Clean the build and output locations." + diff --git a/Documentation/buildWindows.txt b/Documentation/HelpWindows.txt similarity index 100% rename from Documentation/buildWindows.txt rename to Documentation/HelpWindows.txt diff --git a/buildLinux.sh b/buildLinux.sh index c027e72..b19e4c4 100755 --- a/buildLinux.sh +++ b/buildLinux.sh @@ -120,7 +120,7 @@ buildClean() { if [ "${1}" = "--help" ] || [ "${1}" = "-h" ]; then - cat "${toplevelPath}/Documentation/buildLinux.txt" + cat "${toplevelPath}/Documentation/HelpLinux.txt" elif [ "${1}" = "--cmake" ]; then diff --git a/buildMacOS.sh b/buildMacOS.sh new file mode 100755 index 0000000..ae3b5d9 --- /dev/null +++ b/buildMacOS.sh @@ -0,0 +1,110 @@ +#!/bin/bash + +upstreamURL="https://github.com/DEAKSoftware/Synergy-Binaries.git" +queriedURL="$( git config --get remote.origin.url )" +toplevelPath="$( git rev-parse --show-toplevel )" + +if [ "${upstreamURL}" != "${queriedURL}" ] || [ "${toplevelPath}" == "" ]; then + + echo "error: Unrecognised Git upstream URL, or top-level directory. This script must run within the top-level directory of the Synergy-Binaries repository." + exit 1 + +fi + +synergyCorePath="${toplevelPath}/Synergy-Core" +buildPath="${synergyCorePath}/build" +binariesPath="${toplevelPath}/Binaries" +toolsPath="${toplevelPath}/Tools" + + +configureSubmodules() { + + git submodule update --init --remote --recursive + +} + +configureCMake() { + + cmake -S "${synergyCorePath}" -B "${buildPath}" -D CMAKE_BUILD_TYPE=MINSIZEREL -D SYNERGY_ENTERPRISE=ON || exit 1 + +} + +configureVersion() { + + source /etc/os-release || exit 1 + linuxVersion="${ID}${VERSION_ID}" + + source "${buildPath}/version" + synergyVersion="${SYNERGY_VERSION_MAJOR}.${SYNERGY_VERSION_MINOR}.${SYNERGY_VERSION_PATCH}" + synergyVersionStage="${SYNERGY_VERSION_STAGE}" + +} + +configure() { + + configureSubmodules + configureCMake + configureVersion +} + + +buildCMake() { + + cmake --build "${buildPath}" --parallel 8 || exit 1 + +} + +buildDMG() { + + echo . + +} + +buildClean() { + + pushd "${synergyCorePath}" || exit 1 + + git clean -fdx + + popd + + pushd "${toplevelPath}" || exit 1 + + git clean -fdx + + popd + +} + +if [ "${1}" = "--help" ] || [ "${1}" = "-h" ]; then + + cat "${toplevelPath}/Documentation/HelpMacOS.txt" + +elif [ "${1}" = "--cmake" ]; then + + configure + buildCMake + +elif [ "${1}" = "--dmg" ]; then + + configure + buildDMG + +elif [ "${1}" = "--all" ]; then + + configure + buildCMake + buildDMG + +elif [ "${1}" = "--clean" ]; then + + buildClean + +else + + echo "error: Bad or unknown option. Run with '--help' option for details." + exit 1 + +fi + +exit 0 diff --git a/buildWindows.cmd b/buildWindows.cmd index 9fb7b10..1bb04f9 100644 --- a/buildWindows.cmd +++ b/buildWindows.cmd @@ -48,11 +48,11 @@ set toolsPath=%toplevelPath%\Tools if [%1] equ [--help] ( - type "%toplevelPath%\Documentation\buildWindows.txt" + type "%toplevelPath%\Documentation\HelpWindows.txt" ) else if [%1] equ [-h] ( - type "%toplevelPath%\Documentation\buildWindows.txt" + type "%toplevelPath%\Documentation\HelpWindows.txt" ) else if [%1] equ [--msbuild] ( diff --git a/readme.md b/readme.md index db1d68b..68fdad5 100644 --- a/readme.md +++ b/readme.md @@ -16,145 +16,21 @@ The following binaries available in the [Releases](https://github.com/DEAKSoftwa If you can't locate a binary package for your particular distribution, try building the project yourself. - -## Cloning the Repository - -### Preparation - -Before you begin building Synergy, you need to recursively clone this project and its submodules: - -1. Clone the repository: - - git clone https://github.com/DEAKSoftware/Synergy-Binaries.git - -2. Update all submodules: - - cd Synergy-Binaries - git submodule update --init --remote --recursive - -### Project Structure - -The following files or directories should be of interest: - -File / Directory | Description ---- | --- -[`Binaries`](./Binaries) | Output location for the build binaries. -[`Documentation`](./Documentation) | Documentation for various scripts. -[`Synergy-Core`](https://github.com/symless/synergy-core/) | The official Synergy Core submodule. -[`Tools`](./Tools) | Temporary location for build tools. -[`buildLinux.sh`](./buildLinux.sh) | Shell script for building binaries in Linux Mint or Ubuntu. -[`buildWindows.cmd`](./buildWindows.cmd) | Command script for building binaries in Windows. - - - - ## Building -### Official Documentation - -The information presented here is based on the [official wiki pages](https://github.com/symless/synergy-core/wiki). Anyone attempting to build Synergy should consult the official wiki pages first, particularly the following documentation: - -* [Compiling](https://github.com/symless/synergy-core/wiki/Compiling) -* [Compiling Synergy Core](https://github.com/symless/synergy-core/wiki/Compiling-Synergy-Core) -* [Building the Windows MSI Package](https://github.com/symless/synergy-core/wiki/Building-the-Windows-MSI-Package) - - -### Linux Mint / Ubuntu - -#### Prerequisites - -Install the following tools and dependencies: - - sudo apt-get install \ - cmake g++ libavahi-compat-libdnssd-dev \ - libcurl4-openssl-dev libegl1-mesa \ - libgl1-mesa-glx libqt5svg5-dev libsodium-dev \ - libssl-dev libsystemd-dev libx11-dev \ - make qtbase5-dev qtcreator qtdeclarative5-dev \ - qttools5-dev xorg-dev - -For building Debian packages: - - sudo apt-get install build-essential devscripts dh-make lintian - -#### Compiling (Easy Mode) - -Run the shell script `buildLinux.sh --all` to build all packages. For other options, run with the `--help` switch. - -#### Compiling (Hard Mode) - -Alternatively, you can opt to build the binaries only, as detailed below. We're assuming the current path is in the `Synergy-Binaries` project root. - - cd Synergy-Core - mkdir build - cd build - - cmake .. -D CMAKE_BUILD_TYPE=MINSIZEREL -D SYNERGY_ENTERPRISE=ON - - cmake --build . --parallel 8 - -Optional, install the application: - - sudo cmake --install . - -#### Launching Automatically - -In Linux Mint we can launch `synergy` client automatically via _System Settings → Startup Applications_, then add an entry with the command: - - /usr/bin/synergyc --name ClientName --daemon #.#.#.# - -Substitute the `ClientName` with the local machine name, and the Synergy server IP `#.#.#.#` with whatever appropriate for your set-up. - - -### macOS - -_Incomplete._ - - -### Windows - -#### Prerequisites - -1. Install the following tools and dependencies: - - * [Git for Windows](https://gitforwindows.org/) - * [CMake](https://cmake.org/) - * [Visual Studio 2019](https://visualstudio.microsoft.com/downloads/), select the following components: - * VS 2019 C++ x64/x86 build tools - * Windows 10 SDK - * [WiX Toolset](https://wixtoolset.org/releases/), install the following components: - * WiX Toolset Build Tools - * WiX Toolset Visual Studio 2019 Extension - * [Qt 5](https://www.qt.io/download), select the following components: - * Qt 5.12.9, MSVC 2017 64-bit - -2. Edit the `buildWindows.cmd` script and make sure the following script variables are configured properly: - - * `libQtPath` - Path to the Qt library, Visual C++, 64-bit build. - - * `vcvarsallCommand` - Path to Visual Studio's `vcvarsall.bat` command script, which sets compiler environment variables. See [Microsoft C++ toolset documentation](https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=vs-2019) for details. - - * `cmakeGenerator` - Specifies the "generator" setting for cmake. Run `cmake --help` to choose the suitable generator for your current tool chain. - -#### Compiling (Easy Mode) - -Run the command script `buildWindows.cmd --all` to build all packages. For other options, run with the `--help` switch. - -#### Compiling (Hard Mode) - -Alternatively, you can opt to build the binaries only, as detailed below. We're assuming the current path is in the `Synergy-Binaries` project root. - - cd Synergy-Core - mkdir build - cd build - - call "c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x64 +The information presented here is based on the [official wiki pages](https://github.com/symless/synergy-core/wiki). Anyone attempting to build Synergy should consult the official wiki pages first, then read build instructions specific for your platform. - cmake .. -G "Visual Studio 16 2019" -D CMAKE_PREFIX_PATH="c:\Qt\Qt5.12.9\5.12.9\msvc2017_64" -D CMAKE_BUILD_TYPE=MINSIZEREL -D SYNERGY_ENTERPRISE=ON +1. Official Documentation + * [Compiling](https://github.com/symless/synergy-core/wiki/Compiling), and [Compiling Synergy Core](https://github.com/symless/synergy-core/wiki/Compiling-Synergy-Core) + * [Building the Windows MSI Package](https://github.com/symless/synergy-core/wiki/Building-the-Windows-MSI-Package) - msbuild synergy-core.sln /p:Platform="x64" /p:Configuration=Release /m +2. Preparation Work + * [Cloning the Repository](./Documentation/Cloning.md) -You may need to use different paths to `vcvarsall.bat` and Qt libraries, whatever is appropriate for your system. Consequently, the generator `-G` switch for `cmake` must also reflect the tool chain environment. See `cmake --help` for details. +3. Building the Binaries + * [Building on Linux Mint / Ubuntu](./Documentation/BuildLinux.md) + * [Building on macOS](./Documentation/BuildMacOS.md) + * [Building on Windows](./Documentation/BuildWindows.md) ## Disclaimers and Legal