From 85819ab959db2d2c550f186bb8f0d2ff2f5408c6 Mon Sep 17 00:00:00 2001 From: Tru Huynh Date: Wed, 14 Mar 2018 21:03:53 +0100 Subject: [PATCH 1/2] initial version for build_installer for rpm --- dist/rpm/barrier.spec.in | 11 ++++--- dist/rpm/build_installer.sh.in | 55 ++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 4 deletions(-) create mode 100755 dist/rpm/build_installer.sh.in diff --git a/dist/rpm/barrier.spec.in b/dist/rpm/barrier.spec.in index b47c3fa2..2b358692 100644 --- a/dist/rpm/barrier.spec.in +++ b/dist/rpm/barrier.spec.in @@ -4,7 +4,8 @@ Version: @BARRIER_VERSION_MAJOR@.@BARRIER_VERSION_MINOR@.@BARRIER_VERSION_PATCH@ Summary: Keyboard and mouse sharing solution Group: Applications/Productivity URL: https://github.com/debauchee/barrier/ -Source: https://github.com/debauchee/barrier/archive/v@BARRIER_VERSION@.tar.gz +Source: Barrier-@BARRIER_VERSION@.tar.gz +#Source: https://github.com/debauchee/barrier/archive/v@BARRIER_VERSION@.tar.gz # workaround the git versionning and set to Release instead of the default Debug #Source1: build_env.sh Vendor: Debauchee ### FIXME ### @@ -31,7 +32,8 @@ Barrier allows you to share one mouse and keyboard between multiple computers. Work seamlessly across Windows, macOS and Linux. %prep -%setup -n %{name}-@BARRIER_VERSION@ +%setup -n %{name} +#%setup -n %{name}-@BARRIER_VERSION@ %build cp dist/rpm/build_env.sh . @@ -50,14 +52,15 @@ scl enable devtoolset-3 ./clean_build.sh %{__mkdir} -p %{buildroot}%{_bindir} %{buildroot}%{_datarootdir}/applications %{buildroot}%{_datarootdir}/icons/hicolor/scalable/apps %{__install} -t %{buildroot}%{_datarootdir}/applications res/barrier.desktop %{__install} -t %{buildroot}%{_datarootdir}/icons/hicolor/scalable/apps res/barrier.svg -%{__install} -t %{buildroot}%{_bindir} build/bin/{barrier,barrierc,barriers,barrierd,syntool} +%{__install} -t %{buildroot}%{_bindir} build/bin/{barrier,barrierc,barriers,syntool} +#%{__install} -t %{buildroot}%{_bindir} build/bin/{barrier,barrierc,barriers,barrierd,syntool} %files %defattr(755,root,root,-) %{_bindir}/barrier %{_bindir}/barrierc %{_bindir}/barriers -%{_bindir}/barrierd +#%{_bindir}/barrierd %{_bindir}/syntool %attr(644,-,-) %{_datarootdir}/applications/barrier.desktop %attr(644,-,-) %{_datarootdir}/icons/hicolor/scalable/apps/barrier.svg diff --git a/dist/rpm/build_installer.sh.in b/dist/rpm/build_installer.sh.in new file mode 100755 index 00000000..3e8914b7 --- /dev/null +++ b/dist/rpm/build_installer.sh.in @@ -0,0 +1,55 @@ +#!/bin/sh + +# change this to rename the installer package +B_TARGZ="Barrier-@BARRIER_VERSION@.tar.gz" + +# sanity check so we don't distribute packages full of debug symbols +if [ "@CMAKE_BUILD_TYPE@" != "Release" ]; then + echo Will only build installers for Release builds + exit 1 +fi + +cd @CMAKE_CURRENT_SOURCE_DIR@/build/rpm || exit 1 + +B_SPECFILE=@CMAKE_CURRENT_SOURCE_DIR@/barrier.spec +if [ ! -f $B_SPECFILE ]; then + echo Missing spec file: $B_SPECFILE + exit 1 +fi + +# remove any old copies so there's no confusion about whether this +# process completes successfully or not +[ -f $B_TARGZ ] && rm -f $B_TARGZ + +cp build_env.sh $B_SPECFILE @CMAKE_CURRENT_SOURCE_DIR@ && +(cd @CMAKE_CURRENT_SOURCE_DIR@/.. && tar -czvf @CMAKE_CURRENT_SOURCE_DIR@/../$B_TARGZ \ +barrier/barrier.spec \ +barrier/Build.properties \ +barrier/CMakeLists.txt \ +barrier/ChangeLog \ +barrier/LICENSE \ +barrier/README.md \ +barrier/build_env.sh \ +barrier/build_installer.bat \ +barrier/clean_build.bat \ +barrier/clean_build.sh \ +barrier/cmake \ +barrier/debian \ +barrier/dist \ +barrier/doc \ +barrier/ext \ +barrier/osx_environment.sh \ +barrier/res \ +barrier/src \ + + +) + +# copy all executables +#cp @CMAKE_RUNTIME_OUTPUT_DIRECTORY@/* . || exit 1 + +# copy the qt platform plugin +# TODO: this is hacky and will probably break if there is more than one qt +# version installed. need a better way to find this library + +echo "Installer created successfully" From 3ffee3ff0e3a49cfe35e180310d86785c390fa59 Mon Sep 17 00:00:00 2001 From: Tru Huynh Date: Wed, 14 Mar 2018 21:04:31 +0100 Subject: [PATCH 2/2] initial version for build_rpm.sh wrapper --- build_rpm.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 build_rpm.sh diff --git a/build_rpm.sh b/build_rpm.sh new file mode 100755 index 00000000..c58549af --- /dev/null +++ b/build_rpm.sh @@ -0,0 +1,29 @@ +#!/bin/sh +cd "$(dirname $0)" || exit 1 +# some environments have cmake v2 as 'cmake' and v3 as 'cmake3' +# check for cmake3 first then fallback to just cmake +B_CMAKE=`type cmake3 2>/dev/null` +if [ $? -eq 0 ]; then + B_CMAKE=`echo $B_CMAKE | cut -d' ' -f3` +else + B_CMAKE=cmake +fi +# default build configuration +B_BUILD_TYPE=${B_BUILD_TYPE:-Debug} +if [ "$(uname)" = "Darwin" ]; then + # OSX needs a lot of extra help, poor thing + # run the osx_environment.sh script to fix paths + . ./osx_environment.sh + B_CMAKE_FLAGS="-DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 $B_CMAKE_FLAGS" +fi +# allow local customizations to build environment +[ -r ./build_env.sh ] && . ./build_env.sh +B_CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=$B_BUILD_TYPE $B_CMAKE_FLAGS" +rm -rf build +( mkdir build || exit 1 +cd build || exit 1 +echo Starting Barrier $B_BUILD_TYPE build... +$B_CMAKE $B_CMAKE_FLAGS .. || exit 1 +[ -f rpm/barrier.spec ] && [ -f rpm/build_installer.sh ] ) && \ +build/rpm/build_installer.sh && +rpmbuild -ta ../Barrier*.tar.gz