description="A garbage collector for C and C++"
url="http://www.hpl.hp.com/personal/Hans_Boehm/gc/"

packager="Spiky <spiky@nutyx.org>"
contributors="Pierre,Spiky,Tnut"

makedepends=(libtool sed grep m4
             libatomic-ops autoconf automake)

name=gc
version=8.2.2

source=(http://www.hboehm.info/gc/gc_source/gc-$version.tar.gz)

prepare() {
cd $name-*
./autogen.sh
}

build() {
cd gc-*
sed -i 's#pkgdata#doc#' doc/doc.am && autoreconf &&
./configure --prefix=/usr \
--enable-threads=pthreads \
--disable-static \
--enable-shared \
--enable-cplusplus
install -D -m 644 doc/gc.man $PKG/usr/share/man/man3/gc_malloc.3
make
make DESTDIR=$PKG install
# rm obsolets libs
rm $PKG/usr/lib/lib{gc{,cpp},cord}.la
}
uptodate() {
local url ext
url="http://www.hboehm.info/gc/gc_source/"
ext=".tar.gz"
lynx -read_timeout=20 -dump -listonly -nonumbers \
$url?C=M\;O=A|grep $name-[0-9]|grep [0-9]$ext$| \
sed "s@$url$name-@@"|sed "s@$ext@@"|tail -1
}
