changeset 45:5e046980990d

Call the package.py script with WRKSRC as the CWD. This removes the need for patching sysconfig.py and package.py (PyPy3) because files that are created by the scripts in the CWD now are created in WRKSRC. This is also consistent with other build stept, where an explicit change of the CWD to WRKSRC is done.
author Franz Glasner <fzglas.hg@dom66.de>
date Sun, 09 Oct 2022 19:11:04 +0200
parents ff83a2d91909
children 948aab4fc6b9
files Makefile files/patch-lib-python_2.7_sysconfig.py
diffstat 2 files changed, 5 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Sun Oct 09 16:00:56 2022 +0200
+++ b/Makefile	Sun Oct 09 19:11:04 2022 +0200
@@ -50,7 +50,7 @@
 
 ALL_TARGET=	${PYPY_EXECUTABLE}
 BUILD_WRKSRC?=	${WRKDIR}/build/usession-${PORTNAME}-0/testing_1
-MAKE_ENV+=	PYPY_LOCALBASE=${LOCALBASE} PYPY_WRKDIR=${WRKDIR} LDSHARED="${CC} -shared"
+MAKE_ENV+=	PYPY_LOCALBASE=${LOCALBASE} LDSHARED="${CC} -shared"
 PACKAGE_ARGS?=	--without-gdbm --without-sqlite3 --without-_tkinter
 LLD_UNSAFE=	yes
 SHEBANG_FILES?=	lib-python/2.7/plat-mac/appletrunner.py \
@@ -128,9 +128,10 @@
 	${CP} ${BUILD_WRKSRC}/${PYPY_EXECUTABLE} ${BUILD_WRKSRC}/${PYPY_LDLIBRARY} ${WRKSRC}/pypy/goal/
 
 do-install:
-	${SETENV} ${MAKE_ENV} TMPDIR=${WRKDIR}/build \
-		${PYTHON_CMD} ${WRKSRC}/pypy/tool/release/package.py --builddir ${WRKDIR}/build --archive-name ${PYPY_DIR} \
-			${PACKAGE_ARGS}
+	(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}
--- a/files/patch-lib-python_2.7_sysconfig.py	Sun Oct 09 16:00:56 2022 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
---- lib-python/2.7/sysconfig.py.orig	2022-03-28 09:50:42 UTC
-+++ lib-python/2.7/sysconfig.py
-@@ -366,13 +366,15 @@ def _generate_posix_vars():
-         module.build_time_vars = vars
-         sys.modules[name] = module
- 
-+    pypy_wrkdir = os.environ.get("PYPY_WRKDIR")  # this is set by FreeBSD port
-+
-     pybuilddir = 'build/lib.%s-%s' % (get_platform(), sys.version[:3])
-+    if pypy_wrkdir is not None:
-+        pybuilddir = os.path.join(pypy_wrkdir, pybuilddir)
-     if hasattr(sys, "gettotalrefcount"):
-         pybuilddir += '-pydebug'
--    try:
-+    if not os.path.isdir(pybuilddir):
-         os.makedirs(pybuilddir)
--    except OSError:
--        pass
-     destfile = os.path.join(pybuilddir, name + '.py')
- 
-     with open(destfile, 'wb') as f:
-@@ -382,7 +384,10 @@ def _generate_posix_vars():
-         pprint.pprint(vars, stream=f)
- 
-     # Create file used for sys.path fixup -- see Modules/getpath.c
--    with open('pybuilddir.txt', 'w') as f:
-+    pybuilddir_txt = 'pybuilddir.txt'
-+    if pypy_wrkdir is not None:
-+        pybuilddir_txt = os.path.join(pypy_wrkdir, pybuilddir_txt)
-+    with open(pybuilddir_txt, 'w') as f:
-         f.write(pybuilddir)
- 
- def _init_posix(vars):