Makefile 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. # $OpenBSD: Makefile,v 1.28 2017/05/31 08:08:16 espie Exp $
  2. ONLY_FOR_ARCHS = amd64
  3. COMMENT = fast implementation of the Python language
  4. # To update PyPy to a new version:
  5. # * Bump ${V} but set ${BOOTSTRAP_V} to the old ${V} (keeping
  6. # any bootstrap version suffix intact, e.g. "-1")
  7. # * make makesum
  8. # * make plist (fix anything along the way)
  9. # * make package
  10. # * Set BOOTSTRAP_V back to ${V} in the port Makefile
  11. # * make bootstrap && make makesum
  12. # * Try the build using the bootstrap
  13. #
  14. # If the old bootstrap no longer works (e.g. due to an ABI change), then
  15. # You can use the no_bootstrap FLAVOR to make a new bootstrap. This uses
  16. # CPython to build PyPy instead. Note this is slower.
  17. V = 5.3.1
  18. BOOTSTRAP_V = ${V}
  19. DISTNAME = pypy2-v${V}-src
  20. PKGNAME = pypy-${V}
  21. BOOTSTRAP-amd64 = pypy-bootstrap-amd64-${BOOTSTRAP_V}.tar.xz
  22. REVISION = 0
  23. CATEGORIES = lang
  24. HOMEPAGE = http://pypy.org/
  25. MAINTAINER = Edd Barrett <edd@openbsd.org>
  26. # PyPy is MIT; the Python libs it comes with have the same license as Python
  27. PERMIT_PACKAGE_CDROM = Yes
  28. WANTLIB += bz2 c crypto curses expat ffi gdbm iconv intl m
  29. WANTLIB += ncurses panel pthread sqlite3 ssl ${MODTCL_LIB}
  30. WANTLIB += ${MODTK_LIB} util z
  31. LIB_DEPENDS += databases/sqlite3
  32. MASTER_SITES = https://bitbucket.org/pypy/pypy/downloads/
  33. MASTER_SITES0 = https://spacehopper.org/mirrors/
  34. EXTRACT_SUFX = .tar.bz2
  35. PSEUDO_FLAVORS = no_bootstrap
  36. FLAVOR ?=
  37. DIST_SUBDIR = pypy
  38. DISTFILES = ${DISTNAME}${EXTRACT_SUFX}
  39. .if defined(BOOTSTRAP-${MACHINE_ARCH}) && !${FLAVOR:Mno_bootstrap}
  40. DISTFILES += ${BOOTSTRAP-${MACHINE_ARCH}}:0
  41. .endif
  42. # if adding archs, list *all* bootstraps in SUPDISTFILES
  43. SUPDISTFILES = ${BOOTSTRAP-amd64}:0
  44. MODULES += lang/python lang/tcl x11/tk
  45. MODPY_VERSION = 2.7
  46. COMPILER = gcc
  47. COMPILER_LANGS = c
  48. USE_GMAKE = Yes
  49. BUILD_DEPENDS = textproc/py-sphinx \
  50. databases/gdbm \
  51. ${MODTK_BUILD_DEPENDS}
  52. RUN_DEPENDS = ${MODTK_RUN_DEPENDS} \
  53. databases/gdbm
  54. post-extract:
  55. @if [ `ulimit -d` -lt $$((5*1024*1024)) ]; then \
  56. echo datasize limit is too low - amd64 build takes approx 5GB; \
  57. exit 1; fi
  58. .if !${FLAVOR:Mno_bootstrap}
  59. echo '#!/bin/sh' > ${WRKDIR}/bin/pypy
  60. echo 'LD_LIBRARY_PATH=${WRKDIR}/bootstrap/system-libs:${WRKDIR}/bootstrap/pypy/lib exec ${WRKDIR}/bootstrap/bin/pypy "$$@"' >> ${WRKDIR}/bin/pypy
  61. chmod +x ${WRKDIR}/bin/pypy
  62. .endif
  63. SUBST_VARS += MODTK_INCDIR MODTCL_INCDIR MODTK_LIB MODTCL_LIB
  64. pre-configure:
  65. ${SUBST_CMD} ${WRKSRC}/lib_pypy/_tkinter/tklib_build.py
  66. # prevent crap in the plist
  67. rm ${WRKSRC}/lib_pypy/_tkinter/tklib_build.py.beforesubst
  68. do-build:
  69. .if ${FLAVOR:Mno_bootstrap}
  70. cd ${WRKSRC}/pypy/goal/ && ${SETENV} ${MAKE_ENV} \
  71. PYPY_USESSION_DIR=${WRKDIR}/usession \
  72. PYPY_CTYPES_DIR=${WRKDIR}/ctypes \
  73. ${MODPY_BIN} ../../rpython/bin/rpython --source --opt=jit
  74. .else
  75. cd ${WRKSRC}/pypy/goal/ && ${SETENV} ${MAKE_ENV} \
  76. PYPY_GC_MAX_DELTA=300MB \
  77. PYPY_USESSION_DIR=${WRKDIR}/usession \
  78. PYPY_CTYPES_DIR=${WRKDIR}/ctypes \
  79. pypy --jit loop_longevity=300 \
  80. ../../rpython/bin/rpython --source --opt=jit
  81. .endif
  82. cd ${WRKDIR}/usession/testing_1 && ${SETENV} ${MAKE_ENV} \
  83. ${MAKE_PROGRAM} LDFLAGS_LINK="-Wl,-z,wxneeded -pthread"
  84. PYPY_INST_LIB_DIR = ${PREFIX}/pypy/lib
  85. PYPY_LD_LIBRARY_PATH = LD_LIBRARY_PATH=${PYPY_INST_LIB_DIR}
  86. do-install:
  87. mkdir -p ${PREFIX}/pypy/bin
  88. mkdir -p ${PYPY_INST_LIB_DIR}
  89. ${INSTALL_PROGRAM} ${WRKDIR}/usession/testing_1/pypy-c \
  90. ${PREFIX}/pypy/bin/pypy
  91. ${INSTALL_PROGRAM} ${WRKDIR}/usession/testing_1/libpypy-c.so \
  92. ${PYPY_INST_LIB_DIR}
  93. ${INSTALL_DATA_DIR} ${PREFIX}/pypy/include
  94. cp -rp ${WRKSRC}/include/* ${PREFIX}/pypy/include
  95. chown -R ${SHAREOWN}:${SHAREGRP} ${PREFIX}/pypy/include
  96. ${INSTALL_DATA_DIR} ${PREFIX}/pypy/lib_pypy
  97. ${INSTALL_DATA_DIR} ${PREFIX}/pypy/lib-python/2.7
  98. cp -rp ${WRKSRC}/lib_pypy/* ${PREFIX}/pypy/lib_pypy
  99. cp -rp ${WRKSRC}/lib-python/2.7/* ${PREFIX}/pypy/lib-python/2.7
  100. ${PYPY_LD_LIBRARY_PATH} ${PREFIX}/pypy/bin/pypy \
  101. -m compileall ${PREFIX}/pypy/lib_pypy
  102. ${PYPY_LD_LIBRARY_PATH} sh -c \
  103. 'find ${PREFIX}/pypy/lib-python/2.7 -name "*.py" | grep -v test \
  104. | xargs ${PREFIX}/pypy/bin/pypy -m compileall'
  105. # make cffi shared objects
  106. cd ${WRKSRC} && ${PYPY_LD_LIBRARY_PATH} \
  107. LDFLAGS=-L${LOCALBASE}/lib \
  108. CPPFLAGS=-I${LOCALBASE}/include \
  109. PYTHONPATH=`pwd` \
  110. ${PREFIX}/pypy/bin/pypy pypy/tool/build_cffi_imports.py
  111. find ${PREFIX}/pypy/lib_pypy/ -name '*.c' -or -name '*.o' | xargs rm
  112. chown -R ${SHAREOWN}:${SHAREGRP} ${PREFIX}/pypy/lib_pypy
  113. chown -R ${SHAREOWN}:${SHAREGRP} ${PREFIX}/pypy/lib-python/2.7
  114. cd ${PREFIX}/bin && ln -s ../pypy/bin/pypy
  115. cd ${PREFIX}/lib && ln -s ../pypy/lib/libpypy-c.so
  116. # remove patch orig files so they dont appear in the plist
  117. find ${PREFIX} -name '*.py.orig' | xargs rm
  118. PYPY_PKG = ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/all/${FULLPKGNAME}.tgz
  119. .include <bsd.port.mk>
  120. # The bootstrap-based build process uses less memory and is faster,
  121. # but if you need to build a new bootstrap because the existing one no
  122. # longer runs, use FLAVOR=no_bootstrap to do a cpython-based build.
  123. # Expect 6.5GB memory usage on amd64.
  124. bootstrap: ${PYPY_PKG}
  125. mkdir -p ${WRKDIR}/prepare/bootstrap/system-libs
  126. cd ${WRKDIR}/prepare/bootstrap && tar zxf ${PYPY_PKG}
  127. rm -rf ${WRKDIR}/prepare/bootstrap/{+*,info,man}
  128. for i in `LD_LIBRARY_PATH=${WRKDIR}/prepare/bootstrap/pypy/lib ldd ${WRKDIR}/prepare/bootstrap/bin/pypy | grep 'lib/' | grep -v 'libpypy-c' | \
  129. awk '{ print $$7 }'` ; do \
  130. cp $$i ${WRKDIR}/prepare/bootstrap/system-libs; done
  131. cd ${WRKDIR}/prepare && tar cf - bootstrap | \
  132. xz > ${FULLDISTDIR}/${BOOTSTRAP-${MACHINE_ARCH}}