git » libsndfile.git » main » tree

[main] / PKGBUILD

# Maintainer: David Runge <dvzrv@archlinux.org>

pkgname=libsndfile
pkgver=1.2.2
pkgrel=2
pkgdesc="A C library for reading and writing files containing sampled audio data"
arch=(armv7h 'aarch64')
url="https://libsndfile.github.io/libsndfile/"
license=(LGPL-2.1-or-later)
depends=(glibc)
makedepends=(
  alsa-lib
  cmake
  flac
  lame
  libogg
  libvorbis
  mpg123
  opus
  python
  sqlite
)
optdepends=('alsa-lib: for sndfile-play')
provides=(libsndfile.so)
source=(https://github.com/$pkgname/$pkgname/releases/download/$pkgver/$pkgname-$pkgver.tar.xz{,.asc}
        $pkgname-1.2.2-CVE-2022-33065.patch::https://github.com/libsndfile/libsndfile/commit/0754562e13d2e63a248a1c82f90b30bc0ffe307c.patch)
sha512sums=('a6e3ea3ac5d91befaa99f6a31a3fac44e7b7c11f1de4698167317a461d5a19a2651d47486a920b34400f18367b4f6173bf0c1c9ba80eb682cece1b5beee352a0'
            'SKIP'
            'a91112f067e8267ad6448517c6dc7234b1f8664612990e5ef6a074259bbe61e5b389bc334cd4a36ddf7a0bfa5943b9a1c450fe601713dd887cb6bc5172cd0a49')
b2sums=('bc8e49983d9ad9dfd98984e2ffef501c6f576480e556e9f9ef91c7d597524cc1bb8baed15dfef8e239f72c42136c524117029eb8271f3a2c9d607fee490279b5'
        'SKIP'
        '21116ed199bf97b151fd3d6c6684d45a0f5f246afd5b1389b778198445045b93fc5fbe9ae7509e8fa4312f70b4751017f5f2f947101ed6874a6db15a8754c63e')
validpgpkeys=(
  '6A91A5CF22C24C99A35E013FCFDCF91FB242ACED'  # Erik de Castro Lopo <erikd@mega-nerd.com>
  '9B1CFD2E92239C4B288E025F9D0D1F1CCB35FF8C'  # evpobr evpobr@gmail.com
  '31D95CAB6D80D262244A1750A47620E801E47E95'  # David Seifert soap@gentoo.org
)

prepare() {
  patch -d $pkgname-$pkgver -Np1 -i ../$pkgname-1.2.2-CVE-2022-33065.patch
}

build() {
  local cmake_options=(
    -B build
    -D BUILD_SHARED_LIBS=ON
    -D CMAKE_INSTALL_PREFIX=/usr
    -D CMAKE_BUILD_TYPE=None
    -D ENABLE_EXTERNAL_LIBS=ON
    -D ENABLE_MPEG=ON
    -S $pkgname-$pkgver
    -W no-dev
  )
  local cmake_test_options=(
    -B build-test
    -D CMAKE_BUILD_TYPE=None
    -D CMAKE_INSTALL_PREFIX=/usr
    -S $pkgname-$pkgver
    -W no-dev
  )

  cmake "${cmake_test_options[@]}"
  cmake --build build-test --verbose
  cmake "${cmake_options[@]}"
  cmake --build build --verbose
}

check() {
  ctest --test-dir build-test --output-on-failure
}

package() {
  depends+=(
    flac libFLAC.so
    lame libmp3lame.so
    libogg libogg.so
    libvorbis libvorbis.so libvorbisenc.so
    mpg123 libmpg123.so
    opus libopus.so
  )

  DESTDIR="$pkgdir" cmake --install build
  install -vDm 644 $pkgname-$pkgver/{AUTHORS,ChangeLog,README} -t "$pkgdir/usr/share/doc/$pkgname"
}