Source code

Revision control

Other Tools

1
# This Source Code Form is subject to the terms of the Mozilla Public
2
# License, v. 2.0. If a copy of the MPL was not distributed with this
3
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
4
5
ifndef CONFIG_DIR
6
$(error CONFIG_DIR must be set before including makensis.mk)
7
endif
8
9
ABS_CONFIG_DIR := $(abspath $(CONFIG_DIR))
10
11
SFX_MODULE ?= $(error SFX_MODULE is not defined)
12
13
ifeq ($(CPU_ARCH), aarch64)
14
USE_UPX :=
15
else
16
ifneq (,$(UPX)$(MOZ_AUTOMATION))
17
USE_UPX := --use-upx
18
endif
19
endif
20
21
TOOLKIT_NSIS_FILES = \
22
common.nsh \
23
locale.nlf \
24
locale-fonts.nsh \
25
locale-rtl.nlf \
26
locales.nsi \
27
overrides.nsh \
28
setup.ico \
29
$(NULL)
30
31
CUSTOM_NSIS_PLUGINS = \
32
AccessControl.dll \
33
AppAssocReg.dll \
34
ApplicationID.dll \
35
BitsUtils.dll \
36
CertCheck.dll \
37
CityHash.dll \
38
ExecInExplorer.dll \
39
InetBgDL.dll \
40
InvokeShellVerb.dll \
41
liteFirewallW.dll \
42
nsJSON.dll \
43
ServicesHelper.dll \
44
ShellLink.dll \
45
UAC.dll \
46
$(NULL)
47
48
CUSTOM_UI = \
49
nsisui.exe \
50
$(NULL)
51
52
$(CONFIG_DIR)/setup.exe::
53
$(INSTALL) $(addprefix $(MOZILLA_DIR)/toolkit/mozapps/installer/windows/nsis/,$(TOOLKIT_NSIS_FILES)) $(CONFIG_DIR)
54
$(INSTALL) $(addprefix $(MOZILLA_DIR)/other-licenses/nsis/Plugins/,$(CUSTOM_NSIS_PLUGINS)) $(CONFIG_DIR)
55
$(INSTALL) $(addprefix $(MOZILLA_DIR)/other-licenses/nsis/,$(CUSTOM_UI)) $(CONFIG_DIR)
56
cd $(CONFIG_DIR) && $(call WINEWRAP,$(MAKENSISU)) $(MAKENSISU_FLAGS) installer.nsi
57
ifdef MOZ_STUB_INSTALLER
58
cd $(CONFIG_DIR) && $(call WINEWRAP,$(MAKENSISU)) $(MAKENSISU_FLAGS) stub.nsi
59
endif
60
61
ifdef ZIP_IN
62
installer:: $(CONFIG_DIR)/setup.exe $(ZIP_IN)
63
@echo 'Packaging $(WIN32_INSTALLER_OUT).'
64
$(NSINSTALL) -D '$(ABS_DIST)/$(PKG_INST_PATH)'
65
$(MOZILLA_DIR)/mach repackage installer \
66
-o '$(ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe' \
67
--package-name '$(MOZ_PKG_DIR)' \
68
--package '$(ZIP_IN)' \
69
--tag $(topsrcdir)/$(MOZ_BUILD_APP)/installer/windows/app.tag \
70
--setupexe $(CONFIG_DIR)/setup.exe \
71
--sfx-stub $(SFX_MODULE) \
72
$(USE_UPX)
73
ifdef MOZ_STUB_INSTALLER
74
$(MOZILLA_DIR)/mach repackage installer \
75
-o '$(ABS_DIST)/$(PKG_INST_PATH)$(PKG_STUB_BASENAME).exe' \
76
--tag $(topsrcdir)/browser/installer/windows/stub.tag \
77
--setupexe $(CONFIG_DIR)/setup-stub.exe \
78
--sfx-stub $(SFX_MODULE) \
79
$(USE_UPX)
80
endif
81
else
82
installer::
83
$(error ZIP_IN must be set when building installer)
84
endif
85
86
HELPER_DEPS = $(GLOBAL_DEPS) \
87
$(addprefix $(srcdir)/,$(INSTALLER_FILES)) \
88
$(addprefix $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/,$(BRANDING_FILES)) \
89
$(srcdir)/nsis/defines.nsi.in \
90
$(topsrcdir)/toolkit/mozapps/installer/windows/nsis/preprocess-locale.py \
91
$(addprefix $(MOZILLA_DIR)/toolkit/mozapps/installer/windows/nsis/,$(TOOLKIT_NSIS_FILES)) \
92
$(addprefix $(MOZILLA_DIR)/other-licenses/nsis/Plugins/,$(CUSTOM_NSIS_PLUGINS))
93
94
# For building the uninstaller during the application build so it can be
95
# included for mar file generation.
96
$(CONFIG_DIR)/helper.exe: $(HELPER_DEPS)
97
$(RM) -r $(CONFIG_DIR)
98
$(MKDIR) $(CONFIG_DIR)
99
$(INSTALL) $(addprefix $(srcdir)/,$(INSTALLER_FILES)) $(CONFIG_DIR)
100
$(INSTALL) $(addprefix $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/,$(BRANDING_FILES)) $(CONFIG_DIR)
101
$(call py3_action,preprocessor,-Fsubstitution $(DEFINES) $(ACDEFINES) \
102
$(srcdir)/nsis/defines.nsi.in -o $(CONFIG_DIR)/defines.nsi)
103
$(PYTHON) $(topsrcdir)/toolkit/mozapps/installer/windows/nsis/preprocess-locale.py \
104
--preprocess-locale $(topsrcdir) \
105
$(PPL_LOCALE_ARGS) $(AB_CD) $(CONFIG_DIR)
106
$(INSTALL) $(addprefix $(MOZILLA_DIR)/toolkit/mozapps/installer/windows/nsis/,$(TOOLKIT_NSIS_FILES)) $(CONFIG_DIR)
107
$(INSTALL) $(addprefix $(MOZILLA_DIR)/other-licenses/nsis/Plugins/,$(CUSTOM_NSIS_PLUGINS)) $(CONFIG_DIR)
108
cd $(CONFIG_DIR) && $(call WINEWRAP,$(MAKENSISU)) $(MAKENSISU_FLAGS) uninstaller.nsi
109
110
uninstaller:: $(CONFIG_DIR)/helper.exe
111
$(NSINSTALL) -D $(DIST)/bin/uninstall
112
cp $(CONFIG_DIR)/helper.exe $(DIST)/bin/uninstall
113
114
ifdef MOZ_MAINTENANCE_SERVICE
115
maintenanceservice_installer::
116
$(RM) -r $(CONFIG_DIR)
117
$(MKDIR) $(CONFIG_DIR)
118
$(INSTALL) $(addprefix $(srcdir)/,$(INSTALLER_FILES)) $(CONFIG_DIR)
119
$(INSTALL) $(addprefix $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/,$(BRANDING_FILES)) $(CONFIG_DIR)
120
$(call py3_action,preprocessor,-Fsubstitution $(DEFINES) $(ACDEFINES) \
121
$(srcdir)/nsis/defines.nsi.in -o $(CONFIG_DIR)/defines.nsi)
122
$(PYTHON) $(topsrcdir)/toolkit/mozapps/installer/windows/nsis/preprocess-locale.py \
123
--preprocess-locale $(topsrcdir) \
124
$(PPL_LOCALE_ARGS) $(AB_CD) $(CONFIG_DIR)
125
$(INSTALL) $(addprefix $(MOZILLA_DIR)/toolkit/mozapps/installer/windows/nsis/,$(TOOLKIT_NSIS_FILES)) $(CONFIG_DIR)
126
$(INSTALL) $(addprefix $(MOZILLA_DIR)/other-licenses/nsis/Plugins/,$(CUSTOM_NSIS_PLUGINS)) $(CONFIG_DIR)
127
cd $(CONFIG_DIR) && $(call WINEWRAP,$(MAKENSISU)) $(MAKENSISU_FLAGS) maintenanceservice_installer.nsi
128
$(NSINSTALL) -D $(DIST)/bin/
129
cp $(CONFIG_DIR)/maintenanceservice_installer.exe $(DIST)/bin
130
endif