On Fri, Jun 14, 2013 at 11:17:47PM +0100, Stuart Henderson wrote:
> Any chance someone could give this a spin on a clean system please?
> It switches the pypy build to using a binary bootstrap copy of pypy,
> rather than using python2.7 ("cpython") to build. A pseudo flavour
> allows us to ignore the existing bootstrap and use the cpython-based
> build instead (useful if creating a new bootstrap after a flag day).
>
> Downside: extra complexity, slightly more annoying to update.
>
> Upside: build is about half an hour faster on my laptop, and uses
> a fair bit less ram (5.2GB -> 3.6GB max from \time -l).
>
> As this is still fairly hefty and will take some time to fail, I have
> also added an early check to skip building if ulimit -d is obviously
> too low.
>
> Comments and/or OKs welcome..
>
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/lang/pypy/Makefile,v
> retrieving revision 1.1.1.1
> diff -u -p -r1.1.1.1 Makefile
> --- Makefile 11 Jun 2013 22:10:46 -0000 1.1.1.1
> +++ Makefile 14 Jun 2013 22:14:07 -0000
> @@ -1,6 +1,5 @@
> # $OpenBSD: Makefile,v 1.1.1.1 2013/06/11 22:10:46 edd Exp $
>
> -# Oh boy. "5495684 maximum resident set size" on amd64
> VMEM_WARNING = Yes
>
> ONLY_FOR_ARCHS = amd64
> @@ -10,6 +9,7 @@ COMMENT = fast implementation of the Py
> V = 2.0.2
> DISTNAME = pypy-${V}-src
> PKGNAME = pypy-${V}
> +BOOTSTRAP-amd64 = pypy-bootstrap-amd64-$V-0.tar.xz
>
> CATEGORIES = lang
>
> @@ -23,24 +23,52 @@ PERMIT_PACKAGE_CDROM = Yes
> WANTLIB += bz2 c crypto curses expat ffi m pthread ssl util z
>
> MASTER_SITES = https://bitbucket.org/pypy/pypy/downloads/
> +MASTER_SITES0 = http://spacehopper.org/mirrors/
> EXTRACT_SUFX = .tar.bz2
>
> +PSEUDO_FLAVORS = no_bootstrap
> +FLAVOR ?=
> +
> DIST_SUBDIR = pypy
> +DISTFILES = ${DISTNAME}${EXTRACT_SUFX}
> +DISTFILES += ${BOOTSTRAP-${MACHINE_ARCH}}:0
> +# if adding archs, list *all* bootstraps in SUPDISTFILES
> +SUPDISTFILES = ${BOOTSTRAP-amd64}:0
>
> MODULES += devel/gettext lang/python gcc4
> MODPY_VERSION = 2.7
> MODGCC4_ARCHS = *
> MODGCC4_LANGS = c c++
> +MODGCC4_VERSION = 4.8
Why 4.8? I'm not complaining, just asking.
>
> USE_GMAKE = Yes
> BUILD_DEPENDS = textproc/py-sphinx
>
> WRKDIST = ${WRKDIR}/pypy-${V}-src
>
> +post-extract:
> + if [ `ulimit -d` -lt $$((3*1024*1024)) ]; then \
> + echo datasize limit is too low to build; exit 1; fi
> +.if !${FLAVOR:Mno_bootstrap}
> + echo '#!/bin/sh' > ${WRKDIR}/bin/pypy
> + echo 'LD_LIBRARY_PATH=${WRKDIR}/bootstrap/system-libs exec
> ${WRKDIR}/bootstrap/bin/pypy "$$@"' >> ${WRKDIR}/bin/pypy
> + chmod +x ${WRKDIR}/bin/pypy
> +.endif
> +
> do-build:
> +.if ${FLAVOR:Mno_bootstrap}
> cd ${WRKSRC}/pypy/goal/ && ${SETENV} ${MAKE_ENV} \
> - PYPY_USESSION_DIR=${WRKDIR}/usession PYPY_CTYPES_DIR=${WRKDIR}/ctypes
> \
> + PYPY_USESSION_DIR=${WRKDIR}/usession \
> + PYPY_CTYPES_DIR=${WRKDIR}/ctypes \
> ${MODPY_BIN} ../../rpython/bin/rpython --source --opt=jit
> +.else
> + cd ${WRKSRC}/pypy/goal/ && ${SETENV} ${MAKE_ENV} \
> + PYPY_GC_MAX_DELTA=200MB \
> + PYPY_USESSION_DIR=${WRKDIR}/usession \
> + PYPY_CTYPES_DIR=${WRKDIR}/ctypes \
> + pypy --jit loop_longevity=300 \
> + ../../rpython/bin/rpython --source --opt=jit
> +.endif
> cd ${WRKDIR}/usession/testing_1 && ${SETENV} ${MAKE_ENV} ${MAKE_PROGRAM}
>
> do-install:
> @@ -57,4 +85,20 @@ do-install:
> chown -R ${SHAREOWN}:${SHAREGRP} ${PREFIX}/pypy/lib-python/2.7
> cd ${PREFIX}/bin && ln -s ../pypy/bin/pypy
>
> +PYPY_PKG = ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/all/${FULLPKGNAME}.tgz
> +
> .include <bsd.port.mk>
> +
> +# The bootstrap-based build process uses less memory and is faster,
> +# but if you need to build a new bootstrap because the existing one no
> +# longer runs, use FLAVOR=no_bootstrap to do a cpython-based build.
> +# Expect 5.3GB+ memory usage.
> +bootstrap: ${PYPY_PKG}
> + mkdir -p ${WRKDIR}/prepare/bootstrap/system-libs
> + cd ${WRKDIR}/prepare/bootstrap && tar zxf ${PYPY_PKG}
> + rm -rf ${WRKDIR}/prepare/bootstrap/{+*,info,man}
> + for i in `ldd ${WRKDIR}/prepare/bootstrap/bin/pypy | grep 'lib/' | \
> + awk '{ print $$7 }'` ; do \
> + cp $$i ${WRKDIR}/prepare/bootstrap/system-libs; done
> + cd ${WRKDIR}/prepare && tar cf - bootstrap | \
> + xz > ${FULLDISTDIR}/${BOOTSTRAP-${MACHINE_ARCH}}
> Index: distinfo
> ===================================================================
> RCS file: /cvs/ports/lang/pypy/distinfo,v
> retrieving revision 1.1.1.1
> diff -u -p -r1.1.1.1 distinfo
> --- distinfo 11 Jun 2013 22:10:46 -0000 1.1.1.1
> +++ distinfo 14 Jun 2013 22:14:07 -0000
> @@ -1,2 +1,4 @@
> SHA256 (pypy/pypy-2.0.2-src.tar.bz2) =
> GZHJDWuY4kCLN5DUtXtx7BxpNGMouDIVBc6ParRUTDw=
> +SHA256 (pypy/pypy-bootstrap-amd64-2.0.2-0.tar.xz) =
> 6HDP8l5Yt+HjTbrhEqen4cpmFSg2+Y4Bf8SlVrUoses=
> SIZE (pypy/pypy-2.0.2-src.tar.bz2) = 14819848
> +SIZE (pypy/pypy-bootstrap-amd64-2.0.2-0.tar.xz) = 16432356
--
Juan Francisco Cantero Hurtado http://juanfra.info