@ -1,204 +1,139 @@
#!/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
# productRepoPath="${toplevelPath}/Synergy-Core"
# buildPath="${productRepoPath}/build"
# binariesPath="${toplevelPath}/Binaries"
# toolsPath="${toplevelPath}/Tools"
# configureSubmodules() {
# git submodule update --init --remote --recursive
# }
# configureCMake() {
# cmake -S "${productRepoPath}" -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
# }
# buildBinaries() {
# cmake --build "${buildPath}" --parallel 8 || exit 1
# }
# buildAppImage() {
# 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
# # Needed by linuxdeploy
# export VERSION="${synergyVersion}-${linuxVersion}"
# 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 "${productRepoPath}/res/synergy.svg" \
# --output appimage || exit 1
# mv "${toolsPath}/"*.AppImage "${binariesPath}"
# popd
# }
# buildDeb() {
# 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
# popd
configureCMake( ) {
# mv "${productRepoPath}/../"*.deb "${binariesPath}"
cmake -S " ${ productRepoPath } " -B " ${ productBuildPath } " \
-D CMAKE_BUILD_TYPE = Release \
-D SYNERGY_ENTERPRISE = ON \
|| exit 1
# rename "s/(\\d+\\.\\d+.\\d+)/\$1-${linuxVersion}/g" "${binariesPath}"/*.deb
}
# mv "${productRepoPath}/../synergy_${synergyVersion}"* "${buildPath}"
# mv "${productRepoPath}/../synergy-dbgsym_${synergyVersion}"* "${buildPath}"
buildBinaries( ) {
# }
cmake --build " ${ productBuildPath } " --parallel || exit 1
# buildClean() {
}
# pushd "${productRepoPath}" || exit 1
buildAppImage( ) {
# git clean -fdx
pushd " ${ toolsPath } " || exit 1
# popd
wget -O linuxdeploy -c " ${ linuxdeployURL } " || exit 1
chmod a+x linuxdeploy || exit 1
# pushd "${toplevelPath}" || exit 1
# Needed by linuxdeploy
export VERSION = " ${ productVersion } - ${ productStage } "
# git clean -fdx
appImagePath = " ${ productBuildPath } / ${ productPackageName } .AppDir "
# popd
./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
# }
mv " ${ toolsPath } / " *.AppImage " ${ binariesPath } / ${ productPackageName } .AppImage "
# if [ "${1}" = "--help" ] || [ "${1}" = "-h" ]; then
popd
# cat "${toplevelPath}/Documentation/HelpLinux.txt"
}
# elif [ "${1}" = "--bin" ]; then
buildDeb( ) {
# configure
# buildBinaries
pushd " ${ productRepoPath } " || exit 1
# elif [ "${1}" = "--appimage" ]; then
if [ ! -f "./debian/changelog" ] ; then
# configure
# buildBinaries
# buildAppImage
# Make the productName lowercase
packageName = $( echo " ${ productName } " | tr "[:upper:]" "[:lower:]" )
# elif [ "${1}" = "--deb" ]; then
dch --create --controlmaint --distribution unstable \
--package " ${ packageName } " \
--newversion " ${ productVersion } " \
"Snapshot release." \
|| exit 1
# configure
# buildDeb
fi
# elif [ "${1}" = "--all" ]; then
debuild \
--preserve-envvar SYNERGY_* \
--set-envvar CMAKE_BUILD_TYPE = Release \
--set-envvar SYNERGY_ENTERPRISE = ON \
--set-envvar DEB_BUILD_OPTIONS = "parallel=8" \
-us -uc \
|| exit 1
# configure
# buildBinaries
# buildAppImage
# buildDeb
git clean -fd
# elif [ "${1}" = "--clean" ]; then
popd
# buildClean
mv " ${ productRepoPath } /../ " *.deb " ${ binariesPath } / ${ productPackageName } .deb "
mv " ${ productRepoPath } /../synergy_ ${ productVersion } " * " ${ productBuildPath } "
mv " ${ productRepoPath } /../synergy-dbgsym_ ${ productVersion } " * " ${ productBuildPath } "
# else
}
# echo "error: Bad or unknown option. Run with '--help' option for details."
# exit 1
buildRPM( ) {
# fi
# rpmbuild is very flaky with paths containing spaces,
# so we set up a temporary build path and make sure no spaces
# are present in any paths.
temporaryPath = $( mktemp -d -t " ${ productPackageName } -XXXXXXXX " )
# exit 0
if [ [ ! " ${ temporaryPath } " || ! -d " ${ temporaryPath } " ] ] ; then
print "error: Failed to create temporary path."
exit 1
fi
configureCMake( ) {
trap " { rm -fR ' ${ temporaryPath } '; } " EXIT
cmake -S " ${ productRepoPath } " -B " ${ productBuildPath } " \
-D CMAKE_BUILD_TYPE = Release \
-D SYNERGY_ENTERPRISE = ON \
|| exit 1
printf " Created temporary path:\n\t ${ temporaryPath } \n "
}
# We will symlink RPM build paths to our temporary location
# and we'll do work in there.
rpmToplevelPath = " ${ temporaryPath } /rpm "
buildBinaries( ) {
ln -s " ${ productBuildPath } /rpm " " ${ rpmToplevelPath } "
cmake --build " ${ productBuildPath } " --parallel || exit 1
rpmBuildrootPath = " ${ rpmToplevelPath } /BUILDROOT "
installPath = " ${ rpmBuildrootPath } /usr "
}
if [ [ ${ rpmToplevelPath } = *" " * ] ] ; then
printf " error: RPM top-level path contained spaces:\n\t ${ rpmToplevelPath } \n "
fi
buildAppImage( ) {
# Reconfigure with new intall path
cmake -S " ${ productRepoPath } " -B " ${ productBuildPath } " \
-D CMAKE_BUILD_TYPE = Release \
-D SYNERGY_ENTERPRISE = ON \
-D CMAKE_INSTALL_PREFIX:PATH= " ${ installPath } " \
|| exit 1
pushd " ${ toolsPath } " || exit 1
# Rebuild and deploy to intall path
pushd " ${ productBuildPath } " || exit 1
wget -O linuxdeploy -c " ${ linuxdeployURL } " || exit 1
chmod a+x linuxdeploy || exit 1
make -j || exit 1
make install/strip || exit 1
# Needed by linuxdeploy
export VERSION = " ${ productVersion } - ${ productStage } "
popd
appImagePath = " ${ productBuildPath } / ${ productPackageName } .AppDir "
pushd " ${ rpmToplevelPath } " || exit 1
./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
rpmbuild -bb \
--define " _topdir ${ rpmToplevelPath } " \
--buildroot " ${ rpmBuildrootPath } " \
synergy.spec \
|| exit 1
rsync -a --delete " ${ toolsPath } / " *.AppImage " ${ binariesPath } / ${ productPackageName } .AppImage "
mv "RPMS/x86_64/" *.rpm " ${ binariesPath } / ${ productPackageName } .rpm "
popd
popd
}
@ -207,5 +142,7 @@ set -o nounset
configureCMake
buildBinaries
buildAppImage
buildDeb
buildRPM
exit 0