commit | d3a140ce913b379b65dbc404c2419624866e324f | [log] [tgz] |
---|---|---|
author | Dave Cottlehuber <dave@muse.net.nz> | Mon Apr 02 20:57:21 2012 +0200 |
committer | Dave Cottlehuber <dave@muse.net.nz> | Mon Apr 02 21:40:30 2012 +0200 |
tree | 40b7afa526d867fec20f84033dc1b931260b0716 | |
parent | 2f27ad5714f3d5fe7346f26495e544857307e173 [diff] |
tidyup of docs & scripts - building js 1.8.0 is now deprecated although still possible - docs reflect this & display correctly using documentup
I first got involved with CouchDB around 0.7, and liked what I saw. Only having a low-spec Windows PC to develop on, and no CouchDB Cloud provider being available, I tried to build CouchDB myself. It was hard going, and most of the frustration was trying to get the core Erlang environment set up and working without needing to buy Microsoft‘s expensive but excellent Visual Studio tools myself. Once Erlang was working I 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.
Glazier is a set of related scripts and toolchains to ease that pain. It's not fully automated but most of the effort is only required once. I hope it simplifies using Erlang and CouchDB for you by giving you a consistent repeatable build environment.
download glazier latest
unpack it into c:\relax
- you should have c:\relax\bin
for example
download source & tools using aria, and then check MD5 hashes:
pushd c:\relax path=c:\relax\bin;%path% aria2c.exe --force-sequential=false --max-connection-per-server=5 \ --check-certificate=false --auto-file-renaming=false \ --input-file=downloads.md --max-concurrent-downloads=5 \ --dir=bits --save-session=bits/a2session.txt cd bits && md5sum.exe --check ..\downloads.md5
Due to size, these are not downloaded in the bundle apart from mozilla & cygwin setup.
Now that the compilers are installed, we need to set a few things up first:
setenv.cmd /Release /x86
c:\relax\bin\setup.cmd
once to set up links and environment variablesYou should end up with something resembling this structure:
Directory of C:\relax 06/09/2011 10:41 p.m. <DIR> . 06/09/2011 10:41 p.m. <DIR> .. 06/09/2011 10:41 p.m. <SYMLINKD> bin [z:\r\glazier\bin] 06/09/2011 10:41 p.m. <SYMLINKD> bits [z:\r\glazier\bits] 03/09/2011 11:00 a.m. <DIR> release 06/09/2011 10:40 p.m. <SYMLINKD> SDK [C:\Program Files\Microsoft SDKs\Windows\v7.1] 06/09/2011 12:19 a.m. <SYMLINKD> tmp [C:\Users\couch\AppData\Local\Temp] 06/09/2011 10:40 p.m. <SYMLINKD> VC [c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\..]
The Microsoft Visual C++ runtime redistributales are bundled with Erlang and CouchDB by default.
%relax%/
%relax%/
The express solution is just to use 7zip to unpack glazier tools inside %relax%
. Or do it manually for the same result:
c:\mozilla-build\7zip
to your path%relax%/inno5
%relax%/nsis
%relax%/nasm
%relax%/cmake
mkdir strawberry && cd strawberry
then using 7zip, extract Strawberry Perl%relax%/bits/
setenv.cmd /Release /x86
c:\relax\bin\build_wx.cmd
to extract and build wxWidgets/opt/local/pgm/wxWidgets-2.8.12
so we set that up tooErlang requires finding OpenSSL in c:\OpenSSL
so that's where we build to, using mount point to keep things clean=ish under %relax%
.
setenv.cmd /Release /x86
c:\relax\bin\build_openssl.cmd
to extract and build OpenSSLmklink /d c:\OpenSSL %relax%\OpenSSL
c:\relax\openssl\bin
need to be distributed with Erlang/OTP and therefore CouchDB as well.Our goal is to get the path set up in this order:
The express start is to:
setenv.cmd /Release /x86
c:\relax\bin\shell.cmd
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` echo $PATH | /bin/sed 's/:/\n/g' which cl link mc lc mt
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
start an SDK shell via setenv.cmd /Release /x86
launch a cygwin erl-ified shell via c:\relax\bin\shell.cmd
choose your erlang version - R14B04 is strongly advised
unpack erlang source by cd $RELAX && tar xzf bits/otp_src_R14B04.tar.gz
customise Erlang by excluding unneeded Java interface and old GS GUI:
cd $ERL_TOP tar xvzf /relax/bits/tcltk85_win32_bin.tar.gz echo "skipping gs" > lib/gs/SKIP echo "skipping jinterface" > lib/jinterface/SKIP
after validating the path, I usually run these two scripts which can take several hours on slower machines:
erl_config.sh erl_build.sh
the output is logged into $ERL_TOP/build_*.txt
if required
at this point I usually duplicate the OTP source tree for later
robocopy $ERL_TOP /relax/release/$OTP_REL -mir
Download ICU 4.6.1 windows source from icu461zip
either re-use the “shell.cmd” from before, or open a Windows SDK prompt via setenv /release /x86
again
%relax%\bin\build_icu.cmd
confirm that the resulting ICU DLLs have the appropriate manifests
NB for MSVC9 is supported only via cygwin; use icu461tgz instead and
cd $RELAX DEST=`pwd`/icu tar xzf bits/icu4c-4_6_1-src.tgz cd $DEST/source && ./runConfigureICU Cygwin/MSVC --prefix=$DEST make && make install cp $DEST/lib/*.dll $DEST/bin/
compiling under cygwin is likely also to work for MSVC10 if a unified build process is required.
libcurl is only required for versions of CouchDB below 1.1.1 where it is embedded in couchjs.exe. Trunk and future releases will have this as an optional include.
download libcurl source from (http://curl.haxx.se/)
NB when using SDK7.0 I needed to copy %windir%\system32\notepad.exe c:\relax\bin\bscmake.exe
either re-use the “shell.cmd” from before, or open a Windows SDK prompt via setenv /release /x86
again
%relax%\bin\build_curl.cmd
The Javascript engine used by CouchDB is Mozilla Spidermonkey v1.8.5 js185.
to build and install SpiderMonkey we use the mozilla tools chain.
run c:\mozilla-build\start-msvc10.bat
even if you are on a 64-bit platform.
do a sanity check to confirm the MS build compilers are present via which cl link mc lc mt
you may need to fudge the path if cl.exe
can't be found using PATH=$PATH:/c/relax/VC/VC/bin/:/c/relax/SDK/bin:/c/relax/VC/Common7/IDE:/c/relax/VC/VC/bin/amd64/:/c/relax/VC/VC/bin/x86_ia64/
cd /c/relax tar xzf bits/js185-1.0.0.tar.gz cd ./js-1.8.5/js/src autoconf-2.13 ./configure --enable-static --enable-shared-js make
Finally we are going to build Apache CouchDB... whew! Recapping, we should have:
/relax/otp_src_R14B04/release/win32
with a copy stashed nearby/relax/openssl/{bin,lib}/{lib,ssl}eay32.{bin,lib}
/relax/curl/lib/libcurl.lib
/relax/js-1.8.5/js/src/dist/{bin,lib}/mozjs185-1.0.*
/relax/icu/bin/icu*.dll
For CouchDB 1.1.1 or newer, two small filthy hacks are required, which is needed until configure.ac
avoids detection of cygwin's curl and avoids assuming that help2man will be useful on Windows.
start an SDK shell via setenv.cmd /Release /x86
launch a cygwin erl-ified shell via c:\relax\bin\shell.cmd
apply the work-arounds:
mv /usr/bin/curl-config /usr/bin/curl-config.dist mv /usr/bin/help2man /usr/bin/help2man.dist
There are two relevant scripts for building CouchDB:
couchdb_config.sh
for CouchDB 1.1.1 or newer, supporting js185 onlycouchdb_build.sh
which compiles, and packages, CouchDBLet's pull the CouchDB source from git repo:
git clone http://git-wip-us.apache.org/repos/asf/couchdb.git \ /relax/couchdb pushd /relax/couchdb && git checkout -b 1.2.0 git clean -fdx && git reset --hard ./bootstrap /relax/bin/couchdb_config.sh && /relax/bin/couchdb_build.sh
A few minutes later, the release binaries should be made available.