Files
ports/math/py-dgl/Makefile
Charlie Li 4f0eba1efd python.mk: rename PYTHON_EXT_SUFFIX to PYTHON_TAG, document, etc
EXT_SUFFIX, according to PEP 3149, refers to the full tag and
extension for compiled extension module objects, eg .cpython-311.so,
.cpython-313t.so, etc. We do not use the correct semantic meaning,
and this usage becomes ambiguous and confusing when tags do not
match between bytecode and compiled extension module objects.

Rename our PYTHON_EXT_SUFFIX to PYTHON_TAG to align with PEP 3147's
specification of a magic tag, which consists of implementation name
and shorthand version only. This is meant for bytecode and other
files containing this tag in their filename that do not depend on
a specific Python ABI for the same version. Chase all existing
consumers.

Introduce PYTHON_SOABI to align with PEP 3149's specification of a
tag, which consists of implementation name, shorthand version and
any ABI flags present (this and PYTHON_TAG are identical without
ABI flags). This is meant for compiled extension module objects and
other files that depend on a specific Python ABI for the same
version.

Add documentation for these variables that our PYTHON_EXT_SUFFIX
never had.

PR: 274671
Event: Kitchener-Waterloo Hackathon 202506
2025-06-19 16:28:47 -04:00

73 lines
2.1 KiB
Makefile

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
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
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_TAG}.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>