Bug 1367847 Support makensis on MinGW Linux for Windows builds
This involves a few changes:
- Remove the .exe from the makensis binaries. which.which will
auto-add it so Windows will keep working - and with it
present we were finding makensis.exe on Linux and trying to
run it, which isn't going to work
- Doesn't bother checking if nsis is 32bit if we're running on
Linux
- Add the -nocd option to nsis (on Linux) because it takes the
current working directory from the target of a symlink rather
than the symlink itself. See
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=704828
MozReview-Commit-ID: CVT8LwS1t8w
old mode 100644
new mode 100755
--- a/moz.configure
+++ b/moz.configure
@@ -314,20 +314,19 @@ set_config('MOZ_SYSTEM_HUNSPELL', depend
@depends(target)
@imports('os')
def makensis_progs(target):
if target.kernel != 'WINNT':
return
candidates = [
- 'makensis-3.01.exe',
- 'makensis-3.0b3.exe',
- 'makensis-3.0b1.exe',
- 'makensis.exe',
+ 'makensis-3.01',
+ 'makensis-3.0b3',
+ 'makensis-3.0b1',
'makensis',
]
# Look for nsis installed by msys environment. But only the 32-bit version.
# We use an absolute path and insert as the first entry so it is preferred
# over a 64-bit exe that may be in PATH.
if 'MSYSTEM_PREFIX' in os.environ:
prefix = os.path.dirname(os.environ['MSYSTEM_PREFIX'])
@@ -355,26 +354,34 @@ def nsis_version(nsis):
# it works for the non-beta version.
if ver < nsis_min_version and (ver >= '3.0a' or ver < '3'):
raise FatalCheckError('To build the installer you must have NSIS'
' version %s or greater in your path'
% nsis_min_version)
return ver
-# And that makensis is 32-bit.
-@depends_if(nsis)
+# And that makensis is 32-bit (but only on Windows).
+@depends_if(nsis, when=depends(host)(lambda h: h.kernel == 'WINNT'))
@checking('for 32-bit NSIS')
def nsis_binary_type(nsis):
bin_type = windows_binary_type(nsis)
if bin_type != 'win32':
raise FatalCheckError('%s is not a 32-bit Windows application' % nsis)
return 'yes'
+# And any flags we have to give to makensis
+@depends(host)
+def nsis_flags(host):
+ if host.kernel != 'WINNT':
+ return '-nocd'
+ return ''
+
+set_config('MAKENSISU_FLAGS', nsis_flags)
# Fallthrough to autoconf-based configure
include('build/moz.configure/old.configure')
@imports('__sandbox__')
def all_paths():
return __sandbox__._all_paths
old mode 100644
new mode 100755
--- a/toolkit/mozapps/installer/windows/nsis/makensis.mk
+++ b/toolkit/mozapps/installer/windows/nsis/makensis.mk
@@ -39,32 +39,32 @@ CUSTOM_NSIS_PLUGINS = \
CUSTOM_UI = \
nsisui.exe \
$(NULL)
$(CONFIG_DIR)/setup.exe::
$(INSTALL) $(addprefix $(MOZILLA_DIR)/toolkit/mozapps/installer/windows/nsis/,$(TOOLKIT_NSIS_FILES)) $(CONFIG_DIR)
$(INSTALL) $(addprefix $(MOZILLA_DIR)/other-licenses/nsis/Plugins/,$(CUSTOM_NSIS_PLUGINS)) $(CONFIG_DIR)
$(INSTALL) $(addprefix $(MOZILLA_DIR)/other-licenses/nsis/,$(CUSTOM_UI)) $(CONFIG_DIR)
- cd $(CONFIG_DIR) && $(MAKENSISU) installer.nsi
+ cd $(CONFIG_DIR) && $(MAKENSISU) $(MAKENSISU_FLAGS) installer.nsi
ifdef MOZ_STUB_INSTALLER
- cd $(CONFIG_DIR) && $(MAKENSISU) stub.nsi
+ cd $(CONFIG_DIR) && $(MAKENSISU) $(MAKENSISU_FLAGS) stub.nsi
ifdef MOZ_EXTERNAL_SIGNING_FORMAT
$(MOZ_SIGN_CMD) $(foreach f,$(MOZ_EXTERNAL_SIGNING_FORMAT),-f $(f)) $(CONFIG_DIR)/setup-stub.exe
endif
$(MAKE) $(CONFIG_DIR)/7zSD.sfx
cd $(CONFIG_DIR) && $(CYGWIN_WRAPPER) 7z a -t7z $(ABS_CONFIG_DIR)/stub.7z setup-stub.exe -mx -m0=BCJ2 -m1=LZMA:d21 -m2=LZMA:d17 -m3=LZMA:d17 -mb0:1 -mb0s1:2 -mb0s2:3
cat $(CONFIG_DIR)/7zSD.sfx $(CONFIG_DIR)/stub.tag $(CONFIG_DIR)/stub.7z > "$(CONFIG_DIR)/stub.exe"
ifdef MOZ_EXTERNAL_SIGNING_FORMAT_STUB
$(MOZ_SIGN_CMD) $(foreach f,$(MOZ_EXTERNAL_SIGNING_FORMAT_STUB),-f $(f)) $(CONFIG_DIR)/stub.exe
endif
endif
# Support for building the uninstaller when repackaging locales
ifeq ($(CONFIG_DIR),l10ngen)
- cd $(CONFIG_DIR) && $(MAKENSISU) uninstaller.nsi
+ cd $(CONFIG_DIR) && $(MAKENSISU) $(MAKENSISU_FLAGS) uninstaller.nsi
endif
ifdef MOZ_EXTERNAL_SIGNING_FORMAT
$(MOZ_SIGN_CMD) $(foreach f,$(MOZ_EXTERNAL_SIGNING_FORMAT),-f $(f)) "$@"
endif
$(CONFIG_DIR)/7zSD.sfx:
$(CYGWIN_WRAPPER) upx --best -o $(CONFIG_DIR)/7zSD.sfx $(SFX_MODULE)
@@ -83,18 +83,18 @@ ifdef MOZ_EXTERNAL_SIGNING_FORMAT
$(MOZ_SIGN_CMD) $(foreach f,$(MOZ_EXTERNAL_SIGNING_FORMAT),-f $(f)) "$(DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe"
endif
# For building the uninstaller during the application build so it can be
# included for mar file generation.
uninstaller::
$(INSTALL) $(addprefix $(MOZILLA_DIR)/toolkit/mozapps/installer/windows/nsis/,$(TOOLKIT_NSIS_FILES)) $(CONFIG_DIR)
$(INSTALL) $(addprefix $(MOZILLA_DIR)/other-licenses/nsis/Plugins/,$(CUSTOM_NSIS_PLUGINS)) $(CONFIG_DIR)
- cd $(CONFIG_DIR) && $(MAKENSISU) uninstaller.nsi
+ cd $(CONFIG_DIR) && $(MAKENSISU) $(MAKENSISU_FLAGS) uninstaller.nsi
$(NSINSTALL) -D $(DIST)/bin/uninstall
cp $(CONFIG_DIR)/helper.exe $(DIST)/bin/uninstall
ifdef MOZ_MAINTENANCE_SERVICE
maintenanceservice_installer::
- cd $(CONFIG_DIR) && $(MAKENSISU) maintenanceservice_installer.nsi
+ cd $(CONFIG_DIR) && $(MAKENSISU) $(MAKENSISU_FLAGS) maintenanceservice_installer.nsi
$(NSINSTALL) -D $(DIST)/bin/
cp $(CONFIG_DIR)/maintenanceservice_installer.exe $(DIST)/bin
endif