Skip to content

Instantly share code, notes, and snippets.

@Ashark
Last active January 5, 2018 05:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ashark/68365da5f487805ffe1307bc56bde8ba to your computer and use it in GitHub Desktop.
Save Ashark/68365da5f487805ffe1307bc56bde8ba to your computer and use it in GitHub Desktop.
Kdeneur-git package build script for ArchLinux (needs review before publish in AUR)
# Maintainer: Andrew Shark <ashark@linuxcomp.ru>
pkgname=kdeneur-git
pkgver=0.20.0.r153.219393c
pkgrel=1
_xneurver=0.20.0
pkgdesc="KDE frontend for xneur (Auto Keyboard Layout Switcher)"
arch=('x86_64')
url="https://xneur.ru/"
license=('GPL')
depends=('qt4' 'kdelibs' 'kdelibs4support' "xneur-git>=${_xneurver}" "xosd")
makedepends=('git' 'gcc' 'make')
optdepends=()
provides=('kdeneur')
conflicts=('kdeneur')
source=( # 'git+https://github.com/AndrewCrewKuznetsov/xneur-devel' # Choose only one of these sources
# 'git+https://github.com/Ashark/xneur-devel#branch=transition-to-cmake' # I use it when developing
)
sha1sums=( #'SKIP'
)
pkgver() {
cd xneur-devel
knrelver=`cat kdeneur/CMakeLists.txt | grep "kdeneur VERSION" | cut -f3 -d ' ' | tr -d ")"`
printf "$knrelver.r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
# set amake, qmake or cmake here
build_system=cmake
prepare() {
if [[ $build_system == cmake ]]; then
# echo wip prepare
mkdir -p ${srcdir}/xneur-devel/kdeneur/build
elif [[ $build_system == amake ]]; then
cd ${srcdir}/xneur-devel/kdeneur
touch {README,NEWS,TODO} # without these files automake will not work
elif [[ $build_system == qmake ]]; then
echo wip qmake
fi
}
build() {
if [[ $build_system == cmake ]]; then
# clear cache. I use for debugging while developing
if [ -d "${srcdir}/xneur-devel/kdeneur/build/" ]; then
: # if statement should contain at least something (empty op).
# rm -r ${srcdir}/xneur-devel/kdeneur/build/* # Comment if do not want to clear cache
fi
# now going to build
cd ${srcdir}/xneur-devel/kdeneur/build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr
elif [[ $build_system == amake ]]; then
cd ${srcdir}/xneur-devel/kdeneur
./autogen.sh --prefix=/usr # autogen.sh creates configure file and runs it with parameters
# generating ui_*.h, because our configuration of autotools is not correct
cd ${srcdir}/xneur-devel/kdeneur/src
for file in *.ui; do uic-qt4 $file > ui_${file%.ui}.h; done
elif [[ $build_system == qmake ]]; then
# echo wip
cd ${srcdir}/xneur-devel/kdeneur/src/
echo `pwd`
# make qmake
qmake -project
qmake-qt4 src.pro
fi
make
}
package() {
if [[ $build_system == cmake ]]; then
cd ${srcdir}/xneur-devel/kdeneur/build
make DESTDIR=${pkgdir} install
elif [[ $build_system == amake ]]; then
cd ${srcdir}/xneur-devel/kdeneur
make DESTDIR=${pkgdir} install
make clean # removing am build-time stuff from sources
elif [[ $build_system == qmake ]]; then
cd ${srcdir}/xneur-devel/kdeneur
# echo we re in qmake package
# echo $pkgdir
make INSTALL_ROOT="${pkgdir}" install
# make install
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment