From 7f38ef7dd7107d37be1e609eb7adaf81cfdd7b6f Mon Sep 17 00:00:00 2001 From: mattip Date: Sun, 11 Jul 2021 15:06:21 +0300 Subject: [PATCH] use libffi instead of older vendored version --- recipe/meta.yaml | 3 +- recipe/patches/pre-7.3.6-0008.patch | 113 ++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 recipe/patches/pre-7.3.6-0008.patch diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 92e3b28..109671a 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -36,13 +36,14 @@ source: - patches/pre-7.3.6-0005.patch - patches/pre-7.3.6-0006.patch - patches/pre-7.3.6-0007.patch + - patches/pre-7.3.6-0008.patch - url: https://downloads.python.org/pypy/pypy2.7-v7.3.5-win64.zip # [win] sha256: 0b90eded11ba89a526c4288f17fff7e75000914ac071bd6d67912748ae89d761 # [win] folder: pypy2-binary # [win] build: - number: 3 + number: 4 skip: True # [name_suffix=="3.6"] skip_compile_pyc: - lib* diff --git a/recipe/patches/pre-7.3.6-0008.patch b/recipe/patches/pre-7.3.6-0008.patch new file mode 100644 index 0000000..091b522 --- /dev/null +++ b/recipe/patches/pre-7.3.6-0008.patch @@ -0,0 +1,113 @@ +# Branch py3.7 +# Node ID 914662db611500eb62661bf6d1dcb38e327f25c2 +# Parent d23b62357222d2768c072fbceb0650a174acd7e5 + +diff -r d23b62357222 -r 914662db6115 lib-python/3/venv/__init__.py +--- a/lib-python/3/venv/__init__.py Fri Jul 09 19:45:42 2021 +0100 ++++ b/lib-python/3/venv/__init__.py Sun Jul 11 12:46:37 2021 +0300 +@@ -259,9 +259,9 @@ + if not os.path.islink(path): + os.chmod(path, 0o755) + # +- # PyPy extension: also copy the main library, not just the ++ # PyPy extension: also copy needed dlls, not just the + # small executable +- for libname in ['libpypy3-c.so', 'libpypy3-c.dylib']: ++ for libname in ['libpypy3-c.so', 'libpypy3-c.dylib', 'libffi-7.dll']: + dest_library = os.path.join(binpath, libname) + src_library = os.path.join(os.path.dirname(context.executable), + libname) +diff -r d23b62357222 -r 914662db6115 pypy/tool/release/package.py +--- a/pypy/tool/release/package.py Fri Jul 09 19:45:42 2021 +0100 ++++ b/pypy/tool/release/package.py Sun Jul 11 12:46:37 2021 +0300 +@@ -185,7 +185,9 @@ + print('Picking {} as pypy.exe'.format(src)) + # Can't rename a DLL + win_extras = [('lib' + POSIX_EXE + '-c.dll', None), +- ('sqlite3.dll', lib_pypy)] ++ ('sqlite3.dll', lib_pypy), ++ ('libffi-7.dll', None), ++ ] + if not options.no__tkinter: + tkinter_dir = lib_pypy.join('_tkinter') + win_extras += [('tcl86t.dll', tkinter_dir), ('tk86t.dll', tkinter_dir)] +diff -r d23b62357222 -r 914662db6115 rpython/rlib/clibffi.py +--- a/rpython/rlib/clibffi.py Fri Jul 09 19:45:42 2021 +0100 ++++ b/rpython/rlib/clibffi.py Sun Jul 11 12:46:37 2021 +0300 +@@ -38,10 +38,7 @@ + + if _WIN32: + from rpython.rlib import rwin32 +- +-if _WIN32: + separate_module_sources = [''' +- #include "src/precommondefs.h" + #include + #include + +@@ -107,22 +104,22 @@ + ]) + else: + USE_C_LIBFFI_MSVC = True +- libffidir = py.path.local(cdir).join('src', 'libffi_msvc') ++ # libffidir = py.path.local(cdir).join('src', 'libffi_msvc') + if not _WIN64: + asm_ifc = 'win32.c' + else: + asm_ifc = 'win64.asm' + eci = ExternalCompilationInfo( + includes = ['ffi.h', 'windows.h'], +- libraries = ['kernel32'], +- include_dirs = [libffidir, cdir], ++ libraries = ['kernel32', 'libffi-7'], ++ # include_dirs = [libffidir, cdir], + separate_module_sources = separate_module_sources, + post_include_bits = post_include_bits, +- separate_module_files = [libffidir.join('ffi.c'), +- libffidir.join('prep_cif.c'), +- libffidir.join(asm_ifc), +- libffidir.join('pypy_ffi.c'), +- ], ++ # separate_module_files = [libffidir.join('ffi.c'), ++ # libffidir.join('prep_cif.c'), ++ # libffidir.join(asm_ifc), ++ # libffidir.join('pypy_ffi.c'), ++ # ], + ) + + FFI_TYPE_P = lltype.Ptr(lltype.ForwardReference()) +@@ -265,7 +262,7 @@ + return rffi.llexternal(name, args, result, compilation_info=eci, calling_conv='win') + + +-if not _MSVC: ++if 1 or not _MSVC: + def check_fficall_result(result, flags): + pass # No check + else: +@@ -329,7 +326,7 @@ + + c_ffi_prep_cif = external('ffi_prep_cif', [FFI_CIFP, FFI_ABI, rffi.UINT, + FFI_TYPE_P, FFI_TYPE_PP], rffi.INT) +-if _MSVC: ++if 0 and _MSVC: + c_ffi_call_return_type = rffi.INT + else: + c_ffi_call_return_type = lltype.Void + +diff -r d23b62357222 -r 914662db6115 rpython/translator/driver.py +--- a/rpython/translator/driver.py Fri Jul 09 19:45:42 2021 +0100 ++++ b/rpython/translator/driver.py Sun Jul 11 12:46:37 2021 +0300 +@@ -507,6 +507,11 @@ + newname = newexename.new(basename=soname.basename) + shutil.copyfile(str(name), str(newname.new(ext=ext))) + self.log.info("copied: %s" % (newname,)) ++ # HACK: copy libcffi-7.dll which is required for venvs ++ # At some point, we should stop doing this, and instead ++ # use the artifact from packaging the build instead ++ libffi = py.path.local.sysfind('libffi-7.dll') ++ shutil.copyfile(str(libffi), os.getcwd() + r'\libffi-7.dll') + self.c_entryp = newexename + self.log.info("created: %s" % (self.c_entryp,)) + +