From 648547fd9feefef6f73f26487296c27f1fe72ac0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=B6hler?= Date: Thu, 8 Feb 2007 21:16:30 +0000 Subject: [PATCH] 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. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15528 57a11ea4-9604-0410-9ed3-97b8803252fd --- packaging/win32/custom.sh | 4 ++++ packaging/win32/exetype.pl | 28 ++++++++++++++++++++++++++++ packaging/win32/install.sh | 19 +++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 packaging/win32/exetype.pl diff --git a/packaging/win32/custom.sh b/packaging/win32/custom.sh index a1a51e37c2..37ee43d9cf 100644 --- a/packaging/win32/custom.sh +++ b/packaging/win32/custom.sh @@ -93,6 +93,9 @@ OPENSSL_DIR=$GLOBAL_DIR\\openssl 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 @@ if test x$cross_compile != xyes ; then 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 diff --git a/packaging/win32/exetype.pl b/packaging/win32/exetype.pl new file mode 100644 index 0000000000..36abd71da1 --- /dev/null +++ b/packaging/win32/exetype.pl @@ -0,0 +1,28 @@ +#!/usr/bin/env perl + +# URL: http://jenda.krynicky.cz/perl/GUIscripts.html +# code by: Jan Dubois + +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; diff --git a/packaging/win32/install.sh b/packaging/win32/install.sh index 6531be54d7..b29dc9f25d 100644 --- a/packaging/win32/install.sh +++ b/packaging/win32/install.sh @@ -370,6 +370,21 @@ function inst_pexports() { 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 @@ function inst_gnome() { 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 <