From 969ae7f7356584e30667b4e490ffa2ffa1810429 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Fri, 27 Aug 2021 00:57:00 +0100 Subject: 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. --- 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 63e3bb4..8a1ab21 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.11.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.11.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 922a475..7e7842a 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 6062510..da65df5 100644 --- a/PCbuild/python.props +++ b/PCbuild/python.props @@ -60,8 +60,8 @@ $(ExternalsDir)sqlite-3.35.5.0\ $(ExternalsDir)bzip2-1.0.6\ $(ExternalsDir)xz-5.2.2\ - $(ExternalsDir)libffi\ - $(ExternalsDir)libffi\$(ArchName)\ + $(ExternalsDir)libffi-3.3.0\ + $(ExternalsDir)libffi-3.3.0\$(ArchName)\ $(libffiOutDir)include $(ExternalsDir)openssl-1.1.1k\ $(ExternalsDir)openssl-bin-1.1.1k-1\$(ArchName)\ -- cgit v0.12