import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo

This commit is contained in:
Roy Tam 2018-01-19 03:59:58 +08:00
commit dcd9973243
150858 changed files with 23884658 additions and 0 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,681 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
; Acholi
!if "${AB_CD}" == "ach"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Afrikaans
!if "${AB_CD}" == "af"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Akan
!if "${AB_CD}" == "ak"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Aragonese
!if "${AB_CD}" == "an"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Arabic
!if "${AB_CD}" == "ar"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Assamese
!if "${AB_CD}" == "as"
!define FONT_NAME1 "Nirmala UI"
!define FONT_FILE1 "Nirmala.ttf"
!endif
; Asturian
!if "${AB_CD}" == "ast"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Azerbaijani
!if "${AB_CD}" == "az"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Belarusian
!if "${AB_CD}" == "be"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Bulgarian
!if "${AB_CD}" == "bg"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Bengali
!if "${AB_CD}" == "bn-BD"
!define FONT_NAME1 "Nirmala UI"
!define FONT_FILE1 "Nirmala.ttf"
!endif
; Bengali - India
!if "${AB_CD}" == "bn-IN"
!define FONT_NAME1 "Nirmala UI"
!define FONT_FILE1 "Nirmala.ttf"
!endif
; Breton
!if "${AB_CD}" == "br"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Bosnian
!if "${AB_CD}" == "bs"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Catalan
!if "${AB_CD}" == "ca"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Czech
!if "${AB_CD}" == "cs"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Kashubian
!if "${AB_CD}" == "csb"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Welsh
!if "${AB_CD}" == "cy"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Danish
!if "${AB_CD}" == "da"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; German
!if "${AB_CD}" == "de"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Greek
!if "${AB_CD}" == "el"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; English - Great Britain
!if "${AB_CD}" == "en-GB"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; English - United States
!if "${AB_CD}" == "en-US"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; English - South Africa
!if "${AB_CD}" == "en-ZA"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Esperanto
!if "${AB_CD}" == "eo"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Spanish - Argentina
!if "${AB_CD}" == "es-AR"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Spanish - Chile
!if "${AB_CD}" == "es-CL"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Spanish
!if "${AB_CD}" == "es-ES"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Spanish - Mexico
!if "${AB_CD}" == "es-MX"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Estonian
!if "${AB_CD}" == "et"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Basque
!if "${AB_CD}" == "eu"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Persian
!if "${AB_CD}" == "fa"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Fulah
!if "${AB_CD}" == "ff"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Finnish
!if "${AB_CD}" == "fi"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; French
!if "${AB_CD}" == "fr"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Frisian
!if "${AB_CD}" == "fy-NL"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Irish
!if "${AB_CD}" == "ga-IE"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Scottish Gaelic
!if "${AB_CD}" == "gd"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Galician
!if "${AB_CD}" == "gl"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Gujarati
!if "${AB_CD}" == "gu-IN"
!define FONT_NAME1 "Nirmala UI"
!define FONT_FILE1 "Nirmala.ttf"
!endif
; Hawaiian
!if "${AB_CD}" == "haw"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Hebrew
!if "${AB_CD}" == "he"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; hindi
!if "${AB_CD}" == "hi-IN"
!define FONT_NAME1 "Nirmala UI"
!define FONT_FILE1 "Nirmala.ttf"
!endif
; Croatian
!if "${AB_CD}" == "hr"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Upper Sorbian
!if "${AB_CD}" == "hsb"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Hungarian
!if "${AB_CD}" == "hu"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Armenian
!if "${AB_CD}" == "hy-AM"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Indonesian
!if "${AB_CD}" == "id"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Iloko
!if "${AB_CD}" == "ilo"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Icelandic
!if "${AB_CD}" == "is"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Italian
!if "${AB_CD}" == "it"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Japanese
!if "${AB_CD}" == "ja"
!define FONT_NAME1 "Meiryo UI"
!define FONT_FILE1 "meiryo.ttc"
!endif
; Georgian
!if "${AB_CD}" == "ka"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Kazakh
!if "${AB_CD}" == "kk"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Khmer
!if "${AB_CD}" == "km"
!define FONT_NAME1 "Leelawadee UI"
!define FONT_FILE1 "LeelawUI.ttf"
!endif
; Kannada
!if "${AB_CD}" == "kn"
!define FONT_NAME1 "Nirmala UI"
!define FONT_FILE1 "Nirmala.ttf"
!endif
; Korean
!if "${AB_CD}" == "ko"
!define FONT_NAME1 "Malgun Gothic"
!define FONT_FILE1 "malgun.ttf"
!endif
; Kurdish
!if "${AB_CD}" == "ku"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Luganda
!if "${AB_CD}" == "lg"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Ligurian
!if "${AB_CD}" == "lij"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Lithuanian
!if "${AB_CD}" == "lt"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Latvian
!if "${AB_CD}" == "lv"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Maithili
!if "${AB_CD}" == "mai"
!define FONT_NAME1 "Nirmala UI"
!define FONT_FILE1 "Nirmala.ttf"
!endif
; Macedonian
!if "${AB_CD}" == "mk"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Malayalam
!if "${AB_CD}" == "ml"
!define FONT_NAME1 "Nirmala UI"
!define FONT_FILE1 "Nirmala.ttf"
!endif
; Mongolian
!if "${AB_CD}" == "mn"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Marathi
!if "${AB_CD}" == "mr"
!define FONT_NAME1 "Nirmala UI"
!define FONT_FILE1 "Nirmala.ttf"
!endif
; Malay
!if "${AB_CD}" == "ms"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Burmese
!if "${AB_CD}" == "my"
!define FONT_NAME1 "Myanmar Text"
!define FONT_FILE1 "mmrtext.ttf"
!endif
; Norwegian Bokmål
!if "${AB_CD}" == "nb-NO"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Nepali Nepal
!if "${AB_CD}" == "ne-NP"
!define FONT_NAME1 "Nirmala UI"
!define FONT_FILE1 "Nirmala.ttf"
!endif
; Dutch
!if "${AB_CD}" == "nl"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Norwegian Nynorsk
!if "${AB_CD}" == "nn-NO"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Southern Ndebele
!if "${AB_CD}" == "nr"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Northern Sotho
!if "${AB_CD}" == "nso"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Occitan
!if "${AB_CD}" == "oc"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Odia
!if "${AB_CD}" == "or"
!define FONT_NAME1 "Kalinga"
!define FONT_FILE1 "kalinga.ttf"
!endif
; Punjabi
!if "${AB_CD}" == "pa-IN"
!define FONT_NAME1 "Nirmala UI"
!define FONT_FILE1 "Nirmala.ttf"
!endif
; Polish
!if "${AB_CD}" == "pl"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Portugese - Brazil
!if "${AB_CD}" == "pt-BR"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Portugese
!if "${AB_CD}" == "pt-PT"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Romansh
!if "${AB_CD}" == "rm"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Romanian
!if "${AB_CD}" == "ro"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Russian
!if "${AB_CD}" == "ru"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Kinyarwanda
!if "${AB_CD}" == "rw"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Sakha
!if "${AB_CD}" == "sah"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Sinhala
!if "${AB_CD}" == "si"
!define FONT_NAME1 "Nirmala UI"
!define FONT_FILE1 "Nirmala.ttf"
!endif
; Slovak
!if "${AB_CD}" == "sk"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Slovene
!if "${AB_CD}" == "sl"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Songhay
!if "${AB_CD}" == "son"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Albanian
!if "${AB_CD}" == "sq"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Serbian
!if "${AB_CD}" == "sr"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Swazi
!if "${AB_CD}" == "ss"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Southern Sotho
!if "${AB_CD}" == "st"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Swedish
!if "${AB_CD}" == "sv-Se"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Swahili
!if "${AB_CD}" == "sw"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Tamil
!if "${AB_CD}" == "ta"
!define FONT_NAME1 "Nirmala UI"
!define FONT_FILE1 "Nirmala.ttf"
!endif
; Tamil - Sri Lanka
!if "${AB_CD}" == "ta-LK"
!define FONT_NAME1 "Nirmala UI"
!define FONT_FILE1 "Nirmala.ttf"
!endif
; Telugu
!if "${AB_CD}" == "te"
!define FONT_NAME1 "Nirmala UI"
!define FONT_FILE1 "Nirmala.ttf"
!endif
; Thai
!if "${AB_CD}" == "th"
!define FONT_NAME1 "Leelawadee UI"
!define FONT_FILE1 "LeelawUI.ttf"
!endif
; Tswana
!if "${AB_CD}" == "tn"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Turkish
!if "${AB_CD}" == "tr"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Tsonga
!if "${AB_CD}" == "ts"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Uyghur
!if "${AB_CD}" == "ug"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Ukrainian
!if "${AB_CD}" == "uk"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Urdu
!if "${AB_CD}" == "ur"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Venda
!if "${AB_CD}" == "ve"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Vietnamese
!if "${AB_CD}" == "vi"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Wolof
!if "${AB_CD}" == "wo"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Xhosa
!if "${AB_CD}" == "xh"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif
; Chinese (Simplified)
!if "${AB_CD}" == "zh-CN"
!define FONT_NAME1 "Microsoft YaHei UI"
!define FONT_FILE1 "msyh.ttc"
!endif
; Chinese (Traditional)
!if "${AB_CD}" == "zh-TW"
!define FONT_NAME1 "Microsoft JhengHei UI"
!define FONT_FILE1 "msjh.ttc"
!endif
; Zulu
!if "${AB_CD}" == "zu"
!define FONT_NAME1 "Segoe UI"
!define FONT_FILE1 "segoeui.ttf"
!endif

View file

@ -0,0 +1,12 @@
# Header, don't edit
NLF v6
# Start editing here
# Language ID
0
# Font and size - dash (-) means default
-
-
# Codepage - dash (-) means ANSI code page
-
# RTL - anything else than RTL means LTR
RTL

View file

@ -0,0 +1,12 @@
# Header, don't edit
NLF v6
# Start editing here
# Language ID
0
# Font and size - dash (-) means default
-
-
# Codepage - dash (-) means ANSI code page
-
# RTL - anything else than RTL means LTR
-

View file

@ -0,0 +1,23 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
/**
* "One off" locale configuration settings for RTL (e.g. locale text is read
* right to left).
*/
; Arabic
!define ar_rtl
; Hebrew
!define he_rtl
; Persian
!define fa_rtl
; Uyghur
!define ug_rtl
; Urdu
!define ur_rtl

View file

@ -0,0 +1,100 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
ifndef CONFIG_DIR
$(error CONFIG_DIR must be set before including makensis.mk)
endif
include $(MOZILLA_DIR)/toolkit/mozapps/installer/signing.mk
ABS_CONFIG_DIR := $(abspath $(CONFIG_DIR))
SFX_MODULE ?= $(error SFX_MODULE is not defined)
TOOLKIT_NSIS_FILES = \
common.nsh \
locale.nlf \
locale-fonts.nsh \
locale-rtl.nlf \
locales.nsi \
overrides.nsh \
setup.ico \
$(NULL)
CUSTOM_NSIS_PLUGINS = \
AccessControl.dll \
AppAssocReg.dll \
ApplicationID.dll \
CertCheck.dll \
CityHash.dll \
InetBgDL.dll \
InvokeShellVerb.dll \
liteFirewallW.dll \
ServicesHelper.dll \
ShellLink.dll \
UAC.dll \
$(NULL)
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
ifdef MOZ_STUB_INSTALLER
cd $(CONFIG_DIR) && $(MAKENSISU) 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
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)
installer::
$(INSTALL) $(CONFIG_DIR)/setup.exe $(DEPTH)/installer-stage
cd $(DEPTH)/installer-stage && $(CYGWIN_WRAPPER) 7z a -r -t7z $(ABS_CONFIG_DIR)/app.7z -mx -m0=BCJ2 -m1=LZMA:d25 -m2=LZMA:d19 -m3=LZMA:d19 -mb0:1 -mb0s1:2 -mb0s2:3
$(MAKE) $(CONFIG_DIR)/7zSD.sfx
$(NSINSTALL) -D $(DIST)/$(PKG_INST_PATH)
cat $(CONFIG_DIR)/7zSD.sfx $(CONFIG_DIR)/app.tag $(CONFIG_DIR)/app.7z > "$(DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe"
chmod 0755 "$(DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe"
ifdef MOZ_STUB_INSTALLER
cp $(CONFIG_DIR)/stub.exe "$(DIST)/$(PKG_INST_PATH)$(PKG_STUB_BASENAME).exe"
chmod 0755 "$(DIST)/$(PKG_INST_PATH)$(PKG_STUB_BASENAME).exe"
endif
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
$(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
$(NSINSTALL) -D $(DIST)/bin/
cp $(CONFIG_DIR)/maintenanceservice_installer.exe $(DIST)/bin
endif

View file

@ -0,0 +1,604 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
################################################################################
# Modified versions of macros provided by NSIS
!ifndef OVERRIDES_INCLUDED
!define OVERRIDES_INCLUDED
!ifndef ___WINVER__NSH___
!include WinVer.nsh
!endif
; When including a file check if its verbose macro is defined to prevent
; loading the file a second time.
!ifmacrondef TEXTFUNC_VERBOSE
!include TextFunc.nsh
!endif
!ifmacrondef FILEFUNC_VERBOSE
!include FileFunc.nsh
!endif
!macro __MOZ__WinVer_DefineOSTests WinVer
!insertmacro __WinVer_DefineOSTest AtLeast ${WinVer} ""
!insertmacro __WinVer_DefineOSTest Is ${WinVer} ""
!insertmacro __WinVer_DefineOSTest AtMost ${WinVer} ""
!macroend
!ifndef WINVER_8
!define WINVER_8 0x06020000 ;6.02.9200
!insertmacro __MOZ__WinVer_DefineOSTests 8
!endif
!ifndef WINVER_8.1
!define WINVER_8.1 0x06030000 ;6.03.9600
!insertmacro __MOZ__WinVer_DefineOSTests 8.1
!endif
!ifndef WINVER_2012
!define WINVER_2012 0x06020001 ;6.02.9200
!insertmacro __MOZ__WinVer_DefineOSTests 2012
!endif
!ifndef WINVER_2012R2
!define WINVER_2012R2 0x06030001 ;6.03.9600
!insertmacro __MOZ__WinVer_DefineOSTests 2012R2
!endif
!ifndef WINVER_10
!define WINVER_10 0x0A000000 ;10.0.10240
!insertmacro __MOZ__WinVer_DefineOSTests 10
!endif
!verbose push
!verbose 3
!ifndef _OVERRIDE_VERBOSE
!define _OVERRIDE_VERBOSE 3
!endif
!verbose ${_OVERRIDE_VERBOSE}
!define OVERRIDE_VERBOSE `!insertmacro OVERRIDE_VERBOSE`
!define _OVERRIDE_UN
!define _OVERRIDE_S
!verbose pop
!macro OVERRIDE_VERBOSE _VERBOSE
!verbose push
!verbose 3
!undef _OVERRIDE_VERBOSE
!define _OVERRIDE_VERBOSE ${_VERBOSE}
!verbose pop
!macroend
; Modified version of Locate from the NSIS File Functions Header v3.4 (it has
; the same version in earlier versions of NSIS even though it has changed) that
; is distributed with NSIS v2.46-Unicode. This version has the calls to
; SetDetailsPrint commented out.
; See <NSIS v2.46-Unicode App Dir>/include/FileFunc.nsh for more information.
!macro LocateNoDetailsCall _PATH _OPTIONS _FUNC
!verbose push
!verbose ${_OVERRIDE_VERBOSE}
Push $0
Push `${_PATH}`
Push `${_OPTIONS}`
GetFunctionAddress $0 `${_FUNC}`
Push `$0`
Call LocateNoDetails
Pop $0
!verbose pop
!macroend
!macro LocateNoDetails
!ifndef ${_OVERRIDE_UN}LocateNoDetails
!verbose push
!verbose ${_OVERRIDE_VERBOSE}
!define ${_OVERRIDE_UN}LocateNoDetails `!insertmacro ${_OVERRIDE_UN}LocateNoDetailsCall`
Function ${_OVERRIDE_UN}LocateNoDetails
Exch $2
Exch
Exch $1
Exch
Exch 2
Exch $0
Exch 2
Push $3
Push $4
Push $5
Push $6
Push $7
Push $8
Push $9
Push $R6
Push $R7
Push $R8
Push $R9
ClearErrors
StrCpy $3 ''
StrCpy $4 ''
StrCpy $5 ''
StrCpy $6 ''
StrCpy $7 ''
StrCpy $8 0
StrCpy $R7 ''
StrCpy $R9 $0 1 -1
StrCmp $R9 '\' 0 +3
StrCpy $0 $0 -1
goto -3
IfFileExists '$0\*.*' 0 error
option:
StrCpy $R9 $1 1
StrCpy $1 $1 '' 1
StrCmp $R9 ' ' -2
StrCmp $R9 '' sizeset
StrCmp $R9 '/' 0 -4
StrCpy $9 -1
IntOp $9 $9 + 1
StrCpy $R9 $1 1 $9
StrCmp $R9 '' +2
StrCmp $R9 '/' 0 -3
StrCpy $R8 $1 $9
StrCpy $R8 $R8 '' 2
StrCpy $R9 $R8 '' -1
StrCmp $R9 ' ' 0 +3
StrCpy $R8 $R8 -1
goto -3
StrCpy $R9 $1 2
StrCpy $1 $1 '' $9
StrCmp $R9 'L=' 0 mask
StrCpy $3 $R8
StrCmp $3 '' +6
StrCmp $3 'FD' +5
StrCmp $3 'F' +4
StrCmp $3 'D' +3
StrCmp $3 'DE' +2
StrCmp $3 'FDE' 0 error
goto option
mask:
StrCmp $R9 'M=' 0 size
StrCpy $4 $R8
goto option
size:
StrCmp $R9 'S=' 0 gotosubdir
StrCpy $6 $R8
goto option
gotosubdir:
StrCmp $R9 'G=' 0 banner
StrCpy $7 $R8
StrCmp $7 '' +3
StrCmp $7 '1' +2
StrCmp $7 '0' 0 error
goto option
banner:
StrCmp $R9 'B=' 0 error
StrCpy $R7 $R8
StrCmp $R7 '' +3
StrCmp $R7 '1' +2
StrCmp $R7 '0' 0 error
goto option
sizeset:
StrCmp $6 '' default
StrCpy $9 0
StrCpy $R9 $6 1 $9
StrCmp $R9 '' +4
StrCmp $R9 ':' +3
IntOp $9 $9 + 1
goto -4
StrCpy $5 $6 $9
IntOp $9 $9 + 1
StrCpy $1 $6 1 -1
StrCpy $6 $6 -1 $9
StrCmp $5 '' +2
IntOp $5 $5 + 0
StrCmp $6 '' +2
IntOp $6 $6 + 0
StrCmp $1 'B' 0 +3
StrCpy $1 1
goto default
StrCmp $1 'K' 0 +3
StrCpy $1 1024
goto default
StrCmp $1 'M' 0 +3
StrCpy $1 1048576
goto default
StrCmp $1 'G' 0 error
StrCpy $1 1073741824
default:
StrCmp $3 '' 0 +2
StrCpy $3 'FD'
StrCmp $4 '' 0 +2
StrCpy $4 '*.*'
StrCmp $7 '' 0 +2
StrCpy $7 '1'
StrCmp $R7 '' 0 +2
StrCpy $R7 '0'
StrCpy $7 'G$7B$R7'
StrCpy $8 1
Push $0
; SetDetailsPrint textonly
nextdir:
IntOp $8 $8 - 1
Pop $R8
StrCpy $9 $7 2 2
StrCmp $9 'B0' +3
GetLabelAddress $9 findfirst
goto call
; DetailPrint 'Search in: $R8'
findfirst:
FindFirst $0 $R7 '$R8\$4'
IfErrors subdir
StrCmp $R7 '.' 0 dir
FindNext $0 $R7
StrCmp $R7 '..' 0 dir
FindNext $0 $R7
IfErrors 0 dir
FindClose $0
goto subdir
dir:
IfFileExists '$R8\$R7\*.*' 0 file
StrCpy $R6 ''
StrCmp $3 'DE' +4
StrCmp $3 'FDE' +3
StrCmp $3 'FD' precall
StrCmp $3 'F' findnext precall
FindFirst $9 $R9 '$R8\$R7\*.*'
StrCmp $R9 '.' 0 +4
FindNext $9 $R9
StrCmp $R9 '..' 0 +2
FindNext $9 $R9
FindClose $9
IfErrors precall findnext
file:
StrCmp $3 'FDE' +3
StrCmp $3 'FD' +2
StrCmp $3 'F' 0 findnext
StrCpy $R6 0
StrCmp $5$6 '' precall
FileOpen $9 '$R8\$R7' r
IfErrors +3
FileSeek $9 0 END $R6
FileClose $9
System::Int64Op $R6 / $1
Pop $R6
StrCmp $5 '' +2
IntCmp $R6 $5 0 findnext
StrCmp $6 '' +2
IntCmp $R6 $6 0 0 findnext
precall:
StrCpy $9 0
StrCpy $R9 '$R8\$R7'
call:
Push $0
Push $1
Push $2
Push $3
Push $4
Push $5
Push $6
Push $7
Push $8
Push $9
Push $R7
Push $R8
StrCmp $9 0 +4
StrCpy $R6 ''
StrCpy $R7 ''
StrCpy $R9 ''
Call $2
Pop $R9
Pop $R8
Pop $R7
Pop $9
Pop $8
Pop $7
Pop $6
Pop $5
Pop $4
Pop $3
Pop $2
Pop $1
Pop $0
IfErrors 0 +3
FindClose $0
goto error
StrCmp $R9 'StopLocateNoDetails' 0 +3
FindClose $0
goto clearstack
goto $9
findnext:
FindNext $0 $R7
IfErrors 0 dir
FindClose $0
subdir:
StrCpy $9 $7 2
StrCmp $9 'G0' end
FindFirst $0 $R7 '$R8\*.*'
StrCmp $R7 '.' 0 pushdir
FindNext $0 $R7
StrCmp $R7 '..' 0 pushdir
FindNext $0 $R7
IfErrors 0 pushdir
FindClose $0
StrCmp $8 0 end nextdir
pushdir:
IfFileExists '$R8\$R7\*.*' 0 +3
Push '$R8\$R7'
IntOp $8 $8 + 1
FindNext $0 $R7
IfErrors 0 pushdir
FindClose $0
StrCmp $8 0 end nextdir
error:
SetErrors
clearstack:
StrCmp $8 0 end
IntOp $8 $8 - 1
Pop $R8
goto clearstack
end:
; SetDetailsPrint both
Pop $R9
Pop $R8
Pop $R7
Pop $R6
Pop $9
Pop $8
Pop $7
Pop $6
Pop $5
Pop $4
Pop $3
Pop $2
Pop $1
Pop $0
FunctionEnd
!verbose pop
!endif
!macroend
!macro un.LocateNoDetailsCall _PATH _OPTIONS _FUNC
!verbose push
!verbose ${_OVERRIDE_VERBOSE}
Push $0
Push `${_PATH}`
Push `${_OPTIONS}`
GetFunctionAddress $0 `${_FUNC}`
Push `$0`
Call un.LocateNoDetails
Pop $0
!verbose pop
!macroend
!macro un.LocateNoDetails
!ifndef un.LocateNoDetails
!verbose push
!verbose ${_OVERRIDE_VERBOSE}
!undef _OVERRIDE_UN
!define _OVERRIDE_UN `un.`
!insertmacro LocateNoDetails
!undef _OVERRIDE_UN
!define _OVERRIDE_UN
!verbose pop
!endif
!macroend
; Modified version of TextCompare from the NSIS Text Functions Header v2.4 (it
; has the same version in earlier versions of NSIS even though it has changed)
; that is distributed with NSIS v2.46-Unicode. This version has the calls to
; SetDetailsPrint commented out.
; See <NSIS v2.46-Unicode App Dir>/include/TextFunc.nsh for more information.
!macro TextCompareNoDetailsCall _FILE1 _FILE2 _OPTION _FUNC
!verbose push
!verbose ${_OVERRIDE_VERBOSE}
Push $0
Push `${_FILE1}`
Push `${_FILE2}`
Push `${_OPTION}`
GetFunctionAddress $0 `${_FUNC}`
Push `$0`
${CallArtificialFunction} TextCompareNoDetails_
Pop $0
!verbose pop
!macroend
!macro TextCompareNoDetailsSCall _FILE1 _FILE2 _OPTION _FUNC
!verbose push
!verbose ${_OVERRIDE_VERBOSE}
Push $0
Push `${_FILE1}`
Push `${_FILE2}`
Push `${_OPTION}`
GetFunctionAddress $0 `${_FUNC}`
Push `$0`
${CallArtificialFunction} TextCompareNoDetailsS_
Pop $0
!verbose pop
!macroend
!macro TextCompareNoDetailsBody _OVERRIDE_S
Exch $3
Exch
Exch $2
Exch
Exch 2
Exch $1
Exch 2
Exch 3
Exch $0
Exch 3
Push $4
Push $5
Push $6
Push $7
Push $8
Push $9
ClearErrors
IfFileExists $0 0 TextFunc_TextCompareNoDetails${_OVERRIDE_S}_error
IfFileExists $1 0 TextFunc_TextCompareNoDetails${_OVERRIDE_S}_error
StrCmp $2 'FastDiff' +5
StrCmp $2 'FastEqual' +4
StrCmp $2 'SlowDiff' +3
StrCmp $2 'SlowEqual' +2
goto TextFunc_TextCompareNoDetails${_OVERRIDE_S}_error
FileOpen $4 $0 r
IfErrors TextFunc_TextCompareNoDetails${_OVERRIDE_S}_error
FileOpen $5 $1 r
IfErrors TextFunc_TextCompareNoDetails${_OVERRIDE_S}_error
; SetDetailsPrint textonly
StrCpy $6 0
StrCpy $8 0
TextFunc_TextCompareNoDetails${_OVERRIDE_S}_nextline:
StrCmp${_OVERRIDE_S} $4 '' TextFunc_TextCompareNoDetails${_OVERRIDE_S}_fast
IntOp $8 $8 + 1
FileRead $4 $9
IfErrors 0 +4
FileClose $4
StrCpy $4 ''
StrCmp${_OVERRIDE_S} $5 '' TextFunc_TextCompareNoDetails${_OVERRIDE_S}_end
StrCmp $2 'FastDiff' TextFunc_TextCompareNoDetails${_OVERRIDE_S}_fast
StrCmp $2 'FastEqual' TextFunc_TextCompareNoDetails${_OVERRIDE_S}_fast TextFunc_TextCompareNoDetails${_OVERRIDE_S}_slow
TextFunc_TextCompareNoDetails${_OVERRIDE_S}_fast:
StrCmp${_OVERRIDE_S} $5 '' TextFunc_TextCompareNoDetails${_OVERRIDE_S}_call
IntOp $6 $6 + 1
FileRead $5 $7
IfErrors 0 +5
FileClose $5
StrCpy $5 ''
StrCmp${_OVERRIDE_S} $4 '' TextFunc_TextCompareNoDetails${_OVERRIDE_S}_end
StrCmp $2 'FastDiff' TextFunc_TextCompareNoDetails${_OVERRIDE_S}_call TextFunc_TextCompareNoDetails${_OVERRIDE_S}_close
StrCmp $2 'FastDiff' 0 +2
StrCmp${_OVERRIDE_S} $7 $9 TextFunc_TextCompareNoDetails${_OVERRIDE_S}_nextline TextFunc_TextCompareNoDetails${_OVERRIDE_S}_call
StrCmp${_OVERRIDE_S} $7 $9 TextFunc_TextCompareNoDetails${_OVERRIDE_S}_call TextFunc_TextCompareNoDetails${_OVERRIDE_S}_nextline
TextFunc_TextCompareNoDetails${_OVERRIDE_S}_slow:
StrCmp${_OVERRIDE_S} $4 '' TextFunc_TextCompareNoDetails${_OVERRIDE_S}_close
StrCpy $6 ''
; DetailPrint '$8. $9'
FileSeek $5 0
TextFunc_TextCompareNoDetails${_OVERRIDE_S}_slownext:
FileRead $5 $7
IfErrors 0 +2
StrCmp $2 'SlowDiff' TextFunc_TextCompareNoDetails${_OVERRIDE_S}_call TextFunc_TextCompareNoDetails${_OVERRIDE_S}_nextline
StrCmp $2 'SlowDiff' 0 +2
StrCmp${_OVERRIDE_S} $7 $9 TextFunc_TextCompareNoDetails${_OVERRIDE_S}_nextline TextFunc_TextCompareNoDetails${_OVERRIDE_S}_slownext
IntOp $6 $6 + 1
StrCmp${_OVERRIDE_S} $7 $9 0 TextFunc_TextCompareNoDetails${_OVERRIDE_S}_slownext
TextFunc_TextCompareNoDetails${_OVERRIDE_S}_call:
Push $2
Push $3
Push $4
Push $5
Push $6
Push $7
Push $8
Push $9
Call $3
Pop $0
Pop $9
Pop $8
Pop $7
Pop $6
Pop $5
Pop $4
Pop $3
Pop $2
StrCmp $0 'StopTextCompareNoDetails' 0 TextFunc_TextCompareNoDetails${_OVERRIDE_S}_nextline
TextFunc_TextCompareNoDetails${_OVERRIDE_S}_close:
FileClose $4
FileClose $5
goto TextFunc_TextCompareNoDetails${_OVERRIDE_S}_end
TextFunc_TextCompareNoDetails${_OVERRIDE_S}_error:
SetErrors
TextFunc_TextCompareNoDetails${_OVERRIDE_S}_end:
; SetDetailsPrint both
Pop $9
Pop $8
Pop $7
Pop $6
Pop $5
Pop $4
Pop $3
Pop $2
Pop $1
Pop $0
!macroend
!define TextCompareNoDetails `!insertmacro TextCompareNoDetailsCall`
!define un.TextCompareNoDetails `!insertmacro TextCompareNoDetailsCall`
!macro TextCompareNoDetails
!macroend
!macro un.TextCompareNoDetails
!macroend
!macro TextCompareNoDetails_
!verbose push
!verbose ${_OVERRIDE_VERBOSE}
!insertmacro TextCompareNoDetailsBody ''
!verbose pop
!macroend
!define TextCompareNoDetailsS `!insertmacro TextCompareNoDetailsSCall`
!define un.TextCompareNoDetailsS `!insertmacro TextCompareNoDetailsSCall`
!macro TextCompareNoDetailsS
!macroend
!macro un.TextCompareNoDetailsS
!macroend
!macro TextCompareNoDetailsS_
!verbose push
!verbose ${_OVERRIDE_VERBOSE}
!insertmacro TextCompareNoDetailsBody 'S'
!verbose pop
!macroend
!endif

View file

@ -0,0 +1,360 @@
# preprocess-locale.py
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
# preprocess-locale.py provides two functions depending on the arguments passed
# to it when invoked.
#
# Preprocesses installer locale properties files and creates a basic NSIS nlf
# file when invoked with --preprocess-locale.
#
# Converts a UTF-8 file to a new UTF-16LE file when invoked with
# --convert-utf8-utf16le.
from codecs import BOM_UTF16_LE
from os.path import join, isfile
import sys
from optparse import OptionParser
def open_utf16le_file(path):
"""
Returns an opened file object with a a UTF-16LE byte order mark.
"""
fp = open(path, "w+b")
fp.write(BOM_UTF16_LE)
return fp
def get_locale_strings(path, prefix, middle, add_cr):
"""
Returns a string created by converting an installer locale properties file
into the format required by NSIS locale files.
Parameters:
path - the path to the installer locale properties file to preprocess
prefix - a string to prefix each line with
middle - a string to insert between the name and value for each line
add_cr - boolean for whether to add an NSIS carriage return before NSIS
linefeeds when there isn't one already
"""
output = ""
fp = open(path, "r")
for line in fp:
line = line.strip()
if line == "" or line[0] == "#":
continue
name, value = line.split("=", 1)
value = value.strip() # trim whitespace from the start and end
if value and value[-1] == "\"" and value[0] == "\"":
value = value[1:-1] # remove " from the start and end
if add_cr:
value = value.replace("\\n", "\\r\\n") # prefix $\n with $\r
value = value.replace("\\r\\r", "\\r") # replace $\r$\r with $\r
value = value.replace("\"", "$\\\"") # prefix " with $\
value = value.replace("\\r", "$\\r") # prefix \r with $
value = value.replace("\\n", "$\\n") # prefix \n with $
value = value.replace("\\t", "$\\t") # prefix \t with $
output += prefix + name.strip() + middle + " \"" + value + "\"\n"
fp.close()
return output
def lookup(path, l10ndirs):
for d in l10ndirs:
if isfile(join(d, path)):
return join(d, path)
return join(l10ndirs[-1], path)
def preprocess_locale_files(config_dir, l10ndirs):
"""
Preprocesses the installer localized properties files into the format
required by NSIS and creates a basic NSIS nlf file.
Parameters:
config_dir - the path to the destination directory
l10ndirs - list of paths to search for installer locale files
"""
# Create the main NSIS language file
fp = open_utf16le_file(join(config_dir, "overrideLocale.nsh"))
locale_strings = get_locale_strings(lookup("override.properties",
l10ndirs),
"LangString ^",
" 0 ",
False)
fp.write(unicode(locale_strings, "utf-8").encode("utf-16-le"))
fp.close()
# Create the Modern User Interface language file
fp = open_utf16le_file(join(config_dir, "baseLocale.nsh"))
fp.write((u""";NSIS Modern User Interface - Language File
;Compatible with Modern UI 1.68
;Language: baseLocale (0)
!insertmacro MOZ_MUI_LANGUAGEFILE_BEGIN \"baseLocale\"
!define MUI_LANGNAME \"baseLocale\"
""").encode("utf-16-le"))
locale_strings = get_locale_strings(lookup("mui.properties", l10ndirs),
"!define ", " ", True)
fp.write(unicode(locale_strings, "utf-8").encode("utf-16-le"))
fp.write(u"!insertmacro MOZ_MUI_LANGUAGEFILE_END\n".encode("utf-16-le"))
fp.close()
# Create the custom language file for our custom strings
fp = open_utf16le_file(join(config_dir, "customLocale.nsh"))
locale_strings = get_locale_strings(lookup("custom.properties",
l10ndirs),
"LangString ",
" 0 ",
True)
fp.write(unicode(locale_strings, "utf-8").encode("utf-16-le"))
fp.close()
def create_nlf_file(moz_dir, ab_cd, config_dir):
"""
Create a basic NSIS nlf file.
Parameters:
moz_dir - the path to top source directory for the toolkit source
ab_cd - the locale code
config_dir - the path to the destination directory
"""
rtl = "-"
# Check whether the locale is right to left from locales.nsi.
fp = open(join(moz_dir,
"toolkit/mozapps/installer/windows/nsis/locales.nsi"),
"r")
for line in fp:
line = line.strip()
if line == "!define " + ab_cd + "_rtl":
rtl = "RTL"
break
fp.close()
# Create the main NSIS language file with RTL for right to left locales
# along with the default codepage, font name, and font size represented
# by the '-' character.
fp = open_utf16le_file(join(config_dir, "baseLocale.nlf"))
fp.write((u"""# Header, don't edit
NLF v6
# Start editing here
# Language ID
0
# Font and size - dash (-) means default
-
-
# Codepage - dash (-) means ANSI code page
-
# RTL - anything else than RTL means LTR
%s
""" % rtl).encode("utf-16-le"))
fp.close()
def preprocess_locale_file(config_dir,
l10ndirs,
properties_filename,
output_filename):
"""
Preprocesses a single localized properties file into the format
required by NSIS and creates a basic NSIS nlf file.
Parameters:
config_dir - the path to the destination directory
l10ndirs - list of paths to search for installer locale files
properties_filename - the name of the properties file to search for
output_filename - the output filename to write
"""
# Create the custom language file for our custom strings
fp = open_utf16le_file(join(config_dir, output_filename))
locale_strings = get_locale_strings(lookup(properties_filename,
l10ndirs),
"LangString ",
" 0 ",
True)
fp.write(unicode(locale_strings, "utf-8").encode("utf-16-le"))
fp.close()
def convert_utf8_utf16le(in_file_path, out_file_path):
"""
Converts a UTF-8 file to a new UTF-16LE file
Arguments:
in_file_path - the path to the UTF-8 source file to convert
out_file_path - the path to the UTF-16LE destination file to create
"""
in_fp = open(in_file_path, "r")
out_fp = open_utf16le_file(out_file_path)
out_fp.write(unicode(in_fp.read(), "utf-8").encode("utf-16-le"))
in_fp.close()
out_fp.close()
if __name__ == '__main__':
usage = """usage: %prog command <args>
Commands:
--convert-utf8-utf16le - Preprocesses installer locale properties files
--preprocess-locale - Preprocesses the installer localized properties
files into the format required by NSIS and
creates a basic NSIS nlf file.
--preprocess-single-file - Preprocesses a single properties file into the
format required by NSIS
--create-nlf-file - Creates a basic NSIS nlf file
preprocess-locale.py --preprocess-locale <src> <locale> <code> <dest>
Arguments:
<src> \tthe path to top source directory for the toolkit source
<locale>\tthe path to the installer's locale files
<code> \tthe locale code
<dest> \tthe path to the destination directory
preprocess-locale.py --preprocess-single-file <src>
<locale>
<dest>
<infile>
<outfile>
Arguments:
<src> \tthe path to top source directory for the toolkit source
<locale> \tthe path to the installer's locale files
<dest> \tthe path to the destination directory
<infile> \tthe properties file to process
<outfile>\tthe nsh file to write
preprocess-locale.py --create-nlf-file <src>
<code>
<dest>
Arguments:
<src> \tthe path to top source directory for the toolkit source
<code> \tthe locale code
<dest> \tthe path to the destination directory
preprocess-locale.py --convert-utf8-utf16le <src> <dest>
Arguments:
<src> \tthe path to the UTF-8 source file to convert
<dest>\tthe path to the UTF-16LE destination file to create
"""
preprocess_locale_args_help_string = """\
Arguments to --preprocess-locale should be:
<src> <locale> <code> <dest>
or
<src> <code> <dest> --l10n-dir <dir> [--l10n-dir <dir> ...]"""
preprocess_single_file_args_help_string = """\
Arguments to --preprocess-single_file should be:
<src> <locale> <code> <dest> <infile> <outfile>
or
<src> <locale> <code> <dest> <infile> <outfile>
--l10n-dir <dir> [--l10n-dir <dir>...]"""
create_nlf_args_help_string = """\
Arguments to --create-nlf-file should be:
<src> <code> <dest>"""
p = OptionParser(usage=usage)
p.add_option("--preprocess-locale", action="store_true", default=False,
dest='preprocess')
p.add_option("--preprocess-single-file", action="store_true", default=False,
dest='preprocessSingle')
p.add_option("--create-nlf-file", action="store_true", default=False,
dest='createNlf')
p.add_option("--l10n-dir", action="append", default=[],
dest="l10n_dirs",
help="Add directory to lookup for locale files")
p.add_option("--convert-utf8-utf16le", action="store_true", default=False,
dest='convert')
options, args = p.parse_args()
foundOne = False
if (options.preprocess):
foundOne = True
if (options.convert):
if(foundOne):
p.error("More than one command specified")
else:
foundOne = True
if (options.preprocessSingle):
if(foundOne):
p.error("More than one command specified")
else:
foundOne = True
if (options.createNlf):
if(foundOne):
p.error("More than one command specified")
else:
foundOne = True
if (not foundOne):
p.error("No command specified")
if options.preprocess:
if len(args) not in (3,4):
p.error(preprocess_locale_args_help_string)
# Parse args
pargs = args[:]
moz_dir = pargs[0]
if len(pargs) == 4:
l10n_dirs = [pargs[1]]
del pargs[1]
else:
if not options.l10n_dirs:
p.error(preprocess_locale_args_help_string)
l10n_dirs = options.l10n_dirs
ab_cd = pargs[1]
config_dir = pargs[2]
# Create the output files
create_nlf_file(moz_dir, ab_cd, config_dir)
preprocess_locale_files(config_dir, l10n_dirs)
elif options.preprocessSingle:
if len(args) not in (4,5):
p.error(preprocess_single_file_args_help_string)
# Parse args
pargs = args[:]
moz_dir = pargs[0]
if len(pargs) == 5:
l10n_dirs = [pargs[1]]
del pargs[1]
else:
if not options.l10n_dirs:
p.error(preprocess_single_file_args_help_string)
l10n_dirs = options.l10n_dirs
config_dir = pargs[1]
in_file = pargs[2]
out_file = pargs[3]
# Create the output files
preprocess_locale_file(config_dir,
l10n_dirs,
in_file,
out_file)
elif options.createNlf:
if len(args) != 3:
p.error(create_nlf_args_help_string)
# Parse args
pargs = args[:]
moz_dir = pargs[0]
ab_cd = pargs[1]
config_dir = pargs[2]
# Create the output files
create_nlf_file(moz_dir, ab_cd, config_dir)
elif options.convert:
if len(args) != 2:
p.error("--convert-utf8-utf16le needs both of <src> <dest>")
convert_utf8_utf16le(*args)

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB