slackbuilds/_unmaintained/xap/barrier/SlackBuild

105 lines
3.2 KiB
Bash
Executable file

#!/bin/bash
# variables
CWD=$(pwd)
PRGNAM=$(basename $CWD)
GITHUB_REPO=debauchee/barrier
VERSION=${VERSION:-latest}
ARCH=${ARCH:-$(uname -m)}
BUILD=1
TAG=gwh
TMP=/tmp/$TAG
PKG=$TMP/pkg-$PRGNAM
OUTPUT=/tmp
REPOSITORY=/var/cache/SlackBuilds.gwh/$PRGNAM
PREFIX=/usr
# nettoyage préalable
rm -fr $PKG $TMP/$PRGNAM
mkdir -p $PKG
# mise en place
cd $TMP
[ ! -e $REPOSITORY ] && git clone https://github.com/${GITHUB_REPO}.git $REPOSITORY
cd $REPOSITORY
git pull --all
cp -R $REPOSITORY $TMP/$PRGNAM
cd $TMP/$PRGNAM
[ "x$VERSION" == "xlatest" ] && VERSION=$(git tag --sort=-version:refname | head -n1)
[ "x$VERSION" == "x" ] && VERSION=trunk
[ "x$VERSION" == "xtrunk" ] && VERSION="git_r$(git rev-list --count HEAD)_$(git log -1 --format=%h)" || git checkout $VERSION
git submodule update --init --recursive
# lib/platform: Fix encoding for text copied between linux and windows
# https://github.com/debauchee/barrier/commit/dd3ea8adfef868e52098ea24d2ed08320a90e3b9
git cherry-pick -n dd3ea8adfef868e52098ea24d2ed08320a90e3b9
# Add missing cstddef includes for NULL
# https://github.com/debauchee/barrier/commit/4b12265ae5d324b942698a3177e1d8b1749414d7
git cherry-pick -n 4b12265ae5d324b942698a3177e1d8b1749414d7
# configuration
mkdir build
cd build/
cmake -G "Unix Makefiles" \
-D CMAKE_BUILD_TYPE:STRING=Release \
-D CMAKE_INSTALL_PREFIX:STRING=/usr \
-D BARRIER_REVISION:STRING=00000000 \
-D BARRIER_VERSION_STAGE:STRING=RELEASE \
..
# compilation
make -j3
# installation
make install DESTDIR=$PKG
# correction
cd $PKG
chown -R root:root *
find $PKG -name \.git\* -exec rm -fr {} \;
[ -d $PKG/usr/man ] && find $PKG/usr/man -type f -name "*.?" -exec gzip -9f {} \;
# Strip binaries
cd $PKG
find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
# embaumement
mkdir -p $PKG/install
cat <<EOF > $PKG/install/slack-desc
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.
# Line up the first '|' above the ':' following the base package name, and
# the '|' on the right side marks the last column you can put a character in.
# You must make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
barrier: barrier (Synergy Fork)
barrier:
barrier: Eliminate the barrier between your machines.
barrier: Barrier is KVM software forked from Symless's synergy 1.9 codebase.
barrier: Synergy was a commercialized reimplementation of the original
barrier: CosmoSynergy written by Chris Schoeneman.
barrier: Whereas synergy has moved beyond its goals from the 1.x era, Barrier
barrier: aims to maintain that simplicity. Barrier will let you use your
barrier: keyboard and mouse from machine A to control machine B (or more).
barrier: It's that simple.
barrier:
EOF
# empaquetage
rm -f $PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la
/sbin/makepkg --linkadd y --chown n --prepend $OUTPUT/$PRGNAM-$(echo $VERSION | sed 's/-//g')-$ARCH-$BUILD$TAG.txz