File PKGBUILD of Package libcork

# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: banbanchs <memory.silentvoyage@gmail.com>

pkgname=libcork
pkgver=0.15.0
pkgrel=5
pkgdesc="A simple, easily embeddable cross-platform C library"
arch=('x86_64')
url="https://github.com/redjack/libcork"
license=('BSD')
depends=('glibc')
makedepends=('cmake3' 'check' 'ninja')
options=('!lto' '!debug')
source=("$pkgname-$pkgver.tar.gz::https://github.com/dcreager/libcork/archive/$pkgver.tar.gz"
	"fix-dumb-script.patch"
	"fix-gcc-10.patch"
	"no-git.patch"
	"format-security.patch")
sha512sums=(8f41cce2101b96707068a21e5bd0a43c23f996c3620e7dd36621ed4bdd3f92851a92ea56ed92db40d7d8fe55ddfbdfcdaac4d2c8b2fc6cb3b1abe3b0e74c6a75
c80c3edb45e4051b5b3aac4b4980296e54d78bee0410e833278034a9dcdd971f174be01f8420bb94e294bc229e69d13b200679c600ee56920348af94ccd51b45
b0ce51a8f63eb8095160dd018f54134988fce7cb18d9fcdce45aae250ea098339aab786509d3bd3bbdd3d71c6cbd459f9ff3950ebeb21a0ea0774d53b3892067
26d4ae2e433b4c969c6991fa3607956df9732614cd51628d05286907cfed91dbcce418033e266461c0a3fb5671629f5155b50bf1ba56875ed51dc2b497748a2b
9a2dcc1bb939cbce1401388dd4aa6c4a8cf83c1f0801cb3836beab3feaeab751ddafa1af972b0ff160989e38081bb157925d2502cc837f70204c56366c156728)

prepare() {
  cd $pkgname-$pkgver
    local src
    for src in "${source[@]}"; do
        src="${src%%::*}"
        src="${src##*/}"
        [[ $src = *.patch ]] || continue
        echo "Applying patch $src..."
        patch -Np1 < "../$src"
    done

  echo "$pkgver" > RELEASE-VERSION
}

build() {
cd $pkgname-$pkgver
	/opt/cmake3/bin/cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DENABLE_STATIC=OFF \
		-DCMAKE_INSTALL_LIBDIR=lib
	/opt/cmake3/bin/cmake --build build

}

package() {
  cd $srcdir/$pkgname-$pkgver
  DESTDIR="$pkgdir" /opt/cmake3/bin/cmake --install build

  install -Dm644 "$srcdir"/$pkgname-$pkgver/COPYING "$pkgdir"/usr/share/licenses/$pkgname/COPYING
}
openSUSE Build Service is sponsored by