File PKGBUILD of Package linphone

# Get some information about the machine we are building on:
# Fix for error: bsdtar: Failed to set default locale
# LANG=en_US.UTF-8 #not available, use C or POSIX
LANG=C
LC_ALL=${LANG}
# No longer needed:
# _LinphoneCoreVersion=5.2.98
pkgname=liblinphone
_pkgname=liblinphone
pkgver=5.2.98
pkgrel=10
pkgdesc='A high-level SIP library'
arch=(x86_64 i686)
url='http://www.linphone.org'
license=('GPL')
# With debug symbols
options=(!strip)
conflicts=("$pkgname")
provides=("$pkgname=$pkgver")
depends=(belcard belle-sip mediastreamer2 lime xerces-c jsoncpp
  soci)
# optional makedepends: 'zxing-cpp' libxml++
makedepends=(cmake doxygen graphviz
     python-pystache python-six python-sphinx 
     belr belcard belle-sip mediastreamer2 lime 
     soci boost sqlite3 ffmpeg jsoncpp libdecaf libebml xsd libxml2=2.11.5 python-lxml)
source=("$pkgname-$pkgver.tar.bz2"
  linphone-fix-pkgconfig.patch
  linphone-build-readline.patch
  reproducible.patch
  linphone-link-soci-sqlite3.patch
  linphone-build-jsoncpp.patch
  set_current_version.patch
  linphone-0001-enable-codecs.patch
  linphone-0002-nowebcamjpg.patch
  linphone-fix-Archlinux-compilation.patch)
sha256sums=(SKIP SKIP SKIP SKIP SKIP SKIP SKIP SKIP SKIP SKIP)
_uploaddir=/usr/src/packages/SOURCES
_sourcedir=/usr/src/packages/BUILD/${pkgname}/src/${pkgname}-${pkgver}
# srcdir is already defined as
# ${srcdir}=/usr/src/packages/BUILD/${pkgname}/src
_builddir=/usr/src/packages/BUILD/${pkgname}/build
_pkgdir=/usr/src/packages/BUILD/${pkgname}/pkg/${pkgname}
_installToDir=${_pkgdir}/usr

prepare() {
  echo "Move patching to build() section for verbose log output"
  # patch -d "${_sourcedir}" -p1 < fix.patch
  # patch -d "${_sourcedir}" --forward --strip=1 --input="${srcdir}/fix.patch"
  # patch -d "${_sourcedir}" --forward --strip=1 --input="${_uploaddir}/fix.patch"
  patch -d "${_sourcedir}" -p1 < linphone-fix-pkgconfig.patch
  patch -d "${_sourcedir}" -p1 < linphone-build-readline.patch
  patch -d "${_sourcedir}" -p1 < reproducible.patch
  patch -d "${_sourcedir}" -p1 < linphone-link-soci-sqlite3.patch
  patch -d "${_sourcedir}" -p1 < linphone-build-jsoncpp.patch
  patch -d "${_sourcedir}" -p1 < set_current_version.patch
  patch -d "${_sourcedir}" -p1 < linphone-0001-enable-codecs.patch
  patch -d "${_sourcedir}" -p1 < linphone-0002-nowebcamjpg.patch
  patch -d "${_sourcedir}" -p1 < linphone-fix-Archlinux-compilation.patch
}

build() {
  # Adjust Linphone core version shown in About box or use set_current_version.patch
  # sed -i "s|project(linphone VERSION 5.2.[0-9]* LANGUAGES C CXX)|project(linphone VERSION ${_LinphoneCoreVersion} LANGUAGES C CXX)|g" ${_sourcedir}/CMakeLists.txt
  export CFLAGS=$(echo "$CFLAGS -Wno-error=unused-function")
  export CXXFLAGS=$(echo "$CXXFLAGS -Wno-error=unused-function")
  cmake -S "${_sourcedir}" -B "${_builddir}" \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_MODULE_PATH="$CMAKE_MODULE_PATH;/usr/src/packages/SOURCES" \
    -DCMAKE_VERBOSE_MAKEFILE=ON \
    -DENABLE_UNIT_TESTS=NO \
    -DENABLE_DOC=NO \
    -DENABLE_QRCODE=OFF \
    -DENABLE_STATIC=NO \
    -DENABLE_STRICT=NO
  cmake --build "${_builddir}"
}

package() {
  rm -rf "${pkgdir}"; mkdir -pv "${pkgdir}"
  cmake --install "${_builddir}" --config RelWithDebInfo --prefix "${_installToDir}"
  # cmake --install "${_builddir}" --config RelWithDebInfo --prefix "${_installToDir}" --strip
  # DESTDIR="${_installToDir}" cmake --install "${_builddir}"
  # DESTDIR="${_installToDir}" cmake --install "${_builddir}" --strip
  # Remove certificate
  # find . -type f -name rootca.pem -exec rm {} \;
  # Exchange static camera picture
  #mkdir -pv "${pkgdir}"/usr/share/images
  mkdir -pv "${pkgdir}"/usr/share/linphone/images
  #cp -v ${_uploaddir}/nowebcamCIF.jpg "${pkgdir}"/usr/share/images/nowebcamCIF.jpg
  cp -v ${_uploaddir}/nowebcamCIF.jpg "${pkgdir}"/usr/share/linphone/images/nowebcamCIF.jpg
  echo
  echo pkgdir=${pkgdir}
  echo "--- Show files that will be packaged ---"
  find ${pkgdir} | sed "s|${pkgdir}||g" | sort
  echo "--- End show files that will be packaged ---"
}
openSUSE Build Service is sponsored by