#!/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"
# Website		: https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------

pkgname=gc
pkgver=8.2.4
pkgrel=01
pkgdesc="A garbage collector for C and C++"
groups=( jobbot )
url="https://www.hboehm.info/gc/"
depends=('gcc-libs')
source=(https://github.com/ivmai/bdwgc/releases/download/v${pkgver}/${pkgname}-${pkgver}.tar.gz)
#        gc-missing-header.patch::https://patch-diff.githubusercontent.com/raw/ivmai/bdwgc/pull/389.patch)
#        gc-missing-header.patch::https://github.com/ivmai/bdwgc/commit/c876dc2b.patch)

#prepare() {
#  cd $pkgname-$pkgver
#  patch -p1 < ../gc-missing-header.patch # Install missing header
#  ./autogen.sh
#}

build() {
  cd ${pkgname}-${pkgver}
  ./configure --prefix=/usr --enable-cplusplus --disable-static
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

check() {
  cd ${pkgname}-${pkgver}
  make check
}

package() {
  cd ${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}" install
  sed 's|GC_MALLOC 1L|gc 3|g' doc/gc.man |
    install -Dm644 /dev/stdin "${pkgdir}/usr/share/man/man3/gc.3"
}

#---- arch license gpg-key & sha256sums ----

arch=(x86_64)

license=('GPL')

sha256sums=(3d0d3cdbe077403d3106bb40f0cbb563413d6efdbb2a7e1cd6886595dec48fc2) # gc-8.2.4.tar.gz

##  4cb131ae136d610c521fc1f4b2247ba72fdd67d26a6f195b5c08eec1044dd25d  gc-8.2.4-01-x86_64.pkg.tar.lz
