public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
* [PATCH] setup.exe
@ 2013-01-18 17:24 Achim Gratz
  2013-01-18 18:28 ` Ken Brown
                   ` (2 more replies)
  0 siblings, 3 replies; 58+ messages in thread
From: Achim Gratz @ 2013-01-18 17:24 UTC (permalink / raw)
  To: cygwin-apps

[-- Attachment #1: Type: text/plain, Size: 118 bytes --]

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-README-document-some-recent-changes-in-the-build-env.patch --]
[-- Type: text/x-patch, Size: 2002 bytes --]

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


[-- Attachment #3: Type: text/plain, Size: 88 bytes --]


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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0002-Makefile-additional-targets-strip-and-upx.patch --]
[-- Type: text/x-patch, Size: 1778 bytes --]

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


[-- Attachment #5: Type: text/plain, Size: 535 bytes --]


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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: 0003-Allow-a-different-basename-instead-of-setup.patch --]
[-- Type: text/x-patch, Size: 2604 bytes --]

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


[-- Attachment #7: Type: text/plain, Size: 305 bytes --]


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

^ permalink raw reply	[flat|nested] 58+ messages in thread

end of thread, other threads:[~2013-02-18 19:01 UTC | newest]

Thread overview: 58+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-18 17:24 [PATCH] setup.exe Achim Gratz
2013-01-18 18:28 ` Ken Brown
2013-01-18 21:09 ` Christopher Faylor
2013-01-19  7:41   ` Achim Gratz
2013-01-19 17:18     ` Christopher Faylor
2013-01-19 20:47       ` Achim Gratz
2013-01-19 21:20         ` Christopher Faylor
2013-01-20  3:35           ` green fox
2013-01-20  6:53             ` Christopher Faylor
2013-01-21  7:03               ` green fox
2013-01-21  7:32                 ` Christopher Faylor
2013-01-21  9:46                   ` green fox
2013-01-21 16:01                     ` Christopher Faylor
2013-01-21 19:32                       ` green fox
2013-01-21 20:16                         ` Christopher Faylor
2013-01-20  7:16             ` Achim Gratz
2013-01-21  9:17               ` green fox
2013-01-20  7:23           ` Achim Gratz
2013-01-21 17:58             ` Achim Gratz
2013-01-25 22:07 ` [PATCH 0/4] setup.exe Achim Gratz
2013-01-25 22:10   ` [PATCH 1/4] setup.exe Achim Gratz
2013-02-01 14:40     ` Jon TURNEY
2013-02-01 15:11       ` marco atzeri
2013-02-01 17:10         ` Christopher Faylor
2013-02-01 16:08       ` Achim Gratz
2013-02-08 17:09     ` Jon TURNEY
2013-02-08 21:30       ` Achim Gratz
2013-02-10 19:23         ` Christopher Faylor
2013-02-11 19:40           ` Achim Gratz
2013-02-12 20:02           ` [PATCH 0/3] setup: implement CLI options Achim Gratz
2013-02-12 20:06             ` [PATCH 3/3] " Achim Gratz
2013-02-12 20:06             ` [PATCH 2/3] " Achim Gratz
2013-02-12 20:06             ` [PATCH 1/3] " Achim Gratz
2013-02-13 19:10           ` [PATCH 1/4] setup.exe Achim Gratz
2013-02-13 19:30             ` Christopher Faylor
2013-02-13 21:25               ` Achim Gratz
2013-02-13 22:08                 ` Christopher Faylor
2013-02-14 20:31                   ` Achim Gratz
2013-02-15  0:22                     ` Christopher Faylor
2013-02-15 19:52                       ` Achim Gratz
2013-02-16 18:39                         ` Christopher Faylor
2013-02-16 20:11                           ` Achim Gratz
2013-02-16 21:16                             ` Corinna Vinschen
2013-02-17 17:20                               ` Christopher Faylor
2013-02-17 17:43                                 ` Corinna Vinschen
2013-02-17 18:02                                   ` Christopher Faylor
2013-02-17 18:44                                     ` Achim Gratz
2013-02-17 19:21                                       ` Corinna Vinschen
2013-02-17 21:47                                         ` Christopher Faylor
2013-02-17 22:22                                           ` Christopher Faylor
2013-02-18 19:01                                             ` Achim Gratz
2013-01-25 22:11   ` [PATCH 0/4] setup.exe Achim Gratz
2013-02-01 15:05     ` Jon TURNEY
2013-02-01 16:48       ` Achim Gratz
2013-02-01 19:28       ` [PATCH 5/4] setup.exe Achim Gratz
2013-01-25 22:11   ` [PATCH 2/4] setup.exe Achim Gratz
2013-01-25 22:12   ` [PATCH 4/4] setup.exe Achim Gratz
2013-02-04 16:21   ` [PATCH 3/4] setup.exe Achim Gratz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).