-
Notifications
You must be signed in to change notification settings - Fork 731
/
Makefile
85 lines (71 loc) · 3.32 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
PORTNAME= psi4
DISTVERSION= 1.6.1-20221122
PORTREVISION= 1
CATEGORIES= science # quantum-chemistry
EXTRACT_ONLY= ${DISTNAME}${EXTRACT_SUFX}
MAINTAINER= yuri@FreeBSD.org
COMMENT= Open-source suite of ab initio quantum chemistry programs
WWW= https://psicode.org/
LICENSE= LGPL3
LICENSE_FILE= ${WRKSRC}/COPYING
PY_DEPENDS= ${PYTHON_PKGNAMEPREFIX}gau2grid>0:math/py-gau2grid@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}qcelemental>0:science/py-qcelemental@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}qcengine>0:science/py-qcengine@${PY_FLAVOR}
BUILD_DEPENDS= boost-libs>0:devel/boost-libs \
${LOCALBASE}/include/pybind11/pybind11.h:devel/pybind11 \
${PY_DEPENDS} \
libint2-psi4>0:science/libint2-psi4 # has to be this library
LIB_DEPENDS= libgg.so:math/gau2grid \
libxc.so:science/libxc
RUN_DEPENDS= ${PY_DEPENDS} \
libint2-psi4>0:science/libint2-psi4
TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}pytest>0:devel/py-pytest@${PY_FLAVOR}
USES= blaslapack:openblas cmake compiler:c++17-lang eigen:3 fortran localbase:ldflags python:3.8+
USE_GITHUB= yes
GH_TAGNAME= 0889d6d34
CMAKE_ARGS= -DLibxc_DIR=${LOCALBASE} \
-DFREEBSD_PYTHON_VER=${PYTHON_VER} \
-DPython_EXECUTABLE=${PYTHON_CMD} \
-DPYMOD_INSTALL_LIBDIR=${PYTHONPREFIX_SITELIBDIR:S|${PREFIX}/lib||}
CONFIGURE_ENV= FREEBSD_PYTHON_VER=${PYTHON_VER}
LDFLAGS+= -lexecinfo # for backtrace_symbols
TEST_ENV= ${MAKE_ENV} \
PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}:${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/psi4/tests \
PSIDATADIR=${STAGEDIR}${DATADIR} \
PSIPATH=${STAGEDIR}${DATADIR}/basis
BINARY_ALIAS= python=${PYTHON_CMD} # only for tests
post-patch:
# correct the default data dir
@${REINPLACE_CMD} \
-E 's|os.path.sep.join\(\[os.path.abspath\(os.path.dirname\(__file__\)\), "share", "psi4"\]\)|"${DATADIR}"|' \
${WRKSRC}/psi4/run_psi4.py
@${REINPLACE_CMD} \
-E 's|from pathlib import Path|&; os.environ["PSIDATADIR"] = "${DATADIR}"|' \
${WRKSRC}/psi4/run_psi4.py
do-install: # project fails to install itself into a stage directory due to a convoluted cmake code structure (DESTDIR isn't handled correctly)
# main
cd ${BUILD_WRKSRC}/stage && ${COPYTREE_SHARE} . ${STAGEDIR}${PREFIX}
${FIND} ${STAGEDIR}${PREFIX} -name "*.pyc" -delete
# samples
cd ${WRKSRC} && ${COPYTREE_SHARE} samples ${STAGEDIR}${DATADIR}
${FIND} ${STAGEDIR}${PREFIX} -name "example_psi4rc_file" -delete
# delete empty directories
${FIND} ${STAGEDIR} -type d -empty -delete
# set executable flag
${CHMOD} +x ${STAGEDIR}${PREFIX}/bin/psi4
# correct version number
@${REINPLACE_CMD} -i '' -e "s|__version__ = 'undefined'|__version__ = '${DISTVERSION}'|" \
${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/psi4/metadata.py
@${REINPLACE_CMD} -i '' -e "s|__version_long = 'undefined+11'|__version_long = '${DISTVERSION}'|" \
${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/psi4/metadata.py
do-test:
# based on https://psicode.org/psi4manual/master/build_planning.html#faq-minutetests
#@cd ${WRKSRC}/tests/cc36 && ${SETENV} ${TEST_ENV} pytest # pytest-based tests fail, see https://github.com/psi4/psi4/issues/2802
# run samples as tests, this also fails down the line: https://github.com/psi4/psi4/issues/2803
@cd ${WRKSRC} && ( \
for f in $$(${FIND} samples/cc24 -name test.in | ${XARGS} dirname); do \
echo "===> runing test in $$f"; \
(cd $$f && ${SETENV} ${TEST_ENV} ${STAGEDIR}${PREFIX}/bin/psi4 test.in) \
done \
)
.include <bsd.port.mk>