# $OpenBSD: Makefile,v 1.17 2019/07/12 20:47:47 sthen Exp $

COMMENT =		COIN-OR utilities

V =			2.11.3
DISTNAME =		CoinUtils-${V}
PKGNAME =		${DISTNAME:L}

CATEGORIES =		math

HOMEPAGE =		https://projects.coin-or.org/CoinUtils

SHARED_LIBS +=		CoinUtils	0.0 # 14.3

# Eclipse Public License v1.0
PERMIT_PACKAGE = 	Yes

COMPILER =		base-clang ports-gcc base-gcc
WANTLIB += 		${COMPILER_LIBCXX} blas bz2 glpk gmp lapack m z

MASTER_SITES =		https://www.coin-or.org/download/source/CoinUtils/
EXTRACT_SUFX =		.tgz

# The port asks for Fortran, but from what I see doesn't actually use it
# at all??

MODULES =		fortran
MODFORTRAN_COMPILER =	gfortran

BUILD_DEPENDS =		archivers/bzip2 \
			devel/doxygen \
			devel/glpk \
			math/blas \
			math/graphviz \
			math/lapack
RUN_DEPENDS =		archivers/bzip2 \
			devel/glpk \
			math/blas \
			math/lapack

CONFIGURE_STYLE = 	gnu

# Environmentt needed to pick up bzlib.h in configure.

CONFIGURE_ENV =		CFLAGS="-I${LOCALBASE}/include" \
			CXXFLAGS="-I${LOCALBASE}/include" \
			LDFLAGS="-L${LOCALBASE}/lib"
CONFIGURE_ARGS =	--with-lapack-lib="-L${LOCALBASE}/lib -llapack" \
			--with-blas-lib="-L${LOCALBASE}/lib -lblas" \
			--with-glpk-lib="-L${LOCALBASE}/lib -lglpk" \
			--with-lapack-incdir="${LOCALBASE}/include" \
			--with-blas-incdir="${LOCALBASE}/include" \
			--with-glpk-incdir="${LOCALBASE}/include" \
			--with-dot

TEST_TARGET =		test

post-build:
	cd ${WRKSRC} && ${MAKE} doxydoc

# There is an install-doxydoc but it tries pulling in all sorts of other
# stuff too.

post-install:
	${INSTALL_DATA_DIR} ${PREFIX}/share/doc/coinutils/html
	${INSTALL_DATA_DIR} ${PREFIX}/share/doc/coinutils/html/search
	${INSTALL_DATA} ${WRKSRC}/doxydoc/html/*.{map,html,png,css,js} \
		${PREFIX}/share/doc/coinutils/html
	${INSTALL_DATA} ${WRKSRC}/doxydoc/html/search/*.{html,png,css,js} \
		${PREFIX}/share/doc/coinutils/html/search

.include <bsd.port.mk>
