- makensis should now compile on any POSIX compliment platform (Linux, *BSD, Mac OS X, etc.)
- improved makefiles so nothing is compiled when it's already up-to-date - Added SW_HIDE to ExecShell's accepted show modes git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3518 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
8567625b0e
commit
4c5f8a30eb
46 changed files with 2054 additions and 679 deletions
|
@ -69,7 +69,7 @@ char *ValidateTempDir()
|
|||
|
||||
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam, int nCmdShow)
|
||||
{
|
||||
int ret = 2;
|
||||
static int ret;
|
||||
const char *m_Err = _LANG_ERRORWRITINGTEMP;
|
||||
|
||||
int cl_flags = 0;
|
||||
|
|
|
@ -10,6 +10,8 @@ BZIP2_OBJS = Release-bzip2/bgbg.o Release-bzip2/exec.o Release-bzip2/fileform.o
|
|||
LZMA_SRCS = bgbg.c exec.c fileform.c main.c ui.c util.c ../crc32.c resource.rc ../7zip/LZMADecode.c
|
||||
LZMA_OBJS = Release-lzma/bgbg.o Release-lzma/exec.o Release-lzma/fileform.o Release-lzma/main.o Release-lzma/ui.o Release-lzma/util.o Release-lzma/crc32.o Release-lzma/resource.res Release-lzma/LZMADecode.o
|
||||
|
||||
SRCS = $(ZLIB_SRCS) $(BZIP2_SRCS) $(LZMA_SRCS)
|
||||
|
||||
LIBS = -lole32 -lgdi32 -lversion -luuid -lcomctl32 -lkernel32 -luser32 -lshell32 -ladvapi32
|
||||
|
||||
# -- Programs --
|
||||
|
@ -17,13 +19,18 @@ CC = gcc
|
|||
RC = windres
|
||||
RM = rm
|
||||
MKDIR = mkdir
|
||||
BIN2H = ./bin2h
|
||||
|
||||
# -- Compilers and linker flags --
|
||||
DEFINES = -DWIN32 -D_WINDOWS_ -DEXEHEAD -DWIN32_LEAN_AND_MEAN -DZEXPORT=__stdcall -DLZMACALL=__stdcall
|
||||
CFLAGS = -Wall -Os -fno-common -fomit-frame-pointer -fno-inline $(DEFINES)
|
||||
LFLAGS = -s -mwindows -nostdlib -nostartfiles --enable-stdcall-fixup -Wl,-Bdynamic -Wl,--file-alignment,512 -Wl,--exclude-libs,msvcrt.a -Wl,-e,_WinMain@16 -Wl,sections_script.ld
|
||||
CPPFLAGS = -DEXEHEAD -DWIN32_LEAN_AND_MEAN -DZEXPORT=__stdcall -DLZMACALL=__fastcall
|
||||
CFLAGS = -Wall -Os
|
||||
LDFLAGS = -s -mwindows -nostdlib -nostartfiles --enable-stdcall-fixup -Wl,-Bdynamic -Wl,--file-alignment,512 -Wl,--exclude-libs,msvcrt.a -Wl,-e,_WinMain@16 -Wl,sections_script -Wl,-Map,$(subst .exe,.map,$@)
|
||||
RCFLAGS = --input-format rc --output-format coff
|
||||
|
||||
vpath %.c .:..:../zlib:../bzip2:../7zip
|
||||
|
||||
%c : config.h fileform.h
|
||||
|
||||
all : exehead_zlib exehead_bzip2 exehead_lzma exehead_resources
|
||||
|
||||
missing_dirs = $(filter-out $(wildcard Release-*),Release-zlib Release-bzip2 Release-lzma)
|
||||
|
@ -34,75 +41,99 @@ else
|
|||
mkdirline =
|
||||
endif
|
||||
|
||||
dirs:
|
||||
dirs :
|
||||
$(mkdirline)
|
||||
|
||||
exehead_zlib : dirs $(ZLIB_SRCS) $(ZLIB_OBJS) sections_script
|
||||
$(CC) $(CFLAGS) $(LFLAGS) -o Release-zlib/exehead_zlib.exe $(ZLIB_OBJS) $(LIBS)
|
||||
bin2h Release-zlib/exehead_zlib.exe Release-zlib/exehead_zlib.h zlib_header_data
|
||||
%.o : dirs
|
||||
|
||||
exehead_bzip2 : dirs $(BZIP2_SRCS) $(BZIP2_OBJS) sections_script
|
||||
$(CC) $(CFLAGS) $(LFLAGS) -o Release-bzip2/exehead_bzip2.exe $(BZIP2_OBJS) $(LIBS)
|
||||
bin2h Release-bzip2/exehead_bzip2.exe Release-bzip2/exehead_bzip2.h bzip2_header_data
|
||||
exehead_zlib : Release-zlib/exehead_zlib.exe Release-zlib/exehead_zlib.h
|
||||
|
||||
exehead_lzma : dirs $(LZMA_SRCS) $(LZMA_OBJS) sections_script
|
||||
$(CC) $(CFLAGS) $(LFLAGS) -o Release-lzma/exehead_lzma.exe $(LZMA_OBJS) $(LIBS)
|
||||
bin2h Release-lzma/exehead_lzma.exe Release-lzma/exehead_lzma.h lzma_header_data
|
||||
Release-zlib/exehead_zlib.exe : $(ZLIB_OBJS) sections_script
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(ZLIB_OBJS) $(LIBS)
|
||||
|
||||
exehead_resources : exehead_zlib
|
||||
bin2h bitmap1.bmp Release-zlib/bitmap1.h bitmap1_data
|
||||
bin2h nsis.ico Release-zlib/icon.h icon_data
|
||||
bin2h uninst.ico Release-zlib/unicon.h unicon_data
|
||||
Release-zlib/exehead_zlib.h : Release-zlib/exehead_zlib.exe
|
||||
$(BIN2H) $< $@ zlib_header_data
|
||||
|
||||
sections_script:
|
||||
echo SECTIONS > sections_script.ld
|
||||
echo { >> sections_script.ld
|
||||
echo .text : { *(.text) } >> sections_script.ld
|
||||
echo .data : { *(.data) } >> sections_script.ld
|
||||
echo .rdata : { *(.rdata) } >> sections_script.ld
|
||||
echo .bss : { *(.bss) } >> sections_script.ld
|
||||
echo .idata : { *(.idata) } >> sections_script.ld
|
||||
echo .ndata BLOCK(__section_alignment__) : { [ .ndata ] } >> sections_script.ld
|
||||
echo .rsrc : { *(.rsrc) } >> sections_script.ld
|
||||
echo } >> sections_script.ld
|
||||
Release-zlib/%.o : %.c
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
|
||||
|
||||
Release-zlib/resource.res : resource.rc resource.h config.h
|
||||
$(RC) $(RCFLAGS) -o $@ -i $<
|
||||
|
||||
exehead_bzip2 : Release-bzip2/exehead_bzip2.exe Release-bzip2/exehead_bzip2.h
|
||||
|
||||
Release-bzip2/exehead_bzip2.exe : $(BZIP2_OBJS) sections_script
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(BZIP2_OBJS) $(LIBS)
|
||||
|
||||
Release-bzip2/exehead_bzip2.h : Release-bzip2/exehead_bzip2.exe
|
||||
$(BIN2H) $< $@ bzip2_header_data
|
||||
|
||||
Release-bzip2/%.o : %.c
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
|
||||
|
||||
Release-bzip2/resource.res : resource.rc resource.h config.h
|
||||
$(RC) $(RCFLAGS) -o $@ -i $<
|
||||
|
||||
exehead_lzma : Release-lzma/exehead_lzma.exe Release-lzma/exehead_lzma.h
|
||||
|
||||
Release-lzma/exehead_lzma.exe : $(LZMA_OBJS) sections_script
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(LZMA_OBJS) $(LIBS)
|
||||
|
||||
Release-lzma/exehead_lzma.h : Release-lzma/exehead_lzma.exe
|
||||
$(BIN2H) $< $@ lzma_header_data
|
||||
|
||||
Release-lzma/%.o : %.c
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
|
||||
|
||||
Release-lzma/resource.res : resource.rc resource.h config.h
|
||||
$(RC) $(RCFLAGS) -o $@ -i $<
|
||||
|
||||
exehead_resources : Release-zlib/bitmap1.h Release-zlib/icon.h Release-zlib/unicon.h
|
||||
|
||||
Release-zlib/bitmap1.h : bitmap1.bmp
|
||||
$(BIN2H) bitmap1.bmp Release-zlib/bitmap1.h bitmap1_data
|
||||
|
||||
Release-zlib/icon.h : nsis.ico
|
||||
$(BIN2H) nsis.ico Release-zlib/icon.h icon_data
|
||||
|
||||
Release-zlib/unicon.h : uninst.ico
|
||||
$(BIN2H) uninst.ico Release-zlib/unicon.h unicon_data
|
||||
|
||||
sections_script:
|
||||
echo "SECTIONS" > sections_script
|
||||
echo "{" >> sections_script
|
||||
echo " .text : { *(.text) }" >> sections_script
|
||||
echo " .data : { *(.data) }" >> sections_script
|
||||
echo " .rdata : { *(.rdata) }" >> sections_script
|
||||
echo " .bss : { *(.bss) }" >> sections_script
|
||||
echo " .idata : { *(.idata) }" >> sections_script
|
||||
echo " .ndata BLOCK(__section_alignment__) : { [ .ndata ] }" >> sections_script
|
||||
echo " .rsrc : { *(.rsrc) }" >> sections_script
|
||||
echo "}" >> sections_script
|
||||
|
||||
Release-zlib/ = -DNSIS_COMPRESS_USE_ZLIB
|
||||
Release-bzip2/ = -DNSIS_COMPRESS_USE_BZIP2
|
||||
Release-lzma/ = -DNSIS_COMPRESS_USE_LZMA
|
||||
getdefine = $($(dir $@))
|
||||
|
||||
Release-zlib/%.o Release-bzip2/%.o Release-lzma/%.o : %.c $(DEPENDS)
|
||||
$(CC) $(CFLAGS) $(getdefine) -c $< -o $@
|
||||
|
||||
Release-zlib/%.o Release-bzip2/%.o Release-lzma/%.o : ../%.c $(DEPENDS)
|
||||
$(CC) $(CFLAGS) $(getdefine) -c $< -o $@
|
||||
|
||||
Release-zlib/%.o Release-bzip2/%.o Release-lzma/%.o : ../zlib/%.c $(DEPENDS)
|
||||
$(CC) $(CFLAGS) $(getdefine) -c $< -o $@
|
||||
|
||||
Release-zlib/%.o Release-bzip2/%.o Release-lzma/%.o : ../bzip2/%.c $(DEPENDS)
|
||||
$(CC) $(CFLAGS) $(getdefine) -c $< -o $@
|
||||
|
||||
Release-zlib/%.o Release-bzip2/%.o Release-lzma/%.o : ../7zip/%.c $(DEPENDS)
|
||||
$(CC) $(CFLAGS) $(getdefine) -c $< -o $@
|
||||
|
||||
%/resource.res : resource.rc resource.h config.h Makefile
|
||||
$(RC) $(RCFLAGS) -o $*/resource.res -i resource.rc
|
||||
CFLAGS =: $(CFLAGS) $(getdefine)
|
||||
|
||||
clean ::
|
||||
$(RM) sections_script.ld
|
||||
$(RM) Release-zlib/*.o
|
||||
$(RM) Release-zlib/resource.res
|
||||
$(RM) Release-zlib/exehead_zlib.exe
|
||||
$(RM) Release-zlib/exehead_zlib.h
|
||||
$(RM) Release-zlib/bitmap1.h
|
||||
$(RM) Release-zlib/icon.h
|
||||
$(RM) Release-zlib/unicon.h
|
||||
$(RM) Release-bzip2/*.o
|
||||
$(RM) Release-bzip2/resource.res
|
||||
$(RM) Release-bzip2/exehead_bzip2.exe
|
||||
$(RM) Release-bzip2/exehead_bzip2.h
|
||||
$(RM) Release-lzma/*.o
|
||||
$(RM) Release-lzma/resource.res
|
||||
$(RM) Release-lzma/exehead_lzma.exe
|
||||
$(RM) Release-lzma/exehead_lzma.h
|
||||
$(RM) -f sections_script
|
||||
$(RM) -f Release-zlib/*.o
|
||||
$(RM) -f Release-zlib/resource.res
|
||||
$(RM) -f Release-zlib/exehead_zlib.exe
|
||||
$(RM) -f Release-zlib/exehead_zlib.h
|
||||
$(RM) -f Release-zlib/bitmap1.h
|
||||
$(RM) -f Release-zlib/icon.h
|
||||
$(RM) -f Release-zlib/unicon.h
|
||||
$(RM) -f Release-bzip2/*.o
|
||||
$(RM) -f Release-bzip2/resource.res
|
||||
$(RM) -f Release-bzip2/exehead_bzip2.exe
|
||||
$(RM) -f Release-bzip2/exehead_bzip2.h
|
||||
$(RM) -f Release-lzma/*.o
|
||||
$(RM) -f Release-lzma/resource.res
|
||||
$(RM) -f Release-lzma/exehead_lzma.exe
|
||||
$(RM) -f Release-lzma/exehead_lzma.h
|
||||
|
||||
.PHONY : exehead_zlib exehead_bzip2 exehead_lzma exehead_resources dirs clean
|
|
@ -794,7 +794,7 @@ static int NSISCALL _sumsecsfield(int idx)
|
|||
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
||||
if (sections[x].flags & SF_SELECTED)
|
||||
#endif
|
||||
total += sections[x].fields[idx];
|
||||
total += ((int *)§ions[x])[idx];
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ typedef struct _stack_t {
|
|||
static stack_t *g_st;
|
||||
#endif
|
||||
|
||||
union exec_flags g_exec_flags;
|
||||
exec_flags g_exec_flags;
|
||||
|
||||
#if defined(NSIS_SUPPORT_ACTIVEXREG) || defined(NSIS_SUPPORT_CREATESHORTCUT)
|
||||
HRESULT g_hres;
|
||||
|
@ -212,16 +212,16 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
break;
|
||||
#endif//NSIS_CONFIG_VISIBLE_SUPPORT
|
||||
case EW_SETFLAG:
|
||||
g_exec_flags.flags[parm0]=GetIntFromParm(1);
|
||||
FIELDN(g_exec_flags,parm0)=GetIntFromParm(1);
|
||||
break;
|
||||
case EW_IFFLAG:
|
||||
{
|
||||
int f=lent.offsets[!g_exec_flags.flags[parm2]];
|
||||
g_exec_flags.flags[parm2]&=parm3;
|
||||
int f=lent.offsets[!FIELDN(g_exec_flags,parm2)];
|
||||
FIELDN(g_exec_flags,parm2)&=parm3;
|
||||
return f;
|
||||
}
|
||||
case EW_GETFLAG:
|
||||
myitoa(var0,g_exec_flags.flags[parm1]);
|
||||
myitoa(var0,FIELDN(g_exec_flags,parm1));
|
||||
break;
|
||||
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
|
||||
case EW_CHDETAILSVIEW:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef _EXEC_H_
|
||||
#define _EXEC_H_
|
||||
|
||||
extern union exec_flags g_exec_flags;
|
||||
extern exec_flags g_exec_flags;
|
||||
|
||||
int NSISCALL ExecuteCodeSegment(int pos, HWND hwndProgress); // returns 0 on success
|
||||
|
||||
|
|
|
@ -315,18 +315,14 @@ typedef struct
|
|||
#define SF_EXPAND 32
|
||||
#define SF_PSELECTED 64
|
||||
|
||||
typedef union
|
||||
typedef struct
|
||||
{
|
||||
struct
|
||||
{
|
||||
int name_ptr; // '' for non-optional components
|
||||
int install_types; // bits set for each of the different install_types, if any.
|
||||
int flags; // SF_* - defined above
|
||||
int code;
|
||||
int code_size;
|
||||
int size_kb;
|
||||
};
|
||||
int fields[1];
|
||||
int name_ptr; // '' for non-optional components
|
||||
int install_types; // bits set for each of the different install_types, if any.
|
||||
int flags; // SF_* - defined above
|
||||
int code;
|
||||
int code_size;
|
||||
int size_kb;
|
||||
} section;
|
||||
|
||||
#define SECTION_OFFSET(field) (FIELD_OFFSET(section, field)/sizeof(int))
|
||||
|
@ -395,6 +391,7 @@ typedef struct
|
|||
int parms[5];
|
||||
} page;
|
||||
|
||||
// text/bg color
|
||||
#define CC_TEXT 1
|
||||
#define CC_TEXT_SYS 2
|
||||
#define CC_BK 4
|
||||
|
@ -410,6 +407,42 @@ typedef struct {
|
|||
int flags;
|
||||
} ctlcolors;
|
||||
|
||||
// $0..$9, $INSTDIR, etc are encoded as ASCII bytes starting from this value.
|
||||
// Added by ramon 3 jun 2003
|
||||
#define NS_SKIP_CODE 252
|
||||
#define NS_VAR_CODE 253
|
||||
#define NS_SHELL_CODE 254
|
||||
#define NS_LANG_CODE 255
|
||||
#define NS_CODES_START NS_SKIP_CODE
|
||||
|
||||
#define CODE_SHORT(x) (WORD)((((WORD)x & 0x7F) | (((WORD)x & 0x3F80) << 1) | 0x8080))
|
||||
#define MAX_CODED 16383
|
||||
|
||||
#define NSIS_INSTDIR_INVALID 1
|
||||
#define NSIS_INSTDIR_NOT_ENOUGH_SPACE 2
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int autoclose;
|
||||
int all_user_var;
|
||||
int exec_error;
|
||||
int abort;
|
||||
#ifdef NSIS_SUPPORT_REBOOT
|
||||
int exec_reboot;
|
||||
#endif
|
||||
int cur_insttype;
|
||||
int insttype_changed;
|
||||
#ifdef NSIS_CONFIG_SILENT_SUPPORT
|
||||
int silent;
|
||||
#endif
|
||||
int instdir_error;
|
||||
int rtl;
|
||||
} exec_flags;
|
||||
|
||||
#define FIELDN(x, y) (((int *)&x)[y])
|
||||
|
||||
#ifdef EXEHEAD
|
||||
|
||||
// the following are only used/implemented in exehead, not makensis.
|
||||
|
||||
int NSISCALL isheader(firstheader *h); // returns 0 on not header, length_of_datablock on success
|
||||
|
@ -431,41 +464,6 @@ extern int g_quit_flag;
|
|||
BOOL NSISCALL ReadSelfFile(LPVOID lpBuffer, DWORD nNumberOfBytesToRead);
|
||||
DWORD NSISCALL SetSelfFilePointer(LONG lDistanceToMove);
|
||||
|
||||
// $0..$9, $INSTDIR, etc are encoded as ASCII bytes starting from this value.
|
||||
// Added by ramon 3 jun 2003
|
||||
#define NS_SKIP_CODE 252
|
||||
#define NS_VAR_CODE 253
|
||||
#define NS_SHELL_CODE 254
|
||||
#define NS_LANG_CODE 255
|
||||
#define NS_CODES_START NS_SKIP_CODE
|
||||
|
||||
#define CODE_SHORT(x) (WORD)((((WORD)x & 0x7F) | (((WORD)x & 0x3F80) << 1) | 0x8080))
|
||||
#define MAX_CODED 16383
|
||||
|
||||
#define NSIS_INSTDIR_INVALID 1
|
||||
#define NSIS_INSTDIR_NOT_ENOUGH_SPACE 2
|
||||
|
||||
union exec_flags {
|
||||
struct {
|
||||
int autoclose;
|
||||
int all_user_var;
|
||||
int exec_error;
|
||||
int abort;
|
||||
#ifdef NSIS_SUPPORT_REBOOT
|
||||
int exec_reboot;
|
||||
#endif
|
||||
int cur_insttype;
|
||||
int insttype_changed;
|
||||
#ifdef NSIS_CONFIG_SILENT_SUPPORT
|
||||
int silent;
|
||||
#endif
|
||||
int instdir_error;
|
||||
int rtl;
|
||||
};
|
||||
int flags[1];
|
||||
};
|
||||
|
||||
#ifdef EXEHEAD
|
||||
extern struct block_header g_blocks[BLOCKS_NUM];
|
||||
extern header *g_header;
|
||||
extern int g_flags;
|
||||
|
|
|
@ -4,9 +4,8 @@
|
|||
#include "state.h"
|
||||
#include "config.h"
|
||||
#include "lang.h"
|
||||
#include "exec.h"
|
||||
|
||||
#include "fileform.h"
|
||||
#include "exec.h"
|
||||
#include "ui.h"
|
||||
|
||||
#ifdef NSIS_CONFIG_LOG
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue