forked from adang1345/PythonWindows
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlibffi-fix.patch
More file actions
114 lines (103 loc) · 4.98 KB
/
libffi-fix.patch
File metadata and controls
114 lines (103 loc) · 4.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
From 399cd466d0379d12e4af343a49ca7e8ec84997fa Mon Sep 17 00:00:00 2001
From: "Miss Islington (bot)"
<31488909+miss-islington@users.noreply.github.com>
Date: Fri, 27 Aug 2021 09:28:30 -0700
Subject: [PATCH] bpo-45022: Pin current libffi build to fixed version in
preparation for upcoming update (GH-27982)
Also improve the build script for libffi, which is not used as part of the regular build.
(cherry picked from commit 969ae7f7356584e30667b4e490ffa2ffa1810429)
Co-authored-by: Steve Dower <steve.dower@python.org>
---
PCbuild/get_externals.bat | 4 ++--
PCbuild/prepare_libffi.bat | 18 +++++++++++++-----
PCbuild/python.props | 4 ++--
3 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/PCbuild/get_externals.bat b/PCbuild/get_externals.bat
index b5a44e3e959b..dbd2ff1afd78 100644
--- a/PCbuild/get_externals.bat
+++ b/PCbuild/get_externals.bat
@@ -52,7 +52,7 @@ echo.Fetching external libraries...
set libraries=
set libraries=%libraries% bzip2-1.0.6
-if NOT "%IncludeLibffiSrc%"=="false" set libraries=%libraries% libffi
+if NOT "%IncludeLibffiSrc%"=="false" set libraries=%libraries% libffi-3.3.0
if NOT "%IncludeSSLSrc%"=="false" set libraries=%libraries% openssl-1.1.1k
set libraries=%libraries% sqlite-3.35.5.0
if NOT "%IncludeTkinterSrc%"=="false" set libraries=%libraries% tcl-core-8.6.9.0
@@ -76,7 +76,7 @@ for %%e in (%libraries%) do (
echo.Fetching external binaries...
set binaries=
-if NOT "%IncludeLibffi%"=="false" set binaries=%binaries% libffi
+if NOT "%IncludeLibffi%"=="false" set binaries=%binaries% libffi-3.3.0
if NOT "%IncludeSSL%"=="false" set binaries=%binaries% openssl-bin-1.1.1k-1
if NOT "%IncludeTkinter%"=="false" set binaries=%binaries% tcltk-8.6.9.0
if NOT "%IncludeSSLSrc%"=="false" set binaries=%binaries% nasm-2.11.06
diff --git a/PCbuild/prepare_libffi.bat b/PCbuild/prepare_libffi.bat
index 922a47565c8d..7e7842a2fc97 100644
--- a/PCbuild/prepare_libffi.bat
+++ b/PCbuild/prepare_libffi.bat
@@ -38,6 +38,7 @@ set BUILD_ARM32=
set BUILD_ARM64=
set BUILD_PDB=
set BUILD_NOOPT=
+set COPY_LICENSE=
set INSTALL_CYGWIN=
:CheckOpts
@@ -49,6 +50,7 @@ if /I "%1"=="-arm32" (set BUILD_ARM32=1) & shift & goto :CheckOpts
if /I "%1"=="-arm64" (set BUILD_ARM64=1) & shift & goto :CheckOpts
if /I "%1"=="-pdb" (set BUILD_PDB=-g) & shift & goto :CheckOpts
if /I "%1"=="-noopt" (set BUILD_NOOPT=CFLAGS='-Od -warn all') & shift & goto :CheckOpts
+if /I "%1"=="-license" (set COPY_LICENSE=1) & shift & goto :CheckOpts
if /I "%1"=="-?" goto :Usage
if /I "%1"=="--install-cygwin" (set INSTALL_CYGWIN=1) & shift & goto :CheckOpts
goto :Usage
@@ -60,6 +62,7 @@ if NOT DEFINED BUILD_X64 if NOT DEFINED BUILD_X86 if NOT DEFINED BUILD_ARM32 if
set BUILD_X86=1
set BUILD_ARM32=1
set BUILD_ARM64=1
+ set COPY_LICENSE=1
)
if "%INSTALL_CYGWIN%"=="1" call :InstallCygwin
@@ -98,9 +101,14 @@ if not exist Makefile.in (
)
if "%BUILD_X64%"=="1" call :BuildOne x64 x86_64-w64-cygwin x86_64-w64-cygwin
+if errorlevel 1 exit /B %ERRORLEVEL%
if "%BUILD_X86%"=="1" call :BuildOne x86 i686-pc-cygwin i686-pc-cygwin
+if errorlevel 1 exit /B %ERRORLEVEL%
if "%BUILD_ARM32%"=="1" call :BuildOne x86_arm i686-pc-cygwin arm-w32-cygwin
+if errorlevel 1 exit /B %ERRORLEVEL%
if "%BUILD_ARM64%"=="1" call :BuildOne x86_arm64 i686-pc-cygwin aarch64-w64-cygwin
+if errorlevel 1 exit /B %ERRORLEVEL%
+if "%COPY_LICENSE%"=="1" copy /y "%LIBFFI_SOURCE%\LICENSE" "%LIBFFI_OUT%\LICENSE"
popd
endlocal
@@ -179,11 +187,11 @@ if "%LIBFFI_TEST%" EQU "1" (
echo copying files to %_LIBFFI_OUT%
if not exist %_LIBFFI_OUT%\include (md %_LIBFFI_OUT%\include)
-copy %ARTIFACTS%\.libs\libffi-7.dll %_LIBFFI_OUT%
-copy %ARTIFACTS%\.libs\libffi-7.lib %_LIBFFI_OUT%
-copy %ARTIFACTS%\.libs\libffi-7.pdb %_LIBFFI_OUT%
-copy %ARTIFACTS%\fficonfig.h %_LIBFFI_OUT%\include
-copy %ARTIFACTS%\include\*.h %_LIBFFI_OUT%\include
+copy %ARTIFACTS%\.libs\libffi-*.dll %_LIBFFI_OUT% || exit /B 1
+copy %ARTIFACTS%\.libs\libffi-*.lib %_LIBFFI_OUT% || exit /B 1
+copy %ARTIFACTS%\.libs\libffi-*.pdb %_LIBFFI_OUT%
+copy %ARTIFACTS%\fficonfig.h %_LIBFFI_OUT%\include || exit /B 1
+copy %ARTIFACTS%\include\*.h %_LIBFFI_OUT%\include || exit /B 1
endlocal
exit /b
diff --git a/PCbuild/python.props b/PCbuild/python.props
index 60625101b472..da65df58e227 100644
--- a/PCbuild/python.props
+++ b/PCbuild/python.props
@@ -60,8 +60,8 @@
<sqlite3Dir>$(ExternalsDir)sqlite-3.35.5.0\</sqlite3Dir>
<bz2Dir>$(ExternalsDir)bzip2-1.0.6\</bz2Dir>
<lzmaDir>$(ExternalsDir)xz-5.2.2\</lzmaDir>
- <libffiDir>$(ExternalsDir)libffi\</libffiDir>
- <libffiOutDir>$(ExternalsDir)libffi\$(ArchName)\</libffiOutDir>
+ <libffiDir>$(ExternalsDir)libffi-3.3.0\</libffiDir>
+ <libffiOutDir>$(ExternalsDir)libffi-3.3.0\$(ArchName)\</libffiOutDir>
<libffiIncludeDir>$(libffiOutDir)include</libffiIncludeDir>
<opensslDir>$(ExternalsDir)openssl-1.1.1k\</opensslDir>
<opensslOutDir>$(ExternalsDir)openssl-bin-1.1.1k-1\$(ArchName)\</opensslOutDir>