PORTNAME=	libsbml
PORTVERSION=	5.21.0
DISTVERSIONPREFIX=	v
CATEGORIES=	biology devel

MAINTAINER=	sunpoet@FreeBSD.org
COMMENT=	API Library for Working with SBML File
WWW=		https://sbml.org/software/libsbml/ \
		https://synonym.caltech.edu/ \
		https://github.com/sbmlteam/libsbml

LICENSE=	LGPL21
LICENSE_FILE=	${WRKSRC}/COPYING.txt

USES=		cmake:testing iconv:build

CMAKE_OFF=	EXIT_ON_ERROR \
		LIBSBML_SKIP_SHARED_LIBRARY \
		LIBSBML_SKIP_STATIC_LIBRARY \
		LIBSBML_USE_STRICT_INCLUDES \
		PYTHON_USE_API2_WARNINGS \
		WITH_ALL_PACKAGES \
		WITH_CHECK \
		WITH_CPP_NAMESPACE \
		WITH_CSHARP \
		WITH_DOXYGEN \
		WITH_JAVA \
		WITH_JAVASCRIPT \
		WITH_MATLAB \
		WITH_OCTAVE \
		WITH_PERL \
		WITH_PHP \
		WITH_R \
		WITH_STABLE_PACKAGES \
		WITH_WALL
CMAKE_ON=	LIBSBML_SHARED_VERSION \
		WITH_BZIP2 \
		WITH_SWIG \
		WITH_THREADSAFE_PARSER \
		WITH_ZLIB
CMAKE_TESTING_ON=	WITH_CHECK
USE_CXXSTD=	c++98
USE_LDCONFIG=	yes

PLIST_SUB=	PORTVERSION=${PORTVERSION}

USE_GITHUB=	yes
GH_ACCOUNT=	sbmlteam

OPTIONS_DEFINE=	EXAMPLES PYTHON RUBY
OPTIONS_SINGLE=	XML
OPTIONS_SINGLE_XML=	EXPAT LIBXML2 XERCES
OPTIONS_DEFAULT=LIBXML2 PYTHON
OPTIONS_SUB=	yes

EXAMPLES_CMAKE_BOOL=	WITH_EXAMPLES
EXPAT_CMAKE_BOOL=	WITH_EXPAT
EXPAT_LIB_DEPENDS=	libexpat.so:textproc/expat2
LIBXML2_CMAKE_BOOL=	WITH_LIBXML
LIBXML2_USE=		GNOME=libxml2
LIBXML2_USES=		gnome
PYTHON_BUILD_DEPENDS=	swig:devel/swig
PYTHON_CMAKE_BOOL=	WITH_PYTHON
PYTHON_USES=		python
PYTHON_CMAKE_ON=	WITH_SWIG
RUBY_BUILD_DEPENDS=	swig:devel/swig
RUBY_CMAKE_BOOL=	WITH_RUBY
RUBY_USES=		ruby
XERCES_CMAKE_BOOL=	WITH_XERCES
XERCES_LIB_DEPENDS=	libxerces-c.so:textproc/xerces-c3

post-patch:
	@${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|g' ${WRKSRC}/CMakeLists.txt

post-install-EXAMPLES-on:
	${MV} ${STAGEDIR}${DATADIR}examples ${STAGEDIR}${EXAMPLESDIR}

.include <bsd.port.mk>
