diff options
author | dbn <dbn@FreeBSD.org> | 2015-08-13 02:13:23 +0800 |
---|---|---|
committer | dbn <dbn@FreeBSD.org> | 2015-08-13 02:13:23 +0800 |
commit | 479244e71dacfb1921e5d67396477ca111dbc65e (patch) | |
tree | 32cd5e280032791f30ab98f0c6f0313b39a4b813 /lang/pypy | |
parent | 8a61d3de445091384fdfaad4bff57daee04470f9 (diff) | |
download | freebsd-ports-gnome-479244e71dacfb1921e5d67396477ca111dbc65e.tar.gz freebsd-ports-gnome-479244e71dacfb1921e5d67396477ca111dbc65e.tar.zst freebsd-ports-gnome-479244e71dacfb1921e5d67396477ca111dbc65e.zip |
lang/pypy: support cffi, fix and simplify.
* Mark as only for i386, amd64 and armv6 (JIT only supported on those archs)
* Move PyPy dir to pypy26 (for consistency with llvm, et al)
* Drop PYPY_ARCH (unused)
* Use shell to detect ${BUILD_WRKSRC}/Makefile [1]
* Enable CFFI for components that do not have external dependencies
* Update regression-test to align with upstreams procedures
* Complete changes for detecting cpu count via sysctl (upstreamed)
* Properly detect arm (upstreamed) [2]
* Update pkg-plist generation and regenerate
[1] When make evaluates the dependency for pre-build the variable
${BUILD_WRKSRC} is not fully defined (i.e. ${WRKSRC}) so it does not get
properly expanded causing make to never find the correct Makefile.
PR: 202159 [2]
Reviewed by: sbruno (prior version)
Diffstat (limited to 'lang/pypy')
-rw-r--r-- | lang/pypy/Makefile | 72 | ||||
-rw-r--r-- | lang/pypy/files/patch-rpython_config_test_test__support.py | 44 | ||||
-rw-r--r-- | lang/pypy/files/patch-rpython_jit_backend_detect__cpu.py | 10 | ||||
-rw-r--r-- | lang/pypy/pkg-plist | 4 |
4 files changed, 93 insertions, 37 deletions
diff --git a/lang/pypy/Makefile b/lang/pypy/Makefile index 0566c69cde18..93ba06f24421 100644 --- a/lang/pypy/Makefile +++ b/lang/pypy/Makefile @@ -3,7 +3,7 @@ PORTNAME= pypy PORTVERSION= 2.6.0 -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= lang python MASTER_SITES= https://bitbucket.org/pypy/pypy/get/ LOCAL/dbn/pypy DISTNAME= release-${DISTVERSION} @@ -18,6 +18,9 @@ LICENSE_COMB= multi LIB_DEPENDS= libexpat.so:${PORTSDIR}/textproc/expat2 \ libffi.so:${PORTSDIR}/devel/libffi +ONLY_FOR_ARCHS= i386 amd64 armv6 +ONLY_FOR_ARCHS_REASON= PyPy JIT only supported on these architectures + 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) @@ -34,74 +37,69 @@ CONFLICTS_INSTALL= pypy3-[0-9]* ALL_TARGET= pypy-c BUILD_WRKSRC= ${WRKDIR}/build/usession-release-${DISTVERSION}-0/testing_1 MAKE_ENV+= PYPY_LOCALBASE=${LOCALBASE} - USE_LDCONFIG= ${PREFIX}/${PYPY_DIR}/bin USES= compiler:c11 gettext-runtime tar:bzip2 WRKSRC= ${WRKDIR}/pypy-pypy-295ee98b6928 - -PYPY_DIR= pypy-${DISTVERSION:C|([0-9])\.([0-9]).*|\1.\2|} -PLIST_SUB+= PYPY_DIR=${PYPY_DIR} +PYPY_VER= ${DISTVERSION:C|([0-9])\.([0-9]).*|\1\2|} +PYPY_DIR= pypy${PYPY_VER +PLIST_SUB+= PYPY_VER=${PYPY_VER} PYPY_DIR=${PYPY_DIR} .include <bsd.port.options.mk> .if ${PORT_OPTIONS:MPYPY} || defined(PYTHON_CMD) PYTHON_CMD?= ${LOCALBASE}/bin/pypy .elif ${PORT_OPTIONS:MPYPY_MINMEM} -PYTHON_CMD?= "${SETENV} PYPY_GC_MAX_DELTA=200MB ${LOCALBASE}/bin/pypy --jit loop_longevity=300" -.else +PYTHON_CMD?= ${SETENV} PYPY_GC_MAX_DELTA=200MB ${LOCALBASE}/bin/pypy --jit loop_longevity=300 +.else # if ${PORT_OPTIONS:MPYTHON} USES+= python:2,build .endif -# Translate FreeBSD ARCH types to PyPy ARCH types -# Pypy officially only supports i386 and amd64, the other platforms are -# untested (and do not have jit support). -.if ${ARCH} == "i386" -PYPY_ARCH= x86_32 +.if ${ARCH} == "i386" || ${ARCH} == "armv6" PYPY_BITS= 32 .elif ${ARCH} == "amd64" -PYPY_ARCH= x86_64 -PYPY_BITS= 64 -.elif ${ARCH} == "powerpc" -PYPY_ARCH= ppc_32 -PYPY_BITS= 32 -.elif ${ARCH} == "powerpc64" -PYPY_ARCH= ppc_64 PYPY_BITS= 64 -.else -PYPY_ARCH= ${ARCH} -PYPY_BITS= 32 .endif -PLIST_SUB+= PYPY_ARCH="${PYPY_ARCH}" PLIST_SUB+= PYPY_BITS="${PYPY_BITS}" -pre-build: ${BUILD_WRKSRC}/Makefile - -${BUILD_WRKSRC}/Makefile: - ${RM} -r ${WRKDIR}/build - ${MKDIR} ${WRKDIR}/build - (cd ${WRKSRC}/pypy/goal; \ - ${SETENV} ${MAKE_ENV} TMPDIR=${WRKDIR}/build \ - ${PYTHON_CMD} ../../rpython/bin/rpython --source -Ojit targetpypystandalone.py) - ${REINPLACE_CMD} -e 's|^%.o: %.c$$|.c.o:|g' ${BUILD_WRKSRC}/Makefile +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 \ + ${PYTHON_CMD} ../../rpython/bin/rpython --source -Ojit targetpypystandalone.py); \ + ${REINPLACE_CMD} -e 's|^%.o: %.c$$|.c.o:|g' ${BUILD_WRKSRC}/Makefile; \ + fi post-build: ${CP} ${BUILD_WRKSRC}/pypy-c ${BUILD_WRKSRC}/libpypy-c.so ${WRKSRC}/pypy/goal/ do-install: ${SETENV} TMPDIR=${WRKDIR}/build \ - ${PYTHON_CMD} ${WRKSRC}/pypy/tool/release/package.py --without-cffi --builddir ${WRKDIR}/build --archive-name ${PYPY_DIR} + ${PYTHON_CMD} ${WRKSRC}/pypy/tool/release/package.py --builddir ${WRKDIR}/build --archive-name ${PYPY_DIR} \ + --without-gdbm --without-sqlite3 --without-tk ${EXTRACT_CMD} -C ${STAGEDIR}${PREFIX} -xf ${WRKDIR}/build/${PYPY_DIR}.tar.bz2 - ${LN} -s ../${PYPY_DIR}/bin/pypy ${STAGEDIR}${PREFIX}/bin/pypy + ${LN} -fs ../${PYPY_DIR}/bin/pypy ${STAGEDIR}${PREFIX}/bin/pypy regression-test: build + # 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 \ - ${WRKSRC}/pypy/goal/pypy-c pypy/test_all.py --basetemp ${WRKDIR}/build pypy lib-python) + ${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 pkg-plist: build ${TAR} -tf ${WRKDIR}/build/${PYPY_DIR}.tar.bz2 > ${WRKDIR}/.plist-files-gen ${REINPLACE_CMD} -e 's|^${PYPY_DIR}|%%PYPY_DIR%%|g' \ - -e 's|${PYPY_ARCH}|%%PYPY_ARCH%%|g' \ + -e 's|-${PYPY_VER}|-%%PYPY_VER%%|g' \ -e 's|_${PYPY_BITS}_|_%%PYPY_BITS%%_|g' \ -e '/\/$$/d' \ ${WRKDIR}/.plist-files-gen diff --git a/lang/pypy/files/patch-rpython_config_test_test__support.py b/lang/pypy/files/patch-rpython_config_test_test__support.py new file mode 100644 index 000000000000..1b53f5351a74 --- /dev/null +++ b/lang/pypy/files/patch-rpython_config_test_test__support.py @@ -0,0 +1,44 @@ +--- rpython/config/test/test_support.py.orig 2015-05-31 07:19:51 UTC ++++ rpython/config/test/test_support.py +@@ -52,25 +52,30 @@ def test_cpuinfo_linux(): + finally: + os.environ = saved + +-def test_cpuinfo_darwin(): +- if sys.platform != 'darwin': +- py.test.skip('mac only') +- saved_func = support.darwin_get_cpu_count ++def test_cpuinfo_sysctl(): ++ if sys.platform != 'darwin' and not sys.platform.startswith('freebsd'): ++ py.test.skip('mac and bsd only') ++ saved_func = support.sysctl_get_cpu_count + saved = os.environ +- def count(): ++ def count(cmd): ++ if sys.platform == 'darwin': ++ assert cmd == '/usr/sbin/sysctl' ++ else: ++ assert cmd == '/sbin/sysctl' + return 42 + try: +- support.darwin_get_cpu_count = count ++ support.sysctl_get_cpu_count = count + os.environ = FakeEnviron(None) + assert support.detect_number_of_processors() == 42 + os.environ = FakeEnviron('-j2') + assert support.detect_number_of_processors() == 1 + finally: + os.environ = saved +- support.darwin_get_cpu_count = saved_func ++ support.sysctl_get_cpu_count = saved_func + +-def test_darwin_get_cpu_count(): +- if sys.platform != 'darwin': ++def test_sysctl_get_cpu_count(): ++ if sys.platform != 'darwin' and not sys.platform.startswith('freebsd'): + py.test.skip('mac only') +- assert support.darwin_get_cpu_count() > 0 # hopefully +- assert support.darwin_get_cpu_count("false") == 1 ++ cmd = '/usr/sbin/sysctl' if sys.platform != 'darwin' else '/sbin/sysctl' ++ assert support.sysctl_get_cpu_count(cmd) > 0 # hopefully ++ assert support.sysctl_get_cpu_count(cmd, "false") == 1 diff --git a/lang/pypy/files/patch-rpython_jit_backend_detect__cpu.py b/lang/pypy/files/patch-rpython_jit_backend_detect__cpu.py new file mode 100644 index 000000000000..0ad94b4ab636 --- /dev/null +++ b/lang/pypy/files/patch-rpython_jit_backend_detect__cpu.py @@ -0,0 +1,10 @@ +--- rpython/jit/backend/detect_cpu.py.orig 2015-08-11 18:20:39 UTC ++++ rpython/jit/backend/detect_cpu.py +@@ -63,6 +63,7 @@ def detect_model_from_host_platform(): + 'AMD64': MODEL_X86, # win64 + 'armv7l': MODEL_ARM, + 'armv6l': MODEL_ARM, ++ 'arm': MODEL_ARM, # freebsd + }.get(mach) + + if result is None: diff --git a/lang/pypy/pkg-plist b/lang/pypy/pkg-plist index e7ec59ca3731..70c7d23cf020 100644 --- a/lang/pypy/pkg-plist +++ b/lang/pypy/pkg-plist @@ -2040,6 +2040,7 @@ bin/pypy %%PYPY_DIR%%/lib-python/2.7/zipfile.py %%PYPY_DIR%%/lib_pypy/__init__.py %%PYPY_DIR%%/lib_pypy/_audioop_build.py +%%PYPY_DIR%%/lib_pypy/_audioop_cffi.pypy-%%PYPY_VER%%.so %%PYPY_DIR%%/lib_pypy/_codecs_cn.py %%PYPY_DIR%%/lib_pypy/_codecs_hk.py %%PYPY_DIR%%/lib_pypy/_codecs_iso2022.py @@ -2064,6 +2065,7 @@ bin/pypy %%PYPY_DIR%%/lib_pypy/_ctypes_test.py %%PYPY_DIR%%/lib_pypy/_curses.py %%PYPY_DIR%%/lib_pypy/_curses_build.py +%%PYPY_DIR%%/lib_pypy/_curses_cffi.pypy-%%PYPY_VER%%.so %%PYPY_DIR%%/lib_pypy/_curses_panel.py %%PYPY_DIR%%/lib_pypy/_elementtree.py %%PYPY_DIR%%/lib_pypy/_ffi.py @@ -2072,6 +2074,7 @@ bin/pypy %%PYPY_DIR%%/lib_pypy/_marshal.py %%PYPY_DIR%%/lib_pypy/_md5.py %%PYPY_DIR%%/lib_pypy/_pwdgrp_build.py +%%PYPY_DIR%%/lib_pypy/_pwdgrp_cffi.pypy-%%PYPY_VER%%.so %%PYPY_DIR%%/lib_pypy/_pypy_interact.py %%PYPY_DIR%%/lib_pypy/_pypy_irc_topic.py %%PYPY_DIR%%/lib_pypy/_pypy_testcapi.py @@ -2085,6 +2088,7 @@ bin/pypy %%PYPY_DIR%%/lib_pypy/_structseq.py %%PYPY_DIR%%/lib_pypy/_subprocess.py %%PYPY_DIR%%/lib_pypy/_syslog_build.py +%%PYPY_DIR%%/lib_pypy/_syslog_cffi.pypy-%%PYPY_VER%%.so %%PYPY_DIR%%/lib_pypy/_testcapi.py %%PYPY_DIR%%/lib_pypy/_testcapimodule.c %%PYPY_DIR%%/lib_pypy/_tkinter/__init__.py |