Commit c2aaa57f authored by Currell Berry's avatar Currell Berry

updating README with download link.

parent 095c1354
Emacs Powerpack README -- Currell Berry -- 9/15/2015
=================================================
Emacs Powerpack is an installer which bundles Emacs+MingW+Msys+Some optional default configurations for emacs. It is intended to get users up and running with emacs and a unix-like environment on windows as quickly as possible.
For now you can download the alpha 0.2 release here:
https://mega.nz/#!J81CVaSR!DhVTulh0PsurA7S7NgLaKuZsKSaDsr_jvXOly3OsifM
More documentation is forthcoming. For now the best way to familiarize yourself with what it does it to look in the nsis installer script.
Emacs Powerpack README
#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"
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"
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
// Totally undocumented! And if you set it lower than 512 bytes, the program crashes.
// Either leave at 0x200 or 0x1000
//#pragma comment(linker,"/FILEALIGN:0x200")
// Option #2: use /opt:nowin98
// See KB:Q235956 or the READMEVC.htm in your VC directory for info on this one.
// This is our currently preferred option, since it is fully documented and unlikely
// to break in service packs and updates.
#pragma comment(linker,"/opt:nowin98")
// Option #3: use /align:4096
// A side effect of using the default align value is that it turns on the above switch.
// May break in future versions!
//#pragma comment(linker,"/ALIGN:4096")
#endif // _MSC_VER >= 1000
#endif // NDEBUG
; Example script for nsisunz
; Written by Saivert
; Homepage: http://members.tripod.com/files_saivert/
;
; Dependencies:
; - nsisunz.dll Plug-in
; - InstallOptions.dll Plug-in
; - zippage.ini (InstallOptions INI file)
!addplugindir ".\Release"
OutFile "nsisunz_test.exe"
Name "NSIS Unzip plug-in test"
Caption "NSIS Unzip plug-in test"
ShowInstDetails show
XPStyle on
CompletedText "Extracted!"
SubCaption 3 " - Extracting files"
SubCaption 4 " - Extracted"
LoadLanguageFile "${NSISDIR}\Contrib\Language files\english.nlf"
; Installer pages
Page custom onZipPageShow onZipPageLeave " - Select Zip file"
Page instfiles
; Localized strings for use with nsisunz
; The '%f' in the string is replaced with the filename on run-time.
; "%c", "%u", "%p" and "%p" is replaced with compressed size,
; uncompressed size, percent complete (with "%") and byte complete
; respectively.
LangString nsisunz_text ${LANG_ENGLISH} "Extract: %f (%c -> %b) [%p]"
Function .onInit
InitPluginsDir
File "/oname=$PLUGINSDIR\zippage.ini" "zippage.ini"
FunctionEnd
Function onZipPageShow
; Turn Text control into a button (HM NIS Edit v2.0b5 does not support "Button" type).
WriteINIStr "$PLUGINSDIR\zippage.ini" "Field 12" "Type" "Button"
WriteINIStr "$PLUGINSDIR\zippage.ini" "Field 12" "Flags" "NOTIFY"
InstallOptions::dialog "$PLUGINSDIR\zippage.ini"
FunctionEnd
Function onZipPageLeave
; $R0 = zip filename $R1 = dest. folder
ReadINIStr $R0 "$PLUGINSDIR\zippage.ini" "Field 4" "State"
ReadINIStr $R1 "$PLUGINSDIR\zippage.ini" "Field 6" "State"
; Remove trailing backslash if any
StrCpy $0 $R1 1 -1
StrCmp "$0" "\" 0 notneeded
StrCpy $R1 $R1 -1
notneeded:
IfFileExists $R0 checkdir
MessageBox MB_ICONEXCLAMATION|MB_OK 'The file "$R0" does not exist!'
Abort ;return to page
checkdir:
IfFileExists $R1\*.* unzip
MessageBox MB_ICONEXCLAMATION|MB_YESNO 'The folder "$R1" does not exist!$\r$\nDo you wish to create it?' IDNO skipcreate
CreateDirectory $R1
Goto unzip
skipcreate:
Abort ;return to page
unzip:
; Just fall of the end, so the sections can be executed
FunctionEnd
Section -pre
DetailPrint "ZIP file: $R0"
DetailPrint "Dest. folder: $R1"
SectionEnd
Section
; Check if the checkbox is checked and if it is, then don't extract paths
ReadINIStr $R2 "$PLUGINSDIR\zippage.ini" "Field 7" "State"
StrCmp $R2 "1" 0 usepaths
nsisunz::UnzipToLog /text "$(nsisunz_text)" /noextractpath $R0 $R1
Goto check
usepaths:
nsisunz::UnzipToLog /text "$(nsisunz_text)" $R0 $R1
check:
; Always check for errors. Everything else than "success" means an error.
Pop $0
StrCmp $0 "success" ok
Abort "$0"
ok:
SectionEnd
; Example script for nsisunz
; Written by Saivert
; Homepage: http://members.tripod.com/files_saivert/
;
; Dependencies:
; - nsisunz.dll Plug-in
; - InstallOptions.dll Plug-in
; - zippage.ini (InstallOptions INI file)
!addplugindir ".\Release"
!include "MUI.nsh"
OutFile "nsisunz_testmui.exe"
Name "NSIS Unzip plug-in test"
Caption "NSIS Unzip plug-in test"
ShowInstDetails show
CompletedText "Extracted!"
; Installer pages
Page custom onZipPageShow onZipPageLeave " "
!define MUI_PAGE_HEADER_TEXT "Extracting"
!define MUI_PAGE_HEADER_SUBTEXT "Extracting files"
!define MUI_INSTFILESPAGE_FINISHHEADER_TEXT "Extracted"
!define MUI_INSTFILESPAGE_FINISHHEADER_SUBTEXT "Thes files has been extracted"
!define MUI_INSTFILESPAGE_ABORTHEADER_TEXT "Extraction aborted"
!define MUI_INSTFILESPAGE_ABORTHEADER_SUBTEXT "The extraction process was aborted"
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
; Localized strings for use with nsisunz
; The '%f' in the string is replaced with the filename on run-time.
; "%c" and "%u" is replaced with compressed size and uncompressed size
; respectively.
LangString nsisunz_text ${LANG_ENGLISH} "Extract: %f (%c -> %u)"
Function .onInit
InitPluginsDir
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "zippage.ini"
FunctionEnd
Function onZipPageShow
!insertmacro MUI_HEADER_TEXT "Unzip" "Select ZIP file and destination folder"
; Remove icon (so we get away with one INI file for both scripts)
!insertmacro MUI_INSTALLOPTIONS_WRITE "zippage.ini" "Field 1" "Type" ""
!insertmacro MUI_INSTALLOPTIONS_WRITE "zippage.ini" "Field 2" "Left" "0"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "zippage.ini"
FunctionEnd
Function onZipPageLeave
; $R0 = zip filename $R1 = dest. folder
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "zippage.ini" "Field 4" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $R1 "zippage.ini" "Field 6" "State"
; Remove trailing backslash if any
StrCpy $0 $R1 1 -1
StrCmp "$0" "\" 0 notneeded
StrCpy $R1 $R1 -1
notneeded:
IfFileExists $R0 checkdir
MessageBox MB_ICONEXCLAMATION|MB_OK 'The file "$R0" does not exist!'
Abort ;return to page
checkdir:
IfFileExists $R1\*.* unzip
MessageBox MB_ICONEXCLAMATION|MB_YESNO 'The folder "$R1" does not exist!$\r$\nDo you wish to create it?' IDNO skipcreate
CreateDirectory $R1
Goto unzip
skipcreate:
Abort ;return to page
unzip:
; Just fall of the end, so the sections can be executed
FunctionEnd
Section -pre
DetailPrint "ZIP file: $R0"
DetailPrint "Dest. folder: $R1"
SectionEnd
Section
; Check if the checkbox is checked and if it is, then don't extract paths
ReadINIStr $R2 "$PLUGINSDIR\zippage.ini" "Field 7" "State"
StrCmp $R2 "1" 0 usepaths
nsisunz::UnzipToLog /text "$(nsisunz_text)" /noextractpath $R0 $R1
Goto check
usepaths:
nsisunz::UnzipToLog /text "$(nsisunz_text)" $R0 $R1
check:
; Always check for errors. Everything else than "success" means an error.
Pop $0
StrCmp $0 "success" ok
Abort "$0"
ok:
SectionEnd
#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 __stdcall popstring(char *str); // 0 on success, 1 on empty stack
static void __stdcall 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
};
typedef struct {
int autoclose;
int all_user_var;
int exec_error;
int abort;
int exec_reboot;
int reboot_called;
int XXX_cur_insttype; // deprecated
int XXX_insttype_changed; // deprecated
int silent;
int instdir_error;
int rtl;
int errlvl;
} exec_flags;
typedef struct {
exec_flags *exec_flags;
int (__stdcall *ExecuteCodeSegment)(int, HWND);
} extra_parameters;
// utility functions (not required but often useful)
static int __stdcall 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 __stdcall 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 * __stdcall getuservariable(const int varnum)
{
if (varnum < 0 || varnum >= __INST_LAST) return NULL;
return g_variables+varnum*g_stringsize;
}
static void __stdcall setuservariable(const int varnum, const 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
/* Public Domain [mini] c runtime library replacements for Win32
* KJD <jeremyd@computer.org>
*/
#include "miniclib.h"
int errno = ESUCCESS;
FILE *stdin=NULL, *stdout=NULL, *stderr=NULL;
#define setStdFileHnd(f,h) \
f = (FILE *)malloc(sizeof(FILE)); \
if (f != NULL) \
{ \
f->handle = GetStdHandle(h); \
f->eof = 0; \
f->err = 0; \
}
/* DLL entry function, needs to be __stdcall, but must be extern "C" for proper decoration (name mangling) */
/*extern "C"*/ BOOL WINAPI DllMain(HANDLE _hModule, DWORD ul_reason_for_call, LPVOID lpReserved);
/*extern "C"*/ BOOL WINAPI _DllMainCRTStartup(HANDLE _hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
mCRTinit();
return DllMain(_hModule, ul_reason_for_call, lpReserved);
}
/* you must call this before using any other function!!! */
void mCRTinit(void)
{
setStdFileHnd(stdin, STD_INPUT_HANDLE);
setStdFileHnd(stdout, STD_OUTPUT_HANDLE);
setStdFileHnd(stderr, STD_ERROR_HANDLE);
}
void * malloc(size_t size)
{
return HeapAlloc(GetProcessHeap(), 0, size);
}
void * calloc(size_t num, size_t size)
{
return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, num*size);
}
void free(void *ptr)
{
HeapFree(GetProcessHeap(), 0, ptr);
}
void * realloc(void *ptr, size_t size)
{
if (ptr == NULL) return malloc(size);
if (!size)
{
free(ptr);
return NULL;
}
else
return HeapReAlloc( GetProcessHeap(), 0, ptr, size );
}