diff --git a/packaging/win32/README b/packaging/win32/README index 6bc0b0b6d9..a977b71e5f 100644 --- a/packaging/win32/README +++ b/packaging/win32/README @@ -5,7 +5,8 @@ For cross-compiling the windows executable on Linux, see the lower section of this file. Before you start with the automated build, you have to complete these -steps manually. The directory variables are set in custom.sh. +steps manually. The directory variables are set in `defaults' and optionally +`custom'. * Download MSYS (but *only* msys; no mingw and no msysdtk) from http://www.mingw.org/download.shtml -> Current -> MSYS -> (bin, *.exe) @@ -18,13 +19,9 @@ to $MSYS_DIR from http://www.mingw.org/download.shtml -> Current -> mingwPORT -> (bin, wget-*) to $DOWNLOAD_DIR -* Adjust custom.sh (install.sh doesn't need to be changed). In - custom.sh you should adapt the directory variables. If you want to, - you could also comment out those build steps that have been - completed already and/or should not be performed now, although the - script is quite intelligent not to duplicate already completed - work. If you want verbose output of any script step, change the - first line in install.sh and add the "-x" switch. +* Look at defaults and optionally create a file named custom to specify + adapted directory variables. If you want verbose output of any script + step, add "set -x" to custom. Start/Enter any MSYS shell window. Let the automated build begin by: @@ -57,19 +54,19 @@ These steps need to be performed: script create_cross_mingw.sh - it will download, compile, and install a mingw32 toolchain. -2. Edit the file custom.sh: Make a globale search-and-replace of +2. Edit the file defaults: Make a global search-and-replace of '\\' into '/' so that all directories are specified in unix conventions. Set the variable cross_compile to "yes". Then - adjust the directories in custom.sh according to your + adjust the directories in defaults according to your preferred installation, especially $GLOBAL_DIR. 3. Download a binary windows packages for "guile" e.g. from http://www.tu-harburg.de/~et2cs/gnc/ and unpack it into the - directory $GUILE_DIR as given in custom.sh. (This is done because + directory $GUILE_DIR as given in defaults. (This is done because the build system for guile doesn't support cross-compiling.) 4. Call install.sh, which will read the directory settings from - custom.sh. It should download, compile, and install everything + defaults. It should download, compile, and install everything automatically. Eventually the windows gnucash is installed into $GNUCASH_DIR. diff --git a/packaging/win32/custom.sh b/packaging/win32/defaults similarity index 93% rename from packaging/win32/custom.sh rename to packaging/win32/defaults index ee21fb2ef5..42e2b86b2d 100644 --- a/packaging/win32/custom.sh +++ b/packaging/win32/defaults @@ -1,9 +1,17 @@ #!/bin/sh # for emacs # -# all directories should be without spaces! +# Instead of just editing this file, it is recommended to create a file `custom' +# in the same directory that will be read in at the end of this script. +# +# You can use the full power of bash 2.04 scripting. In particular you can +# override any variable set here, add steps (use add_step and implement +# function ()), remove steps (use remove_step ) and more. +# Keep in mind that this might render install.sh & friends non-functional. +# +# Note: All directories must be without spaces! -[ "$__SOURCED_CUSTOM_SH" ] && return -__SOURCED_CUSTOM_SH=1 +[ "$__SOURCED_DEFAULTS" ] && return +__SOURCED_DEFAULTS=1 GLOBAL_DIR=c:\\soft TMP_DIR=$GLOBAL_DIR\\tmp @@ -250,3 +258,8 @@ add_step inst_svn add_step svn_up add_step inst_gnucash add_step inst_docs + + +### read custom +[ -f "custom" ] && . custom || true +### end of script diff --git a/packaging/win32/dist.sh b/packaging/win32/dist.sh index 70b5562940..36b8484d33 100644 --- a/packaging/win32/dist.sh +++ b/packaging/win32/dist.sh @@ -8,7 +8,7 @@ function unix_path() { echo "$*" | sed 's,^\([A-Za-z]\):,/\1,;s,\\,/,g'; } qpushd "$(dirname $(unix_path "$0"))" . functions -. custom.sh +. defaults register_env_var PATH ":" diff --git a/packaging/win32/functions b/packaging/win32/functions index 05f9ceb33a..4567c78453 100644 --- a/packaging/win32/functions +++ b/packaging/win32/functions @@ -2,6 +2,17 @@ __SOURCED_FUNCTIONS=1 function add_step() { steps=("${steps[@]}" "$@"); } +function remove_step() { + while [ "$1" ]; do + _steps=("${steps[@]}") + unset steps + for _step in "${_steps[@]}"; do + [ "$_step" != "$1" ] && add_step $_step + done + shift + done + unset _steps +} function quiet() { "$@" &>/dev/null; } # c:/dir/sub diff --git a/packaging/win32/install.sh b/packaging/win32/install.sh index 79fd940bc5..b1866864ea 100644 --- a/packaging/win32/install.sh +++ b/packaging/win32/install.sh @@ -8,7 +8,7 @@ function unix_path() { echo "$*" | sed 's,^\([A-Za-z]\):,/\1,;s,\\,/,g'; } qpushd "$(dirname $(unix_path "$0"))" . functions -. custom.sh +. defaults register_env_var ACLOCAL_FLAGS " " register_env_var AUTOTOOLS_CPPFLAGS " " diff --git a/packaging/win32/reset.sh b/packaging/win32/reset.sh index cdddc58a08..379bfc9ba7 100644 --- a/packaging/win32/reset.sh +++ b/packaging/win32/reset.sh @@ -2,7 +2,7 @@ set -e -#### Load Custom.sh +#### Load defaults function qpushd() { pushd "$@" >/dev/null; } function qpopd() { popd >/dev/null; } @@ -10,7 +10,7 @@ function unix_path() { echo "$*" | sed 's,^\([A-Za-z]\):,/\1,;s,\\,/,g'; } qpushd "$(dirname $(unix_path "$0"))" . functions -. custom.sh +. defaults ## too bad, bash 2.04 has no real support for arrays