view bsd.pypy.mk @ 60:4a2bf3c9eb24

FIX: Apply byte-compilation in the "main" Makefile because of MAKE variable issues and allow configuration of byte-compilation in build options
author Franz Glasner <hg@dom66.de>
date Wed, 10 Jan 2024 17:57:02 +0100
parents b0ce0cf90f22
children e12dfbf0a674
line wrap: on
line source

# Common include for lang/pypy and lang/pypy3
# Also includes bsd.port.pre.mk

.if !defined(LICENSE)
LICENSE=	MIT PSFL
LICENSE_COMB=	multi
.endif

USES+=		compiler:c11

PYTHON_IMPL?=	${PORTNAME}
PYPY_DIR=	${PYTHON_IMPL}-${DISTVERSION:C|([0-9])\.([0-9]+).*|\1.\2|}
PLIST_SUB+=	PYPY_DIR=${PYPY_DIR} \
		PYPY_CFFI_VER=${PYPY_CFFI_VER} \
		PYPY_LDLIBRARY=${PYPY_LDLIBRARY}

.if ${PYTHON_IMPL} == pypy

DISTVERSION=	7.3.14
PY_VERSION_SHORT=	2.7
PYPY_CFFI_VER=	${PYTHON_IMPL}-73
PYPY_LDLIBRARY=	libpypy-c.so
PYPY_EXECUTABLE=	pypy-c

.else # ${PYTHON_IMPL} == pypy3

DISTVERSION=	7.3.14
PYPY_CFFI_VER=	${PYTHON_IMPL_NODOT}-pp${DISTVERSION:S|.||:C|\..*||}-${OPSYS:tl}${OSREL:C|\..*||}
PLIST_SUB+=	PYTHON_IMPL_MINOR=${PYTHON_IMPL_MINOR} \
		PY_VERSION_SHORT=${PY_VERSION_SHORT}

OPTIONS_DEFINE=	BYTECOMPILE
OPTIONS_DEFAULT=	BYTECOMPILE

BYTECOMPILE_DESC=	Enable to build byte-compiled Python files

OPTIONS_SINGLE+=	FORPYIMPL BCSTYLE

OPTIONS_SINGLE_FORPYIMPL=	FORPYIMPL37 FORPYIMPL38 FORPYIMPL39 FORPYIMPL310

FORPYIMPL_DESC=		Required Python compatibility
FORPYIMPL37_DESC=	Build for compat to Python 3.7
FORPYIMPL38_DESC=	Build for compat to Python 3.8
FORPYIMPL39_DESC=	Build for compat to Python 3.9
FORPYIMPL310_DESC=	Build for compat to Python 3.10

OPTIONS_SINGLE_BCSTYLE=	BCTIMESTAMP BCCHECKEDHASH BCUNCHECKEDHASH

BCSTYLE_DESC=	PEP-552 .pyc-File Invalidation Modes
BCTIMESTAMP_DESC=	Traditional timestamp based .pyc file invalidataion
BCCHECKEDHASH_DESC=	Use checked hash based .pyc file invalidataion
BCUNCHECKEDHASH_DESC=	Use unchecked hash based .pyc file invalidataion

OPTIONS_SUB=		yes
OPTIONS_DEFAULT+=	FORPYIMPL39 BCUNCHECKEDHASH

BCTIMESTAMP_VARS=	COMPILEALL_INVALIDATIONMODE=timestamp
BCCHECKEDHASH_VARS=	COMPILEALL_INVALIDATIONMODE=checked-hash
BCUNCHECKEDHASH_VARS=	COMPILEALL_INVALIDATIONMODE=unchecked-hash

.endif

PY_VERSION_NODOT=       ${PY_VERSION_SHORT:S/.//}
PYTHON_IMPL_MINOR=	pypy${PY_VERSION_SHORT}
PYTHON_IMPL_NODOT=	pypy${PY_VERSION_NODOT}

DISTINFO_FILE=		${.CURDIR}/distinfo.py${PY_VERSION_NODOT}

.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MFORPYIMPL37}
PY_VERSION_SHORT=	3.7
PYPY_LDLIBRARY=		libpypy3-c.so
PYPY_EXECUTABLE=	pypy3-c
.endif
.if ${PORT_OPTIONS:MFORPYIMPL38}
PY_VERSION_SHORT=	3.8
PYPY_LDLIBRARY=		libpypy3-c.so
PYPY_EXECUTABLE=	pypy3-c
.endif
.if ${PORT_OPTIONS:MFORPYIMPL39}
PY_VERSION_SHORT=	3.9
PYPY_LDLIBRARY=		libpypy3.9-c.so
PYPY_EXECUTABLE=	pypy3.9-c
.endif
.if ${PORT_OPTIONS:MFORPYIMPL310}
PY_VERSION_SHORT=	3.10
PYPY_LDLIBRARY=		libpypy3.10-c.so
PYPY_EXECUTABLE=	pypy3.10-c
.endif

.include <bsd.port.pre.mk>