Skip to content
Permalink
Browse files
Merge branch 'master' into windows_sdk_7.0
  • Loading branch information
dch committed Sep 7, 2011
2 parents 65c8743 + 117efdd commit df29c03f6bde1f9c9ba5d60ff178854bb0e2cda8
Show file tree
Hide file tree
Showing 6 changed files with 148 additions and 11 deletions.
@@ -91,7 +91,7 @@ The express solution is just to use 7zip to unpack [glazier tools](https://githu
[isetup]: http://www.jrsoftware.org/download.php/is-unicode.exe
[7zip]: http://downloads.sourceforge.net/sevenzip/7z465.exe

## wxWidgets
# wxWidgets
################################################################################
* [wxWidgets] source and the glazier [overlay] are already downloaded
* start an SDK shell via `setenv.cmd /Release /x86`
@@ -103,7 +103,7 @@ The express solution is just to use 7zip to unpack [glazier tools](https://githu
[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

## OpenSSL
# OpenSSL
################################################################################
Erlang requires finding OpenSSL in `c:\OpenSSL` so that's where we build to,
using mount point to keep things clean=ish under `%relax%`.
@@ -119,7 +119,7 @@ Erlang/OTP and therefore CouchDB as well.

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

## Environment
# Environment
################################################################################
Our goal is to get the path set up in this order:

@@ -186,7 +186,7 @@ can take several hours on slower machines:

[patches]: https://github.com/dch/otp/commit/d1e151a689f8e54cdc2d671e96e00beb86d2b571

## ICU 4.4.2
# ICU 4.4.2
################################################################################
Ideally ICU would compile with current VC runtime using VC++ directly but
it doesn't. Instead we use cygwin make tools and VC++ compiler.
@@ -216,7 +216,7 @@ via `setenv /release /x86` again
couchdb_config.sh
couchdb_build.sh

## LibcURL
# 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.
@@ -229,7 +229,7 @@ via `setenv /release /x86` again

[libcurl]: http://curl.haxx.se/download/curl-7.21.7.zip

## Javascript
# 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
@@ -268,3 +268,47 @@ 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

# Building CouchDB
################################################################################

Finally we are going to build Apache CouchDB... whew! Recapping, we should have:

* erlang in `/relax/otp_src_R14B03/release/win32` with a copy stashed nearby
* openssl in `/relax/openssl/lib/{lib,ssl}eay32.lib`
* libcurl in `/relax/curl/lib/libcurl.lib`
* two js libraries in `/relax/js-1.8.5/js/src/dist/{bin,lib}/mozjs185-1.0.*` and
`/relax/tracemonkey-57a6ad20eae9/js/src/dist/{bin,lib}/mozjs.*`
* icu in `/relax/icu/bin/icu*.dll`

There are three relevant scripts for building CouchDB:

* `couchdb_config_js180.sh` for CouchDB 1.1.0 + js18x with libcurl
* `couchdb_config_js185.sh` for CouchDB 1.2.0 + js185 without libcurl
* `couchdb_build.sh` which compiles, and packages, CouchDB

There are still some patches required against both released and trunk versions.
For CouchDB 1.1.0, the patch from [COUCHDB-1152] is required.

cd /relax && tar xzf bits/apache-couchdb-1.1.0.tar.gz
cd apache-couchdb-1.1.0
patch -p0 < ../bits/COUCHDB-1152_move_to_ICU-4_4_2.patch
/relax/bin/couchdb_config_js180.sh
/relax/bin/couchdb_build.sh

For CouchDB 1.2.x, most patches are already in trunk, apart from 1 patch, and a
filthy hack. The hack is needed until `configure.ac` is updated to identify
that curl is not required and that the cygwin library version of it should not
be pulled into CouchDB by accident.

cd /relax && svn checkout https://svn.apache.org/repos/asf/couchdb/trunk
cd trunk
patch -p1 < ../bits/COUCHDB-1197_libtool_sed_hackery.patch
mv /usr/bin/curl-config /usr/bin/curl-config.dist
./bootstrap
/relax/bin/couchdb_config_js185.sh
/relax/bin/couchdb_build.sh


[COUCHDB-1152]: https://issues.apache.org/jira/secure/attachment/12481030/COUCHDB-1152_move_to_ICU-4_4_2.patch
[COUCHDB-1197]: https://issues.apache.org/jira/secure/attachment/12493303/COUCHDB-1197_libtool_sed_hackery.patch
@@ -21,18 +21,20 @@ if defined curl_ver rd /s/q %curl_src%
7z x "%RELAX%\bits\curl-*.zip" -o%RELAX% -y

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
pushd %relax%\curl-*\lib
pushd %curl_src%
:: 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
::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
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 doesn't pull in SSL .libs correctly
:: pushd %relax%\curl-*\lib
:: nmake /f Makefile.vc9 CFG=release-ssl
popd
:: make this specific curl version available to CouchDB build script
mklink /d %curl_path% %curl_src%
@@ -0,0 +1 @@
robocopy c:\relax\release\otp_src_R14B03 c:\relax\otp_src_R14B03 -mir -log:NUL:
@@ -0,0 +1,39 @@
Index: src/couchdb/priv/Makefile.am
===================================================================
--- src/couchdb/priv/Makefile.am (revision 1129890)
+++ src/couchdb/priv/Makefile.am (working copy)
@@ -78,9 +78,9 @@
$(LN_S) couch_icu_driver couch_icu_driver.so; \
fi
if WINDOWS
- $(INSTALL) $(ICU_LOCAL_BIN)/icuuc42.dll $(bindir)
- $(INSTALL) $(ICU_LOCAL_BIN)/icudt42.dll $(bindir)
- $(INSTALL) $(ICU_LOCAL_BIN)/icuin42.dll $(bindir)
+ $(INSTALL) $(ICU_LOCAL_BIN)/icuuc44.dll $(bindir)
+ $(INSTALL) $(ICU_LOCAL_BIN)/icudt44.dll $(bindir)
+ $(INSTALL) $(ICU_LOCAL_BIN)/icuin44.dll $(bindir)
$(INSTALL) $(JS_LIB_BINARY) $(bindir)
$(INSTALL) .libs/couchspawnkillable.exe \
"$(DESTDIR)$(couchprivdir)/couchspawnkillable.exe"
Index: INSTALL.Windows
===================================================================
--- INSTALL.Windows (revision 1129890)
+++ INSTALL.Windows (working copy)
@@ -9,7 +9,7 @@
You will need the following installed:

* Erlang OTP (=14B01) (http://erlang.org/)
- * ICU (http://icu.sourceforge.net/)
+ * ICU (=4.4.*) (http://icu.sourceforge.net/)
* OpenSSL (http://www.openssl.org/)
* Mozilla SpiderMonkey (1.8) (http://www.mozilla.org/js/spidermonkey/)
* libcurl (http://curl.haxx.se/libcurl/)
@@ -21,7 +21,7 @@

* When installing Erlang, you must build it from source.

- The CouchDB build makes use of a number of the Erlang build scripts.
+The CouchDB build requires a number of the Erlang build scripts.

* When installing ICU, select the binaries built with Visual Studio 2008.

@@ -0,0 +1,21 @@
diff --git a/configure.ac b/configure.ac
index 7a9bc87..600b374 100644
--- a/configure.ac
+++ b/configure.ac
@@ -517,10 +517,12 @@ AC_OUTPUT
# PLEASE, someone help put this out of its misery!!
# This hackery is being tracked via COUCHDB-440.
if test x${IS_WINDOWS} = xTRUE; then
- sed -e 's,libname_spec="lib\\$name",libname_spec="\\\$name",' \
+ mv libtool libtool.dist
+ sed -E -e 's,libname_spec="lib\\$name",libname_spec="\\\$name",' \
-e 's,-link,,' \
- < libtool > libtool.tmp
- mv libtool.tmp libtool
+ -e 's/-Xlinker --out-implib -Xlinker \\\$lib//' \
+ -e 's/(-shared -nostdlib)/-dll \1/' \
+ < libtool.dist > libtool
# probably would chmod +x if we weren't on windows...
fi


@@ -0,0 +1,30 @@

## Make & Build ###############################################################

* The generic configure script looks like this:

./configure \
--with-js-include=/cygdrive/c/path_to_spidermonkey/dist/include \
--with-js-lib=/cygdrive/c/path_to_spidermonkey/dist/lib \
--with-win32-icu-binaries=/cygdrive/c/path_to_icu_binaries_root \
--with-erlang=$ERL_TOP/release/win32/usr/include \
--with-win32-curl=/cygdrive/c/path/to/curl/root/directory \
--with-openssl-bin-dir=/cygdrive/c/path/to/openssl/bin \
--with-msvc-redist-dir=/cygdrive/c/dir/with/vcredist_platform_executable \
--prefix=$ERL_TOP/release/win32

## using spidermonkey 1.8.x ###################################################

* This is the recommended config if you have used the above steps:

./configure \
--prefix=$ERL_TOP/release/win32 \
--with-erlang=$ERL_TOP/release/win32/usr/include \
--with-win32-icu-binaries=/relax/icu \
--with-win32-curl=/relax/curl-7.21.5 \
--with-openssl-bin-dir=/relax/openssl/bin \
--with-msvc-redist-dir=/relax \
--with-js-lib=/relax/57a6ad20eae9/js/src/dist/lib \
--with-js-include=/relax/57a6ad20eae9/js/src/dist/include \
2>&1 | tee $COUCH_TOP/build_configure.txt

0 comments on commit df29c03

Please sign in to comment.