diff --git a/Scripts/Build/BuildLinux.sh b/Scripts/Build/BuildLinux.sh index 7c37793..9267930 100755 --- a/Scripts/Build/BuildLinux.sh +++ b/Scripts/Build/BuildLinux.sh @@ -1,159 +1,211 @@ #!/bin/bash -upstreamURL="https://github.com/DEAKSoftware/Synergy-Binaries.git" -queriedURL="$( git config --get remote.origin.url )" -toplevelPath="$( git rev-parse --show-toplevel )" +# 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 +# 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 +# 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 +# fi -synergyCorePath="${toplevelPath}/Synergy-Core" -buildPath="${synergyCorePath}/build" -binariesPath="${toplevelPath}/Binaries" -toolsPath="${toplevelPath}/Tools" +# productRepoPath="${toplevelPath}/Synergy-Core" +# buildPath="${productRepoPath}/build" +# binariesPath="${toplevelPath}/Binaries" +# toolsPath="${toplevelPath}/Tools" -configureSubmodules() { +# configureSubmodules() { - git submodule update --init --remote --recursive +# git submodule update --init --remote --recursive -} +# } -configureCMake() { +# configureCMake() { - cmake -S "${synergyCorePath}" -B "${buildPath}" -D CMAKE_BUILD_TYPE=MINSIZEREL -D SYNERGY_ENTERPRISE=ON || exit 1 +# cmake -S "${productRepoPath}" -B "${buildPath}" -D CMAKE_BUILD_TYPE=MINSIZEREL -D SYNERGY_ENTERPRISE=ON || exit 1 -} +# } -configureVersion() { +# configureVersion() { - source /etc/os-release || exit 1 - linuxVersion="${ID}${VERSION_ID}" +# 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}" +# source "${buildPath}/version" +# synergyVersion="${SYNERGY_VERSION_MAJOR}.${SYNERGY_VERSION_MINOR}.${SYNERGY_VERSION_PATCH}" +# synergyVersionStage="${SYNERGY_VERSION_STAGE}" -} +# } -configure() { +# configure() { - configureSubmodules - configureCMake - configureVersion -} +# configureSubmodules +# configureCMake +# configureVersion +# } -buildBinaries() { +# buildBinaries() { - cmake --build "${buildPath}" --parallel 8 || exit 1 +# cmake --build "${buildPath}" --parallel 8 || exit 1 -} +# } -buildAppImage() { +# buildAppImage() { - pushd "${toolsPath}" || exit 1 +# pushd "${toolsPath}" || exit 1 - wget -O linuxdeploy -c https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage || exit 1 - chmod a+x linuxdeploy || exit 1 +# wget -O linuxdeploy -c https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage || exit 1 +# chmod a+x linuxdeploy || exit 1 - # Needed by linuxdeploy - export VERSION="${synergyVersion}-${linuxVersion}" +# # Needed by linuxdeploy +# export VERSION="${synergyVersion}-${linuxVersion}" - appImagePath="${buildPath}/Synergy-${VERSION}.AppDir" +# appImagePath="${buildPath}/Synergy-${VERSION}.AppDir" - ./linuxdeploy \ - --appdir "${appImagePath}" \ - --executable "${buildPath}/bin/synergy" \ - --executable "${buildPath}/bin/synergyc" \ - --executable "${buildPath}/bin/synergyd" \ - --executable "${buildPath}/bin/synergys" \ - --executable "${buildPath}/bin/syntool" \ - --create-desktop-file \ - --icon-file "${synergyCorePath}/res/synergy.svg" \ - --output appimage || exit 1 +# ./linuxdeploy \ +# --appdir "${appImagePath}" \ +# --executable "${buildPath}/bin/synergy" \ +# --executable "${buildPath}/bin/synergyc" \ +# --executable "${buildPath}/bin/synergyd" \ +# --executable "${buildPath}/bin/synergys" \ +# --executable "${buildPath}/bin/syntool" \ +# --create-desktop-file \ +# --icon-file "${productRepoPath}/res/synergy.svg" \ +# --output appimage || exit 1 - mv "${toolsPath}/"*.AppImage "${binariesPath}" +# mv "${toolsPath}/"*.AppImage "${binariesPath}" - popd +# popd -} +# } -buildDeb() { +# buildDeb() { - pushd "${synergyCorePath}" || exit 1 +# pushd "${productRepoPath}" || exit 1 - printf "synergy (${synergyVersion}) ${synergyVersionStage}; urgency=medium\n" > "debian/changelog" || exit 1 - debuild --set-envvar CMAKE_BUILD_TYPE=MINSIZEREL --set-envvar SYNERGY_ENTERPRISE=ON -us -uc || exit 1 - git clean -fd +# printf "synergy (${synergyVersion}) ${synergyVersionStage}; urgency=medium\n" > "debian/changelog" || exit 1 +# debuild --set-envvar CMAKE_BUILD_TYPE=MINSIZEREL --set-envvar SYNERGY_ENTERPRISE=ON -us -uc || exit 1 +# git clean -fd - popd +# popd - mv "${synergyCorePath}/../"*.deb "${binariesPath}" +# mv "${productRepoPath}/../"*.deb "${binariesPath}" - rename "s/(\\d+\\.\\d+.\\d+)/\$1-${linuxVersion}/g" "${binariesPath}"/*.deb +# rename "s/(\\d+\\.\\d+.\\d+)/\$1-${linuxVersion}/g" "${binariesPath}"/*.deb - mv "${synergyCorePath}/../synergy_${synergyVersion}"* "${buildPath}" - mv "${synergyCorePath}/../synergy-dbgsym_${synergyVersion}"* "${buildPath}" +# mv "${productRepoPath}/../synergy_${synergyVersion}"* "${buildPath}" +# mv "${productRepoPath}/../synergy-dbgsym_${synergyVersion}"* "${buildPath}" -} +# } -buildClean() { +# buildClean() { - pushd "${synergyCorePath}" || exit 1 +# pushd "${productRepoPath}" || exit 1 - git clean -fdx +# git clean -fdx - popd +# popd - pushd "${toplevelPath}" || exit 1 +# pushd "${toplevelPath}" || exit 1 - git clean -fdx +# git clean -fdx - popd +# popd -} +# } + +# if [ "${1}" = "--help" ] || [ "${1}" = "-h" ]; then + +# cat "${toplevelPath}/Documentation/HelpLinux.txt" + +# elif [ "${1}" = "--bin" ]; then + +# configure +# buildBinaries + +# elif [ "${1}" = "--appimage" ]; then -if [ "${1}" = "--help" ] || [ "${1}" = "-h" ]; then +# configure +# buildBinaries +# buildAppImage - cat "${toplevelPath}/Documentation/HelpLinux.txt" +# elif [ "${1}" = "--deb" ]; then -elif [ "${1}" = "--bin" ]; then +# configure +# buildDeb - configure - buildBinaries +# elif [ "${1}" = "--all" ]; then -elif [ "${1}" = "--appimage" ]; then +# configure +# buildBinaries +# buildAppImage +# buildDeb - configure - buildBinaries - buildAppImage +# elif [ "${1}" = "--clean" ]; then -elif [ "${1}" = "--deb" ]; then +# buildClean - configure - buildDeb +# else -elif [ "${1}" = "--all" ]; then +# echo "error: Bad or unknown option. Run with '--help' option for details." +# exit 1 - configure - buildBinaries - buildAppImage - buildDeb +# fi -elif [ "${1}" = "--clean" ]; then +# exit 0 - buildClean +configureCMake() { + + cmake -S "${productRepoPath}" -B "${productBuildPath}" \ + -D CMAKE_BUILD_TYPE=Release \ + -D SYNERGY_ENTERPRISE=ON \ + || exit 1 + +} + +buildBinaries() { + + cmake --build "${productBuildPath}" --parallel || exit 1 -else +} + +buildAppImage() { + + pushd "${toolsPath}" || exit 1 + + wget -O linuxdeploy -c "${linuxdeployURL}" || exit 1 + chmod a+x linuxdeploy || exit 1 + + # Needed by linuxdeploy + export VERSION="${productVersion}-${productStage}" + + appImagePath="${productBuildPath}/${productPackageName}.AppDir" + + ./linuxdeploy \ + --appdir "${appImagePath}" \ + --executable "${productBuildPath}/bin/synergy" \ + --executable "${productBuildPath}/bin/synergyc" \ + --executable "${productBuildPath}/bin/synergyd" \ + --executable "${productBuildPath}/bin/synergys" \ + --executable "${productBuildPath}/bin/syntool" \ + --create-desktop-file \ + --icon-file "${productRepoPath}/res/synergy.svg" \ + --output appimage || exit 1 + + rsync -a --delete "${toolsPath}/"*.AppImage "${binariesPath}/${productPackageName}.AppImage" + + popd + +} - echo "error: Bad or unknown option. Run with '--help' option for details." - exit 1 +set -o nounset -fi +configureCMake +buildBinaries +buildAppImage exit 0