Commit f4dddb8e authored by cberry's avatar cberry

updating with changes ahead of rebuild.

parent 34f05b9a
This diff is collapsed.
externals
releases
\ No newline at end of file
This diff is collapsed.
;Currell Berry
; 2017-09-03 note: I have removed the component that installed msys for you
; emacs powerpack is configured to work perfectly with msys2 installed using the
; installer from http://www.msys2.org/
;TODO
;3. test on a couple different platforms. MEH
;8. go through and make sure bundled msys has all advertised features. HARDISH.
;8. go through and make sure bundled msys has all advertised features. HARDISH. DONTFIX
!include "MUI2.nsh"
!include nsDialogs.nsh
......@@ -15,9 +19,9 @@ OutFile "Emacs_PowerPack.exe"
!define VERSIONMAJOR 1
!define VERSIONMINOR 1
!define VERSIONBUILD 1
!define DESCRIPTION "Facilitates install of Emacs+MinGW+Utilities"
!define EMACSFILE 'emacs-24.5.zip'
!define MINGWFILE 'MinGW.zip'
!define DESCRIPTION "Facilitates install of Emacs on Windows."
!define EMACSFILE 'emacs-25.1.zip'
;!define MINGWFILE 'MinGW.zip'
;!define EMACSFILE 'emacs2.zip'
;!define MINGWFILE 'MinGW2.zip'
......@@ -26,7 +30,7 @@ InstallDir "$PROGRAMFILES\Emacs_PowerPack"
;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\Emacs PowerPack" ""
!define MINGWINSTALLDIR "C:\MinGW"
;!define MINGWINSTALLDIR "C:\MinGW"
!define EMACSINSTALLDIR $PROGRAMFILES\emacs
!define EPINSTALLDIR $INSTDIR
......@@ -49,7 +53,7 @@ LicenseData "LICENSE.txt"
;--------------------------------
;Pages
;LangString welcome_str ${LANG_ENGLISH} "This wizard will guide you through the installation of Emacs Powerpack.$\r$\n$\r$\nEmacs Powerpack provides an accelerated install for emacs, mingw, and several add-ons for mingw. Emacs Powerpack is intended to make it as easy as possible to set up a productive emacs-based development environment on a windows computer.$\r$\n$\r$\nIt is recommended that you close all other applications before starting Setup. This will make it possible to update relevant system files without having to reboot your computer$\r$\n$\r$\nClick next to continue."
;LangString welcome_str ${LANG_ENGLISH} "This wizard will guide you through the installation of Emacs Powerpack.$\r$\n$\r$\nEmacs Powerpack provides an integrated windows install for emacs. Before installing Emacs Powerpack, I recommend you install msys2 from http://www.msys2.org/. When installed together with msys2, Emacs Powerpack enables easy setup of a productive emacs-based development environment on a Windows computer.$\r$\n$\r$\nIt is recommended that you close all other applications before starting Setup. This will make it possible to update relevant system files without having to reboot your computer$\r$\n$\r$\nClick next to continue."
;!define MUI_WELCOMEPAGE_TEXT $(welcome_str)
!insertmacro MUI_PAGE_WELCOME
......@@ -83,7 +87,7 @@ Function myConfirmPage
!insertmacro MUI_HEADER_TEXT "Confirm Installation" "Review Changes"
${NSD_CreateLabel} 0 0 100% -2u "When you click 'Install', the following things will happen.$\r$\n1. Emacs Powerpack files and uninstaller will be installed in ${EPINSTALLDIR}.$\r$\n2. Emacs will be installed in ${EMACSINSTALLDIR}.$\r$\n3. MinGW will be installed in ${MINGWINSTALLDIR}.$\r$\n$\r$\nIf for any reason you are not satisfied you can always run the emacs powerpack uninstaller to revert all changes."
${NSD_CreateLabel} 0 0 100% -2u "When you click 'Install', the following things will happen.$\r$\n1. Emacs Powerpack files and uninstaller will be installed in ${EPINSTALLDIR}.$\r$\n2. Emacs will be installed in ${EMACSINSTALLDIR}.$\r$\n$\r$\nIf for any reason you are not satisfied you can always run the emacs powerpack uninstaller to revert all changes."
Pop $Label
;${NSD_CreateText} 0 13u 100% -13u "Type something here..."
......@@ -92,7 +96,7 @@ Function myConfirmPage
nsDialogs::Show
FunctionEnd
InstType "Full (Installs Emacs+MinGW in standard locations)"
InstType "Full (Installs Emacs in standard locations)"
;------------ functions and macros --------------
function .onInit
......@@ -107,7 +111,7 @@ Section
setOutPath $INSTDIR
# Files added here should be removed by the uninstaller (see section "uninstall")
file "README.txt"
file "README.md"
file /r "icons"
# Uninstaller - See function un.onInit and section "uninstall" for configuration
......@@ -195,23 +199,23 @@ SectionEnd
SectionGroupEnd
SectionGroup "MinGW" MinGWGroup
Section "MinGW 1.x" MinGW
SectionIn 1
SetOutPath "${MINGWINSTALLDIR}"
File /r "externals\${MINGWFILE}"
nsisunz::UnzipToLog "${MINGWINSTALLDIR}\${MINGWFILE}" "${MINGWINSTALLDIR}"
;Always check result on stack
Pop $0
StrCmp $0 "success" ok
DetailPrint "$0" ;print error message to log
ok:
delete "${MINGWINSTALLDIR}\${MINGWFILE}"
createShortCut "$SMPROGRAMS\Emacs_PowerPack\msys.lnk" "${MINGWINSTALLDIR}\msys\1.0\msys.bat" "" "$INSTDIR\icons\msys.ico"
SectionEnd
;SectionGroup "MinGW" MinGWGroup
; Section "MinGW 1.x" MinGW
; SectionIn 1
; SetOutPath "${MINGWINSTALLDIR}"
;
; File /r "externals\${MINGWFILE}"
; nsisunz::UnzipToLog "${MINGWINSTALLDIR}\${MINGWFILE}" "${MINGWINSTALLDIR}"
; ;Always check result on stack
; Pop $0
; StrCmp $0 "success" ok
; DetailPrint "$0" ;print error message to log
; ok:
;
; delete "${MINGWINSTALLDIR}\${MINGWFILE}"
;
; createShortCut "$SMPROGRAMS\Emacs_PowerPack\msys.lnk" "${MINGWINSTALLDIR}\msys\1.0\msys.bat" "" "$INSTDIR\icons\msys.ico"
; SectionEnd
; Section "MinGW Extras" MinGWExtras
; SectionIn 1
......@@ -220,36 +224,36 @@ SectionGroup "MinGW" MinGWGroup
; File test3.txt
; SectionEnd
;
;Section "Add MinGW utilities (gcc, gdb, etc...) to PATH" MINGW_PATH_SECTION
; SectionIn 1
;
; Push "${MINGWINSTALLDIR}\bin"
; Call AddToPath
;SectionEnd
;
;Section "Add msys (mingw shell) to PATH" MSYS_PATH_SECTION
; SectionIn 1
;
; Push "${MINGWINSTALLDIR}\msys\1.0"
; Call AddToPath
;SectionEnd
Section "Add MinGW utilities (gcc, gdb, etc...) to PATH" MINGW_PATH_SECTION
SectionIn 1
Push "${MINGWINSTALLDIR}\bin"
Call AddToPath
SectionEnd
Section "Add msys (mingw shell) to PATH" MSYS_PATH_SECTION
SectionIn 1
Push "${MINGWINSTALLDIR}\msys\1.0"
Call AddToPath
SectionEnd
SectionGroupEnd
;SectionGroupEnd
;--------------------------------
;Descriptions
;Language strings
LangString DESC_Emacs ${LANG_ENGLISH} "Install and configure GNU Emacs 24.5."
LangString DESC_MinGW ${LANG_ENGLISH} "Install MinGW"
LangString DESC_MinGWExtras ${LANG_ENGLISH} "man pages."
;LangString DESC_MinGW ${LANG_ENGLISH} "Install MinGW"
;LangString DESC_MinGWExtras ${LANG_ENGLISH} "man pages."
;Assign language strings to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${Emacs} $(DESC_Emacs)
!insertmacro MUI_DESCRIPTION_TEXT ${MinGW} $(DESC_MinGW)
!insertmacro MUI_DESCRIPTION_TEXT ${MinGWExtras} $(DESC_MinGWExtras)
; !insertmacro MUI_DESCRIPTION_TEXT ${MinGW} $(DESC_MinGW)
; !insertmacro MUI_DESCRIPTION_TEXT ${MinGWExtras} $(DESC_MinGWExtras)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
;--------------------------------
......@@ -263,7 +267,7 @@ LangString DESC_MinGWExtras ${LANG_ENGLISH} "man pages."
Section "Uninstall"
SetShellVarContext all
delete "$SMPROGRAMS\Emacs_PowerPack\Emacs.lnk"
delete "$SMPROGRAMS\Emacs_PowerPack\msys.lnk"
; delete "$SMPROGRAMS\Emacs_PowerPack\msys.lnk"
delete "$SMPROGRAMS\Emacs_PowerPack\ep_uninstall.lnk"
# Remove files
......@@ -282,14 +286,14 @@ Section "Uninstall"
RMDir /r "${EMACSINSTALLDIR}"
; Remove mingw bin from PATH
Push "${MINGWINSTALLDIR}\bin"
Call un.RemoveFromPath
; ; Remove mingw bin from PATH
; Push "${MINGWINSTALLDIR}\bin"
; Call un.RemoveFromPath
; Remove msys bin from PATH
Push "${MINGWINSTALLDIR}\msys\1.0"
Call un.RemoveFromPath
RMDir /r "${MINGWINSTALLDIR}"
; ; Remove msys bin from PATH
; Push "${MINGWINSTALLDIR}\msys\1.0"
; Call un.RemoveFromPath
; RMDir /r "${MINGWINSTALLDIR}"
Delete $INSTDIR\Uninstall.exe
......
#ifndef _EXDLL_H_
#define _EXDLL_H_
// only include this file from one place in your DLL.
// (it is all static, if you use it in two places it will fail)
#define EXDLL_INIT() { \
g_stringsize=string_size; \
g_stacktop=stacktop; \
g_variables=variables; }
// For page showing plug-ins
#define WM_NOTIFY_OUTER_NEXT (WM_USER+0x8)
#define WM_NOTIFY_CUSTOM_READY (WM_USER+0xd)
#define NOTIFY_BYE_BYE 'x'
typedef struct _stack_t {
struct _stack_t *next;
char text[1]; // this should be the length of string_size
} stack_t;
static unsigned int g_stringsize;
static stack_t **g_stacktop;
static char *g_variables;
static int popstring(char *str); // 0 on success, 1 on empty stack
static void pushstring(const char *str);
enum
{
INST_0, // $0
INST_1, // $1
INST_2, // $2
INST_3, // $3
INST_4, // $4
INST_5, // $5
INST_6, // $6
INST_7, // $7
INST_8, // $8
INST_9, // $9
INST_R0, // $R0
INST_R1, // $R1
INST_R2, // $R2
INST_R3, // $R3
INST_R4, // $R4
INST_R5, // $R5
INST_R6, // $R6
INST_R7, // $R7
INST_R8, // $R8
INST_R9, // $R9
INST_CMDLINE, // $CMDLINE
INST_INSTDIR, // $INSTDIR
INST_OUTDIR, // $OUTDIR
INST_EXEDIR, // $EXEDIR
INST_LANG, // $LANGUAGE
__INST_LAST
};
// utility functions (not required but often useful)
static int popstring(char *str)
{
stack_t *th;
if (!g_stacktop || !*g_stacktop) return 1;
th=(*g_stacktop);
lstrcpy(str,th->text);
*g_stacktop = th->next;
GlobalFree((HGLOBAL)th);
return 0;
}
static void pushstring(const char *str)
{
stack_t *th;
if (!g_stacktop) return;
th=(stack_t*)GlobalAlloc(GPTR,sizeof(stack_t)+g_stringsize);
lstrcpyn(th->text,str,g_stringsize);
th->next=*g_stacktop;
*g_stacktop=th;
}
static char *getuservariable(int varnum)
{
if (varnum < 0 || varnum >= __INST_LAST) return NULL;
return g_variables+varnum*g_stringsize;
}
static void setuservariable(int varnum, char *var)
{
if (var != NULL && varnum >= 0 && varnum < __INST_LAST)
lstrcpy(g_variables + varnum*g_stringsize, var);
}
#ifndef _EXDLL_H_
#define _EXDLL_H_
// only include this file from one place in your DLL.
// (it is all static, if you use it in two places it will fail)
#define EXDLL_INIT() { \
g_stringsize=string_size; \
g_stacktop=stacktop; \
g_variables=variables; }
// For page showing plug-ins
#define WM_NOTIFY_OUTER_NEXT (WM_USER+0x8)
#define WM_NOTIFY_CUSTOM_READY (WM_USER+0xd)
#define NOTIFY_BYE_BYE 'x'
typedef struct _stack_t {
struct _stack_t *next;
char text[1]; // this should be the length of string_size
} stack_t;
static unsigned int g_stringsize;
static stack_t **g_stacktop;
static char *g_variables;
static int popstring(char *str); // 0 on success, 1 on empty stack
static void pushstring(const char *str);
enum
{
INST_0, // $0
INST_1, // $1
INST_2, // $2
INST_3, // $3
INST_4, // $4
INST_5, // $5
INST_6, // $6
INST_7, // $7
INST_8, // $8
INST_9, // $9
INST_R0, // $R0
INST_R1, // $R1
INST_R2, // $R2
INST_R3, // $R3
INST_R4, // $R4
INST_R5, // $R5
INST_R6, // $R6
INST_R7, // $R7
INST_R8, // $R8
INST_R9, // $R9
INST_CMDLINE, // $CMDLINE
INST_INSTDIR, // $INSTDIR
INST_OUTDIR, // $OUTDIR
INST_EXEDIR, // $EXEDIR
INST_LANG, // $LANGUAGE
__INST_LAST
};
// utility functions (not required but often useful)
static int popstring(char *str)
{
stack_t *th;
if (!g_stacktop || !*g_stacktop) return 1;
th=(*g_stacktop);
lstrcpy(str,th->text);
*g_stacktop = th->next;
GlobalFree((HGLOBAL)th);
return 0;
}
static void pushstring(const char *str)
{
stack_t *th;
if (!g_stacktop) return;
th=(stack_t*)GlobalAlloc(GPTR,sizeof(stack_t)+g_stringsize);
lstrcpyn(th->text,str,g_stringsize);
th->next=*g_stacktop;
*g_stacktop=th;
}
static char *getuservariable(int varnum)
{
if (varnum < 0 || varnum >= __INST_LAST) return NULL;
return g_variables+varnum*g_stringsize;
}
static void setuservariable(int varnum, char *var)
{
if (var != NULL && varnum >= 0 && varnum < __INST_LAST)
lstrcpy(g_variables + varnum*g_stringsize, var);
}
#endif//_EXDLL_H_
\ No newline at end of file
#name the installer
Outfile "Emacs_PowerPack.exe"
InstallDir "$PROGRAMFILES\Emacs PowerPack"
# For removing Start Menu shortcut in Windows 7
RequestExecutionLevel admin
# default section start; every NSIS script has at least one section.
Section
SetOutPath $INSTDIR
File test.txt
WriteUninstaller $INSTDIR\uninstall.exe
# create a shortcut named "new shortcut" in the start menu programs directory
# point the new shortcut at the program uninstaller
CreateShortCut "$SMPROGRAMS\uninstallEmacsPowerpack.lnk" "$INSTDIR\uninstall.exe"
# default section end
SectionEnd
Section "Uninstall"
Delete $INSTDIR\uninstall.exe
Delete $INSTDIR\test.txt
RMDir $INSTDIR
Delete "$SMPROGRAMS\uninstallEmacsPowerpack.lnk"
#name the installer
Outfile "Emacs_PowerPack.exe"
InstallDir "$PROGRAMFILES\Emacs PowerPack"
# For removing Start Menu shortcut in Windows 7
RequestExecutionLevel admin
# default section start; every NSIS script has at least one section.
Section
SetOutPath $INSTDIR
File test.txt
WriteUninstaller $INSTDIR\uninstall.exe
# create a shortcut named "new shortcut" in the start menu programs directory
# point the new shortcut at the program uninstaller
CreateShortCut "$SMPROGRAMS\uninstallEmacsPowerpack.lnk" "$INSTDIR\uninstall.exe"
# default section end
SectionEnd
Section "Uninstall"
Delete $INSTDIR\uninstall.exe
Delete $INSTDIR\test.txt
RMDir $INSTDIR
Delete "$SMPROGRAMS\uninstallEmacsPowerpack.lnk"
SectionEnd
\ No newline at end of file
;Emacs Powerpack install script
;Currell Berry
;based on MUI example by Joost Verburg
;--------------------------------
;Include Modern UI
!include "MUI2.nsh"
;--------------------------------
;General
;Name and file
Name "Emacs PowerPack"
OutFile "EmacsPowerPack.exe"
;Default installation folder
InstallDir "$PROGRAMFILES\Emacs PowerPack"
;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\Emacs PowerPack" ""
;Request application privileges for Windows Vista
RequestExecutionLevel admin
;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
;--------------------------------
;Pages
LangString welcome_str ${LANG_ENGLISH} "This wizard will guide you through the installation of Emacs Powerpack.$\r$\n$\r$\nEmacs Powerpack provides an accelerated install for emacs, mingw, and several add-ons for mingw. Emacs Powerpack is intended to make it as easy as possible to set up a productive emacs-based development environment on a windows computer.$\r$\n$\r$\nIt is recommended that you close all other applications before starting Setup. This will make it possible to update relevant system files without having to reboot your computer$\r$\n$\r$\nClick next to continue."
!define MUI_WELCOMEPAGE_TEXT $(welcome_str)
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "LICENSE.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Installer Sections
;global section
Section
SetOutPath "$INSTDIR"
;Store installation folder
WriteRegStr HKCU "Software\Emacs PowerPack" "" $INSTDIR
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd
Section "Emacs 24.5" Emacs
SetOutPath "$INSTDIR"
File test.txt
SectionEnd
Section "MinGW" MinGW
SetOutPath "$INSTDIR"
File test2.txt
SectionEnd
Section "Helper Utilities" HelperUtils
SetOutPath "$INSTDIR"
File test3.txt
SectionEnd
;--------------------------------
;Descriptions
;Language strings
LangString DESC_Emacs ${LANG_ENGLISH} "Install GNU Emacs 24.5."
LangString DESC_MinGW ${LANG_ENGLISH} "Install MinGW"
LangString DESC_MinGW ${LANG_ENGLISH} "Install MinGW"
;Assign language strings to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${Emacs} $(DESC_Emacs)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
;--------------------------------
;Uninstaller Section
Section "Uninstall"
Delete $INSTDIR\Uninstall.exe
Delete $INSTDIR\test.txt
Delete $INSTDIR\test2.txt
RMDir $INSTDIR
DeleteRegKey /ifempty HKCU "Software\Emacs PowerPack"
;Emacs Powerpack install script
;Currell Berry
;based on MUI example by Joost Verburg
;--------------------------------
;Include Modern UI
!include "MUI2.nsh"
;--------------------------------
;General
;Name and file
Name "Emacs PowerPack"
OutFile "EmacsPowerPack.exe"
;Default installation folder
InstallDir "$PROGRAMFILES\Emacs PowerPack"
;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\Emacs PowerPack" ""
;Request application privileges for Windows Vista
RequestExecutionLevel admin
;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
;--------------------------------
;Pages
LangString welcome_str ${LANG_ENGLISH} "This wizard will guide you through the installation of Emacs Powerpack.$\r$\n$\r$\nEmacs Powerpack provides an accelerated install for emacs, mingw, and several add-ons for mingw. Emacs Powerpack is intended to make it as easy as possible to set up a productive emacs-based development environment on a windows computer.$\r$\n$\r$\nIt is recommended that you close all other applications before starting Setup. This will make it possible to update relevant system files without having to reboot your computer$\r$\n$\r$\nClick next to continue."
!define MUI_WELCOMEPAGE_TEXT $(welcome_str)
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "LICENSE.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Installer Sections
;global section
Section
SetOutPath "$INSTDIR"
;Store installation folder
WriteRegStr HKCU "Software\Emacs PowerPack" "" $INSTDIR
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd
Section "Emacs 24.5" Emacs
SetOutPath "$INSTDIR"
File test.txt
SectionEnd
Section "MinGW" MinGW
SetOutPath "$INSTDIR"
File test2.txt
SectionEnd
Section "Helper Utilities" HelperUtils
SetOutPath "$INSTDIR"
File test3.txt
SectionEnd
;--------------------------------
;Descriptions
;Language strings
LangString DESC_Emacs ${LANG_ENGLISH} "Install GNU Emacs 24.5."
LangString DESC_MinGW ${LANG_ENGLISH} "Install MinGW"
LangString DESC_MinGW ${LANG_ENGLISH} "Install MinGW"
;Assign language strings to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${Emacs} $(DESC_Emacs)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
;--------------------------------
;Uninstaller Section
Section "Uninstall"
Delete $INSTDIR\Uninstall.exe
Delete $INSTDIR\test.txt
Delete $INSTDIR\test2.txt
RMDir $INSTDIR
DeleteRegKey /ifempty HKCU "Software\Emacs PowerPack"
SectionEnd
\ No newline at end of file
//////////////////////////////
// Version 1.30
// Nov 24th, 2000
// Version 1.20
// Jun 9th, 2000
// Version 1.10
// Jan 23rd, 2000
// Version 1.00
// May 20th, 1999
// Todd C. Wilson, Fresh Ground Software
// (todd@nopcode.com)
// This header file will kick in settings for Visual C++ 5 and 6 that will (usually)
// result in smaller exe's.
// The "trick" is to tell the compiler to not pad out the function calls; this is done
// by not using the /O1 or /O2 option - if you do, you implicitly use /Gy, which pads
// out each and every function call. In one single 500k dll, I managed to cut out 120k
// by this alone!
// The other two "tricks" are telling the Linker to merge all data-type segments together
// in the exe file. The relocation, read-only (constants) data, and code section (.text)
// sections can almost always be merged. Each section merged can save 4k in exe space,
// since each section is padded out to 4k chunks. This is very noticeable with smaller
// exes, since you could have only 700 bytes of data, 300 bytes of code, 94 bytes of
// strings - padded out, this could be 12k of runtime, for 1094 bytes of stuff! For larger
// programs, this is less overall, but can save at least 4k.
// Note that if you're using MFC static or some other 3rd party libs, you may get poor
// results with merging the readonly (.rdata) section - the exe may grow larger.
// To use this feature, define _MERGE_DATA_ in your project or before this header is used.
// With Visual C++ 5, the program uses a file alignment of 512 bytes, which results
// in a small exe. Under VC6, the program instead uses 4k, which is the same as the
// section size. The reason (from what I understand) is that 4k is the chunk size of
// the virtual memory manager, and that WinAlign (an end-user tuning tool for Win98)
// will re-align the programs on this boundary. The problem with this is that all of
// Microsoft's system exes and dlls are *NOT* tuned like this, and using 4k causes serious
// exe bloat. Very noticeable for smaller programs.
// The "trick" for this is to use the undocumented FILEALIGN linker parm to change the
// padding from 4k to 1/2k, which results in a much smaller exe - anywhere from 20%-75%
// depending on the size. Note that this is the same as using /OPT:NOWIN98, which *is*
// a previously documented switch, but was left out of the docs for some reason in VC6 and
// all of the current MSDN's - see KB:Q235956 for more information.
// Microsoft does say that using the 4k alignment will "speed up process loading",
// but I've been unable to notice a difference, even on my P180, with a very large (4meg) exe.
// Please note, however, that this will probably not change the size of the COMPRESSED
// file (either in a .zip file or in an install archive), since this 4k is all zeroes and
// gets compressed away.
// Also, the /ALIGN:4096 switch will "magically" do the same thing, even though this is the
// default setting for this switch. Apparently this sets the same values as the above two
// switches do. We do not use this in this header, since it smacks of a bug and not a feature.
// Thanks to Michael Geary <Mike@Geary.com> for some additional tips!
#ifdef NDEBUG
// /Og (global optimizations), /Os (favor small code), /Oy (no frame pointers)
#pragma optimize("gsy",on)
#pragma comment(linker,"/RELEASE")
// Note that merging the .rdata section will result in LARGER exe's if you using
// MFC (esp. static link). If this is desirable, define _MERGE_RDATA_ in your project.
#ifdef _MERGE_RDATA_
#pragma comment(linker,"/merge:.rdata=.data")
#endif // _MERGE_RDATA_
#pragma comment(linker,"/merge:.text=.data")
#pragma comment(linker,"/merge:.reloc=.data")
// Merging sections with different attributes causes a linker warning, so
// turn off the warning. From Michael Geary. Undocumented, as usual!
#pragma comment(linker,"/ignore:4078")
// With Visual C++ 5, you already get the 512-byte alignment, so you will only need
// it for VC6, and maybe later.
#if _MSC_VER >= 1000
// Option #1: use /filealign