#!/usr/bin/bash
# JOBoRun		: Jwm OpenBox Obarun RUNit
# Maintainer		: Joe Bo Run <joborun@disroot.org>
# PkgSource		: url="https://gittea.disroot.org/joborun-pkg/jobcore/$pkgname"
#-----------------------------------------| DESCRIPTION |---------------------------------------

pkgname=db
pkgver=5.3.28
pkgrel=05
pkgdesc="The Berkeley DB embedded database system"
arch=('x86_64')
groups=( jobbot )
url="https://www.oracle.com/technology/software/products/berkeley-db/index.html"
depends=('gcc-libs' 'sh')
source=(https://download.oracle.com/berkeley-db/db-${pkgver}.tar.gz atomic.patch)

prepare() {
  cd $pkgname-$pkgver
  patch -p0 -i ../atomic.patch # Fix build 
}

build() {
  cd "${srcdir}"/$pkgname-${pkgver}/build_unix
  ../dist/configure --prefix=/usr --enable-compat185 \
    --enable-shared --enable-static --enable-cxx --enable-dbm \
    --enable-stl
  make LIBSO_LIBS=-lpthread
}

package() {
  cd "${srcdir}"/$pkgname-${pkgver}/build_unix
  make DESTDIR="${pkgdir}" install
  rm -r "${pkgdir}"/usr/docs
  install -Dm644 "${srcdir}"/${pkgname}-${pkgver}/LICENSE \
    "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE
}

#---- license gpg-key sha256sums ----

license=('custom')

sha256sums=(e0a992d740709892e81f9d93f06daf305cf73fb81b545afe72478043172c3628  #  db-5.3.28.tar.gz
	ba0e2b4f53e9cb0ec58f60a979b53b8567b4565f0384886196f1fc1ef111d151) #  atomic.patch
