(Back)
@echo off

cd vim

REM ----------------------------------------------------------------------
REM PREREQUISITES:
REM * Mercurial
REM * 7-zip
REM * gettext (for the src/po folder)
REM * a local clone of the Vim repository (here: /vim)
REM   --> https://bitbucket.org/vim-mirror/vim/
REM * Visual Studio 2015 or higher (Community Edition would work)
REM * Strawberry Perl (x86 and x64), ActiveTcl (x86 and x64), Lua for
REM   Windows, Python2 and Python3
REM * Racket (x86 and x64), compiled with the same MSVC version.
REM * Depending on your Perl distribution, you might have to fix Perl's
REM   config file (CORE/config.h) by commenting out symbols you don't have
REM   (like STDBOOL).
REM * Also you'll need to grab Ruby 2.x (the MSVC version, not the MinGW
REM   version). You'll probably have to compile it from scratch. This is a
REM   bit tricky. See the README file inside the Ruby archive.
REM   The RubyInstaller DLLs are said to work with this version of Vim.
REM * TERMINAL support is compiled in with winpty. You'll need winpty-agent
REM   and winpty.dll in the appropriate binary directories.
REM   winpty can be obtained from github.com/rprichard/winpty/releases.
REM ----------------------------------------------------------------------

REM update the sources ...
REM ------------------------------------

hg pull
hg update


REM set libraries ...
REM ------------------------------------

REM LIBPYTHON2 = short (2-digit) version of Python 2.x
REM LIBPYTHON3 = short (2-digit) version of Python 3.x
REM LIBTCLSHRT = short (2-digit) version of Tcl
REM LIBTCLLONG = long (x.y) version of Tcl
REM LIBRBYSHRT = short (2-digit) version of Ruby
REM LIBRBYLONG = long (x.y.z) version of Ruby
REM LIBRBYLIB  = Ruby version (x.y.z) in the library folder name
REM LIBLUASHRT = short (2-digit) version of Lua
REM LIBLUALONG = long (x.y) version of Lua
REM LIBPERLVER = 3-digit version of Perl
REM LIBRACKET  = current version of your libracket.lib (part of its file name)
REM WINPTYDIR  = the root directory of your winpty folder (see the intro for details)

set LIBPYTHON2=27
set LIBPYTHON3=36
set LIBTCLSHRT=86
set LIBTCLLONG=8.6
set LIBRBYSHRT=24
set LIBRBYLONG=2.4.1
set LIBRBYLIB=2.4.0
set LIBLUASHRT=53
set LIBLUALONG=5.3
set LIBPERLVER=526
set LIBRACKET=xxxxxxx
set WINPTYDIR=..\..\libs\winpty-0.4.3-msvc2015


REM create output directory ...
REM ------------------------------------

if not exist src\tempoutput mkdir src\tempoutput
if not exist src\tempoutput mkdir src\tempoutput\x86
if not exist src\tempoutput mkdir src\tempoutput\x64


REM make clean (manually)
REM -------------------------------------

cd src
del /Q ObjCULYHTRZAMD64\*.*
del /Q ObjCULYHTRZi386\*.*
del /Q ObjGXOULYHTRZAMD64\*.*
del /Q ObjGXOULYHTRZi386\*.*
del /Q ObjGXULYHTRZAMD64\*.*
del /Q ObjGXULYHTRZi386\*.*


REM delete archive files
REM -------------------------------------

if exist tempoutput\complete*.7z del tempoutput\complete*.7z
if exist tempoutput\complete*.exe del tempoutput\complete*.exe


REM prepare the environment ...
REM ------------------------------------

del gvim_noOLE.exe
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86


REM compile! (x86)
REM -------------------------------------

nmake /C /S /f Make_mvc.mak CPU=i386  DEBUG=no USE_MSVCRT=yes FEATURES=HUGE CHANNEL=yes MBYTE=yes CSCOPE=yes TERMINAL=yes IME=yes GIME=yes GUI=yes OLE=no  XPM=.\xpm\x86 DIRECTX=yes PERL=C:\Perl_x86\perl DYNAMIC_PERL=yes PERL_VER=%LIBPERLVER% LUA="%PROGRAMFILES(X86)%\Lua\%LIBLUALONG%" DYNAMIC_LUA=yes LUA_VER=%LIBLUASHRT% TCL=C:\TCL_x86 TCL_VER=%LIBTCLSHRT% TCL_VER_LONG=%LIBTCLLONG% DYNAMIC_TCL=yes RUBY=C:\Ruby_x86 DYNAMIC_RUBY=yes RUBY_VER=%LIBRBYSHRT% RUBY_VER_LONG=%LIBRBYLIB% RUBY_PLATFORM=i386-mswin32_140 RUBY_MSVCRT_NAME=msvcrt PYTHON=C:\Python%LIBPYTHON2% DYNAMIC_PYTHON=yes PYTHON_VER=%LIBPYTHON2% PYTHON3=C:\Python%LIBPYTHON3% DYNAMIC_PYTHON3=yes PYTHON3_VER=%LIBPYTHON3% MZSCHEME="%USERPROFILE%\Desktop\racket-x86" DYNAMIC_MZSCHEME=yes MZSCHEME_MAIN_LIB=racket MZSCHEME_VER=%LIBRACKET% SDK_INCLUDE_DIR="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include"
nmake /C /S /f Make_mvc.mak SDK_INCLUDE_DIR="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include" clean
ren gvim.exe gvim_noOLE.exe

nmake /C /S /f Make_mvc.mak CPU=i386  DEBUG=no USE_MSVCRT=yes FEATURES=HUGE CHANNEL=yes MBYTE=yes CSCOPE=yes TERMINAL=yes IME=yes GIME=yes GUI=yes OLE=yes XPM=.\xpm\x86 DIRECTX=yes PERL=C:\Perl_x86\perl DYNAMIC_PERL=yes PERL_VER=%LIBPERLVER% LUA="%PROGRAMFILES(X86)%\Lua\%LIBLUALONG%" DYNAMIC_LUA=yes LUA_VER=%LIBLUASHRT% TCL=C:\TCL_x86 TCL_VER=%LIBTCLSHRT% TCL_VER_LONG=%LIBTCLLONG% DYNAMIC_TCL=yes RUBY=C:\Ruby_x86 DYNAMIC_RUBY=yes RUBY_VER=%LIBRBYSHRT% RUBY_VER_LONG=%LIBRBYLIB% RUBY_PLATFORM=i386-mswin32_140 RUBY_MSVCRT_NAME=msvcrt PYTHON=C:\Python%LIBPYTHON2% DYNAMIC_PYTHON=yes PYTHON_VER=%LIBPYTHON2% PYTHON3=C:\Python%LIBPYTHON3% DYNAMIC_PYTHON3=yes PYTHON3_VER=%LIBPYTHON3% MZSCHEME="%USERPROFILE%\Desktop\racket-x86" DYNAMIC_MZSCHEME=yes MZSCHEME_MAIN_LIB=racket MZSCHEME_VER=%LIBRACKET% SDK_INCLUDE_DIR="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include"
nmake /C /S /f Make_mvc.mak SDK_INCLUDE_DIR="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include" clean
nmake /C /S /f Make_mvc.mak CPU=i386  DEBUG=no USE_MSVCRT=yes FEATURES=HUGE CHANNEL=yes MBYTE=yes CSCOPE=yes TERMINAL=yes IME=no  GIME=no  GUI=no  OLE=no  XPM=.\xpm\x86 DIRECTX=no  PERL=C:\Perl_x86\perl DYNAMIC_PERL=yes PERL_VER=%LIBPERLVER% LUA="%PROGRAMFILES(X86)%\Lua\%LIBLUALONG%" DYNAMIC_LUA=yes LUA_VER=%LIBLUASHRT% TCL=C:\TCL_x86 TCL_VER=%LIBTCLSHRT% TCL_VER_LONG=%LIBTCLLONG% DYNAMIC_TCL=yes RUBY=C:\Ruby_x86 DYNAMIC_RUBY=yes RUBY_VER=%LIBRBYSHRT% RUBY_VER_LONG=%LIBRBYLIB% RUBY_PLATFORM=i386-mswin32_140 RUBY_MSVCRT_NAME=msvcrt PYTHON=C:\Python%LIBPYTHON2% DYNAMIC_PYTHON=yes PYTHON_VER=%LIBPYTHON2% PYTHON3=C:\Python%LIBPYTHON3% DYNAMIC_PYTHON3=yes PYTHON3_VER=%LIBPYTHON3% MZSCHEME="%USERPROFILE%\Desktop\racket-x86" DYNAMIC_MZSCHEME=yes MZSCHEME_MAIN_LIB=racket MZSCHEME_VER=%LIBRACKET% SDK_INCLUDE_DIR="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include"


REM keep up the right directory structure
REM -------------------------------------

cd po
nmake -f Make_mvc.mak install-all
cd ..

robocopy ..\runtime\ tempoutput\x86\ /MIR /NP /NJH /NJS /NFL /NDL
copy ..\vimtutor.* tempoutput\x86\
xcopy xxd\xxd.exe tempoutput\x86\ /K
xcopy tee\tee.exe tempoutput\x86\ /K
xcopy *.exe tempoutput\x86\ /K
copy vimtbar.dll tempoutput\x86\
copy README.txt tempoutput\x86\

if not exist tempoutput\x86\GVimExt mkdir tempoutput\x86\GVimExt
if not exist tempoutput\x86\VisVim mkdir tempoutput\x86\VisVim

copy gvimext\*.dll tempoutput\x86\gvimext\
copy gvimext\*.inf tempoutput\x86\gvimext\
copy gvimext\*.reg tempoutput\x86\gvimext\
copy gvimext\README.txt tempoutput\x86\gvimext\

copy VisVim\*.txt tempoutput\x86\VisVim\
copy VisVim\*.dll tempoutput\x86\VisVim\
copy VisVim\*.bat tempoutput\x86\VisVim\

copy %WINPTYDIR%\ia32\bin\winpty.dll tempoutput\x86\
copy %WINPTYDIR%\ia32\bin\winpty-agent.exe tempoutput\x86\


REM cleanup
REM ------------------------------------

del tempoutput\x86\vimlogo.*
del tempoutput\x86\*.png
del tempoutput\x86\vim??x??.*


REM pack it!
REM ------------------------------------

cd tempoutput\x86
"%PROGRAMFILES%\7-zip\7z" a -mx=9 -r -bd ..\complete-x86.7z *
"%PROGRAMFILES%\7-zip\7z" a -mx=9 -r -bd -sfx7z.sfx ..\complete-x86.exe *
cd ..\..


REM prepare the environment ...
REM ------------------------------------

del gvim_noOLE.exe
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64


REM compile! (x64)
REM -------------------------------------

nmake /C /S /f Make_mvc.mak SDK_INCLUDE_DIR="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include" clean
nmake /C /S /f Make_mvc.mak CPU=AMD64 DEBUG=no USE_MSVCRT=yes FEATURES=HUGE CHANNEL=yes MBYTE=yes CSCOPE=yes TERMINAL=yes IME=yes GIME=yes GUI=yes OLE=no  XPM=.\xpm\x64 DIRECTX=yes PERL=C:\Perl64\perl DYNAMIC_PERL=yes PERL_VER=%LIBPERLVER% LUA="%PROGRAMFILES%\Lua\%LIBLUALONG%" DYNAMIC_LUA=yes LUA_VER=%LIBLUASHRT% TCL=C:\TCL TCL_VER=%LIBTCLSHRT% TCL_VER_LONG=%LIBTCLLONG% DYNAMIC_TCL=yes RUBY=C:\Ruby_x64 DYNAMIC_RUBY=yes RUBY_VER=%LIBRBYSHRT% RUBY_VER_LONG=%LIBRBYLIB% RUBY_PLATFORM=x64-mswin64_140 RUBY_MSVCRT_NAME=msvcrt PYTHON=C:\Python%LIBPYTHON2%_x64 DYNAMIC_PYTHON=yes PYTHON_VER=%LIBPYTHON2% PYTHON3=C:\Python%LIBPYTHON3%_x64 DYNAMIC_PYTHON3=yes PYTHON3_VER=%LIBPYTHON3% MZSCHEME="%USERPROFILE%\Desktop\racket-x64" DYNAMIC_MZSCHEME=yes MZSCHEME_MAIN_LIB=racket MZSCHEME_VER=%LIBRACKET% SDK_INCLUDE_DIR="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include"
nmake /C /S /f Make_mvc.mak SDK_INCLUDE_DIR="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include" clean
ren gvim.exe gvim_noOLE.exe

nmake /C /S /f Make_mvc.mak CPU=AMD64 DEBUG=no USE_MSVCRT=yes FEATURES=HUGE CHANNEL=yes MBYTE=yes CSCOPE=yes TERMINAL=yes IME=yes GIME=yes GUI=yes OLE=yes XPM=.\xpm\x64 DIRECTX=yes PERL=C:\Perl64\perl DYNAMIC_PERL=yes PERL_VER=%LIBPERLVER% LUA="%PROGRAMFILES%\Lua\%LIBLUALONG%" DYNAMIC_LUA=yes LUA_VER=%LIBLUASHRT% TCL=C:\TCL TCL_VER=%LIBTCLSHRT% TCL_VER_LONG=%LIBTCLLONG% DYNAMIC_TCL=yes RUBY=C:\Ruby_x64 DYNAMIC_RUBY=yes RUBY_VER=%LIBRBYSHRT% RUBY_VER_LONG=%LIBRBYLIB% RUBY_PLATFORM=x64-mswin64_140 RUBY_MSVCRT_NAME=msvcrt PYTHON=C:\Python%LIBPYTHON2%_x64 DYNAMIC_PYTHON=yes PYTHON_VER=%LIBPYTHON2% PYTHON3=C:\Python%LIBPYTHON3%_x64 DYNAMIC_PYTHON3=yes PYTHON3_VER=%LIBPYTHON3% MZSCHEME="%USERPROFILE%\Desktop\racket-x64" DYNAMIC_MZSCHEME=yes MZSCHEME_MAIN_LIB=racket MZSCHEME_VER=%LIBRACKET% SDK_INCLUDE_DIR="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include"
nmake /C /S /f Make_mvc.mak SDK_INCLUDE_DIR="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include" clean
nmake /C /S /f Make_mvc.mak CPU=AMD64 DEBUG=no USE_MSVCRT=yes FEATURES=HUGE CHANNEL=yes MBYTE=yes CSCOPE=yes TERMINAL=yes IME=no GIME=no GUI=no OLE=no XPM=.\xpm\x64 DIRECTX=no PERL=C:\Perl64\perl DYNAMIC_PERL=yes PERL_VER=%LIBPERLVER% LUA="%PROGRAMFILES%\Lua\%LIBLUALONG%" DYNAMIC_LUA=yes LUA_VER=%LIBLUASHRT% TCL=C:\TCL TCL_VER=%LIBTCLSHRT% TCL_VER_LONG=%LIBTCLLONG% DYNAMIC_TCL=yes RUBY=C:\Ruby_x64 DYNAMIC_RUBY=yes RUBY_VER=%LIBRBYSHRT% RUBY_VER_LONG=%LIBRBYLIB% RUBY_PLATFORM=x64-mswin64_140 RUBY_MSVCRT_NAME=msvcrt PYTHON=C:\Python%LIBPYTHON2%_x64 DYNAMIC_PYTHON=yes PYTHON_VER=%LIBPYTHON2% PYTHON3=C:\Python%LIBPYTHON3%_x64 DYNAMIC_PYTHON3=yes PYTHON3_VER=%LIBPYTHON3% MZSCHEME="%USERPROFILE%\Desktop\racket-x64" DYNAMIC_MZSCHEME=yes MZSCHEME_MAIN_LIB=racket MZSCHEME_VER=%LIBRACKET% SDK_INCLUDE_DIR="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include"


REM keep up the right directory structure
REM -------------------------------------

cd po
nmake -f Make_mvc.mak install-all
cd ..

robocopy ..\runtime\ tempoutput\x64\ /MIR /NP /NJH /NJS /NFL /NDL
copy ..\vimtutor.* tempoutput\x64\
copy xxd\xxd.exe tempoutput\x64\
copy tee\tee.exe tempoutput\x64\
copy *.exe tempoutput\x64\
copy vimtbar.dll tempoutput\x64\
copy README.txt tempoutput\x64\

if not exist tempoutput\x64\GVimExt mkdir tempoutput\x64\GVimExt
if not exist tempoutput\x64\VisVim mkdir tempoutput\x64\VisVim

copy gvimext\*.dll tempoutput\x64\gvimext\
copy gvimext\*.inf tempoutput\x64\gvimext\
copy gvimext\*.reg tempoutput\x64\gvimext\
copy gvimext\README.txt tempoutput\x64\gvimext\

copy VisVim\*.txt tempoutput\x64\VisVim\
copy VisVim\*.dll tempoutput\x64\VisVim\
copy VisVim\*.bat tempoutput\x64\VisVim\

copy %WINPTYDIR%\x64\bin\winpty.dll tempoutput\x64\
copy %WINPTYDIR%\x64\bin\winpty-agent.exe tempoutput\x64\


REM cleanup
REM ------------------------------------

del tempoutput\x64\vimlogo.*
del tempoutput\x64\*.png
del tempoutput\x64\vim??x??.*


REM pack it!
REM ------------------------------------

cd tempoutput\x64
"%PROGRAMFILES%\7-zip\7z" a -mx=9 -r -bd ..\complete-x64.7z *
"%PROGRAMFILES%\7-zip\7z" a -mx=9 -r -bd -sfx7z.sfx ..\complete-x64.exe *


REM ------------------------------------------------ DONE!