# Description: General-purpose scalable concurrent allocator
# URL: http://jemalloc.net/
# Maintainer: Danny Rawlins, crux at romster dot me
# Optional: clang lld

name=jemalloc
version=5.3.0
release=1
source=(https://github.com/$name/$name/releases/download/$version/$name-$version.tar.bz2)

build() {
	cd $name-$version

	export CFLAGS+=' -O3'
	prt-get isinst clang lld && LDFLAGS+=' -fuse-ld=lld -flto=thin'
	prt-get isinst clang && export CC=clang CXX=clang++ AR=llvm-ar NM=llvm-nm RANLIB=llvm-ranlib || \
		export CC=gcc CXX=g++

	./configure --prefix=/usr
	make
	make DESTDIR=$PKG install

	rm -r $PKG/usr/share/doc
}
