commit | 0f824e244649e2f65dd8f1d397f07a3912f55c1e | [log] [tgz] |
---|---|---|
author | Joan Touzet <wohali@apache.org> | Tue Nov 13 18:22:10 2018 -0500 |
committer | Joan Touzet <wohali@apache.org> | Tue Nov 13 18:22:10 2018 -0500 |
tree | 99c5bcecf6b4026acaa8e59bf3785c63ca0542f8 | |
parent | a5887cd3293ebe56e5bd838af6af29cda86a9cdc [diff] |
Updates for elixir, mango tests, 2.3.0
Glazier is a set of batch files, scripts and toolchains designed to ease building CouchDB on Windows. It's as fully automated as possible, with most of the effort required only once.
Glazier uses the MS Visual Studio 2013 toolchain as much as possible, to ensure a quality Windows experience and to execute all binary dependencies within the same runtime.
We hope Glazier simplifies using Erlang and CouchDB for you, giving a consistent, repeatable build environment.
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
These packages install silently, without intervention. Cut and paste them into an Administrator command prompt.
cinst -y git 7zip.commandline StrawberryPerl nasm cyg-get wixtoolset python aria2 nodejs.install make cinst -y nssm --version 2.24.101-g897c7ad cinst -y -i elixir cyg-get p7zip autoconf binutils bison gcc-code gcc-g++ gdb git libtool make patchutils pkg-config readline file renameutils socat time tree util-linux wget pip install sphinx docutils pygments nose hypothesis
Note: Do NOT install curl or help2man inside CygWin!
Fetch the latest Mozilla Build version from https://wiki.mozilla.org/MozillaBuild and install to c:\mozilla-build with all defaults.
Make a new shortcut on the desktop. The location should be:
cmd.exe /E:ON /V:ON /T:1F /K ""C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"" amd64 && color 1f
Name it “CouchDB SDK Prompt”.
Right-click on the icon, select Properties, click the Advanced...
button, and tick the Run as administrator
checkbox. Click OK twice.
I suggest you pin it to the Start menu. We'll use this all the time.
Start a CouchDB SDK Prompt window and run where cl mc mt link lc rc nmake make
. Make sure the output matches the following:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64\cl.exe C:\Program Files (x86)\Windows Kits\8.1\bin\x64\mc.exe C:\Program Files (x86)\Windows Kits\8.1\bin\x86\mc.exe C:\Program Files (x86)\Windows Kits\8.1\bin\x64\mt.exe C:\Program Files (x86)\Windows Kits\8.1\bin\x86\mt.exe C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64\link.exe C:\tools\cygwin\bin\link.exe C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\x64\lc.exe C:\Program Files (x86)\Windows Kits\8.1\bin\x64\rc.exe C:\Program Files (x86)\Windows Kits\8.1\bin\x86\rc.exe C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64\nmake.exe C:\ProgramData\chocolatey\bin\make.exe C:\tools\cygwin\bin\make.exe
Stop here if your results are not identical. If you are unable to reproduce these results, please open an issue on this repository for assistance.
In the CouchDB SDK Prompt, run the following commands:
mkdir c:\relax cd c:\relax rd /s/q SDK VC nasm inno5 nsis strawberry mklink /j c:\relax\bin c:\relax\glazier\bin mklink /j c:\relax\nasm "c:\Program Files (x86)\NASM" mklink /j c:\relax\SDK "c:\Program Files (x86)\Windows Kits\8.1" mklink /j c:\relax\VC "C:\Program Files (x86)\Microsoft Visual Studio 12.0" mklink /j c:\openssl c:\relax\openssl setx RELAX c:\relax
Close all open command prompts. Now we're ready to go!
Open a new CouchDB SDK Prompt
and run the following:
cd c:\relax git config --global core.autocrlf input git clone https://github.com/apache/couchdb-glazier c:\relax\bin\aria2c --force-sequential=false --max-connection-per-server=5 --check-certificate=false --auto-file-renaming=false --allow-overwrite=true --input-file=couchdb-glazier/downloads.md --max-concurrent-downloads=5 --dir=bits --save-session=bits/a2session.txt color 1f
As of 2017-07-08, this will download the source for the following versions of our dependencies:
In the same CouchDB SDK Prompt
, run the following:
cd %RELAX%\bin && build_openssl.cmd
Close your CouchDB SDK Prompt
.
Open a new CouchDB SDK Prompt
and run the following:
cd %RELAX%\bin && build_curl.cmd
In the same CouchDB SDK Prompt
run the following:
cd %RELAX%\bin && build_icu.cmd
Close the window.
CouchDB SDK Prompt
as abovec:\relax\bin\shell.cmd
b for bash prompt
.For more detail on why this is necessary, see UNIX-friendly shell details below.
At the bash prompt, enter the following commands:
ln -s /cygdrive/c/relax /relax cd .. && tar xzf /relax/bits/otp_src_18.3.tar.gz cd $ERL_TOP echo "skipping gs" > lib/gs/SKIP echo "skipping wx" > lib/wx/SKIP echo "skipping ic" > lib/ic/SKIP echo "skipping jinterface" > lib/jinterface/SKIP eval `$ERL_TOP/otp_build env_win32 x64`
At this point, check your paths. Run which cl link mc lc mt nmake rc
. The output should match the following:
/cygdrive/c/PROGRA~2/MICROS~1.0/VC/BIN/amd64/cl /cygdrive/c/PROGRA~2/MICROS~1.0/VC/BIN/amd64/link /cygdrive/c/PROGRA~2/WI3CF2~1/8.1/bin/x64/mc /cygdrive/c/PROGRA~2/MICROS~1/Windows/v8.1A/bin/NETFX4~1.1TO/x64/lc /cygdrive/c/PROGRA~2/WI3CF2~1/8.1/bin/x64/mt /cygdrive/c/PROGRA~2/MICROS~1.0/VC/BIN/amd64/nmake /cygdrive/c/PROGRA~2/WI3CF2~1/8.1/bin/x64/rc
If it does not, stop and diagnose.
Now you can proceed to build Erlang, closing the window when done:
erl_config.sh # Ensure OpenSSL is found by the configure script. # If you see any warnings, stop and diagnose. erl_build.sh exit exit
Spidermonkey needs to be compiled with the Mozilla Build chain. To build it with VS2013 requires a few patches contained in this repository.
Start by launching a fresh CouchDB SDK prompt
, then setup the Mozilla build environment with the command:
call c:\mozilla-build\start-shell-msvc2013-x64.bat
Now, ensure the output of which cl lc link mt rc make
matches the following:
/c/Program Files (x86)/Microsoft Visual Studio 12.0/VC/BIN/amd64/cl.exe /c/Program Files (x86)/Microsoft SDKs/Windows/v8.1A/bin/NETFX 4.5.1 Tools/x64/lc.exe gram Files (x86)/Microsoft Visual Studio 12.0/VC/BIN/amd64/link.exe /c/Program Files (x86)/Windows Kits/8.1/bin/x64/mt.exe /c/Program Files (x86)/Windows Kits/8.1/bin/x64/rc.exe /local/bin/make.exe
If this does not match exactly, stop and diagnose.
Now, proceed to patch and build SpiderMonkey 1.8.5:
cd /c/relax tar xzf bits/js185-1.0.0.tar.gz patch -p0 </c/relax/couchdb-glazier/bits/js185-msvc2013.patch cd js-1.8.5/js/src autoconf-2.13 ./configure --enable-static --enable-shared-js --disable-debug-symbols --disable-debug --disable-debugger-info-modules --target=x86_64-pc-mingw32 --host=x86_64-pc-mingw32 make
If desired, tests can be run at this point. This is optional, takes a while, and the math-jit-tests may fail. For more detail as to why, see https://bugzilla.mozilla.org/show_bug.cgi?id=1076670 Also, one jsapi test has been disabled that crashes; this exercises a call CouchDB doesn't use.
To run the tests:
make check
Close the prompt window by entering exit
twice.
Start a new SDK prompt
, then run c:\relax\bin\shell.cmd
. Select Erlang 18.3
and w for a Windows prompt
. Then, run the following commands to download and build CouchDB from the master repository:
cd \relax && git clone https://github.com/apache/couchdb cd couchdb # optionally, switch to a different tag or branch for building with: # git checkout --track origin/2.0.x git clean -fdx && git reset --hard powershell -ExecutionPolicy Bypass .\configure.ps1 -WithCurl make check
This will build a development version of CouchDB runnable via
python dev\run <-n1> <--with-admin-party-please>
To build a self-contained CouchDB installation (also known as an Erlang release), after running the above use:
make release
To build an installer using WiX to create a full Windows .msi, run:
make release cd \relax\glazier bin\build_installer.cmd
You made it! Time to relax. :D
@dch first got involved with CouchDB around 0.7. Only having a low-spec Windows PC to develop on, and no CouchDB Cloud provider being available, he tried to build CouchDB himself. It was hard going, and most of the frustration was trying to get the core Erlang environment set up and compiling without needing to buy Microsoft‘s expensive but excellent Visual Studio tools. Once Erlang was working he found many of the pre-requisite modules such as cURL, Zlib, OpenSSL, Mozilla’s SpiderMonkey JavaScript engine, and IBM's ICU were not available at a consistent compiler and VC runtime release.
There is a branch of glazier that has been used to build each CouchDB release.
Our goal is to get the path set up in this order:
It seems this is a challenge for most environments, so glazier
just assumes you're using [chocolatey] and takes care of the rest.
Alternatively, you can launch your own cmd prompt, and ensure that your system path is correct first in the win32 side before starting cygwin. Once in cygwin go to the root of where you installed erlang, and run the Erlang/OTP script:
eval `./otp_build env_win32 x64` echo $PATH | /bin/sed 's/:/\n/g' which cl link mc lc mt nmake rc
Confirm that output of which
returns only MS versions from VC++ or the SDK. This is critical and if not correct will cause confusing errors much later on. Overall, the desired order for your $PATH is:
%windir%;%windir%\system32
etcotp_build
scriptMore details are at erlang INSTALL-Win32.md on github