File PKGBUILD of Package cntlm
pkgname=cntlm
_pkgname=cntlm
pkgver=0.93.1gss
pkgrel=0
pkgdesc="Fast NTLM/Kerberos authentication proxy with tunneling"
arch=('x86_64')
url="https://github.com/biserov/cntlm-gss/"
license=('GPLv2')
#conflicts=('-')
provides=('cntlm=$pkgver')
depends=('krb5' 'systemd')
#optional makedepends: 'libdecaf' (not available in OBS)
makedepends=('cmake' 'git' 'tar' 'gcc')
#source=("git+https://github.com/BelledonneCommunications/$_pkgname.git")
source=("${_pkgname}-gss-${pkgver}.tar.gz")
sha256sums=('7adb0747b5483004fe4c51db53a21f1797083c953ead00b47603871fd31f62c2')
install=PKGBUILD.install
# Getting around the problem that bsdtar cannot set locale
# since en_US.UTF-8 locale is missing on the system.
# Workaround:
# Use tar instead of bsdtar. This way:
#bsdtar() { tar $@ ; }
# After compilation is done, to finish the packaging
# makepkg needs bsdtar again, but since we said
# bsdtart -> tar and only root can change this we have to
# figure out a way around the issue we introduced to
# bypass that OpenSUSE Build System does not set the default
# locale to en-US.UTF-8 which some programs require in Archlinux.
# What could be done is to create the directory:
# $HOME/.local/bin
# which usually systemd accepts as a default path if it exists.
# But we don't seem to have $HOME/.local/bin
# /home/abuild/.local/bin
# set up from start which would make life simpler.
# It is possible to export the PATH variable, prepending
# our newly made /home/abuild/.local/bin in front of it.
# That way, the system will look for our path first, where
# we can modify things and have write access.
# We create links to bsdtar in the system for both
# tar and bsdtar in /home/abuild/.local/bin
# and no matter what makepkg wants, it will end up getting
# bsdtar after we set our links that way.
# Problem solved, and compilation finnishes.
#
# Another advantage with this bug-fix is that all of a sudden
# you can archive your files with file-roller app and doesn't
# need to use bsdtar from commandline if you are currently not
# on Archlinux but need to create source files for Archlinux.
# bsdtar complains about archives made with file-roller normally.
# That was an improvement until bsdtar is reprogrammed
# so it can handle files *tar.xz made with file-roller on
# other linux distributions that have other archiving software
# (not bsdtar) installed.
#
# Suggestion fro improvement of the OBS service:
# Archlinux just uses a PKGBUILD file which retrieves
# the sourcefiles without the additional download step.
# It should be possible to set up a download service of
# the required sourcefiles directly without having to manually
# set the software to download. PKGBUILD often uses and
# https://my.planet.org/archive/${pkgname}-${pkgver}.tar.xz
# which has variables that are set upon activation.
# OpenSUSE Build Service should have the same capability and
# like makepkg fetch the files needed itself, and create the
# download service itself if it needs to do it. That would make
# life easier and the packages would be easier maintained.
# A change of version in one line would trigger downloading
# updated code.
#
# End of observations with OpenSUSE Build Service for Archlinux, Manjaro...
#
#
#
prepare() {
echo "--- Entering section prepare() ---"
echo pwd=$(pwd)
echo "--- Exiting section prepare() ---"
}
build() {
echo "--- Entering section build() ---"
builddir=/usr/src/packages/BUILD/${_pkgname}/build
sourcedir=/usr/src/packages/BUILD/${_pkgname}/src/${_pkgname}-gss-${pkgver}
echo builddir=$builddir
echo sourcedir=$sourcedir
echo \${srcdir}=${srcdir}
echo \${_builddir}=${_builddir}
echo pwd=$(pwd)
#echo "--- Start apply patches ---"
# ${srcdir}=/usr/src/packages/BUILD/${_pkgname}/src
# patch file: /usr/src/packages/BUILD/${_pkgname}/src/myFixErrorDuringCompilation.patch
#cd "$sourcedir"
# patch --forward --strip=1 --input="${srcdir}/${mePatchFileThree}"
#echo "--- End apply patches ---"
cmake -B "${builddir}" \
-DSYSCONF_INSTALL_DIR="/etc" \
-DCMAKE_INSTALL_PREFIX="/usr" \
-DCMAKE_INSTALL_SBINDIR="/usr/bin" \
-Wno-dev \
"${sourcedir}"
cmake --build "${builddir}"
#echo pwd=$(pwd)
#find ${builddir} 2>/dev/null
echo "--- Exiting section build() ---"
}
package() {
echo "--- Entering section package() ---"
builddir=/usr/src/packages/BUILD/${_pkgname}/build
srcdir=/usr/src/packages/BUILD/${_pkgname}/src/${_pkgname}-gss-${pkgver}
rm -rf "$pkgdir"
mkdir -p "$pkgdir"
DESTDIR="$pkgdir" cmake --install "${builddir}"
#echo "--- Start of investigation ---"
#echo Try to find out what causes:
#echo WARNING: Package contains reference to \$srcdir
#cd "${srcdir}/.."
#echo pwd=$(pwd)
#echo grep -R "$PWD/src" pkg/ 2>/dev/null
# Unfortunately it creates an error once it
# finds a directory which root owns... so this approach does not work on OBS.
# grep -R "$PWD/src" pkg/ 2>/dev/null
#echo "--- End of investigation ---"
#echo "--- List packaged files ---"
#find ${pkgdir}
#echo "--- End list packaged files ---"
echo "--- Exiting section package() ---"
}
# Original packaging code from Archlinux that does not work on OBS:
# package() {
# make DESTDIR="${pkgdir}" -C build install
# }