summaryrefslogtreecommitdiff
path: root/math/py-dgl/Makefile
blob: f94131bdde5c42d7a5d4669e287c66194c5754b7 (plain) (blame)
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
PORTNAME=	dgl
DISTVERSION=	1.1.2
PORTREVISION=	1
CATEGORIES=	math python # machine-learning
PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}

MAINTAINER=	yuri@FreeBSD.org
COMMENT=	Deep Graph Library
WWW=		https://www.dgl.ai/

LICENSE=	BSD3CLAUSE

BUILD_DEPENDS=	${PY_SETUPTOOLS} \
		${PYTHON_PKGNAMEPREFIX}wheel>0:devel/py-wheel@${PY_FLAVOR} \
		${BACKEND_DEPENDS}
LIB_DEPENDS=	libdgl.so:math/dgl
RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}networkx>=2.1:math/py-networkx@${PY_FLAVOR} \
		${PYNUMPY} \
		${PYTHON_PKGNAMEPREFIX}psutil>=5.8.0:sysutils/py-psutil@${PY_FLAVOR} \
		${PYTHON_PKGNAMEPREFIX}requests>=2.19.0:www/py-requests@${PY_FLAVOR} \
		${PYTHON_PKGNAMEPREFIX}scipy>=1.1.0:science/py-scipy@${PY_FLAVOR} \
		${PYTHON_PKGNAMEPREFIX}tqdm>0:misc/py-tqdm@${PY_FLAVOR} \
		${BACKEND_DEPENDS}

USES=		python localbase
USE_PYTHON=	distutils cython autoplist

WRKSRC_SUBDIR=	python

USE_GITHUB=	yes
GH_ACCOUNT=	dmlc

MAKE_ENV=	DGL_LIBRARY_PATH=${LOCALBASE}/lib

POST_PLIST=	fix-plist

OPTIONS_RADIO=			BACKEND
OPTIONS_RADIO_BACKEND=		PYTORCH TENSORFLOW MXNET
OPTIONS_DEFAULT=		PYTORCH

PYTORCH_DESC=			Use PyTorch backend
PYTORCH_VARS=			BACKEND_DEPENDS=${PYTHON_PKGNAMEPREFIX}pytorch>0:misc/py-pytorch@${PY_FLAVOR}
PYTORCH_MAKE_ENV=		DGLBACKEND=pytorch

TENSORFLOW_DESC=		Use TensorFlow backend
TENSORFLOW_VARS=		BACKEND_DEPENDS=${PYTHON_PKGNAMEPREFIX}tensorflow>0:science/py-tensorflow@${PY_FLAVOR}
TENSORFLOW_MAKE_ENV=		DGLBACKEND=tensorflow

MXNET_DESC=			Use MXNET backend
MXNET_VARS=			BACKEND_DEPENDS=${PYTHON_PKGNAMEPREFIX}mxnet>0:misc/py-mxnet@${PY_FLAVOR}
MXNET_MAKE_ENV=			DGLBACKEND=mxnet

post-install:
	# workaround for https://github.com/dmlc/dgl/issues/5665
	@${RM} ${STAGEDIR}${PREFIX}/dgl/libdgl.so
	# remove empty dirs
	@${RMDIR} \
		${STAGEDIR}${PREFIX}/dgl/tensoradapter/pytorch \
		${STAGEDIR}${PREFIX}/dgl/tensoradapter \
		${STAGEDIR}${PREFIX}/dgl/dgl_sparse \
		${STAGEDIR}${PREFIX}/dgl
	# strip binaries
	@${STRIP_CMD} ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/dgl/_ffi/_cy3/core${PYTHON_EXT_SUFFIX}.so

fix-plist:
	# workaround for https://github.com/dmlc/dgl/issues/5665
	@${REINPLACE_CMD} ' \
		/dgl\/libdgl.so/d ; \
		' ${TMPPLIST}
	# remove empty dirs
	@${REINPLACE_CMD} ' \
		/dgl\/tensoradapter\/pytorch/d ; \
		/dgl\/dgl_sparse/d ; \
		' ${TMPPLIST}

.include <bsd.port.mk>