File PKGBUILD of Package bcmatroska2

# 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}
pkgname=bcmatroska2
pkgver=5.2.1
pkgrel=1
pkgdesc="C Library to Deal with Matroska Files"
arch=('x86_64')
url="https://github.com/BelledonneCommunications/bcmatroska2"
license=('GPL2')
conflicts=('bcmatroska2')
provides=("bcmatroska2=$pkgver")
depends=(glibc)
makedepends=('cmake' 'cpio' 'bctoolbox')
# Recompress
# https://build.opensuse.org/source/home:kimi:telephony-ithod/bcmatroska2/_service%3Arecompress%3Atar_scm%3Abcmatroska2-5.2.1.tar.bz2?rev=af27d9d2bd1d1f01b01184394016f559
# bsdtar -C bcmatroska2-5.2.1 -v -a -cf bcmatroska2-5.2.1-compressed-with-bsdtar.tar.xz bcmatroska2-5.2.1
source=("${pkgname}-${pkgver}-compressed-with-bsdtar.tar.xz")
sha256sums=(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"
}

build() {
  mkdir -pv "${_builddir}"
  cmake -S "${_sourcedir}" -B "${_builddir}" \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DENABLE_STATIC=NO
  cmake --build "${_builddir}"
}

package() {
  rm -rf "${pkgdir}"; mkdir -pv "${pkgdir}"
  #cmake --install "${_builddir}" --config RelWithDebInfo --prefix "${_installToDir}" --strip
  DESTDIR="${_installToDir}" cmake --install "${_builddir}" --strip
}
openSUSE Build Service is sponsored by