diff options
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | README | 29 | ||||
-rw-r--r-- | configure.ac | 63 | ||||
-rw-r--r-- | etc/Makefile.am | 36 | ||||
-rw-r--r-- | etc/windows/README.txt.tpl | 24 | ||||
-rw-r--r-- | etc/windows/couchdb.iss.tpl | 68 | ||||
-rw-r--r-- | src/couchdb/Makefile.am | 21 |
7 files changed, 231 insertions, 11 deletions
@@ -12,6 +12,7 @@ Version 0.11.0 This version has not been released yet. + * Added support for building a Windows installer as part of 'make dist'. * Added optional 'raw' binary collation for faster view builds where Unicode collation is not important. * Improved view index build time by reducing ICU collation callouts. @@ -370,21 +370,44 @@ Now we need to run a complicated configure command-line. --with-js-lib=/cygdrive/c/path_to_seamonkey_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-win32-curl=/cygdrive/c/path/to/curl/root/directory \ + --with-openssl-bin-dir=c:/openssl/bin \ + --with-msvc-redist-dir=c:/dir/with/vcredist_platform_executable \ --prefix=$ERL_TOP/release/win32 +Relax, then relax some more, then get a beer and relax some more; the +above command may take many many minutes to complete... + Note that all paths must be in cygwin format. Those starting with $ERL_TOP can be entered literally, assuming ERL_TOP is set as described above. +Notes: + When building the installer, the necessary openssl binaries are pulled from + the directory pointed to --with-openssl-bin-dir. + +Now we can build it and "install" it into the $ERL_TOP/release/win32 (or +wherever you set --prefix to above) directory: + + $ make install + Relax on your new couch: - The $ERL_TOP/win32/release directory is now ready to .zip up, be packaged + The $ERL_TOP/release/win32 directory is now ready to .zip up, be packaged by an installer, etc. To test it in-place, execute: - $ $ERL_TOP/win32/release/bin/couchdb.bat + $ $ERL_TOP/release/win32/bin/couchdb.bat and everything should work fine. +To create an installer, execute: + + $ make dist + +and look for etc/windows/setup-couch*.exe. Note - only do this after +a clean build, not after testing in-place - otherwise your test database and +log files will be shipped! + + Additional Notes: Building erlang: diff --git a/configure.ac b/configure.ac index 557a6280..f48b8677 100644 --- a/configure.ac +++ b/configure.ac @@ -73,7 +73,13 @@ AC_ARG_WITH([js-include], [AC_HELP_STRING([--with-js-include=PATH], AC_ARG_WITH([js-lib], [AC_HELP_STRING([--with-js-lib=PATH], [set PATH to the SpiderMonkey library directory])], - [JS_LIB_FLAGS="-L$withval"], []) + [ + JS_LIB_DIR=$withval + JS_LIB_FLAGS="-L$withval" +], [ + JS_LIB_DIR= +]) +AC_SUBST(JS_LIB_DIR) AC_ARG_VAR([ERLC_FLAGS], [general flags to prepend to ERLC_FLAGS]) AC_ARG_VAR([FLAGS], [general flags to prepend to LDFLAGS and CPPFLAGS]) @@ -103,14 +109,61 @@ esac AM_CONDITIONAL([WINDOWS], [test x$IS_WINDOWS = xTRUE]) -AC_CHECK_LIB([mozjs], [JS_NewContext], [JSLIB=-lmozjs], [ - AC_CHECK_LIB([js], [JS_NewContext], [JSLIB=-ljs], [ - AC_CHECK_LIB([js3250], [JS_NewContext], [JSLIB=-ljs3250], [ - AC_CHECK_LIB([js32], [JS_NewContext], [JSLIB=-ljs32], [ +AC_CHECK_LIB([mozjs], [JS_NewContext], [JS_LIB_BASE=mozjs], [ + AC_CHECK_LIB([js], [JS_NewContext], [JS_LIB_BASE=js], [ + AC_CHECK_LIB([js3250], [JS_NewContext], [JS_LIB_BASE=js3250], [ + AC_CHECK_LIB([js32], [JS_NewContext], [JS_LIB_BASE=js32], [ AC_MSG_ERROR([Could not find the js library. Is the Mozilla SpiderMonkey library installed?])])])])]) +AC_SUBST(JS_LIB_BASE) + +if test x${IS_WINDOWS} = xTRUE; then + if test -f "$JS_LIB_DIR/$JS_LIB_BASE.dll"; then + # seamonkey 1.7- build layout on Windows + JS_LIB_BINARY="$JS_LIB_DIR/$JS_LIB_BASE.dll" + else + # seamonkey 1.8+ build layout on Windows + if test -f "$JS_LIB_DIR/../bin/$JS_LIB_BASE.dll"; then + JS_LIB_BINARY="$JS_LIB_DIR/../bin/$JS_LIB_BASE.dll" + else + AC_MSG_ERROR([Could not find $JS_LIB_BASE.dll.]) + fi + fi + AC_SUBST(JS_LIB_BINARY) + + # On windows we need to know the path to the openssl binaries. + AC_ARG_WITH([openssl-bin-dir], [AC_HELP_STRING([--with-openssl-bin-dir=PATH], + [path to the open ssl binaries for distribution on Windows])], [ + openssl_bin_dir=`cygpath -m "$withval"` + AC_SUBST(openssl_bin_dir) + ], []) + + # Windows uses Inno setup - look for its compiler. + AC_PATH_PROG([INNO_COMPILER_EXECUTABLE], [iscc]) + if test x${INNO_COMPILER_EXECUTABLE} = x; then + AC_MSG_WARN([You will be unable to build the Windows installer.]) + fi + + # We need the msvc redistributables for this platform too + # (in theory we could just install the assembly locally - but + # there are at least 4 directories with binaries, meaning 4 copies; + # so using the redist .exe means it ends up installed globally...) + AC_ARG_WITH([msvc-redist-dir], [AC_HELP_STRING([--with-msvc-redist-dir=PATH], + [path to the msvc redistributables for the Windows platform])], [ + msvc_redist_dir=`cygpath -m "$withval"` + msvc_redist_name="vcredist_x86.exe" + AC_SUBST(msvc_redist_dir) + AC_SUBST(msvc_redist_name) + ], []) + if test ! -f ${msvc_redist_dir}/${msvc_redist_name}; then + AC_MSG_WARN([The MSVC redistributable seems to be missing; expect the installer to fail.]) + fi +fi + +JSLIB=-l$JS_LIB_BASE + AC_CHECK_HEADER([jsapi.h], [], [ AC_CHECK_HEADER([js/jsapi.h], [ diff --git a/etc/Makefile.am b/etc/Makefile.am index 51a00d26..2ff298ad 100644 --- a/etc/Makefile.am +++ b/etc/Makefile.am @@ -27,6 +27,10 @@ nobase_sysconf_DATA = $(default_sysconf_data) $(init_sysconf_data) EXTRA_DIST = $(init_sysconf_data) +if WINDOWS +EXTRA_DIST += windows/setup-couchdb-@version@.exe +endif + CLEANFILES = $(init_DATA) $(default_sysconf_data) $(launchd_DATA) transform = @program_transform_name@ @@ -63,6 +67,38 @@ launchd/org.apache.couchdb.plist: launchd/org.apache.couchdb.plist.tpl -e "s|%couchdb_command_name%|$(couchdb_command_name)|" \ < $< > $@ +if WINDOWS + +# README.txt has \n line endings in the repo and must have \r\n +# when installed as notepad is used to view it. +# Also: the targets below don't seem to update after an svn-up (which +# changes the version string in the generated files) so we trick make +# into always building it with the FORCE pattern... +windows/README.txt: windows/README.txt.tpl FORCE + sed -e "s|%package_name%|@package_name@|g" \ + -e "s|%version%|@version@|g" \ + < $< | unix2dos > $@ + +windows/couchdb.iss: windows/couchdb.iss.tpl FORCE + sed -e "s|%configure_input%|$@. Generated from $< by configure.|" \ + -e "s|%package_name%|@package_name@|g" \ + -e "s|%locallibbindir%|`cygpath -m @locallibbindir@`|g" \ + -e "s|%version%|@version@|g" \ + -e "s|%openssl_bin_dir%|@openssl_bin_dir@|g" \ + -e "s|%msvc_redist_dir%|@msvc_redist_dir@|g" \ + -e "s|%msvc_redist_name%|@msvc_redist_name@|g" \ + < $< > $@ + +# The installer depends on all files, not just the source .iss file, +# so we trick make into always building it with the FORCE pattern... +windows/setup-couchdb-@version@.exe: windows/couchdb.iss windows/README.txt FORCE + $(INNO_COMPILER_EXECUTABLE) /q $< + @echo Windows Installer is at: `cygpath -a -w windows/setup-couchdb-@version@.exe` + +FORCE: + +endif + install-data-hook: if test -n "$(init_DATA)"; then \ chmod +x "$(DESTDIR)$(initdir)/couchdb"; \ diff --git a/etc/windows/README.txt.tpl b/etc/windows/README.txt.tpl new file mode 100644 index 00000000..485757a3 --- /dev/null +++ b/etc/windows/README.txt.tpl @@ -0,0 +1,24 @@ +This is the README for the %package_name% binary distribution for +Windows, version %version%. + +* Although CouchDB defaults to installing into your "Program Files" directory, + the permissions on the 'var' and 'etc' sub-directories have been adjusted + to allow modification by any authorized user so the couchdb databases, logs + and .ini files can be written. You may like to further restrict these + permissions to only the user who will be running couchdb. + +* To start couchdb execute couchdb.bat in the 'bin' directory. A shortcut + to this batch file should have been installed. There is currently no + support for Windows Services etc, but you are encouraged to look at the + various tools which allow arbitrary programs to be run as services. + +* The Futon application which comes with CouchDB does not work with + Internet Explorer - Mozilla Firefox is generally recommended. + +* The test suite is known to fail on Windows due to what appear to be + permissions errors; this is due to couch being unable to delete a + file while it is in use on Windows. + See also https://issues.apache.org/jira/browse/COUCHDB-326 + +* Additional help with the Windows support is needed - please contact the + couchdb-dev list if you can help. diff --git a/etc/windows/couchdb.iss.tpl b/etc/windows/couchdb.iss.tpl new file mode 100644 index 00000000..b673113e --- /dev/null +++ b/etc/windows/couchdb.iss.tpl @@ -0,0 +1,68 @@ +; Licensed under the Apache License, Version 2.0 (the "License"); you may not +; use this file except in compliance with the License. You may obtain a copy of +; the License at +; +; http://www.apache.org/licenses/LICENSE-2.0 +; +; Unless required by applicable law or agreed to in writing, software +; distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +; WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +; License for the specific language governing permissions and limitations under +; the License. + +; CouchDB inno installer script +; %configure_input% + +[Setup] +AppID=ApacheCouchDB +AppName=%package_name% +AppVerName=%package_name% %version% +AppPublisher=Apache Software Foundation +AppPublisherURL=http://couchdb.apache.org/ +LicenseFile=../../LICENSE +DefaultDirName={pf}\Apache Software Foundation\CouchDB +DefaultGroupName=%package_name% +OutputBaseFilename=setup-couchdb-%version% +OutputDir=. + +[Files] +Source: "%locallibbindir%\..\*.*"; DestDir: "{app}"; Flags: ignoreversion uninsrestartdelete restartreplace +; bin dir +Source: "%locallibbindir%\*.*"; DestDir: "{app}\bin"; Flags: ignoreversion uninsrestartdelete restartreplace recursesubdirs +; other dirs copied '*.*' +Source: "%locallibbindir%\..\erts-5.7.2\*.*"; DestDir: "{app}\erts-5.7.2"; Flags: ignoreversion uninsrestartdelete restartreplace recursesubdirs +Source: "%locallibbindir%\..\lib\*.*"; DestDir: "{app}\lib"; Flags: ignoreversion uninsrestartdelete restartreplace recursesubdirs +Source: "%locallibbindir%\..\share\*.*"; DestDir: "{app}\share"; Flags: ignoreversion uninsrestartdelete restartreplace recursesubdirs +Source: "%locallibbindir%\..\releases\*.*"; DestDir: "{app}\releases"; Flags: ignoreversion uninsrestartdelete restartreplace recursesubdirs +; skip ./usr, ./var + +; custom stuff... +; ./etc/default.ini is unconditional +Source: "%locallibbindir%\..\etc\couchdb\default.ini"; DestDir: "{app}\etc\couchdb"; Flags: ignoreversion uninsrestartdelete restartreplace +; ./etc/local.ini is preserved and should not be updated if it exists +Source: "%locallibbindir%\..\etc\couchdb\local.ini"; DestDir: "{app}\etc\couchdb"; Flags: onlyifdoesntexist uninsneveruninstall +; readme +Source: "README.txt"; DestDir: "{app}"; Flags: isreadme + +; msvc redists - see comments in configure.ac for notes about these... +; ( deleteafterinstall - not needed - {tmp} auto cleaned???? +Source: "%msvc_redist_dir%\%msvc_redist_name%"; DestDir: "{tmp}"; Flags: deleteafterinstall + +; These are erlang requirements and not copied by our makefiles. +Source: "%openssl_bin_dir%\ssleay32.dll"; DestDir: "{app}\bin"; Flags: ignoreversion uninsrestartdelete restartreplace +Source: "%openssl_bin_dir%\libeay32.dll"; DestDir: "{app}\bin"; Flags: ignoreversion uninsrestartdelete restartreplace + +[Dirs] +Name: "{app}\var\lib\couchdb"; Permissions: authusers-modify +Name: "{app}\var\log\couchdb"; Permissions: authusers-modify +Name: "{app}\etc\couchdb"; Permissions: authusers-modify + +[Icons] +Name: "{group}\Start CouchDB"; Filename: "{app}\bin\couchdb.bat" +Name: "{group}\Futon (CouchDB web interface)"; Filename: "http://127.0.0.1:5984/_utils" +Name: "{group}\CouchDB Web Site"; Filename: "http://couchdb.apache.org/" + +[Run] +Filename: "{tmp}\%msvc_redist_name%"; Parameters: "/q" +; This is erlang's Install.exe which updates erl.ini correctly. +Filename: "{app}\Install.exe"; Parameters: "-s"; Flags: runhidden diff --git a/src/couchdb/Makefile.am b/src/couchdb/Makefile.am index 2fc2340a..2459ca8f 100644 --- a/src/couchdb/Makefile.am +++ b/src/couchdb/Makefile.am @@ -40,9 +40,6 @@ couchjs_LDADD = $(CURL_LDFLAGS) @JSLIB@ if WINDOWS couch_erl_driver_la_LDFLAGS += -no-undefined -# copy ICU dlls for the erlang driver -#dist_couch_erl_driver_la_DATA=$(ICU_LOCAL_BIN)/icuuc42.dll $(ICU_LOCAL_BIN)/icudt42.dll $(ICU_LOCAL_BIN)/icuin42.dll -couch_erl_driver_ladir=$(bindir) endif couchinclude_DATA = couch_db.hrl @@ -196,16 +193,28 @@ compiled_files = \ # couch_util.html \ # couch_view.html +if WINDOWS couch.app: couch.app.tpl modules=`find . -name "couch*.erl" -exec basename {} .erl \; | tr '\n' ',' | sed "s/,$$//"`; \ sed -e "s|%package_name%|@package_name@|g" \ -e "s|%version%|@version@|g" \ -e "s|@modules@|$$modules|g" \ + -e "s|%localconfdir%|../etc/couchdb|g" \ + -e "s|@defaultini@|default.ini|g" \ + -e "s|@localini@|local.ini|g" > \ + $@ < $< +else +couch.app: couch.app.tpl + modules=`find . -name "*.erl" -exec basename {} .erl \; | tr '\n' ',' | sed "s/,$$//"`; \ + sed -e "s|%package_name%|@package_name@|g" \ + -e "s|%version%|@version@|g" \ + -e "s|@modules@|$$modules|g" \ -e "s|%localconfdir%|@localconfdir@|g" \ -e "s|@defaultini@|default.ini|g" \ -e "s|@localini@|local.ini|g" > \ $@ < $< chmod +x $@ +endif # $(dist_devdoc_DATA): edoc-info @@ -220,6 +229,12 @@ install-data-hook: cd "$(DESTDIR)$(couchprivlibdir)" && \ $(LN_S) couch_erl_driver couch_erl_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) $(JS_LIB_BINARY) $(bindir) +endif uninstall-local: if test -f "$(DESTDIR)$(couchprivlibdir)/couch_erl_driver"; then \ |