# Created by: Wen Heping <wenheping@gmail.com>

PORTNAME=	libsbml
PORTVERSION=	5.19.0
CATEGORIES=	biology devel
MASTER_SITES=	SF/sbml/libsbml/${PORTVERSION}/stable
DISTNAME=	libSBML-${PORTVERSION}-core-src

MAINTAINER=	sunpoet@FreeBSD.org
COMMENT=	API Library for Working with SBML File

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

USES=		cmake iconv:build pathfix

CMAKE_OFF=	EXIT_ON_ERROR 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_ZLIB
USE_CXXSTD=	c++98
USE_LDCONFIG=	yes
WRKSRC=		${WRKDIR}/libsbml-${PORTVERSION}

PLIST_SUB=	PORTVERSION=${PORTVERSION}

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

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_USE=		ruby=yes
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:
	${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
	cd ${WRKSRC}/examples && ${COPYTREE_SHARE} . ${STAGEDIR}${EXAMPLESDIR} '! -name *Makefile*'

.include <bsd.port.mk>
