From 94cde08c7a673762d64aff16410b452f06c35c60 Mon Sep 17 00:00:00 2001
From: Mikhail Teterin <mi@FreeBSD.org>
Date: Thu, 12 Dec 2024 21:03:54 -0500
Subject: [PATCH] math/arpack-ng: switch to using blaslapack.mk

Still default to NETLIB, remove mentions of gotoblas.

PR:	246938
PR:	274110
---
 math/arpack-ng/Makefile | 34 ++++++++++++----------------------
 1 file changed, 12 insertions(+), 22 deletions(-)

diff --git a/math/arpack-ng/Makefile b/math/arpack-ng/Makefile
index 8cd7b13945a..efef6df73f8 100644
--- a/math/arpack-ng/Makefile
+++ b/math/arpack-ng/Makefile
@@ -12,16 +12,13 @@ LICENSE_FILE=	${WRKSRC}/COPYING
 
 LIB_DEPENDS=	libmpich.so:net/mpich # MPI is incremental: it adds the libparpack.so lib, it is a candidate for a sub-package
 
-USES=		autoreconf fortran libtool pkgconfig
+USES=		autoreconf fortran libtool localbase pkgconfig
 USE_GITHUB=	yes
 GH_ACCOUNT=	opencollab
 GNU_CONFIGURE=	yes
-CONFIGURE_ARGS=	--with-blas="${BLAS}" \
-		--with-lapack="${LAPACK}" \
-		--enable-mpi \
+CONFIGURE_ARGS=	--enable-mpi \
 		--disable-static \
 		--enable-icb
-LDFLAGS+=	-L${LOCALBASE}/lib
 TEST_TARGET=	check
 USE_LDCONFIG=	yes
 
@@ -31,25 +28,18 @@ PORTEXAMPLES=	*
 CONFLICTS_INSTALL=	arpack
 
 OPTIONS_DEFINE=	DOCS EXAMPLES
+OPTIONS_SINGLE=	BLASLIB
 
-WITH_BLAS?=	blas
+OPTIONS_SINGLE_BLASLIB=	ATLAS NETLIB OPENBLAS GOTOBLAS
+OPTIONS_DEFAULT=	NETLIB
+ATLAS_USES=	blaslapack:atlas
+NETLIB_USES=	blaslapack:netlib
+OPENBLAS_USES=	blaslapack:openblas
 
-.if ${WITH_BLAS} == "gotoblas"
-BLAS=		-lgoto2p
-LAPACK=		-lgoto2p
-LIB_DEPENDS+=	libgoto2p.so:math/gotoblas
-.elif ${WITH_BLAS} == "atlas"
-BLAS=		-lptf77blas
-LAPACK=		-lalapack -lptcblas
-LIB_DEPENDS+=	libptf77blas.so:math/atlas
-.elif ${WITH_BLAS} == "blas"
-BLAS=		-lblas
-LAPACK=		-llapack
-LIB_DEPENDS+=	libblas.so:math/blas \
-		liblapack.so:math/lapack
-.else
-IGNORE=		unknown value of WITH_BLAS: ${WITH_BLAS}
-.endif
+.include <bsd.port.options.mk>
+
+CONFIGURE_ARGS+=--with-blas="${BLASLIB}" \
+		--with-lapack="${LAPACKLIB}"
 
 pre-configure:
 	@cd ${WRKSRC}; ./bootstrap
-- 
2.43.0