diff --git a/winbuild/build_dep.cmd b/winbuild/build_dep.cmd new file mode 100644 index 000000000..840931327 --- /dev/null +++ b/winbuild/build_dep.cmd @@ -0,0 +1,165 @@ +@echo off +rem Build Matplotlib Dependencies + +setlocal +set MSBUILD=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe +set CMAKE="C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" +set INCLIB=%~dp0\depends +set BUILD=%~dp0\build + +rd /S /Q %INCLIB% +rd /S /Q %BUILD% + +mkdir %INCLIB% +mkdir %BUILD% + +rem Get freetype +py -3 fetch.py http://download.savannah.gnu.org/releases/freetype/ft253.zip +py -3 unzip.py ft253.zip %BUILD% +set FREETYPE=%BUILD%\freetype-2.5.3 +copy /Y /B ft253.zip %INCLIB% + +rem Get zlib +py -3 fetch.py http://zlib.net/zlib128.zip +py -3 unzip.py zlib128.zip %BUILD% +set ZLIB=%BUILD%\zlib-1.2.8 +copy /Y /B zlib128.zip %INCLIB% + +rem Get tcl/tk +py -3 fetch.py http://hivelocity.dl.sourceforge.net/project/tcl/Tcl/8.5.13/tcl8513-src.zip +py -3 unzip.py tcl8513-src.zip %BUILD% +copy /Y /B tcl8513-src.zip %INCLIB% +py -3 fetch.py http://hivelocity.dl.sourceforge.net/project/tcl/Tcl/8.5.13/tk8513-src.zip +py -3 unzip.py tk8513-src.zip %BUILD% +copy /Y /B tk8513-src.zip %INCLIB% + +mkdir %INCLIB%\tcl85\include\X11 +copy /Y /B %BUILD%\tcl8.5.13\generic\*.h %INCLIB%\tcl85\include\ +copy /Y /B %BUILD%\tk8.5.13\generic\*.h %INCLIB%\tcl85\include\ +copy /Y /B %BUILD%\tk8.5.13\xlib\X11\* %INCLIB%\tcl85\include\X11\ + +rem Build for VC 2008 64 bit +setlocal EnableDelayedExpansion +call "%ProgramFiles%\Microsoft SDKs\Windows\v7.0\Bin\SetEnv.Cmd" /Release /x64 /vista +set INCLIB=%INCLIB%\msvcr90-x64 +mkdir %INCLIB% + +rem Build zlib +setlocal +cd /D %ZLIB% +nmake -f win32\Makefile.msc clean +nmake -f win32\Makefile.msc +copy /Y /B *.dll %INCLIB% +copy /Y /B *.lib %INCLIB% +copy /Y /B zlib.lib %INCLIB%\z.lib +copy /Y /B zlib.h %INCLIB% +copy /Y /B zconf.h %INCLIB% +endlocal + +rem Build freetype +setlocal +py -3 %~dp0\fixproj.py %FREETYPE%\builds\win32\vc2008\freetype.sln x64 +py -3 %~dp0\fixproj.py %FREETYPE%\builds\win32\vc2008\freetype.vcproj x64 +rd /S /Q %FREETYPE%\objs +%MSBUILD% %FREETYPE%\builds\win32\vc2008\freetype.sln /t:Clean;Build /p:Configuration="LIB Release";Platform=x64 +xcopy /E /Q %FREETYPE%\include %INCLIB% +xcopy /E /Q %FREETYPE%\objs\win32\vc2008 %INCLIB% +copy /Y /B %FREETYPE%\objs\win32\vc2008\*.lib %INCLIB%\freetype.lib +endlocal + +endlocal + +rem Build for VC 2008 32 bit +setlocal EnableDelayedExpansion +call "%ProgramFiles%\Microsoft SDKs\Windows\v7.0\Bin\SetEnv.Cmd" /Release /x86 /xp +set INCLIB=%INCLIB%\msvcr90-x32 +mkdir %INCLIB% + +rem Build zlib +setlocal +cd /D %ZLIB% +nmake -f win32\Makefile.msc clean +nmake -f win32\Makefile.msc +copy /Y /B *.dll %INCLIB% +copy /Y /B *.lib %INCLIB% +copy /Y /B zlib.lib %INCLIB%\z.lib +copy /Y /B zlib.h %INCLIB% +copy /Y /B zconf.h %INCLIB% +endlocal + +rem Build freetype +setlocal +%~dp0\fixproj.py %FREETYPE%\builds\win32\vc2008\freetype.sln Win32 +%~dp0\fixproj.py %FREETYPE%\builds\win32\vc2008\freetype.vcproj Win32 +rd /S /Q %FREETYPE%\objs +%MSBUILD% %FREETYPE%\builds\win32\vc2008\freetype.sln /t:Clean;Build /p:Configuration="LIB Release";Platform=Win32 +xcopy /E /Q %FREETYPE%\include %INCLIB% +xcopy /E /Q %FREETYPE%\objs\win32\vc2008 %INCLIB% +copy /Y /B %FREETYPE%\objs\win32\vc2008\*.lib %INCLIB%\freetype.lib +endlocal + +endlocal + +rem Build for VC 2010 64 bit +setlocal EnableDelayedExpansion +call "%ProgramFiles%\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /Release /x64 /vista +set INCLIB=%INCLIB%\msvcr100-x64 +mkdir %INCLIB% + +rem Build zlib +setlocal +cd /D %ZLIB% +nmake -f win32\Makefile.msc clean +nmake -f win32\Makefile.msc +copy /Y /B *.dll %INCLIB% +copy /Y /B *.lib %INCLIB% +copy /Y /B zlib.lib %INCLIB%\z.lib +copy /Y /B zlib.h %INCLIB% +copy /Y /B zconf.h %INCLIB% +endlocal + +rem Build freetype +setlocal +py -3 %~dp0\fixproj.py %FREETYPE%\builds\win32\vc2010\freetype.sln x64 +py -3 %~dp0\fixproj.py %FREETYPE%\builds\win32\vc2010\freetype.vcxproj x64 +rd /S /Q %FREETYPE%\objs +%MSBUILD% %FREETYPE%\builds\win32\vc2010\freetype.sln /t:Clean;Build /p:Configuration="Release";Platform=x64 +xcopy /E /Q %FREETYPE%\include %INCLIB% +xcopy /E /Q %FREETYPE%\objs\win32\vc2010 %INCLIB% +copy /Y /B %FREETYPE%\objs\win32\vc2010\*.lib %INCLIB%\freetype.lib +endlocal + +endlocal + +rem Build for VC 2010 32 bit +setlocal EnableDelayedExpansion +call "%ProgramFiles%\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /Release /x86 /xp +set INCLIB=%INCLIB%\msvcr100-x32 +mkdir %INCLIB% + +rem Build zlib +setlocal +cd /D %ZLIB% +nmake -f win32\Makefile.msc clean +nmake -f win32\Makefile.msc +copy /Y /B *.dll %INCLIB% +copy /Y /B *.lib %INCLIB% +copy /Y /B zlib.lib %INCLIB%\z.lib +copy /Y /B zlib.h %INCLIB% +copy /Y /B zconf.h %INCLIB% +endlocal + +rem Build freetype +setlocal +%~dp0\fixproj.py %FREETYPE%\builds\win32\vc2010\freetype.sln Win32 +%~dp0\fixproj.py %FREETYPE%\builds\win32\vc2010\freetype.vcxproj Win32 +rd /S /Q %FREETYPE%\objs +%MSBUILD% %FREETYPE%\builds\win32\vc2010\freetype.sln /t:Clean;Build /p:Configuration="Release";Platform=Win32 +xcopy /E /Q %FREETYPE%\include %INCLIB% +xcopy /E /Q %FREETYPE%\objs\win32\vc2010 %INCLIB% +copy /Y /B %FREETYPE%\objs\win32\vc2010\*.lib %INCLIB%\freetype.lib +endlocal + +endlocal + +endlocal \ No newline at end of file diff --git a/winbuild/build_dep.cmd~ b/winbuild/build_dep.cmd~ new file mode 100644 index 000000000..0bb983972 --- /dev/null +++ b/winbuild/build_dep.cmd~ @@ -0,0 +1,165 @@ +@echo off +rem Build Matplotlib Dependencies + +setlocal +set MSBUILD=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe +set CMAKE="C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" +set INCLIB=%~dp0\pillow-build-dependencies +set BUILD=%~dp0\build + +rd /S /Q %INCLIB% +rd /S /Q %BUILD% + +mkdir %INCLIB% +mkdir %BUILD% + +rem Get freetype +py -3 fetch.py http://download.savannah.gnu.org/releases/freetype/ft253.zip +py -3 unzip.py ft253.zip %BUILD% +set FREETYPE=%BUILD%\freetype-2.5.3 +copy /Y /B ft253.zip %INCLIB% + +rem Get zlib +py -3 fetch.py http://zlib.net/zlib128.zip +py -3 unzip.py zlib128.zip %BUILD% +set ZLIB=%BUILD%\zlib-1.2.8 +copy /Y /B zlib128.zip %INCLIB% + +rem Get tcl/tk +py -3 fetch.py http://hivelocity.dl.sourceforge.net/project/tcl/Tcl/8.5.13/tcl8513-src.zip +py -3 unzip.py tcl8513-src.zip %BUILD% +copy /Y /B tcl8513-src.zip %INCLIB% +py -3 fetch.py http://hivelocity.dl.sourceforge.net/project/tcl/Tcl/8.5.13/tk8513-src.zip +py -3 unzip.py tk8513-src.zip %BUILD% +copy /Y /B tk8513-src.zip %INCLIB% + +mkdir %INCLIB%\tcl85\include\X11 +copy /Y /B %BUILD%\tcl8.5.13\generic\*.h %INCLIB%\tcl85\include\ +copy /Y /B %BUILD%\tk8.5.13\generic\*.h %INCLIB%\tcl85\include\ +copy /Y /B %BUILD%\tk8.5.13\xlib\X11\* %INCLIB%\tcl85\include\X11\ + +rem Build for VC 2008 64 bit +setlocal EnableDelayedExpansion +call "%ProgramFiles%\Microsoft SDKs\Windows\v7.0\Bin\SetEnv.Cmd" /Release /x64 /vista +set INCLIB=%INCLIB%\msvcr90-x64 +mkdir %INCLIB% + +rem Build zlib +setlocal +cd /D %ZLIB% +nmake -f win32\Makefile.msc clean +nmake -f win32\Makefile.msc +copy /Y /B *.dll %INCLIB% +copy /Y /B *.lib %INCLIB% +copy /Y /B zlib.lib %INCLIB%\z.lib +copy /Y /B zlib.h %INCLIB% +copy /Y /B zconf.h %INCLIB% +endlocal + +rem Build freetype +setlocal +py -3 %~dp0\fixproj.py %FREETYPE%\builds\win32\vc2008\freetype.sln x64 +py -3 %~dp0\fixproj.py %FREETYPE%\builds\win32\vc2008\freetype.vcproj x64 +rd /S /Q %FREETYPE%\objs +%MSBUILD% %FREETYPE%\builds\win32\vc2008\freetype.sln /t:Clean;Build /p:Configuration="LIB Release";Platform=x64 +xcopy /E /Q %FREETYPE%\include %INCLIB% +xcopy /E /Q %FREETYPE%\objs\win32\vc2008 %INCLIB% +copy /Y /B %FREETYPE%\objs\win32\vc2008\*.lib %INCLIB%\freetype.lib +endlocal + +endlocal + +rem Build for VC 2008 32 bit +setlocal EnableDelayedExpansion +call "%ProgramFiles%\Microsoft SDKs\Windows\v7.0\Bin\SetEnv.Cmd" /Release /x86 /xp +set INCLIB=%INCLIB%\msvcr90-x32 +mkdir %INCLIB% + +rem Build zlib +setlocal +cd /D %ZLIB% +nmake -f win32\Makefile.msc clean +nmake -f win32\Makefile.msc +copy /Y /B *.dll %INCLIB% +copy /Y /B *.lib %INCLIB% +copy /Y /B zlib.lib %INCLIB%\z.lib +copy /Y /B zlib.h %INCLIB% +copy /Y /B zconf.h %INCLIB% +endlocal + +rem Build freetype +setlocal +%~dp0\fixproj.py %FREETYPE%\builds\win32\vc2008\freetype.sln Win32 +%~dp0\fixproj.py %FREETYPE%\builds\win32\vc2008\freetype.vcproj Win32 +rd /S /Q %FREETYPE%\objs +%MSBUILD% %FREETYPE%\builds\win32\vc2008\freetype.sln /t:Clean;Build /p:Configuration="LIB Release";Platform=Win32 +xcopy /E /Q %FREETYPE%\include %INCLIB% +xcopy /E /Q %FREETYPE%\objs\win32\vc2008 %INCLIB% +copy /Y /B %FREETYPE%\objs\win32\vc2008\*.lib %INCLIB%\freetype.lib +endlocal + +endlocal + +rem Build for VC 2010 64 bit +setlocal EnableDelayedExpansion +call "%ProgramFiles%\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /Release /x64 /vista +set INCLIB=%INCLIB%\msvcr100-x64 +mkdir %INCLIB% + +rem Build zlib +setlocal +cd /D %ZLIB% +nmake -f win32\Makefile.msc clean +nmake -f win32\Makefile.msc +copy /Y /B *.dll %INCLIB% +copy /Y /B *.lib %INCLIB% +copy /Y /B zlib.lib %INCLIB%\z.lib +copy /Y /B zlib.h %INCLIB% +copy /Y /B zconf.h %INCLIB% +endlocal + +rem Build freetype +setlocal +py -3 %~dp0\fixproj.py %FREETYPE%\builds\win32\vc2010\freetype.sln x64 +py -3 %~dp0\fixproj.py %FREETYPE%\builds\win32\vc2010\freetype.vcxproj x64 +rd /S /Q %FREETYPE%\objs +%MSBUILD% %FREETYPE%\builds\win32\vc2010\freetype.sln /t:Clean;Build /p:Configuration="Release";Platform=x64 +xcopy /E /Q %FREETYPE%\include %INCLIB% +xcopy /E /Q %FREETYPE%\objs\win32\vc2010 %INCLIB% +copy /Y /B %FREETYPE%\objs\win32\vc2010\*.lib %INCLIB%\freetype.lib +endlocal + +endlocal + +rem Build for VC 2010 32 bit +setlocal EnableDelayedExpansion +call "%ProgramFiles%\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /Release /x86 /xp +set INCLIB=%INCLIB%\msvcr100-x32 +mkdir %INCLIB% + +rem Build zlib +setlocal +cd /D %ZLIB% +nmake -f win32\Makefile.msc clean +nmake -f win32\Makefile.msc +copy /Y /B *.dll %INCLIB% +copy /Y /B *.lib %INCLIB% +copy /Y /B zlib.lib %INCLIB%\z.lib +copy /Y /B zlib.h %INCLIB% +copy /Y /B zconf.h %INCLIB% +endlocal + +rem Build freetype +setlocal +%~dp0\fixproj.py %FREETYPE%\builds\win32\vc2010\freetype.sln Win32 +%~dp0\fixproj.py %FREETYPE%\builds\win32\vc2010\freetype.vcxproj Win32 +rd /S /Q %FREETYPE%\objs +%MSBUILD% %FREETYPE%\builds\win32\vc2010\freetype.sln /t:Clean;Build /p:Configuration="Release";Platform=Win32 +xcopy /E /Q %FREETYPE%\include %INCLIB% +xcopy /E /Q %FREETYPE%\objs\win32\vc2010 %INCLIB% +copy /Y /B %FREETYPE%\objs\win32\vc2010\*.lib %INCLIB%\freetype.lib +endlocal + +endlocal + +endlocal \ No newline at end of file diff --git a/winbuild/fetch.py b/winbuild/fetch.py new file mode 100644 index 000000000..00845678e --- /dev/null +++ b/winbuild/fetch.py @@ -0,0 +1,7 @@ +import sys, os, urllib.parse, urllib.request +name = urllib.parse.urlsplit(sys.argv[1])[2].split('/')[-1] +if not os.path.exists(name): + print("Fetching", sys.argv[1]) + content = urllib.request.urlopen(sys.argv[1]).read() + with open(name, 'wb') as fd: + fd.write(content) diff --git a/winbuild/fixproj.py b/winbuild/fixproj.py new file mode 100644 index 000000000..e52de707f --- /dev/null +++ b/winbuild/fixproj.py @@ -0,0 +1,7 @@ +import sys, os +with open(sys.argv[1], 'r') as fd: + content = '\n'.join(line.strip() for line in fd if line.strip()) +if len(sys.argv) == 3: + content = content.replace('Win32', sys.argv[2]).replace('x64', sys.argv[2]) +with open(sys.argv[1], 'w') as fd: + fd.write(content) diff --git a/winbuild/untar.py b/winbuild/untar.py new file mode 100644 index 000000000..26a47678c --- /dev/null +++ b/winbuild/untar.py @@ -0,0 +1,4 @@ +import sys, tarfile +with tarfile.open(sys.argv[1], 'r:gz') as tgz: + tgz.extractall(sys.argv[2]) + diff --git a/winbuild/unzip.py b/winbuild/unzip.py new file mode 100644 index 000000000..9793906cb --- /dev/null +++ b/winbuild/unzip.py @@ -0,0 +1,3 @@ +import sys, zipfile +with zipfile.ZipFile(sys.argv[1]) as zf: + zf.extractall(sys.argv[2])