gnucash-on-windows master: Multiple changes pushed

Geert Janssens gjanssens at code.gnucash.org
Tue Jun 17 09:32:45 EDT 2014


Updated	 via  https://github.com/Gnucash/gnucash-on-windows/commit/dd260065 (commit)
	 via  https://github.com/Gnucash/gnucash-on-windows/commit/d053bf20 (commit)
	 via  https://github.com/Gnucash/gnucash-on-windows/commit/914b8640 (commit)
	 via  https://github.com/Gnucash/gnucash-on-windows/commit/f1b560a0 (commit)
	 via  https://github.com/Gnucash/gnucash-on-windows/commit/83afafea (commit)
	 via  https://github.com/Gnucash/gnucash-on-windows/commit/3afabee2 (commit)
	from  https://github.com/Gnucash/gnucash-on-windows/commit/4e043a86 (commit)



commit dd26006577618469400718bec3c51a14886df79b
Author: Geert Janssens <janssens-geert at telenet.be>
Date:   Tue Jun 17 17:54:42 2014 +0200

    Don't exit with error code - that will end install.sh

diff --git a/get-install-path.vbs b/get-install-path.vbs
index 4f6e58d..3022963 100755
--- a/get-install-path.vbs
+++ b/get-install-path.vbs
@@ -30,6 +30,4 @@ For Each strSubkey In arrSubkeys
         WScript.Echo strInstallDir
         WScript.Quit 0
     End If
-Next
-
-WScript.Quit 1
\ No newline at end of file
+Next
\ No newline at end of file

commit d053bf20dd1c6af13c3975120a8c604eb369db16
Author: Geert Janssens <janssens-geert at telenet.be>
Date:   Tue Jun 17 17:40:17 2014 +0200

    Install HTML Help Workshop with elevated privileges starting from Windows Vista

diff --git a/install-impl.sh b/install-impl.sh
index 3c90d63..7e43dfb 100644
--- a/install-impl.sh
+++ b/install-impl.sh
@@ -1135,7 +1135,8 @@ function inst_hh() {
         echo "!!! Contray to older installation scripts the HtmlHelp Workshop should !!!"
         echo "!!! no longer be installed in $HH_DIR !!!"
         echo "!!! When asked for an installation path, DO NOT specify $HH_DIR !!!"
-        $LAST_FILE
+        CMD=$(basename "$LAST_FILE")
+        cscript //nologo run-as-admin.vbs $CMD "" "$DOWNLOAD_DIR"
         HH_SYS_DIR=$(cscript //nologo get-install-path.vbs)
         if [ -z "$HH_SYS_DIR" ]; then
             die "HTML Help Workshop not installed correctly (Windows installer failed for some reason)"
diff --git a/run-as-admin.vbs b/run-as-admin.vbs
new file mode 100644
index 0000000..3817432
--- /dev/null
+++ b/run-as-admin.vbs
@@ -0,0 +1,77 @@
+' Attempt to run the command passed with administrator privileges
+' on Windows versions starting from Vista
+' On Windows XP it will just run the command with current privileges
+
+' Note: this script uses ShellExecute to elevate privileges when
+' necessary. This command however is asynchronous but we want to
+' wait for it to finish.
+' There is no good universal way to do this. I have chosen to
+' read the running processes list and wait for as long as the name of the requested
+' command is still in the list. This as limitations:
+' - if the started command immediatly starts another command and then quits
+'   this test will fail and run-as admin.vbs script will exit too soon
+' - if a command appears with a different name in the process list than what is
+'   passed as argument, this will fail as well
+' - if more than one instance of the command are running, run-as-admin.vbs will
+'   only quit if all instances have exited.
+' For our limited purposes this is ok for now (we only wait for a windows installer
+' to finish)
+
+' Parameters:
+' - strInstFile: name of the command to run, without path
+' - strInstParms: parameters to pass to the command
+' - strInstPath: directory in which the command is stored if not in the system path
+' Note: if you don't have any parameters to add to the command call, you still need
+'       to set strInstParms to the empty string ("")
+
+strInstFile = WScript.Arguments (0)
+strInstPath = WScript.Arguments (1)
+strInstPath = WScript.Arguments (2)
+
+' Read OS version number
+strComputer = "."
+Set objWMIService = GetObject("winmgmts:" _
+    & "{impersonationLevel=impersonate}!\\" _
+    & strComputer & "\root\cimv2")
+Set colOperatingSystems = objWMIService.ExecQuery _
+    ("Select * from Win32_OperatingSystem")
+For Each objOperatingSystem in colOperatingSystems
+    strVersion = objOperatingSystem.Version
+Next
+
+' Parse only major version.
+' Windows Vista is version 6.0 so any Windows version with a major
+' version >= 6 needs elevated privileges
+' Note this ignores various Windows server editions between XP and Vista
+' assuming those are not used for gnucash development
+Set objRegExp = new RegExp
+objRegExp.Global = True
+objRegExp.Pattern = "\..*"
+strMajor = objRegExp.Replace (strVersion, "")
+
+If cint (strMajor = 5) Then
+    ' Windows XP - just execute without any extras
+    strCommand = "open"
+Else
+    ' Windows Vista or up - run with elevated privileges
+    strCommand = "runas"
+End If
+
+
+set objShell = CreateObject("shell.application")
+objShell.ShellExecute strInstFile, strInstParms, strInstPath, strCommand, 1
+
+WScript.Sleep 100
+Set objShell2 = WScript.CreateObject("WScript.Shell")
+Set objExecObject = objShell2.Exec("cscript //nologo get-install-path.vbs")
+
+Do
+    WScript.Sleep 100
+    bStillRunning = False
+    For Each objProcess In objWMIService.InstancesOf("Win32_process")
+        If objProcess.Name = strInstFile Then
+            bStillRunning = True
+            Exit For
+        End If
+    Next
+Loop While bStillRunning = True
\ No newline at end of file

commit 914b8640fbfc8419ad81a1ed18424b63ce5d9737
Author: Geert Janssens <janssens-geert at telenet.be>
Date:   Mon Jun 16 23:00:34 2014 +0200

    Issue warning if html help workshop is installed on HH_DIR
    
    And explain how to fix it for the future

diff --git a/install-impl.sh b/install-impl.sh
index b33db87..3c90d63 100644
--- a/install-impl.sh
+++ b/install-impl.sh
@@ -1141,9 +1141,20 @@ function inst_hh() {
             die "HTML Help Workshop not installed correctly (Windows installer failed for some reason)"
         fi
     fi
-    
+
     _HH_UDIR=`unix_path $HH_DIR`
     _HH_SYS_UDIR="`unix_path $HH_SYS_DIR`"
+    if [ "$_HH_UDIR" = "$_HH_SYS_UDIR" ]; then
+        echo "Warning: Installing HTML Help Workshop inside the gnucash development directory is no longer recommended."
+        echo "         The script will proceed in $HH_DIR\\mingw for now."
+        echo "         To fix this for future safety, you should"
+        echo "         - uninstall HTML Help Workshop"
+        echo "         - delete directory $HH_DIR and all of its remaining content"
+        echo "         - rerun install.sh"
+        echo
+        _HH_UDIR="$_HH_UDIR/mingw"
+    fi
+
     add_to_env "-I$_HH_SYS_UDIR/include" HH_CPPFLAGS
     add_to_env -L$_HH_UDIR/lib HH_LDFLAGS
     add_to_env $_HH_UDIR PATH

commit f1b560a0dbb74cdf0fae0abba1e949c5252e84d0
Author: Geert Janssens <janssens-geert at telenet.be>
Date:   Mon Jun 16 22:48:03 2014 +0200

    Introduce vbscript to check if/where HTML Help is installed
    
    This allows htmlhelp to be installed anywhere on the system
    and be shared by multiple build trees as well.
    
    Note: it should *not* be installed anymore in HH_DIR !

diff --git a/get-install-path.vbs b/get-install-path.vbs
new file mode 100755
index 0000000..4f6e58d
--- /dev/null
+++ b/get-install-path.vbs
@@ -0,0 +1,35 @@
+' This helper script will try to determine the installation directory
+' for HTML Help Workshop. If found it will be returned on stdout
+'
+' Exit codes:
+'    0 if program was found to be installed
+'    1 if program was not found to be installed
+
+' Note: the script works as follows
+'    - it will query the Uninstall information in the Windows registry
+'    - when it finds uninstall information for HTML Help Workshop it will read the uninstall string
+'    - and will extract the installation path from this string
+
+Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
+
+strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
+strDisplayName = "DisplayName"
+strUninstallString = "UninstallString"
+
+Set objReg = GetObject("winmgmts://./root/default:StdRegProv")
+objReg.EnumKey HKLM, strKey, arrSubkeys
+
+For Each strSubkey In arrSubkeys
+    intRet1 = objReg.GetStringValue(HKLM, strKey & strSubkey, strDisplayName, strValue)
+    If strValue = "HTML Help Workshop" Then
+        intRet1 = objReg.GetStringValue(HKLM, strKey & strSubkey, strUninstallString, strValue)
+        Set myRegExp = new RegExp
+        myRegExp.Global = True
+        myRegExp.Pattern = "\\setup.exe.*"
+        strInstallDir = myRegExp.Replace (strValue, "")
+        WScript.Echo strInstallDir
+        WScript.Quit 0
+    End If
+Next
+
+WScript.Quit 1
\ No newline at end of file
diff --git a/install-impl.sh b/install-impl.sh
index db7200c..b33db87 100644
--- a/install-impl.sh
+++ b/install-impl.sh
@@ -1121,35 +1121,46 @@ int main(int argc, char **argv) {
   return 0;
 }
 EOF
-        gcc -shared -o ofile.dll ofile.c $HH_CPPFLAGS $HH_LDFLAGS -lhtmlhelp || return 1
+        gcc -shared -o ofile.dll ofile.c "$HH_CPPFLAGS" "$HH_LDFLAGS" -lhtmlhelp || return 1
     qpopd
 }
 
 function inst_hh() {
     setup HTML Help Workshop
+    HH_SYS_DIR=$(cscript //nologo get-install-path.vbs)
+    if [ -z "$HH_SYS_DIR" ]; then
+        smart_wget $HH_URL $DOWNLOAD_DIR
+        echo "!!! Attention !!!"
+        echo "!!! This is the only installation step that requires your direct input !!!"
+        echo "!!! Contray to older installation scripts the HtmlHelp Workshop should !!!"
+        echo "!!! no longer be installed in $HH_DIR !!!"
+        echo "!!! When asked for an installation path, DO NOT specify $HH_DIR !!!"
+        $LAST_FILE
+        HH_SYS_DIR=$(cscript //nologo get-install-path.vbs)
+        if [ -z "$HH_SYS_DIR" ]; then
+            die "HTML Help Workshop not installed correctly (Windows installer failed for some reason)"
+        fi
+    fi
+    
     _HH_UDIR=`unix_path $HH_DIR`
-    add_to_env -I$_HH_UDIR/include HH_CPPFLAGS
+    _HH_SYS_UDIR="`unix_path $HH_SYS_DIR`"
+    add_to_env "-I$_HH_SYS_UDIR/include" HH_CPPFLAGS
     add_to_env -L$_HH_UDIR/lib HH_LDFLAGS
     add_to_env $_HH_UDIR PATH
     if quiet test_for_hh
     then
         echo "html help workshop already installed in $_HH_UDIR.  skipping."
     else
-        smart_wget $HH_URL $DOWNLOAD_DIR
-        echo "!!! Attention !!!"
-        echo "!!! This is the only installation step that requires your direct input !!!"
-        echo "!!! When asked for an installation path, specify $HH_DIR !!!"
-        $LAST_FILE
-        qpushd $HH_DIR
-           _HHCTRL_OCX=$(which hhctrl.ocx || true)
-           [ "$_HHCTRL_OCX" ] || die "Did not find hhctrl.ocx"
-           pexports -h include/htmlhelp.h $_HHCTRL_OCX > lib/htmlhelp.def
-           qpushd lib
-               ${DLLTOOL} -k -d htmlhelp.def -l libhtmlhelp.a
-               mv htmlhelp.lib htmlhelp.lib.bak
-           qpopd
+        mkdir -p $_HH_UDIR/lib
+        _HHCTRL_OCX=$(which hhctrl.ocx || true)
+        [ "$_HHCTRL_OCX" ] || die "Did not find hhctrl.ocx"
+        qpushd "$_HH_SYS_UDIR"
+            pexports -h include/htmlhelp.h $_HHCTRL_OCX > $_HH_UDIR/lib/htmlhelp.def
+        qpopd
+        qpushd $_HH_UDIR/lib
+            ${DLLTOOL} -k -d htmlhelp.def -l libhtmlhelp.a
         qpopd
-        quiet test_for_hh || die "html help workshop not installed correctly"
+        quiet test_for_hh || die "HTML Help Workshop not installed correctly (link test failed)"
     fi
 }
 
@@ -1243,8 +1254,8 @@ function inst_gnucash() {
             --enable-binreloc \
             --enable-locale-specific-tax \
             --with-boost=${BOOST_ROOT} \
-            CPPFLAGS="${REGEX_CPPFLAGS} ${GNOME_CPPFLAGS} ${GUILE_CPPFLAGS} ${LIBDBI_CPPFLAGS} ${KTOBLZCHECK_CPPFLAGS} ${HH_CPPFLAGS} ${LIBSOUP_CPPFLAGS} -D_WIN32 ${EXTRA_CFLAGS}" \
-            LDFLAGS="${REGEX_LDFLAGS} ${GNOME_LDFLAGS} ${GUILE_LDFLAGS} ${LIBDBI_LDFLAGS} ${KTOBLZCHECK_LDFLAGS} ${HH_LDFLAGS} -L${_SQLITE3_UDIR}/lib -L${_ENCHANT_UDIR}/lib -L${_LIBXSLT_UDIR}/lib -L${_MINGW_UDIR}/lib" \
+            CPPFLAGS="${REGEX_CPPFLAGS} ${GNOME_CPPFLAGS} ${GUILE_CPPFLAGS} ${LIBDBI_CPPFLAGS} ${KTOBLZCHECK_CPPFLAGS} "${HH_CPPFLAGS}" ${LIBSOUP_CPPFLAGS} -D_WIN32 ${EXTRA_CFLAGS}" \
+            LDFLAGS="${REGEX_LDFLAGS} ${GNOME_LDFLAGS} ${GUILE_LDFLAGS} ${LIBDBI_LDFLAGS} ${KTOBLZCHECK_LDFLAGS} "${HH_LDFLAGS}" -L${_SQLITE3_UDIR}/lib -L${_ENCHANT_UDIR}/lib -L${_LIBXSLT_UDIR}/lib -L${_MINGW_UDIR}/lib" \
             PKG_CONFIG_PATH="${PKG_CONFIG_PATH}"
 
         make

commit 83afafeabbe5608ad93030d4762fc8bbf3fde1f4
Author: Geert Janssens <janssens-geert at telenet.be>
Date:   Mon Jun 16 22:47:15 2014 +0200

    Move extra distributables into subdirectory

diff --git a/dist-impl.sh b/dist-impl.sh
index e97c131..3617d2c 100755
--- a/dist-impl.sh
+++ b/dist-impl.sh
@@ -239,7 +239,7 @@ function dist_gnucash() {
     cp -a $_INSTALL_UDIR/lib/lib*.la $_DIST_UDIR/bin
     mkdir -p $_DIST_UDIR/share
     cp -a $_INSTALL_UDIR/share/{doc,gnucash,locale,glib-2.0} $_DIST_UDIR/share
-    cp -a $_GC_WIN_REPOS_UDIR/{getperl.vbs,gnc-path-check,install-fq-mods.cmd} $_DIST_UDIR/bin
+    cp -a $_GC_WIN_REPOS_UDIR/extra_dist/{getperl.vbs,gnc-path-check,install-fq-mods.cmd} $_DIST_UDIR/bin
 
     _QTDIR_WIN=$(unix_path $QTDIR | sed 's,^/\([A-Za-z]\)/,\1:/,g' )
     # aqbanking >= 5.0.0
diff --git a/getperl.vbs b/extra_dist/getperl.vbs
similarity index 100%
rename from getperl.vbs
rename to extra_dist/getperl.vbs
diff --git a/gnc-path-check b/extra_dist/gnc-path-check
similarity index 100%
rename from gnc-path-check
rename to extra_dist/gnc-path-check
diff --git a/install-fq-mods.cmd b/extra_dist/install-fq-mods.cmd
similarity index 100%
rename from install-fq-mods.cmd
rename to extra_dist/install-fq-mods.cmd

commit 3afabee2bb0005d9e7b9ba99f11c33e56f166c6f
Author: Geert Janssens <janssens-geert at telenet.be>
Date:   Fri Jun 6 17:26:27 2014 +0200

    Fix PKG_CONFIG environment variable setup

diff --git a/install.sh b/install.sh
index 3481981..ec5065e 100644
--- a/install.sh
+++ b/install.sh
@@ -47,7 +47,7 @@ register_env_var KTOBLZCHECK_LDFLAGS " "
 register_env_var PATH ":"
 register_env_var PCRE_CPPFLAGS " "
 register_env_var PCRE_LDFLAGS " "
-register_env_var PKG_CONFIG ":" ""
+register_env_var PKG_CONFIG " "
 register_env_var PKG_CONFIG_PATH ":"
 register_env_var READLINE_CPPFLAGS " "
 register_env_var READLINE_LDFLAGS " "



Summary of changes:
 dist-impl.sh                                       |  2 +-
 getperl.vbs => extra_dist/getperl.vbs              |  0
 gnc-path-check => extra_dist/gnc-path-check        |  0
 .../install-fq-mods.cmd                            |  0
 get-install-path.vbs                               | 33 ++++++++++
 install-impl.sh                                    | 59 ++++++++++++-----
 install.sh                                         |  2 +-
 run-as-admin.vbs                                   | 77 ++++++++++++++++++++++
 8 files changed, 153 insertions(+), 20 deletions(-)
 rename getperl.vbs => extra_dist/getperl.vbs (100%)
 rename gnc-path-check => extra_dist/gnc-path-check (100%)
 rename install-fq-mods.cmd => extra_dist/install-fq-mods.cmd (100%)
 create mode 100755 get-install-path.vbs
 create mode 100644 run-as-admin.vbs



More information about the gnucash-changes mailing list