mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-21 04:34:47 +03:00
add docker Windows build
This commit is contained in:
parent
c8aeab25b4
commit
a7c3f126ed
31
.github/workflows/test-windows.yml
vendored
31
.github/workflows/test-windows.yml
vendored
|
@ -276,3 +276,34 @@ jobs:
|
|||
steps:
|
||||
- name: Success
|
||||
run: echo Windows Test Successful
|
||||
|
||||
docker:
|
||||
runs-on: windows-2019
|
||||
timeout-minutes: 45
|
||||
|
||||
name: Docker Python 3.7 x86
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
|
||||
- uses: actions/checkout@v1
|
||||
with:
|
||||
repository: python-pillow/pillow-depends
|
||||
ref: master
|
||||
|
||||
- name: Build system information
|
||||
run: python .github/workflows/system-info.py
|
||||
|
||||
- name: Build Docker Image
|
||||
run: |
|
||||
# & $Env:ProgramFiles\Docker\Docker\DockerCli.exe -SwitchWindowsEngine
|
||||
docker build -m 2G -t python-pillow-build:latest winbuild\docker
|
||||
|
||||
- name: Create Docker Image
|
||||
run: |
|
||||
docker create --name PillowBuild -t python-pillow-build C:\Pillow\winbuild\docker\build.cmd
|
||||
docker cp . PillowBuild:C:\Pillow
|
||||
docker cp ..\pillow-depends PillowBuild:C:\pillow-depends
|
||||
|
||||
- name: Run Docker
|
||||
run: docker start PillowBuild -a
|
||||
|
|
40
winbuild/docker/Dockerfile
Normal file
40
winbuild/docker/Dockerfile
Normal file
|
@ -0,0 +1,40 @@
|
|||
# escape=`
|
||||
|
||||
# Use the latest Windows Server Core image with .NET Framework 4.8.
|
||||
FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019
|
||||
|
||||
# Restore the default Windows shell for correct batch processing.
|
||||
SHELL ["cmd", "/S", "/C"]
|
||||
|
||||
RUN powershell.exe -Command `
|
||||
$ErrorActionPreference = 'Stop'; `
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; `
|
||||
wget https://www.nasm.us/pub/nasm/releasebuilds/2.14.02/win64/nasm-2.14.02-win64.zip -OutFile c:\nasm.zip ; `
|
||||
Expand-Archive c:\nasm.zip -DestinationPath c:\
|
||||
|
||||
ARG PYTHON=3.7.3
|
||||
ARG PYTHON_DIR=Python37
|
||||
RUN powershell.exe -Command `
|
||||
$ErrorActionPreference = 'Stop'; `
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; `
|
||||
wget https://www.python.org/ftp/python/%PYTHON%/python-%PYTHON%.exe -OutFile c:\python-%PYTHON%.exe ; `
|
||||
Start-Process c:\python-%PYTHON%.exe -ArgumentList '/quiet TargetDir=c:\%PYTHON_DIR%\ InstallAllUsers=1 PrependPath=1' -Wait ; `
|
||||
Remove-Item c:\python-%PYTHON%.exe -Force ; `
|
||||
setx /M PYTHON C:\%PYTHON_DIR%
|
||||
|
||||
RUN C:\%PYTHON_DIR%\Scripts\pip.exe install pytest pytest-cov
|
||||
|
||||
# Default to PowerShell if no other command specified.
|
||||
CMD ["powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]
|
||||
|
||||
# Download the Build Tools bootstrapper.
|
||||
ADD https://aka.ms/vs/16/release/vs_buildtools.exe C:\vs_buildtools.exe
|
||||
|
||||
# Install Build Tools excluding workloads and components with known issues.
|
||||
RUN C:\vs_buildtools.exe --quiet --wait --norestart --nocache `
|
||||
--installPath C:\BuildTools `
|
||||
--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended `
|
||||
|| IF "%ERRORLEVEL%"=="3010" EXIT 0
|
||||
|
||||
# Default to PowerShell if no other command specified.
|
||||
CMD ["powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]
|
177
winbuild/docker/build.cmd
Normal file
177
winbuild/docker/build.cmd
Normal file
|
@ -0,0 +1,177 @@
|
|||
|
||||
xcopy c:\pillow-depends\*.zip c:\pillow\winbuild\
|
||||
xcopy c:\pillow-depends\*.tar.gz c:\pillow\winbuild\
|
||||
xcopy /s c:\pillow-depends\test_images\* c:\pillow\tests\images
|
||||
|
||||
cd c:\pillow\winbuild\
|
||||
c:\python37\python.exe c:\pillow\winbuild\build_dep.py
|
||||
|
||||
rem Set up environment
|
||||
set INCLUDE=
|
||||
set INCLIB=c:\Pillow\winbuild\depends\msvcr10-x32
|
||||
set BUILD=c:\Pillow\winbuild\build
|
||||
call "C:\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x86
|
||||
echo on
|
||||
path C:\nasm-2.14.02\;%PATH%
|
||||
|
||||
rem Build Dependencies
|
||||
|
||||
rem -> Build libjpegturbo
|
||||
setlocal
|
||||
cd /D %BUILD%\libjpeg-turbo-2.0.3
|
||||
set CMAKE=cmake.exe -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_RULE_MESSAGES:BOOL=OFF
|
||||
set CMAKE=%CMAKE% -DENABLE_SHARED:BOOL=OFF -DWITH_JPEG8:BOOL=TRUE -DWITH_CRT_DLL:BOOL=TRUE -DCMAKE_BUILD_TYPE=Release
|
||||
%CMAKE% -G "NMake Makefiles" .
|
||||
nmake -nologo -f Makefile clean
|
||||
nmake -nologo -f Makefile jpeg-static cjpeg-static djpeg-static
|
||||
copy /Y /B j*.h %INCLIB%
|
||||
copy /Y /B jpeg-static.lib %INCLIB%\libjpeg.lib
|
||||
copy /Y /B cjpeg-static.exe %INCLIB%\cjpeg.exe
|
||||
copy /Y /B djpeg-static.exe %INCLIB%\djpeg.exe
|
||||
endlocal
|
||||
|
||||
rem -> Build zlib
|
||||
setlocal
|
||||
cd /D %BUILD%\zlib-1.2.11
|
||||
nmake -nologo -f win32\Makefile.msc clean
|
||||
nmake -nologo -f win32\Makefile.msc zlib.lib
|
||||
copy /Y /B z*.h %INCLIB%
|
||||
copy /Y /B *.lib %INCLIB%
|
||||
copy /Y /B zlib.lib %INCLIB%\z.lib
|
||||
endlocal
|
||||
|
||||
rem -> Build LibTiff
|
||||
setlocal
|
||||
cd /D %BUILD%\tiff-4.1.0
|
||||
copy /Y c:\pillow\winbuild\tiff.opt nmake.opt
|
||||
nmake -nologo -f makefile.vc clean
|
||||
nmake -nologo -f makefile.vc lib
|
||||
copy /Y /B libtiff\tiff*.h %INCLIB%
|
||||
copy /Y /B libtiff\*.dll %INCLIB%
|
||||
copy /Y /B libtiff\*.lib %INCLIB%
|
||||
endlocal
|
||||
|
||||
rem -> Build WebP
|
||||
setlocal
|
||||
cd /D %BUILD%\libwebp-1.1.0
|
||||
rmdir /S /Q output\release-static
|
||||
nmake -nologo -f Makefile.vc CFG=release-static OBJDIR=output ARCH=x86 all
|
||||
mkdir %INCLIB%\webp
|
||||
copy /Y /B src\webp\*.h %INCLIB%\webp
|
||||
copy /Y /B output\release-static\x86\lib\* %INCLIB%
|
||||
endlocal
|
||||
|
||||
rem -> Build FreeType
|
||||
setlocal
|
||||
cd /D %BUILD%\freetype-2.10.1
|
||||
rmdir /S /Q objs
|
||||
set DefaultPlatformToolset=v142
|
||||
set VCTargetsPath=C:\BuildTools\MSBuild\Microsoft\VC\v160\
|
||||
set MSBUILD="C:\BuildTools\MSBuild\Current\Bin\MSBuild.exe"
|
||||
powershell -Command "(gc builds\windows\vc2010\freetype.vcxproj) -replace 'MultiThreaded<', 'MultiThreadedDLL<' | Out-File -encoding ASCII builds\windows\vc2010\freetype.vcxproj"
|
||||
%MSBUILD% builds\windows\vc2010\freetype.sln /t:Build /p:Configuration="Release Static" /p:Platform=Win32 /m
|
||||
xcopy /Y /E /Q include %INCLIB%
|
||||
copy /Y /B "objs\Win32\Release Static\freetype.lib" %INCLIB%
|
||||
endlocal
|
||||
|
||||
rem -> Build LCMS2
|
||||
setlocal
|
||||
cd /D %BUILD%\lcms2-2.8
|
||||
rmdir /S /Q Lib
|
||||
rmdir /S /Q Projects\VC2015\Release
|
||||
set VCTargetsPath=C:\BuildTools\MSBuild\Microsoft\VC\v160\
|
||||
set MSBUILD="C:\BuildTools\MSBuild\Current\Bin\MSBuild.exe"
|
||||
powershell C:\Pillow\winbuild\lcms2_patch.ps1
|
||||
%MSBUILD% Projects\VC2015\lcms2.sln /t:Clean;lcms2_static /p:Configuration="Release" /p:Platform=Win32 /m
|
||||
xcopy /Y /E /Q include %INCLIB%
|
||||
copy /Y /B Lib\MS\*.lib %INCLIB%
|
||||
endlocal
|
||||
|
||||
rem -> Build OpenJPEG
|
||||
setlocal
|
||||
cd /D %BUILD%\openjpeg-2.3.1msvcr10-x32
|
||||
set CMAKE=cmake.exe -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_RULE_MESSAGES:BOOL=OFF
|
||||
set CMAKE=%CMAKE% -DBUILD_THIRDPARTY:BOOL=OFF -DBUILD_SHARED_LIBS:BOOL=OFF
|
||||
set CMAKE=%CMAKE% -DCMAKE_BUILD_TYPE=Release
|
||||
%CMAKE% -G "NMake Makefiles" .
|
||||
nmake -nologo -f Makefile clean
|
||||
nmake -nologo -f Makefile
|
||||
mkdir %INCLIB%\openjpeg-2.3.1
|
||||
copy /Y /B src\lib\openjp2\*.h %INCLIB%\openjpeg-2.3.1
|
||||
copy /Y /B bin\*.lib %INCLIB%
|
||||
endlocal
|
||||
|
||||
rem -> Build libimagequant
|
||||
setlocal
|
||||
rem e5d454b: Merge tag '2.12.6' into msvc
|
||||
cd /D %BUILD%\libimagequant-e5d454bc7f5eb63ee50c84a83a7fa5ac94f68ec4
|
||||
echo (gc CMakeLists.txt) -replace 'add_library', "add_compile_options(-openmp-)`r`nadd_library" ^| Out-File -encoding ASCII CMakeLists.txt > patch.ps1
|
||||
echo (gc CMakeLists.txt) -replace ' SHARED', ' STATIC' ^| Out-File -encoding ASCII CMakeLists.txt >> patch.ps1
|
||||
powershell .\patch.ps1
|
||||
set CMAKE=cmake.exe -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_RULE_MESSAGES:BOOL=OFF
|
||||
set CMAKE=%CMAKE% -DCMAKE_BUILD_TYPE=Release
|
||||
%CMAKE% -G "NMake Makefiles" .
|
||||
nmake -nologo -f Makefile clean
|
||||
nmake -nologo -f Makefile
|
||||
copy /Y /B *.h %INCLIB%
|
||||
copy /Y /B *.lib %INCLIB%
|
||||
endlocal
|
||||
|
||||
rem -> Build HarfBuzz
|
||||
setlocal
|
||||
set INCLUDE=%INCLUDE%;%INCLIB%
|
||||
set LIB=%LIB%;%INCLIB%
|
||||
cd /D %BUILD%\harfbuzz-2.6.1
|
||||
set CMAKE=cmake.exe -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_RULE_MESSAGES:BOOL=OFF
|
||||
set CMAKE=%CMAKE% -DHB_HAVE_FREETYPE:BOOL=ON -DCMAKE_BUILD_TYPE=Release
|
||||
%CMAKE% -G "NMake Makefiles" .
|
||||
nmake -nologo -f Makefile clean
|
||||
nmake -nologo -f Makefile harfbuzz
|
||||
copy /Y /B src\*.h %INCLIB%
|
||||
copy /Y /B *.lib %INCLIB%
|
||||
endlocal
|
||||
|
||||
rem -> Build FriBidi
|
||||
setlocal
|
||||
cd /D %BUILD%\fribidi-1.0.7
|
||||
copy /Y /B C:\Pillow\winbuild\fribidi.cmake CMakeLists.txt
|
||||
set CMAKE=cmake.exe -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_RULE_MESSAGES:BOOL=OFF
|
||||
set CMAKE=%CMAKE% -DCMAKE_BUILD_TYPE=Release
|
||||
%CMAKE% -G "NMake Makefiles" .
|
||||
nmake -nologo -f Makefile clean
|
||||
nmake -nologo -f Makefile fribidi
|
||||
copy /Y /B lib\*.h %INCLIB%
|
||||
copy /Y /B *.lib %INCLIB%
|
||||
endlocal
|
||||
|
||||
rem -> Build Raqm
|
||||
setlocal
|
||||
set INCLUDE=%INCLUDE%;%INCLIB%
|
||||
set LIB=%LIB%;%INCLIB%
|
||||
cd /D %BUILD%\libraqm-0.7.0
|
||||
copy /Y /B C:\Pillow\winbuild\raqm.cmake CMakeLists.txt
|
||||
set CMAKE=cmake.exe -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_RULE_MESSAGES:BOOL=OFF
|
||||
set CMAKE=%CMAKE% -DCMAKE_BUILD_TYPE=Release
|
||||
%CMAKE% -G "NMake Makefiles" .
|
||||
nmake -nologo -f Makefile clean
|
||||
nmake -nologo -f Makefile libraqm
|
||||
copy /Y /B src\*.h %INCLIB%
|
||||
copy /Y /B libraqm.dll %INCLIB%
|
||||
endlocal
|
||||
|
||||
rem Build Pillow
|
||||
cd c:\pillow\
|
||||
set PYTHON=C:\Python37\
|
||||
set MPLSRC=C:\Pillow\
|
||||
set LIB=%INCLIB%;%PYTHON%\tcl;%LIB%
|
||||
set INCLUDE=%INCLIB%;C:\Pillow\depends\tcl86\include;%INCLUDE%
|
||||
set MSSdk=1
|
||||
set DISTUTILS_USE_SDK=1
|
||||
set py_vcruntime_redist=true
|
||||
c:\python37\python.exe setup.py build_ext install
|
||||
|
||||
rem Test Pillow
|
||||
cd c:\pillow
|
||||
path %INCLIB%;%PATH%
|
||||
c:\python37\python.exe selftest.py --installed
|
||||
c:\python37\python.exe -m pytest -vx -W always --cov PIL --cov Tests --cov-report term --cov-report xml Tests
|
Loading…
Reference in New Issue
Block a user