### this file is sourced not run
PKGVER=5.13.0
PKGBUILD=1
PKGARCH=x86_64

# source: james
TARBALL=suitesparse-$PKGVER.tar.gz
MD5SUM=e9e7bc594b77ae4b58d943cdc286d679
SRC_URL=https://github.com/DrTimothyAldenDavis/SuiteSparse/archive/refs/tags/v$PKGVER.tar.gz
BUNDLE=

SLACKREQ=libblas
SLACKDESC="libsuitesparse: libsuitesparse $PKGVER (Sparse matrices library)
libsuitesparse: 
libsuitesparse: SuiteSparse is a set of sparse-matrix-related packages written or 
libsuitesparse: co-authored by Tim Davis, available at 
libsuitesparse: https://github.com/DrTimothyAldenDavis/SuiteSparse .
libsuitesparse: 
libsuitesparse: https://github.com/DrTimothyAldenDavis/SuiteSparse
libsuitesparse: 
libsuitesparse: 
libsuitesparse: 
libsuitesparse:
"

### default pkg_download
### prepare
pkg_prepare() {
	pkg_prepare_default &&
	cd tmp/SuiteSparse* &&
	tar -xf ../pkg/suitesparse_5.12.0+dfsg-2.debian.tar.xz &&
	while read -r p; do
		echo $p
		patch -Np1 -i debian/patches/$p || return 1
	done < debian/patches/series
}

### default pkg_package
### build
pkg_build() {
	cd /tmp/SuiteSparse* &&

	# build system gets confused with -m64 or -m32
	unset CC CXX &&

	# we don't care about mongoose anyway
	sed -i -e '/^install:/ s/moninstall//' Makefile &&
	
	# see notes on debian rules
	make $MAKEFLAGS OPTIMIZATION=-fPIC install \
		INSTALL=/usr \
		INSTALL_INCLUDE=/usr/include/suitesparse \
		INSTALL_LIB=/usr/$LIBDIR \
	&&
	pkg_build_slackdesc &&

	true
}

