nsis: update 3.04-->3.05, fix gcc10, retry build

pull/2343/merge
Tony Theodore 4 years ago
parent 7d3a2b5398
commit 2c3c6d939a

@ -0,0 +1,67 @@
This file is part of MXE. See LICENSE.md for licensing information.
Contains ad hoc patches for cross building.
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marius=20Negru=C8=9Biu?= <marius.negrutiu@protonmail.com>
Date: Mon, 8 Jun 2020 14:08:49 +0300
Subject: [PATCH 1/1] Fixed memmove() linker error caused by gcc/10.1.0-3
compiler optimizer
see:
https://sourceforge.net/p/nsis/bugs/1248/
taken from:
https://github.com/negrutiu/nsis/commit/c252106dd8203515706d9240e99a92cd0c7e3acb.patch
diff --git a/Source/bzip2/decompress.c b/Source/bzip2/decompress.c
index 1111111..2222222 100755
--- a/Source/bzip2/decompress.c
+++ b/Source/bzip2/decompress.c
@@ -263,7 +263,16 @@ Int32 NSISCALL BZ2_decompress ( DState* s )
for (i = 0; i < nSelectors; i++) {
v = s->selectorMtf[i];
tmp = pos[v];
+/*
+ [Marius]
+ gcc/10.1.0-3 compiler optimizer replace the following line with a msvcrt!memmove() call.
+ This file is built into projects compiled with the -nostdlib parameter, therefore a linker error will occur.
+ We'll qualify the destination array as `volatile` to prevent GCC from optimizing it.
+ Related topic: https://stackoverflow.com/questions/2219829/how-to-prevent-gcc-optimizing-some-statements-in-c
+ -----------------------------------------
while (v > 0) { pos[v] = pos[v-1]; v--; }
+*/
+ while (v > 0) { ((volatile UChar*)pos)[v] = pos[v-1]; v--; }
pos[0] = tmp;
s->selector[i] = tmp;
}
@@ -388,7 +397,14 @@ Int32 NSISCALL BZ2_decompress ( DState* s )
}
*/
while (nn > 0) {
+/*
+ [Marius]
+ Mark destination array as `volatile` to prevent GCC optimizer to generate msvcrt!memmove() calls.
+ See comments above.
+ -----------------------------------------
s->mtfa[(pp+nn)] = s->mtfa[(pp+nn)-1]; nn--;
+*/
+ ((volatile UChar*)s->mtfa)[(pp+nn)] = s->mtfa[(pp+nn)-1]; nn--;
};
s->mtfa[pp] = uc;
} else {
@@ -398,7 +414,14 @@ Int32 NSISCALL BZ2_decompress ( DState* s )
pp = s->mtfbase[lno] + off;
uc = s->mtfa[pp];
while (pp > s->mtfbase[lno]) {
+/*
+ [Marius]
+ Mark destination array as `volatile` to prevent GCC optimizer to generate msvcrt!memmove() calls.
+ See comments above.
+ -----------------------------------------
s->mtfa[pp] = s->mtfa[pp-1]; pp--;
+*/
+ ((volatile UChar*)s->mtfa)[pp] = s->mtfa[pp-1]; pp--;
};
s->mtfbase[lno]++;
while (lno > 0) {

@ -4,8 +4,8 @@ PKG := nsis
$(PKG)_WEBSITE := https://nsis.sourceforge.io/
$(PKG)_DESCR := NSIS
$(PKG)_IGNORE :=
$(PKG)_VERSION := 3.04
$(PKG)_CHECKSUM := 609536046c50f35cfd909dd7df2ab38f2e835d0da3c1048aa0d48c59c5a4f4f5
$(PKG)_VERSION := 3.05
$(PKG)_CHECKSUM := b6e1b309ab907086c6797618ab2879cb95387ec144dab36656b0b5fb77e97ce9
$(PKG)_SUBDIR := nsis-$($(PKG)_VERSION)-src
$(PKG)_FILE := nsis-$($(PKG)_VERSION)-src.tar.bz2
$(PKG)_URL := https://$(SOURCEFORGE_MIRROR)/project/nsis/NSIS 3/$($(PKG)_VERSION)/$($(PKG)_FILE)
@ -17,6 +17,17 @@ define $(PKG)_UPDATE
tail -1
endef
define $(PKG)_SCONS_OPTS
XGCC_W32_PREFIX='$(TARGET)-' \
PREFIX='$(PREFIX)/$(TARGET)' \
`[ -d /usr/local/include ] && echo APPEND_CPPPATH=/usr/local/include` \
`[ -d /usr/local/lib ] && echo APPEND_LIBPATH=/usr/local/lib` \
$(if $(findstring x86_64-w64-mingw32,$(TARGET)),\
SKIPPLUGINS='System' TARGET_ARCH=amd64) \
SKIPUTILS='MakeLangId,Makensisw,NSIS Menu,zip2exe' \
NSIS_MAX_STRLEN=8192
endef
define $(PKG)_BUILD
# scons supports -j option but nsis parallel build fails
# nsis uses it's own BUILD_PREFIX which isn't user configurable
@ -26,16 +37,9 @@ define $(PKG)_BUILD
$(SED) -i 's/pei-i386/pei-x86-64/' '$(1)/SCons/Config/linker_script' && \
$(SED) -i 's/m_target_type=TARGET_X86ANSI/m_target_type=TARGET_AMD64/' '$(SOURCE_DIR)/Source/build.cpp')
# scons does various PATH manipulations that don't play well with ccache
cd '$(SOURCE_DIR)' && PATH='$(PREFIX)/bin:$(PATH)' $(PYTHON2) '$(BUILD_DIR).scons/scons.py' \
XGCC_W32_PREFIX='$(TARGET)-' \
PREFIX='$(PREFIX)/$(TARGET)' \
`[ -d /usr/local/include ] && echo APPEND_CPPPATH=/usr/local/include` \
`[ -d /usr/local/lib ] && echo APPEND_LIBPATH=/usr/local/lib` \
$(if $(findstring x86_64-w64-mingw32,$(TARGET)),\
SKIPPLUGINS='System' TARGET_ARCH=amd64) \
SKIPUTILS='MakeLangId,Makensisw,NSIS Menu,zip2exe' \
NSIS_MAX_STRLEN=8192 \
install
cd '$(SOURCE_DIR)' && $(SCONS_LOCAL) $($(PKG)_SCONS_OPTS) -j '$(JOBS)' -k || \
cd '$(SOURCE_DIR)' && $(SCONS_LOCAL) $($(PKG)_SCONS_OPTS) -j '$(JOBS)'
cd '$(SOURCE_DIR)' && $(SCONS_LOCAL) $($(PKG)_SCONS_OPTS) -j 1 install
$(INSTALL) -m755 '$(PREFIX)/$(TARGET)/bin/makensis' '$(PREFIX)/bin/$(TARGET)-makensis'
endef

Loading…
Cancel
Save