diff lang/pypy2/Makefile @ 65:9e9df3f25e7d

Move the old imported pypy repo into the lang/pypy2 folder
author Franz Glasner <fzglas.hg@dom66.de>
date Fri, 12 Jan 2024 09:18:14 +0100
parents Makefile@4f846c664620
children b907e948fed9
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/pypy2/Makefile	Fri Jan 12 09:18:14 2024 +0100
@@ -0,0 +1,383 @@
+# Created by: David Naylor <naylor.b.david@gmail.com>
+
+PORTNAME?=	pypy
+PORTREVISION?=	0
+CATEGORIES=	lang python
+MASTER_SITES=	https://downloads.python.org/pypy/
+DISTNAME?=	${PYTHON_IMPL_MINOR}-v${DISTVERSION}-src
+
+MAINTAINER=	python@FreeBSD.org
+COMMENT=	Fast, compliant implementation of the Python language
+WWW=		 http://pypy.org
+
+LICENSE=	MIT PSFL
+LICENSE_COMB=	multi
+LICENSE_FILE_MIT=	${WRKSRC}/LICENSE
+
+BROKEN_armv6=		fails to package: pypy_objspace_std.c: Crash in JIT!
+BROKEN_armv7=		fails to package: pypy_objspace_std.c: Crash in JIT!
+BROKEN_powerpc64=	fails to compile: platcheck_109.c: fatal error: linux/auxvec.h: No such file or directory
+ONLY_FOR_ARCHS?=	amd64 armv6 armv7 i386 powerpc64 powerpc64le
+ONLY_FOR_ARCHS_REASON?=	PyPy JIT only supported on these architectures
+
+LIB_DEPENDS+=	libexpat.so:textproc/expat2 \
+		libffi.so:devel/libffi
+TEST_DEPENDS=	${LOCALBASE}/${PYPY_DIR}/lib_pypy/_gdbm_cffi.${PYPY_CFFI_VER}.so:databases/pypy-gdbm \
+		${LOCALBASE}/${PYPY_DIR}/lib_pypy/_sqlite3_cffi.${PYPY_CFFI_VER}.so:databases/pypy-sqlite3 \
+		${LOCALBASE}/${PYPY_DIR}/lib_pypy/_tkinter/tklib_cffi.${PYPY_CFFI_VER}.so:x11-toolkits/pypy-tkinter
+
+USES=		gettext-runtime gmake shebangfix ssl tar:bzip2
+USE_LDCONFIG=	${PREFIX}/${PYPY_DIR}/bin
+
+OPTIONS_SINGLE=	TRANS
+OPTIONS_SINGLE_TRANS=	PYTHON
+PYTHON_DESC=	Use Python-2.7 to translate (slowest)
+PYPY_DESC=	Use PyPy to translate (fastest, highest memory usage)
+PYPY_MINMEM_DESC=	Use PyPy to translate (lowest memory usage)
+TRANS_DESC=	Translation method
+
+# Only allow building with pypy if it wouldn't cause a dependency loop (pypy depending on itself)
+.if exists(${LOCALBASE}/bin/pypy) || ${PORTNAME} != pypy
+OPTIONS_SINGLE_TRANS+=	PYPY PYPY_MINMEM
+. if exists(${LOCALBASE}/bin/pypy)
+OPTIONS_DEFAULT=	PYPY_MINMEM
+. else
+OPTIONS_DEFAULT=	PYTHON
+. endif
+.else
+OPTIONS_SLAVE=	PYTHON
+.endif
+
+LOCALBASE?=	/usr/local
+
+ALL_TARGET=	${PYPY_EXECUTABLE}
+BUILD_WRKSRC?=	${WRKDIR}/build/usession-${PORTNAME}-0/testing_1
+MAKE_ENV+=	PYPY_LOCALBASE=${LOCALBASE} LDSHARED="${CC} -shared"
+PACKAGE_ARGS?=	--without-gdbm --without-sqlite3 --without-_tkinter
+LLD_UNSAFE=	yes
+
+python_OLD_CMD=	${LOCALBASE}/bin/python
+python_CMD=	${PREFIX}/bin/${PORTNAME}
+
+.if ${PORTNAME} != pypy
+PYPY_BUILD_DEPENDS=	pypy:lang/pypy
+PYPY_MINMEM_BUILD_DEPENDS=	pypy:lang/pypy
+.endif
+PYPY_VARS=	PYTHON_CMD=${LOCALBASE}/bin/pypy
+PYPY_MINMEM_VARS=	PYTHON_CMD="${SETENV} PYPY_GC_MAX_DELTA=200MB ${LOCALBASE}/bin/pypy --jit loop_longevity=300"
+PYTHON_BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}pycparser>=2.10:devel/py-pycparser@${PY_FLAVOR}
+PYTHON_USES=	python:2.7,build
+
+DESCR=		${.CURDIR}/pkg-descr
+PATCHDIR=	${.CURDIR}/files
+
+.include "bsd.pypy.mk"
+#.include <bsd.port.pre.mk>
+
+DISTINFO_FILE?=	${.CURDIR}/distinfo
+PLIST?=		${.CURDIR}/pkg-plist
+
+.if ${OPSYS} == FreeBSD && ${ARCH} != i386 && ${ARCH} != amd64
+PYPY_ARGS=	--withoutmod-_vmprof
+.else
+LIB_DEPENDS+=	libunwind.so:devel/libunwind
+.endif
+
+.if ${PORTNAME} == pypy
+SHEBANG_FILES=	lib-python/2.7/plat-mac/appletrunner.py \
+		lib-python/2.7/plat-mac/bundlebuilder.py \
+		lib-python/2.7/keyword.py \
+		lib-python/2.7/test/regrtest.py \
+		lib-python/2.7/test/pystone.py \
+		lib-python/2.7/test/curses_tests.py \
+		lib-python/2.7/test/re_tests.py \
+		lib-python/2.7/test/crashers/recursive_call.py \
+		lib-python/2.7/test/bisect_cmd.py \
+		lib-python/2.7/UserString.py \
+		lib-python/2.7/pdb.py \
+		lib-python/2.7/mimify.py \
+		lib-python/2.7/pydoc.py \
+		lib-python/2.7/uu.py \
+		lib-python/2.7/trace.py \
+		lib-python/2.7/platform.py \
+		lib-python/2.7/profile.py \
+		lib-python/2.7/tabnanny.py \
+		lib-python/2.7/lib2to3/tests/pytree_idempotency.py \
+		lib-python/2.7/lib2to3/tests/data/false_encoding.py \
+		lib-python/2.7/lib2to3/tests/data/different_encoding.py \
+		lib-python/2.7/lib2to3/pgen2/token.py \
+		lib-python/2.7/encodings/rot_13.py \
+		lib-python/2.7/base64.py \
+		lib-python/2.7/webbrowser.py \
+		lib-python/2.7/idlelib/PyShell.py \
+		lib-python/2.7/cgi.py \
+		lib-python/2.7/symbol.py \
+		lib-python/2.7/cProfile.py \
+		lib-python/2.7/smtpd.py \
+		lib-python/2.7/quopri.py \
+		lib-python/2.7/timeit.py \
+		lib-python/2.7/smtplib.py \
+		lib_pypy/_cffi_ssl/tools/make_ssl_data.py
+
+.else
+.if ${PORT_OPTIONS:MFORPYIMPL37}
+SHEBANG_FILES=	\
+		lib-python/3/base64.py \
+		lib-python/3/cProfile.py \
+		lib-python/3/cgi.py \
+		lib-python/3/encodings/rot_13.py \
+		lib-python/3/keyword.py \
+		lib-python/3/idlelib/pyshell.py \
+		lib-python/3/lib2to3/pgen2/token.py \
+		lib-python/3/lib2to3/tests/data/different_encoding.py \
+		lib-python/3/lib2to3/tests/data/false_encoding.py \
+		lib-python/3/lib2to3/tests/pytree_idempotency.py \
+		lib-python/3/pdb.py \
+		lib-python/3/platform.py \
+		lib-python/3/profile.py \
+		lib-python/3/pydoc.py \
+		lib-python/3/quopri.py \
+		lib-python/3/smtpd.py \
+		lib-python/3/smtplib.py \
+		lib-python/3/symbol.py \
+		lib-python/3/tabnanny.py \
+		lib-python/3/tarfile.py \
+		lib-python/3/test/bisect_cmd.py \
+		lib-python/3/test/crashers/recursive_call.py \
+		lib-python/3/test/curses_tests.py \
+		lib-python/3/test/pystone.py \
+		lib-python/3/test/re_tests.py \
+		lib-python/3/test/regrtest.py \
+		lib-python/3/timeit.py \
+		lib-python/3/trace.py \
+		lib-python/3/turtledemo/bytedesign.py \
+		lib-python/3/turtledemo/clock.py \
+		lib-python/3/turtledemo/forest.py \
+		lib-python/3/turtledemo/fractalcurves.py \
+		lib-python/3/turtledemo/lindenmayer.py \
+		lib-python/3/turtledemo/minimal_hanoi.py \
+		lib-python/3/turtledemo/paint.py \
+		lib-python/3/turtledemo/peace.py \
+		lib-python/3/turtledemo/penrose.py \
+		lib-python/3/turtledemo/planet_and_moon.py \
+		lib-python/3/turtledemo/tree.py \
+		lib-python/3/turtledemo/yinyang.py \
+		lib-python/3/uu.py \
+		lib-python/3/webbrowser.py \
+		lib_pypy/_cffi_ssl/tools/make_ssl_data.py
+.elif ${PORT_OPTIONS:MFORPYIMPL38}
+SHEBANG_FILES=	\
+		lib-python/3/base64.py \
+		lib-python/3/cProfile.py \
+		lib-python/3/cgi.py \
+		lib-python/3/encodings/rot_13.py \
+		lib-python/3/keyword.py \
+		lib-python/3/idlelib/pyshell.py \
+		lib-python/3/lib2to3/pgen2/token.py \
+		lib-python/3/lib2to3/tests/data/different_encoding.py \
+		lib-python/3/lib2to3/tests/data/false_encoding.py \
+		lib-python/3/lib2to3/tests/pytree_idempotency.py \
+		lib-python/3/pdb.py \
+		lib-python/3/platform.py \
+		lib-python/3/profile.py \
+		lib-python/3/pydoc.py \
+		lib-python/3/quopri.py \
+		lib-python/3/smtpd.py \
+		lib-python/3/smtplib.py \
+		lib-python/3/symbol.py \
+		lib-python/3/tabnanny.py \
+		lib-python/3/tarfile.py \
+		lib-python/3/test/bisect_cmd.py \
+		lib-python/3/test/crashers/recursive_call.py \
+		lib-python/3/test/curses_tests.py \
+		lib-python/3/test/pystone.py \
+		lib-python/3/test/re_tests.py \
+		lib-python/3/test/regrtest.py \
+		lib-python/3/timeit.py \
+		lib-python/3/trace.py \
+		lib-python/3/turtledemo/bytedesign.py \
+		lib-python/3/turtledemo/clock.py \
+		lib-python/3/turtledemo/forest.py \
+		lib-python/3/turtledemo/fractalcurves.py \
+		lib-python/3/turtledemo/lindenmayer.py \
+		lib-python/3/turtledemo/minimal_hanoi.py \
+		lib-python/3/turtledemo/paint.py \
+		lib-python/3/turtledemo/peace.py \
+		lib-python/3/turtledemo/penrose.py \
+		lib-python/3/turtledemo/planet_and_moon.py \
+		lib-python/3/turtledemo/tree.py \
+		lib-python/3/turtledemo/yinyang.py \
+		lib-python/3/uu.py \
+		lib-python/3/webbrowser.py \
+		lib-python/3/test/ziptestdata/header.sh \
+		lib-python/3/test/ziptestdata/exe_with_z64 \
+		lib-python/3/test/ziptestdata/exe_with_zip \
+		lib_pypy/_cffi_ssl/tools/make_ssl_data.py
+.elif ${PORT_OPTIONS:MFORPYIMPL39}
+SHEBANG_FILES=	\
+		lib-python/3/base64.py \
+		lib-python/3/cProfile.py \
+		lib-python/3/cgi.py \
+		lib-python/3/encodings/rot_13.py \
+		lib-python/3/keyword.py \
+		lib-python/3/idlelib/pyshell.py \
+		lib-python/3/lib2to3/pgen2/token.py \
+		lib-python/3/lib2to3/tests/data/different_encoding.py \
+		lib-python/3/lib2to3/tests/data/false_encoding.py \
+		lib-python/3/lib2to3/tests/pytree_idempotency.py \
+		lib-python/3/pdb.py \
+		lib-python/3/platform.py \
+		lib-python/3/profile.py \
+		lib-python/3/pydoc.py \
+		lib-python/3/quopri.py \
+		lib-python/3/smtpd.py \
+		lib-python/3/smtplib.py \
+		lib-python/3/symbol.py \
+		lib-python/3/tabnanny.py \
+		lib-python/3/tarfile.py \
+		lib-python/3/test/bisect_cmd.py \
+		lib-python/3/test/crashers/recursive_call.py \
+		lib-python/3/test/curses_tests.py \
+		lib-python/3/test/pystone.py \
+		lib-python/3/test/re_tests.py \
+		lib-python/3/test/regrtest.py \
+		lib-python/3/timeit.py \
+		lib-python/3/trace.py \
+		lib-python/3/turtledemo/bytedesign.py \
+		lib-python/3/turtledemo/clock.py \
+		lib-python/3/turtledemo/forest.py \
+		lib-python/3/turtledemo/fractalcurves.py \
+		lib-python/3/turtledemo/lindenmayer.py \
+		lib-python/3/turtledemo/minimal_hanoi.py \
+		lib-python/3/turtledemo/paint.py \
+		lib-python/3/turtledemo/peace.py \
+		lib-python/3/turtledemo/penrose.py \
+		lib-python/3/turtledemo/planet_and_moon.py \
+		lib-python/3/turtledemo/sorting_animate.py \
+		lib-python/3/turtledemo/tree.py \
+		lib-python/3/turtledemo/yinyang.py \
+		lib-python/3/turtledemo/__main__.py \
+		lib-python/3/uu.py \
+		lib-python/3/webbrowser.py \
+		lib_pypy/_cffi_ssl/tools/make_ssl_data.py \
+		lib-python/3/test/ziptestdata/header.sh \
+		lib-python/3/test/ziptestdata/exe_with_z64 \
+		lib-python/3/test/ziptestdata/exe_with_zip
+.elif ${PORT_OPTIONS:MFORPYIMPL310}
+SHEBANG_FILES=	\
+		lib-python/3/base64.py \
+		lib-python/3/cProfile.py \
+		lib-python/3/cgi.py \
+		lib-python/3/encodings/rot_13.py \
+		lib-python/3/keyword.py \
+		lib-python/3/idlelib/pyshell.py \
+		lib-python/3/lib2to3/pgen2/token.py \
+		lib-python/3/lib2to3/tests/data/different_encoding.py \
+		lib-python/3/lib2to3/tests/data/false_encoding.py \
+		lib-python/3/lib2to3/tests/pytree_idempotency.py \
+		lib-python/3/pdb.py \
+		lib-python/3/platform.py \
+		lib-python/3/profile.py \
+		lib-python/3/pydoc.py \
+		lib-python/3/quopri.py \
+		lib-python/3/smtpd.py \
+		lib-python/3/smtplib.py \
+		lib-python/3/tabnanny.py \
+		lib-python/3/tarfile.py \
+		lib-python/3/test/bisect_cmd.py \
+		lib-python/3/test/crashers/recursive_call.py \
+		lib-python/3/test/curses_tests.py \
+		lib-python/3/test/pystone.py \
+		lib-python/3/test/re_tests.py \
+		lib-python/3/test/regrtest.py \
+		lib-python/3/timeit.py \
+		lib-python/3/trace.py \
+		lib-python/3/turtledemo/bytedesign.py \
+		lib-python/3/turtledemo/clock.py \
+		lib-python/3/turtledemo/forest.py \
+		lib-python/3/turtledemo/fractalcurves.py \
+		lib-python/3/turtledemo/lindenmayer.py \
+		lib-python/3/turtledemo/minimal_hanoi.py \
+		lib-python/3/turtledemo/paint.py \
+		lib-python/3/turtledemo/peace.py \
+		lib-python/3/turtledemo/penrose.py \
+		lib-python/3/turtledemo/planet_and_moon.py \
+		lib-python/3/turtledemo/sorting_animate.py \
+		lib-python/3/turtledemo/tree.py \
+		lib-python/3/turtledemo/yinyang.py \
+		lib-python/3/turtledemo/__main__.py \
+		lib-python/3/uu.py \
+		lib-python/3/webbrowser.py \
+		lib_pypy/_cffi_ssl/tools/make_ssl_data.py \
+		lib-python/3/test/ziptestdata/header.sh \
+		lib-python/3/test/ziptestdata/exe_with_z64 \
+		lib-python/3/test/ziptestdata/exe_with_zip
+.endif
+.endif
+
+pre-build:
+	if [ ! -f ${BUILD_WRKSRC}/Makefile ]; then \
+		${RM} -r ${WRKDIR}/build; \
+		${MKDIR} ${WRKDIR}/build; \
+		(cd ${WRKSRC}/pypy/goal; \
+			${SETENV} ${MAKE_ENV} TMPDIR=${WRKDIR}/build PYPY_USESSION_BASENAME=${PORTNAME} \
+			${PYTHON_CMD} ../../rpython/bin/rpython --source --opt=jit targetpypystandalone.py ${PYPY_ARGS}); \
+	fi
+
+post-build:
+	${CP} ${BUILD_WRKSRC}/${PYPY_EXECUTABLE} ${BUILD_WRKSRC}/${PYPY_LDLIBRARY} ${WRKSRC}/pypy/goal/
+
+do-install:
+	(cd ${WRKSRC}; \
+		${SETENV} ${MAKE_ENV} TMPDIR=${WRKDIR}/build \
+			${PYTHON_CMD} ${WRKSRC}/pypy/tool/release/package.py --builddir ${WRKDIR}/build --archive-name ${PYPY_DIR} \
+				${PACKAGE_ARGS})
+	${EXTRACT_CMD} -C ${STAGEDIR}${PREFIX} -xf ${WRKDIR}/build/${PYPY_DIR}.tar.bz2
+	${LN} -fs ../${PYPY_DIR}/bin/${PORTNAME} ${STAGEDIR}${PREFIX}/bin/${PORTNAME}
+.if ${PORT_OPTIONS:MFORPYIMPL38} || ${PORT_OPTIONS:MFORPYIMPL39} || ${PORT_OPTIONS:MFORPYIMPL310}
+	${FIND} ${STAGEDIR}${PREFIX}/${PYPY_DIR}/lib/${PYTHON_IMPL_MINOR} -name '*.so' | ${XARGS} ${STRIP_CMD}
+.else
+	${FIND} ${STAGEDIR}${PREFIX}/${PYPY_DIR}/lib_pypy/ -name '*.so' | ${XARGS} ${STRIP_CMD}
+.endif
+.if ${PORT_OPTIONS:MFORPYIMPL39} || ${PORT_OPTIONS:MFORPYIMPL310}
+.if ${PORT_OPTIONS:MBYTECOMPILE}
+	@echo Byte-compile the Python standard library for optimization levels 0, 1 and 2 with invalidation mode ${COMPILEALL_INVALIDATIONMODE}
+	(cd ${STAGEDIR}${PREFIX}/${PYPY_DIR} && ${SETENV} LD_LIBRARY_PATH=${WRKSRC}/pypy/goal \
+		${WRKSRC}/pypy/goal/${PYPY_EXECUTABLE} -B -I -m compileall --invalidation-mode=${COMPILEALL_INVALIDATIONMODE} -q -x '/tests?/' -o 0 -o 1 -o 2 -d "${PREFIX}/${PYPY_DIR}/lib" lib)
+.else
+	@echo Distribution of byte-compiled standard library files is deactivated
+.endif
+.else
+	@echo Byte-compilation of standard library files is not yet supported
+.endif
+
+do-test:
+	# See https://bitbucket.org/pypy/buildbot/src/default/bot2/pypybuildbot/builds.py?at=default#builds.py-386
+	# add_translated_tests()
+	(cd ${WRKSRC}; \
+		${SETENV} ${MAKE_ENV} TMPDIR=${WRKDIR}/build PYTHONPATH=${WRKSRC} \
+		${WRKSRC}/pypy/goal/pypy-c testrunner/runner.py --root pypy --logfile=pytest-A.log \
+			--parallel-runs ${MAKE_JOBS_NUMBER} \
+			--config pypy/pytest-A.cfg --config pypy/pytest-A.py)
+.for dir in lib-python pypy/module/pypyjit/test
+	(cd ${WRKSRC}; \
+		${SETENV} ${MAKE_ENV} TMPDIR=${WRKDIR}/build PYTHONPATH=${WRKSRC} \
+		${WRKSRC}/pypy/goal/pypy-c pypy/test_all.py --basetemp ${WRKDIR}/build --pypy pypy/goal/pypy-c \
+			${dir} )
+.endfor
+	(cd ${WRKSRC}/lib-python/2.7/test; \
+		${SETENV} ${MAKE_ENV} TMPDIR=${WRKDIR}/build PYTHONPATH=${WRKSRC} \
+		${WRKSRC}/pypy/goal/pypy-c regrtest.py -vvu all)
+
+pkg-plist: stage
+	${TAR} -tf ${WRKDIR}/build/${PYPY_DIR}.tar.bz2 > ${WRKDIR}/.plist-files-gen
+	${REINPLACE_CMD} -e 's|^${PYPY_DIR}|%%PYPY_DIR%%|g' \
+		-e 's|${PYPY_CFFI_VER}|%%PYPY_CFFI_VER%%|g' \
+		-e 's/\(.*\/__pycache__\)\/$$/@dir \1/g' \
+		-e '/\/$$/d' \
+			${WRKDIR}/.plist-files-gen
+	${ECHO} bin/${PORTNAME} > ${WRKDIR}/pkg-plist
+	${SORT} ${WRKDIR}/.plist-files-gen | ${GREP} -v '\.orig' >> ${WRKDIR}/pkg-plist
+	${CP} ${WRKDIR}/pkg-plist ${.CURDIR}/pkg-plist
+
+.include <bsd.port.post.mk>