- updated the makefiles and code to allow compliation with MinGW once again (some of patch #875485 by perditionc)
- fixed errors and warnings given by gcc git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3513 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
2b3da85bae
commit
f4a1f17299
43 changed files with 323 additions and 252 deletions
|
@ -49,7 +49,6 @@ extern HANDLE dbd_hFile;
|
|||
#endif
|
||||
|
||||
char g_caption[NSIS_MAX_STRLEN*2];
|
||||
int g_filehdrsize;
|
||||
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
|
||||
HWND g_hwnd;
|
||||
HANDLE g_hInstance;
|
||||
|
@ -70,7 +69,7 @@ char *ValidateTempDir()
|
|||
|
||||
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam, int nCmdShow)
|
||||
{
|
||||
int ret;
|
||||
int ret = 2;
|
||||
const char *m_Err = _LANG_ERRORWRITINGTEMP;
|
||||
|
||||
int cl_flags = 0;
|
||||
|
|
|
@ -1,81 +1,108 @@
|
|||
# -- Objects and source files --
|
||||
SRCS = bgbg.c exec.c fileform.c main.c ui.c util.c ../crc32.c ../zlib/infblock.c ../zlib/infcodes.c ../zlib/inflate.c ../zlib/inftrees.c ../zlib/infutil.c ../bzip2/bzlib.c ../bzip2/decompress.c ../bzip2/huffman.c ../bzip2/randtable.c
|
||||
OBJS = bgbg.o exec.o fileform.o main.o ui.o util.o resource.res crc32.o infblock.o infcodes.o inflate.o inftrees.o infutil.o bzlib.o decompress.o huffman.o randtable.o
|
||||
DEPENDS = ../Platform.h config.h
|
||||
|
||||
ZLIB_SRCS = bgbg.c exec.c fileform.c main.c ui.c util.c ../crc32.c resource.rc ../zlib/infblock.c
|
||||
ZLIB_OBJS = Release-zlib/bgbg.o Release-zlib/exec.o Release-zlib/fileform.o Release-zlib/main.o Release-zlib/ui.o Release-zlib/util.o Release-zlib/crc32.o Release-zlib/resource.res Release-zlib/infblock.o
|
||||
|
||||
BZIP2_SRCS = bgbg.c exec.c fileform.c main.c ui.c util.c ../crc32.c resource.rc ../bzip2/bzlib.c ../bzip2/decompress.c ../bzip2/huffman.c
|
||||
BZIP2_OBJS = Release-bzip2/bgbg.o Release-bzip2/exec.o Release-bzip2/fileform.o Release-bzip2/main.o Release-bzip2/ui.o Release-bzip2/util.o Release-bzip2/crc32.o Release-bzip2/resource.res Release-bzip2/bzlib.o Release-bzip2/decompress.o Release-bzip2/huffman.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
|
||||
|
||||
LIBS = -lole32 -lgdi32 -lversion -luuid -lcomctl32 -lkernel32 -luser32 -lshell32 -ladvapi32
|
||||
|
||||
# -- Programs --
|
||||
CC = gcc
|
||||
RC = windres
|
||||
RM = del
|
||||
RM = rm
|
||||
MKDIR = mkdir
|
||||
|
||||
# -- Compilers and linker flags --
|
||||
DEFINES = -DWIN32 -D_WINDOWS_ -DEXEHEAD -DWinMain=WinMainCRTStartup
|
||||
CFLAGS = -Os -fomit-frame-pointer -fno-inline $(DEFINES)
|
||||
LFLAGS = -s -mwindows -nostdlib -nostartfiles -Wl,--enable-stdcall-fixup
|
||||
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
|
||||
RCFLAGS = --input-format rc --output-format coff
|
||||
|
||||
all : exehead
|
||||
all : exehead_zlib exehead_bzip2 exehead_lzma exehead_resources
|
||||
|
||||
exehead : $(OBJS)
|
||||
$(CC) $(CFLAGS) $(LFLAGS) -o exehead.exe $(OBJS) $(LIBS)
|
||||
bin2h exehead.exe Release\exehead.h header_data
|
||||
bin2h bitmap1.bmp Release\bitmap1.h bitmap1_data
|
||||
bin2h bitmap2.bmp Release\bitmap2.h bitmap2_data
|
||||
bin2h nsis.ico Release\icon.h icon_data
|
||||
bin2h uninst.ico Release\unicon.h unicon_data
|
||||
missing_dirs = $(filter-out $(wildcard Release-*),Release-zlib Release-bzip2 Release-lzma)
|
||||
|
||||
# -- Dependencies --
|
||||
bgbg.o : bgbg.c resource.h config.h Makefile
|
||||
exec.o : exec.c fileform.h util.h state.h ui.h exec.h config.h lang.h Makefile
|
||||
fileform.o : fileform.c fileform.h util.h state.h ../zlib/zlib.h ../zlib/zconf.h ui.h config.h Makefile
|
||||
main.o : main.c resource.h util.h fileform.h state.h ui.h ../zlib/zlib.h ../zlib/zconf.h config.h lang.h Makefile
|
||||
ui.o : ui.c resource.h fileform.h state.h ui.h config.h Makefile
|
||||
util.o : util.c util.h state.h fileform.h ui.h config.h Makefile
|
||||
ifneq ($(strip $(missing_dirs)),)
|
||||
mkdirline = $(MKDIR) $(missing_dirs)
|
||||
else
|
||||
mkdirline =
|
||||
endif
|
||||
|
||||
# -- Special command line for the resource file --
|
||||
resource.res : resource.rc resource.h config.h Makefile
|
||||
$(RC) $(RCFLAGS) -o resource.res -i resource.rc
|
||||
dirs:
|
||||
$(mkdirline)
|
||||
|
||||
crc32.o : ../crc32.c config.h Makefile
|
||||
$(CC) $(CFLAGS) -c ../crc32.c -o crc32.o
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
# -- Special command lines for zlib --
|
||||
infblock.o : ../zlib/infblock.c ../zlib/zutil.h ../zlib/infblock.h ../zlib/inftrees.h ../zlib/infcodes.h ../zlib/infutil.h ../zlib/zlib.h ../zlib/zconf.h Makefile
|
||||
$(CC) $(CFLAGS) -c ../zlib/infblock.c -o infblock.o
|
||||
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
|
||||
|
||||
infcodes.o : ../zlib/infcodes.c ../zlib/zutil.h ../zlib/inftrees.h ../zlib/infblock.h ../zlib/infcodes.h ../zlib/infutil.h ../zlib/zlib.h ../zlib/zconf.h Makefile
|
||||
$(CC) $(CFLAGS) -c ../zlib/infcodes.c -o infcodes.o
|
||||
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
|
||||
|
||||
inflate.o : ../zlib/inflate.c ../zlib/zutil.h ../zlib/infblock.h ../zlib/zlib.h ../zlib/zconf.h Makefile
|
||||
$(CC) $(CFLAGS) -c ../zlib/inflate.c -o inflate.o
|
||||
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
|
||||
|
||||
inftrees.o : ../zlib/inftrees.c ../zlib/zutil.h ../zlib/inftrees.h ../zlib/zlib.h ../zlib/zconf.h Makefile
|
||||
$(CC) $(CFLAGS) -c ../zlib/inftrees.c -o inftrees.o
|
||||
Release-zlib/ = -DNSIS_COMPRESS_USE_ZLIB
|
||||
Release-bzip2/ = -DNSIS_COMPRESS_USE_BZIP2
|
||||
Release-lzma/ = -DNSIS_COMPRESS_USE_LZMA
|
||||
getdefine = $($(dir $@))
|
||||
|
||||
infutil.o : ../zlib/infutil.c ../zlib/zutil.h ../zlib/infblock.h ../zlib/inftrees.h ../zlib/infcodes.h ../zlib/infutil.h ../zlib/zlib.h ../zlib/zconf.h Makefile
|
||||
$(CC) $(CFLAGS) -c ../zlib/infutil.c -o infutil.o
|
||||
Release-zlib/%.o Release-bzip2/%.o Release-lzma/%.o : %.c $(DEPENDS)
|
||||
$(CC) $(CFLAGS) $(getdefine) -c $< -o $@
|
||||
|
||||
# -- Special command lines for bzip2 --
|
||||
bzlib.o : ../bzip2/bzlib.c ../bzip2/bzlib.h ../bzip2/bzlib_private.h config.h
|
||||
$(CC) $(CFLAGS) -c ../bzip2/bzlib.c -o bzlib.o
|
||||
Release-zlib/%.o Release-bzip2/%.o Release-lzma/%.o : ../%.c $(DEPENDS)
|
||||
$(CC) $(CFLAGS) $(getdefine) -c $< -o $@
|
||||
|
||||
decompress.o : ../bzip2/decompress.c ../bzip2/bzlib.h ../bzip2/bzlib_private.h config.h
|
||||
$(CC) $(CFLAGS) -c ../bzip2/decompress.c -o decompress.o
|
||||
Release-zlib/%.o Release-bzip2/%.o Release-lzma/%.o : ../zlib/%.c $(DEPENDS)
|
||||
$(CC) $(CFLAGS) $(getdefine) -c $< -o $@
|
||||
|
||||
huffman.o : ../bzip2/huffman.c ../bzip2/bzlib.h ../bzip2/bzlib_private.h config.h
|
||||
$(CC) $(CFLAGS) -c ../bzip2/huffman.c -o huffman.o
|
||||
Release-zlib/%.o Release-bzip2/%.o Release-lzma/%.o : ../bzip2/%.c $(DEPENDS)
|
||||
$(CC) $(CFLAGS) $(getdefine) -c $< -o $@
|
||||
|
||||
randtable.o : ../bzip2/randtable.c ../bzip2/bzlib.h ../bzip2/bzlib_private.h config.h
|
||||
$(CC) $(CFLAGS) -c ../bzip2/randtable.c -o randtable.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
|
||||
|
||||
# -- Clean script --
|
||||
clean ::
|
||||
$(RM) *.o
|
||||
$(RM) resource.res
|
||||
$(RM) exehead.exe
|
||||
$(RM) Release\exehead.h
|
||||
$(RM) Release\bitmap1.h
|
||||
$(RM) Release\bitmap2.h
|
||||
$(RM) Release\icon.h
|
||||
$(RM) Release\unicon.h
|
||||
$(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
|
||||
|
|
|
@ -707,8 +707,10 @@ static BOOL CALLBACK LicenseProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
|
|||
if (nmhdr->code==EN_LINK) {
|
||||
if (enlink->msg==WM_LBUTTONDOWN) {
|
||||
TEXTRANGE tr = {
|
||||
enlink->chrg.cpMin,
|
||||
enlink->chrg.cpMax,
|
||||
{
|
||||
enlink->chrg.cpMin,
|
||||
enlink->chrg.cpMax,
|
||||
},
|
||||
ps_tmpbuf
|
||||
};
|
||||
if (tr.chrg.cpMax-tr.chrg.cpMin < sizeof(ps_tmpbuf)) {
|
||||
|
@ -1232,7 +1234,9 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
int ns=lParam;
|
||||
TVITEM tv;
|
||||
|
||||
if (tv.hItem=hTreeItems[x])
|
||||
tv.hItem=hTreeItems[x];
|
||||
|
||||
if (tv.hItem)
|
||||
{
|
||||
tv.mask=TVIF_TEXT;
|
||||
tv.pszText=GetNSISStringTT(ns);
|
||||
|
@ -1360,7 +1364,9 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
|
||||
if (t->flags&SF_RO) l+=3;
|
||||
|
||||
if (tv.hItem=*ht) {
|
||||
tv.hItem=*ht;
|
||||
|
||||
if (tv.hItem) {
|
||||
tv.mask=TVIF_STATE;
|
||||
tv.state=INDEXTOSTATEIMAGEMASK(l);
|
||||
tv.stateMask=TVIS_STATEIMAGEMASK;
|
||||
|
|
|
@ -3,22 +3,6 @@
|
|||
|
||||
#ifndef APSTUDIO_INVOKED // keep msdev's resource editor from mangling the .rc file
|
||||
|
||||
// Added by Dave Laundon 19th August 2002
|
||||
// For all internal functions, use of stdcall calling convention moves the
|
||||
// responsibility for tidying the stack to callee from caller, reducing the code
|
||||
// involved considerably. Gives an instant saving of 0.5K.
|
||||
// NB - the zlib and bzip2 portions have been given the same treatment, but with
|
||||
// project compiler-options settings and/or project-wide defines.
|
||||
// NB - safer for NSIS's routines to be defined explicitly to avoid problems
|
||||
// calling DLL functions.
|
||||
#if defined(_WIN32) && ((_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED))
|
||||
#define NSISCALL __stdcall // Ordinary functions
|
||||
#define NSISCALLV __cdecl // Variable-argument-list functions
|
||||
#else
|
||||
#define NSISCALL
|
||||
#define NSISCALLV
|
||||
#endif
|
||||
|
||||
// NSIS_MAX_STRLEN defines the maximum string length for internal variables
|
||||
// and stack entries. 1024 should be plenty, but if you are doing crazy registry
|
||||
// shit, you might want to bump it up. Generally it adds about 16-32x the memory,
|
||||
|
|
|
@ -120,7 +120,7 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
char *buf1 = bufs[1];
|
||||
char *buf2 = bufs[2];
|
||||
char *buf3 = bufs[3];
|
||||
char *buf4 = bufs[4];
|
||||
//char *buf4 = bufs[4];
|
||||
|
||||
char *var0;
|
||||
char *var1;
|
||||
|
@ -1312,7 +1312,6 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
if (*hptr)
|
||||
{
|
||||
char lc=0;
|
||||
int rcnt=0;
|
||||
HANDLE h=(HANDLE)myatoi(hptr);
|
||||
while (rpos<maxlen)
|
||||
{
|
||||
|
|
|
@ -472,7 +472,7 @@ static int NSISCALL __ensuredata(int amount)
|
|||
{
|
||||
return -3;
|
||||
}
|
||||
r=g_inflate_stream.next_out-_outbuffer;
|
||||
r=(DWORD)g_inflate_stream.next_out-(DWORD)_outbuffer;
|
||||
if (r)
|
||||
{
|
||||
if (!WriteFile(dbd_hFile,_outbuffer,r,&t,NULL) || r != t)
|
||||
|
|
|
@ -19,4 +19,4 @@ extern HWND insthwnd,insthwndbutton;
|
|||
#else
|
||||
#define g_hwnd 0
|
||||
#define g_hInstance 0
|
||||
#endif//NSIS_CONFIG_VISIBLE_SUPPORT
|
||||
#endif//NSIS_CONFIG_VISIBLE_SUPPORT
|
||||
|
|
|
@ -21,11 +21,18 @@ char g_log_file[1024];
|
|||
// and change the virtual size of this section
|
||||
// which result in extra memory for extra variables without code to do allocation :)
|
||||
// nsis then removes the "DISCARDABLE" style from section (for safe)
|
||||
#pragma bss_seg( VARS_SECTION_NAME )
|
||||
#ifdef _MSC_VER
|
||||
# pragma bss_seg(VARS_SECTION_NAME)
|
||||
NSIS_STRING g_usrvars[1];
|
||||
#pragma bss_seg()
|
||||
#define SECTION_VARS_RWD "/section:" ## VARS_SECTION_NAME ## ",rwd"
|
||||
#pragma comment(linker, SECTION_VARS_RWD)
|
||||
# pragma bss_seg()
|
||||
# pragma comment(linker, "/section:" VARS_SECTION_NAME ",rwd")
|
||||
#else
|
||||
# ifdef __GNUC__
|
||||
NSIS_STRING g_usrvars[1] __attribute__((section (VARS_SECTION_NAME)));
|
||||
# else
|
||||
# error Unknown compiler. You must implement the seperate PE section yourself.
|
||||
# endif
|
||||
#endif
|
||||
|
||||
void NSISCALL FreePIDL(LPITEMIDLIST idl)
|
||||
{
|
||||
|
@ -155,7 +162,7 @@ void NSISCALL trimslashtoend(char *buf)
|
|||
int NSISCALL validpathspec(char *ubuf)
|
||||
{
|
||||
char dl = ubuf[0] | 0x20; // convert alleged drive letter to lower case
|
||||
return ((*(WORD*)ubuf==CHAR2_TO_WORD('\\','\\')) || (dl >= 'a' && dl <= 'z' && *CharNext(ubuf)==':'));
|
||||
return ((*(WORD*)ubuf==CHAR2_TO_WORD('\\','\\')) || (dl >= 'a' && dl <= 'z' && ubuf[1]==':'));
|
||||
}
|
||||
|
||||
char * NSISCALL skip_root(char *path)
|
||||
|
@ -176,7 +183,7 @@ char * NSISCALL skip_root(char *path)
|
|||
p2 = findchar(p2, '\\');
|
||||
if (!*p2)
|
||||
return NULL;
|
||||
p2 = CharNext(p2);
|
||||
p2++; // skip backslash
|
||||
}
|
||||
|
||||
return p2;
|
||||
|
@ -475,7 +482,7 @@ char * NSISCALL GetNSISString(char *outbuf, int strtab)
|
|||
unsigned char nVarIdx = (unsigned char)*in++;
|
||||
int nData;
|
||||
int fldrs[4];
|
||||
if (nVarIdx > NS_SKIP_CODE)
|
||||
if (nVarIdx > NS_CODES_START)
|
||||
{
|
||||
nData = ((in[1] & 0x7F) << 7) | (in[0] & 0x7F);
|
||||
fldrs[0] = in[0]; // current user
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#include "../Platform.h"
|
||||
#include "config.h"
|
||||
#include <shlobj.h>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue