Skip to content
Permalink
Browse files
Merge branch 'master' into windows_sdk_7.0
  • Loading branch information
dch committed Sep 7, 2011
2 parents e221a30 + 5911fb9 commit 65c8743b56aa8ed87f19f0d24da134800075e627
Show file tree
Hide file tree
Showing 4 changed files with 157 additions and 139 deletions.
243 README.md
@@ -19,9 +19,9 @@ consistent repeatable build environment.
# Download Glazier scripts, tools, and source
################################################################################

* download [glazier latest zip](https://nodeload.github.com/dch/glazier/zipball/master)
* unpack it into `c:\relax` - you should have `c:\relax\bin` for example
* download source & tools using aria, and then check MD5 hashes:
* download [glazier latest zip](https://nodeload.github.com/dch/glazier/zipball/master)
* 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%
@@ -32,16 +32,16 @@ consistent repeatable build environment.
################################################################################
Due to size, these are not downloaded in the bundle apart from
mozilla & cygwin setup.
* Install Windows SDK 7.0 either 32 or 64bit for your platform
[win7sdk_32bit] or [win7sdk_64bit]
* Run Windows Update for latest patches
* Reboot
* Download Mozilla toolkit from [mozbuild] and install per defaults
* Install [cygwin] components, at least:
* devel: ALL
* editors: vim or emacs
* utils: file

* Install Windows SDK 7.0 either 32 or 64bit for your platform
[win7sdk_32bit] or [win7sdk_64bit]
* Run Windows Update for latest patches
* Reboot
* Download Mozilla toolkit from [mozbuild] and install per defaults
* Install [cygwin] components, at least:
* devel: ALL
* editors: vim or emacs
* utils: file

[cygwin]: http://www.cygwin.com/setup.exe
[msvc++]: http://download.microsoft.com/download/E/8/E/E8EEB394-7F42-4963-A2D8-29559B738298/VS2008ExpressWithSP1ENUX1504728.iso
@@ -52,9 +52,9 @@ mozilla & cygwin setup.
# Initial Setup of Environment
################################################################################
Now that the compilers are installed, we need to set a few things up first:
* start an SDK shell via `setenv.cmd /Release /x86`
* run `c:\relax\bin\setup.cmd` once to set up links and environment variables

* start an SDK shell via `setenv.cmd /Release /x86`
* run `c:\relax\bin\setup.cmd` once to set up links and environment variables

You should end up with something resembling this structure:

@@ -73,15 +73,15 @@ You should end up with something resembling this structure:
################################################################################
The express solution is just to use 7zip to unpack [glazier tools](https://github.com/downloads/dch/glazier/toolbox.7z)
inside `%relax%`. Or do it manually for the same result:
* Download [7zip] to `%relax%/7zip`
* Innosoft's [isetup] to `%relax%/inno5`
* Nullsoft [NSIS] Installer to `%relax%/nsis`
* Add 7zip, Inno5, and nsis to the user environment PATH
* using 7zip, extract and rename [nasm] to `%relax%/nasm`
* using 7zip, extract and rename [cmake] to `%relax%/cmake`
* `mkdir strawberry && cd strawberry` then using 7zip, extract Strawberry [Perl]
* copy [vcredist] to `%relax%/` for later use by Erlang and CouchDB builds

* Download [7zip] to `%relax%/7zip`
* Innosoft's [isetup] to `%relax%/inno5`
* Nullsoft [NSIS] Installer to `%relax%/nsis`
* Add 7zip, Inno5, and nsis to the user environment PATH
* using 7zip, extract and rename [nasm] to `%relax%/nasm`
* using 7zip, extract and rename [cmake] to `%relax%/cmake`
* `mkdir strawberry && cd strawberry` then using 7zip, extract Strawberry [Perl]
* copy [vcredist] to `%relax%/` for later use by Erlang and CouchDB builds

[perl]: http://strawberryperl.com/download/5.12.2.0/strawberry-perl-5.12.2.0-portable.zip
[nasm]: http://www.nasm.us/pub/nasm/releasebuilds/2.09.07/win32/nasm-2.09.07-win32.zip
@@ -93,12 +93,12 @@ The express solution is just to use 7zip to unpack [glazier tools](https://githu

## wxWidgets
################################################################################
* [wxWidgets] source and the glazier [overlay] are already downloaded
* start an SDK shell via `setenv.cmd /Release /x86`
* run `c:\relax\bin\build_wx.cmd` to extract and build wxWidgets
* NB Erlang build requires wxWidgets in `/opt/local/pgm/wxWidgets-2.8.11` so
we set that up too
* check for errors
* [wxWidgets] source and the glazier [overlay] are already downloaded
* start an SDK shell via `setenv.cmd /Release /x86`
* run `c:\relax\bin\build_wx.cmd` to extract and build wxWidgets
* NB Erlang build requires wxWidgets in `/opt/local/pgm/wxWidgets-2.8.11` so
we set that up too
* check for errors

[wxwidgets]: http://sourceforge.net/projects/wxwindows/files/2.8.11/wxMSW-2.8.11.zip
[overlay]: https://raw.github.com/dch/glazier/master/bits/wxMSW-2.8.11_erlang_overlay.zip
@@ -107,32 +107,32 @@ The express solution is just to use 7zip to unpack [glazier tools](https://githu
################################################################################
Erlang requires finding OpenSSL in `c:\OpenSSL` so that's where we build to,
using mount point to keep things clean=ish under `%relax%`.
* [OpenSSL] source has already been downloaded
* start an SDK shell via `setenv.cmd /Release /x86`
* run `c:\relax\bin\build_openssl.cmd` to extract and build OpenSSL
* it requires nasm, 7zip, strawberry perl all in place
* check for errors
* ensure Erlang can locate SSL with `mklink /d c:\OpenSSL %relax%\OpenSSL`
* the resulting DLLs in `c:\relax\openssl\bin` need to be distributed with
Erlang/OTP and therefore CouchDB as well.

* [OpenSSL] source has already been downloaded
* start an SDK shell via `setenv.cmd /Release /x86`
* run `c:\relax\bin\build_openssl.cmd` to extract and build OpenSSL
* it requires nasm, 7zip, strawberry perl all in place
* check for errors
* ensure Erlang can locate SSL with `mklink /d c:\OpenSSL %relax%\OpenSSL`
* the resulting DLLs in `c:\relax\openssl\bin` need to be distributed with
Erlang/OTP and therefore CouchDB as well.

[openssl]: http://www.openssl.org/source/openssl-1.0.0d.tar.gz

## Environment
################################################################################
Our goal is to get the path set up in this order:
1. erlang and couchdb build helper scripts
2. Microsoft VC compiler, linker, etc from Windows SDK 7.0
3. cygwin path for other build tools like make, autoconf, libtool
4. the remaining windows system path

1. erlang and couchdb build helper scripts
2. Microsoft VC compiler, linker, etc from Windows SDK 7.0
3. cygwin path for other build tools like make, autoconf, libtool
4. the remaining windows system path

The express start is to:
* start an SDK shell via `setenv.cmd /Release /x86`
* launch a cygwin erl-ified shell via `c:\relax\bin\shell.cmd`
* go to next session to compile Erlang/OTP

* start an SDK shell via `setenv.cmd /Release /x86`
* launch a cygwin erl-ified shell via `c:\relax\bin\shell.cmd`
* go to next section to compile Erlang/OTP

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
@@ -145,42 +145,42 @@ go to the root of where you installed erlang, and run the Erlang/OTP script:
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:
* Erlang build helper scripts
* Windows SDK tools, .Net framework
* Visual C++ if installed
* Ancillary Erlang and CouchDB packaging tools
* Usual cygwin unix tools such as make, gcc
* Ancillary glazier/relax tools for building dependent libraries
* Usual Windows folders `%windir%;%windir%\system32` etc
* Various settings form the `otp_build` script

* Erlang build helper scripts
* Windows SDK tools, .Net framework
* Visual C++ if installed
* Ancillary Erlang and CouchDB packaging tools
* Usual cygwin unix tools such as make, gcc
* Ancillary glazier/relax tools for building dependent libraries
* Usual Windows folders `%windir%;%windir%\system32` etc
* Various settings form the `otp_build` script

More details are at [erlang INSTALL-Win32.md on github](http://github.com/erlang/otp/blob/dev/INSTALL-WIN32.md)

# Erlang
################################################################################
* 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 - R14B03 is strongly advised
* unpack erlang source by `cd $RELAX && tar xzf bits/otp_src_R14B03.tar.gz`
* apply additional [patches] to allow building with OpenSSL again
* customise Erlang by excluding unneeded Java interface and old GS GUI:

* 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 - R14B03 is strongly advised
* unpack erlang source by `cd $RELAX && tar xzf bits/otp_src_R14B03.tar.gz`
* apply additional [patches] to allow building with OpenSSL again
* 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:
* 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

* 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

@@ -194,18 +194,15 @@ it doesn't. Instead we use cygwin make tools and VC++ compiler.
* download ICU 4.4.2 unix source from [icu442]
* either re-use the "shell.cmd" from before, or open a Windows SDK prompt
via `setenv /release /x86` again

set CL=/D_BIND_TO_CURRENT_VCLIBS_VERSION=1
call \cygwin\bin\bash.exe

export PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin
RELAX=/relax
cd $RELAX && tar xzf bits/icu4c-4_4_2-src.tgz
cd $RELAX/icu/source
./runConfigureICU Cygwin/MSVC --prefix=$RELAX/icu
make
make install
cp $RELAX/icu/lib/*.dll $RELAX/icu/bin/
cd $RELAX
DEST=`pwd`/icu
tar xzf bits/icu4c-4_4_2-src.tgz
cd $DEST/source
./runConfigureICU Cygwin/MSVC --prefix=$DEST
make
make install
cp $DEST/lib/*.dll $DEST/bin/

* the last line is because CouchDB still looks in icu/bin/ for the DLLs even though the build puts them
in icu/lib/. This should probably be changed in CouchDB
@@ -214,46 +211,60 @@ via `setenv /release /x86` again
[icu442]: http://download.icu-project.org/files/icu4c/4.4.2/icu4c-4_4_2-src.tgz






cfdc2ab751bf18049c5ef7866602d8ed *apache-couchdb-1.0.3.tar.gz
907b763d3a14b6649bf0371ffa75a36b *apache-couchdb-1.1.0.tar.gz
8e0411224c978aaa449210637165072c *curl-7.21.7.zip

#TODO needs work

cd /relax
CYGWIN="nontsec nodosfilewarning"
CL=/D_BIND_TO_CURRENT_VCLIBS_VERSION=1
tar xzf /relax/bits/apache-couchdb-1.1.0.tar.gz &
tar xzf /relax/bits/curl-7.21.7.tar.gz &
tar xzf /relax/bits/otp_src_R14B03.tar.gz &
cd /relax/otp_src_R14B03 && tar xzf /relax/bits/tcltk85_win32_bin.tar.gz &

* then run the following 4 scripts in order

erl_config.sh
erl_build.sh
couchdb_config.sh
couchdb_build.sh

## LibcURL
################################################################################
LibcURL is only required for versions of CouchDB <= 1.10 where it is embedded
in couchjs.exe. Trunk and future releases will have this as an optional include.

## Microsoft Visual C++ runtime ###############################################

* download the runtime installer [vcredist] and copy to `c:\relax\` - note this
must be the same as the one your compiler uses.


# Building pre-requisites for Erlang ##########################################
## Inno Installer #############################################################

* download [LibcURL] source from (http://curl.haxx.se/)
* either re-use the "shell.cmd" from before, or open a Windows SDK prompt
via `setenv /release /x86` again

## OpenSSL ####################################################################
%relax%\bin\build_curl.cmd

* already installed into `C:/OpenSSL/` no further steps required
[libcurl]: http://curl.haxx.se/download/curl-7.21.7.zip

[vcredist]:
# NB this is the same version as supplied with VS2008sp1 - EXEs and DLLs built against older vcredists can use the newer one successfully
http://download.microsoft.com/download/d/d/9/dd9a82d0-52ef-40db-8dab-795376989c03/vcredist_x86.exe
## Javascript
################################################################################
The Javascript engine used by CouchDB is Mozilla Spidermonkey. Prior to 1.8.5
[js185] there was no formal release for it, so you can build from anywhere on
trunk. The 1.8.x source below [js18x] is also used on the Mac OS X homebrew
build of CouchDB.

* to build and install SpiderMonkey we use the mozilla tools chain.
* run `c:\mozilla-build\start-msvc9.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/`

* to build Spidermonkey JS 1.8.x [js18x]

cd /c/relax
tar xzf bits/57a6ad20eae9.tar.gz
cd ./tracemonkey-57a6ad20eae9/js/src
autoconf-2.13
export CXXFLAGS='-D_BIND_TO_CURRENT_VCLIBS_VERSION=1'
./configure --enable-static --enable-shared-js
make


* alternatively to build Spidermonkey JS 1.8.5 [js185]

cd /c/relax
tar xzf bits/js185-1.0.0.tar.gz
cd ./js-1.8.5/js/src
autoconf-2.13
export CXXFLAGS='-D_BIND_TO_CURRENT_VCLIBS_VERSION=1'
./configure --enable-static --enable-shared-js
make

The CouchDB configure script is used later on to select which version of
Spidermonkey is used.

[js185]: http://ftp.mozilla.org/pub/mozilla.org/js/js185-1.0.0.tar.gz
[js18x]: http://hg.mozilla.org/tracemonkey/archive/57a6ad20eae9.tar.gz
@@ -21,23 +21,23 @@ if defined curl_ver rd /s/q %curl_src%
7z x "%RELAX%\bits\curl-*.zip" -o%RELAX% -y

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
pushd %relax%\curl-7*

pushd %relax%\curl-*\lib
:: settings for Compiler
set USE_SSLEAY=1
set USE_OPENSSL=1
set INCLUDE=%INCLUDE%;%SSL_PATH%\include;%SSL_PATH%\include\openssl;
set LIBPATH=%LIBPATH%;%SSL_PATH%\lib;
set LIB=%LIB%;%SSL_PATH%\lib;
set CL=/D_BIND_TO_CURRENT_VCLIBS_VERSION=1

cmake -G "NMake Makefiles" -D CMAKE_BUILD_TYPE=Release -D BUILD_CURL_TESTS=No -D CURL_STATICLIB=Yes -D CURL_ZLIB=No -D CMAKE_INSTALL_PREFIX="%curl_path%" -H"%curl_src%" -B"%temp%\%curl_ver%"
cmake --build "%temp%\%curl_ver%" --target install
::vcbuild /useenv /upgrade /platform:Win32 lib\libcurl.vcproj
::vcbuild /useenv /platform:Win32 lib\libcurl.vcproj "Release|Win32"
::xcopy lib\Release\libcurl.lib lib\ /y
nmake /f Makefile.vc9 CFG=release-ssl
popd
dir /b %install%\bin %install%\lib

:: make this specific curl version available to CouchDB build script
mklink /d %curl_path% %curl_src%
popd
endlocal
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:eof
:eof
13 icu.md
@@ -8,15 +8,16 @@ it doesn't. Instead we use cygwin make tools and VC++ compiler.

set CL=/D_BIND_TO_CURRENT_VCLIBS_VERSION=1
call \cygwin\bin\bash.exe

export PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin
RELAX=/relax
cd $RELAX && tar xzf bits/icu4c-4_4_2-src.tgz
cd $RELAX/icu/source
./runConfigureICU Cygwin/MSVC --prefix=$RELAX/icu

cd $RELAX
DEST=`pwd`/icu
tar xzf bits/icu4c-4_4_2-src.tgz
cd $DEST/source
./runConfigureICU Cygwin/MSVC --prefix=$DEST
make
make install
cp $RELAX/icu/lib/*.dll $RELAX/icu/bin/
cp $DEST/lib/*.dll $DEST/bin/

* the last line is because CouchDB still looks in icu/bin/ for the DLLs even though the build puts them
in icu/lib/. This should probably be changed in CouchDB

0 comments on commit 65c8743

Please sign in to comment.