This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] setup.exe


As requested by Corinna on the Cygwin list, here's a patch to document
some recent changes in the build environment.

>From 3dd23c6063a3edb8bfd1874f5b3c68baf0a89ec4 Mon Sep 17 00:00:00 2001
From: Achim Gratz <Achim.Gratz@Infineon.com>
Date: Fri, 18 Jan 2013 14:24:13 +0100
Subject: [PATCH 1/3] README: document some recent changes in the build
 environment

* setup/README (HOW TO BUILD): Cross compiler package is now named
  mingw-gcc-g++, also mention package upx as an optional dependency.
  Document the requirement of libgetopt++ as a subdirectory in the
  main source tree.  Change the bootstrap stanza to take place in the
  source tree since an out-of-tree build doesn't seem to work (if it
  does, it apparently has additional requirements that I haven't
  figured out).
---
 setup/README | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/setup/README b/setup/README
index 2f36fb8..d5b0240 100755
--- a/setup/README
+++ b/setup/README
@@ -5,7 +5,7 @@ HOW TO BUILD:
 -------------
 Setup should build out-of-the-box on any Cygwin environment that has all the
 required packages installed:
-  - gcc-mingw-g++
+  - mingw-gcc-g++
   - make
   - mingw-bzip2
   - mingw-libgcrypt-devel
@@ -13,6 +13,7 @@ required packages installed:
   - mingw-zlib
   - and all packages that are dependencies of the above, i.e.  gcc-mingw-core,
     mingw-runtime, binutils, w*api, etc.
+  - upx (optional)
 
 The following additional packages are required if building from CVS, not from
 a source tarball, or if you want to make changes to the build system.
@@ -22,9 +23,14 @@ a source tarball, or if you want to make changes to the build system.
   - flex
   - bison
 
+Additionally, libgetopt++ (also available from the cygwin-apps CVS at
+sourceware.org) must be available directly as a subdirectory
+libgetopt++ within the setup source directory.
+
 Build commands:
 1) Configure using this option
-   $ /path/to/setup/bootstrap.sh
+   $ cd /path/to/setup
+   $ ./bootstrap.sh
    This will automatically rebuild configure files and run configure in the
    current directory.
 2) $ make
-- 
1.8.1

A second patch adds two new targets for the makefile to strip and
compress setup.exe.

>From ba454956b3e934cf767c9cc57ffbe090acd9437e Mon Sep 17 00:00:00 2001
From: Achim Gratz <Achim.Gratz@Infineon.com>
Date: Fri, 18 Jan 2013 14:33:29 +0100
Subject: [PATCH 2/3] Makefile: additional targets "strip" and "upx"

* setup/Makefile.am: Provide new targets "strip" and "upx" to remove
  debugging symbols and compress the executable using UPX,
  respectively.  Check for an executable "upx" in path and bail with a
  warning message if not found.

* setup/README: Change the description of how to produce stripped and
  compressed binaries to use the new make targets.
---
 setup/Makefile.am | 11 +++++++++++
 setup/README      |  9 +++++----
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/setup/Makefile.am b/setup/Makefile.am
index 7bd4546..6d06f01 100755
--- a/setup/Makefile.am
+++ b/setup/Makefile.am
@@ -299,3 +299,14 @@ setup-src:
 	sort | tar -T - -cjf ${CURDIR}/$$ver-src.tar.bz2;\
 	echo $$ver-src.tar.bz2; exec rm -f $$ver
 
+# optional: strip and compress executable
+.PHONY:	strip upx
+
+strip:	all
+	$(STRIP) -s setup$(EXEEXT)
+upx:	strip
+	@if [ -e `which upx` ]; then\
+		upx -9 setup$(EXEEXT) ;\
+	else \
+		echo "UPX doesn't seem to be installed, cannot compress setup$(EXEEXT)." ;\
+	fi
diff --git a/setup/README b/setup/README
index d5b0240..a0846be 100755
--- a/setup/README
+++ b/setup/README
@@ -36,10 +36,11 @@ Build commands:
 2) $ make
 
 3) Wondering why your binary is so much bigger than the official releases?
-   Remove debugging symbols:
-   $ strip -s setup.exe
-   Compress using UPX:
-   $ upx -9 setup.exe
+   This removes debugging symbols:
+   $ make strip
+   This additionally compresses it using UPX
+   (requires package upx to be installed):
+   $ make upx
 
 CODING GUIDELINES:
 ------------------
-- 
1.8.1

I#ll also offer a third patch that adds an option to setup.exe to enable
the use of (local) ini files with a different basename than "setup".
This is useful to offer (in the same install hierarchy) multiple
installations, either for having different configurations or to allow
individual installations to be rolled back.  The idea is to copy the
setup.ini to something like release_2013-01-18.ini whenever a release is
made and let setup.ini keep going forward for testing without having to
duplicate the complete install hierarchy.

>From a69118718bd5e7ac0ca22d36480fefa992da449c Mon Sep 17 00:00:00 2001
From: Achim Gratz <Achim.Gratz@Infineon.com>
Date: Fri, 18 Jan 2013 17:05:52 +0100
Subject: [PATCH 3/3] Allow a different basename (instead of "setup")

* setup/ini.h: Modify macro definition to pick up name from external
  variable SetupBaseName instead of string constant.

* setup/main.cc: New string option "-I" aka "--ini-basename" to feed
  basename into setup.  Copy resulting string to the exported
  variable SetupBaseName.
---
 setup/ini.h   | 6 ++++--
 setup/main.cc | 5 +++++
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/setup/ini.h b/setup/ini.h
index 7276e0a..cf26aa1 100755
--- a/setup/ini.h
+++ b/setup/ini.h
@@ -39,8 +39,10 @@ typedef enum
 } excludes;
 
 extern bool is_legacy;
-#define SETUP_INI_FILENAME (is_legacy ? "setup-legacy.ini" : "setup.ini")
-#define SETUP_BZ2_FILENAME (is_legacy ? "setup-legacy.bz2" : "setup.bz2")
+
+#define SETUP_INI_FILENAME (is_legacy ? "setup-legacy.ini" : (std::string(SetupBaseName)+".ini").c_str())
+#define SETUP_BZ2_FILENAME (is_legacy ? "setup-legacy.bz2" : (std::string(SetupBaseName)+".bz2").c_str())
+extern std::string SetupBaseName;
 
 /* The following three vars are used to facilitate error handling between the
    parser/lexer and its callers, namely ini.cc:do_remote_ini() and
diff --git a/setup/main.cc b/setup/main.cc
index dc73936..0a66e1f 100755
--- a/setup/main.cc
+++ b/setup/main.cc
@@ -67,6 +67,7 @@ static const char *cvsid =
 
 #include "getopt++/GetOption.h"
 #include "getopt++/BoolOption.h"
+#include "getopt++/StringOption.h"
 
 #include "Exception.h"
 #include <stdexcept>
@@ -91,6 +92,8 @@ bool is_legacy;
 static BoolOption UnattendedOption (false, 'q', "quiet-mode", "Unattended setup mode");
 static BoolOption PackageManagerOption (false, 'M', "package-manager", "Semi-attended chooser-only mode");
 static BoolOption HelpOption (false, 'h', "help", "print help");
+static StringOption SetupBaseNameOpt ("blafasel", 'I', "ini-basename", "Use a different basename instead of setup", false);
+std::string SetupBaseName;
 static BOOL WINAPI (*dyn_AttachConsole) (DWORD);
 static BOOL WINAPI (*dyn_GetLongPathName) (LPCTSTR, LPTSTR, DWORD);
 
@@ -289,6 +292,8 @@ WinMain (HINSTANCE h,
     if (unattended_mode || HelpOption)
       set_cout ();
 
+    SetupBaseName = SetupBaseNameOpt;
+
     LogSingleton::SetInstance (*(theLog = LogFile::createLogFile ()));
     const char *sep = isdirsep (local_dir[local_dir.size () - 1]) ? "" : "\\";
     theLog->setFile (LOG_BABBLE, local_dir + sep + "setup.log.full", false);
-- 
1.8.1

This is certainly not the most elegant way to do this, but I was more
concerned to not change most code.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptations for Waldorf Q V3.00R3 and Q+ V3.54R2:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]