r15528 - gnucash/trunk/packaging/win32 - Install.sh: Add exetype.pl, hide gconfd-2.exe window.

Andreas Köhler andi5 at cvs.gnucash.org
Thu Feb 8 16:16:30 EST 2007


Author: andi5
Date: 2007-02-08 16:16:30 -0500 (Thu, 08 Feb 2007)
New Revision: 15528
Trac: http://svn.gnucash.org/trac/changeset/15528

Added:
   gnucash/trunk/packaging/win32/exetype.pl
Modified:
   gnucash/trunk/packaging/win32/custom.sh
   gnucash/trunk/packaging/win32/install.sh
Log:
Install.sh: Add exetype.pl, hide gconfd-2.exe window.

exetype.pl is a perl script that sets the subsystem type of executables
to CONSOLE or WINDOWS (GUI). Apply that to gconfd-2.exe to hide the
console. Editbin.exe could do the same.


Modified: gnucash/trunk/packaging/win32/custom.sh
===================================================================
--- gnucash/trunk/packaging/win32/custom.sh	2007-02-08 20:50:29 UTC (rev 15527)
+++ gnucash/trunk/packaging/win32/custom.sh	2007-02-08 21:16:30 UTC (rev 15528)
@@ -93,6 +93,9 @@
 PEXPORTS_URL="http://www.emmestech.com/software/cygwin/pexports-0.43/pexports-0.43.zip"
 PEXPORTS_DIR=$GLOBAL_DIR\\tools
 
+EXETYPE_SCRIPT=`pwd`/exetype.pl
+EXETYPE_DIR=$GLOBAL_DIR\\tools
+
 LIBXML2_URL="http://www.zlatkovic.com/pub/libxml/libxml2-2.6.27.win32.zip"
 LIBXML2_DIR=$GLOBAL_DIR\\gnome #avoid XML_FLAGS
 
@@ -208,6 +211,7 @@
  add_step inst_openssl
 fi
 add_step inst_pexports
+add_step inst_exetype
 add_step inst_libxml2
 add_step inst_gnome
 add_step inst_swig

Added: gnucash/trunk/packaging/win32/exetype.pl
===================================================================
--- gnucash/trunk/packaging/win32/exetype.pl	2007-02-08 20:50:29 UTC (rev 15527)
+++ gnucash/trunk/packaging/win32/exetype.pl	2007-02-08 21:16:30 UTC (rev 15528)
@@ -0,0 +1,28 @@
+#!/usr/bin/env perl
+
+# URL: http://jenda.krynicky.cz/perl/GUIscripts.html
+# code by: Jan Dubois <jand at ActiveState.com>
+
+use strict;
+unless (@ARGV == 2) {
+    print "Usage: $0 exefile [CONSOLE|WINDOWS]\n";
+    exit;
+}
+unless ($ARGV[1] =~ /^(console|windows)$/i) {
+    print "Invalid subsystem $ARGV[1], please use CONSOLE or WINDOWS\n";
+    exit;
+}
+my ($record,$magic,$offset,$size);
+open EXE, "+< $ARGV[0]" or die "Cannot open $ARGV[0]: $!";
+binmode EXE;
+read EXE, $record, 32*4;
+($magic,$offset) = unpack "Sx58L", $record;
+die "Not an MSDOS executable file" unless $magic == 0x5a4d;
+seek EXE, $offset, 0;
+read EXE, $record, 24;
+($magic,$size) = unpack "Lx16S", $record;
+die "PE header not found" unless $magic == 0x4550;
+die "Optional header not in NT32 format" unless $size == 224;
+seek EXE, $offset+24+68, 0;
+print EXE pack "S", uc($ARGV[1]) eq 'CONSOLE' ? 3 : 2;
+close EXE;

Modified: gnucash/trunk/packaging/win32/install.sh
===================================================================
--- gnucash/trunk/packaging/win32/install.sh	2007-02-08 20:50:29 UTC (rev 15527)
+++ gnucash/trunk/packaging/win32/install.sh	2007-02-08 21:16:30 UTC (rev 15528)
@@ -370,6 +370,21 @@
     quiet which pexports || die "pexports unavailable"
 }
 
+function inst_exetype() {
+    setup exetype
+    _EXETYPE_UDIR=`unix_path $EXETYPE_DIR`
+    add_to_env $_EXETYPE_UDIR/bin PATH
+    if quiet which exetype
+    then
+        echo "exetype already installed.  skipping."
+    else
+        mkdir -p $_EXETYPE_UDIR/bin
+        cp $EXETYPE_SCRIPT $_EXETYPE_UDIR/bin/exetype
+    fi
+    quiet which exetype || die "exetype unavailable"
+}
+
+
 function inst_libxml2() {
     setup LibXML2
     _LIBXML2_UDIR=`unix_path $LIBXML2_DIR`
@@ -482,6 +497,10 @@
                     mv libz.dll.a ../lib
                 qpopd
             fi
+            if [ ! -f libexec/gconfd-2.console.exe ]; then
+                cp libexec/gconfd-2.exe libexec/gconfd-2.console.exe
+                exetype libexec/gconfd-2.exe windows
+            fi
             # work around a bug in msys bash, adding 0x01 smilies
             cat > bin/pkg-config-msys.sh <<EOF
 #!/bin/sh



More information about the gnucash-changes mailing list