Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | # vim:set ts=8 sw=8 sts=8 noet: |
michael@0 | 2 | # This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | # License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 5 | |
michael@0 | 6 | |
michael@0 | 7 | # Shared makefile that can be used to easily kick off l10n builds |
michael@0 | 8 | # of Mozilla applications. |
michael@0 | 9 | # This makefile should be included, and then assumes that the including |
michael@0 | 10 | # makefile defines the following targets: |
michael@0 | 11 | # clobber-zip |
michael@0 | 12 | # This target should remove all language dependent-files from $(STAGEDIST), |
michael@0 | 13 | # depending on $(AB_CD) set to the locale code. |
michael@0 | 14 | # $(AB_CD) will be en-US on the initial unpacking of the package |
michael@0 | 15 | # libs-% |
michael@0 | 16 | # This target should call into the various libs targets that this |
michael@0 | 17 | # application depends on. |
michael@0 | 18 | # installer-% |
michael@0 | 19 | # This target should list all required targets, a typical rule would be |
michael@0 | 20 | # installers-%: clobber-% langpack-% repackage-zip-% |
michael@0 | 21 | # @echo "repackaging done" |
michael@0 | 22 | # to initially clobber the locale staging area, and then to build the |
michael@0 | 23 | # language pack and zip package. |
michael@0 | 24 | # Other targets like windows installers might be listed, too, and should |
michael@0 | 25 | # be defined in the including makefile. |
michael@0 | 26 | # The including makefile should provide values for the variables |
michael@0 | 27 | # MOZ_APP_VERSION and MOZ_LANGPACK_EID. |
michael@0 | 28 | |
michael@0 | 29 | |
michael@0 | 30 | run_for_effects := $(shell if test ! -d $(DIST); then $(NSINSTALL) -D $(DIST); fi) |
michael@0 | 31 | |
michael@0 | 32 | # This makefile uses variable overrides from the libs-% target to |
michael@0 | 33 | # build non-default locales to non-default dist/ locations. Be aware! |
michael@0 | 34 | |
michael@0 | 35 | AB = $(firstword $(subst -, ,$(AB_CD))) |
michael@0 | 36 | |
michael@0 | 37 | # These are defaulted to be compatible with the files the wget-en-US target |
michael@0 | 38 | # pulls. You may override them if you provide your own files. You _must_ |
michael@0 | 39 | # override them when MOZ_PKG_PRETTYNAMES is defined - the defaults will not |
michael@0 | 40 | # work in that case. |
michael@0 | 41 | ZIP_IN ?= $(_ABS_DIST)/$(PACKAGE) |
michael@0 | 42 | WIN32_INSTALLER_IN ?= $(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe |
michael@0 | 43 | |
michael@0 | 44 | # Allows overriding the final destination of the repackaged file |
michael@0 | 45 | ZIP_OUT ?= $(_ABS_DIST)/$(PACKAGE) |
michael@0 | 46 | |
michael@0 | 47 | DEFINES += \ |
michael@0 | 48 | -DAB_CD=$(AB_CD) \ |
michael@0 | 49 | -DMOZ_LANGPACK_EID=$(MOZ_LANGPACK_EID) \ |
michael@0 | 50 | -DMOZ_APP_VERSION=$(MOZ_APP_VERSION) \ |
michael@0 | 51 | -DMOZ_APP_MAXVERSION=$(MOZ_APP_MAXVERSION) \ |
michael@0 | 52 | -DLOCALE_SRCDIR=$(abspath $(LOCALE_SRCDIR)) \ |
michael@0 | 53 | -DPKG_BASENAME='$(PKG_BASENAME)' \ |
michael@0 | 54 | -DPKG_INST_BASENAME='$(PKG_INST_BASENAME)' \ |
michael@0 | 55 | $(NULL) |
michael@0 | 56 | |
michael@0 | 57 | |
michael@0 | 58 | clobber-%: |
michael@0 | 59 | $(RM) -rf $(DIST)/xpi-stage/locale-$* |
michael@0 | 60 | |
michael@0 | 61 | |
michael@0 | 62 | PACKAGER_NO_LIBS = 1 |
michael@0 | 63 | |
michael@0 | 64 | ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) |
michael@0 | 65 | STAGEDIST = $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_DIR)/$(_APPNAME)/Contents/MacOS |
michael@0 | 66 | else |
michael@0 | 67 | STAGEDIST = $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_DIR) |
michael@0 | 68 | endif |
michael@0 | 69 | |
michael@0 | 70 | include $(MOZILLA_DIR)/toolkit/mozapps/installer/signing.mk |
michael@0 | 71 | include $(MOZILLA_DIR)/toolkit/mozapps/installer/packager.mk |
michael@0 | 72 | |
michael@0 | 73 | PACKAGE_BASE_DIR = $(_ABS_DIST)/l10n-stage |
michael@0 | 74 | |
michael@0 | 75 | $(STAGEDIST): AB_CD:=en-US |
michael@0 | 76 | $(STAGEDIST): UNPACKAGE=$(call ESCAPE_WILDCARD,$(ZIP_IN)) |
michael@0 | 77 | $(STAGEDIST): $(call ESCAPE_WILDCARD,$(ZIP_IN)) |
michael@0 | 78 | # only mac needs to remove the parent of STAGEDIST... |
michael@0 | 79 | ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) |
michael@0 | 80 | $(RM) -r -v $(DIST)/l10n-stage |
michael@0 | 81 | else |
michael@0 | 82 | # ... and windows doesn't like removing STAGEDIST itself, remove all children |
michael@0 | 83 | find $(STAGEDIST) -maxdepth 1 -print0 | xargs -0 $(RM) -r |
michael@0 | 84 | endif |
michael@0 | 85 | $(NSINSTALL) -D $(DIST)/l10n-stage |
michael@0 | 86 | cd $(DIST)/l10n-stage && \ |
michael@0 | 87 | $(INNER_UNMAKE_PACKAGE) |
michael@0 | 88 | |
michael@0 | 89 | |
michael@0 | 90 | unpack: $(STAGEDIST) |
michael@0 | 91 | @echo done unpacking |
michael@0 | 92 | |
michael@0 | 93 | # The path to the object dir for the mozilla-central build system, |
michael@0 | 94 | # may be overridden if necessary. |
michael@0 | 95 | MOZDEPTH ?= $(DEPTH) |
michael@0 | 96 | |
michael@0 | 97 | ifdef MOZ_MAKE_COMPLETE_MAR |
michael@0 | 98 | MAKE_COMPLETE_MAR = 1 |
michael@0 | 99 | ifeq ($(OS_ARCH), WINNT) |
michael@0 | 100 | ifneq ($(MOZ_PKG_FORMAT), SFX7Z) |
michael@0 | 101 | MAKE_COMPLETE_MAR = |
michael@0 | 102 | endif |
michael@0 | 103 | endif |
michael@0 | 104 | endif |
michael@0 | 105 | repackage-zip: UNPACKAGE='$(ZIP_IN)' |
michael@0 | 106 | repackage-zip: ALREADY_SZIPPED=1 |
michael@0 | 107 | repackage-zip: libs-$(AB_CD) |
michael@0 | 108 | # call a hook for apps to put their uninstall helper.exe into the package |
michael@0 | 109 | $(UNINSTALLER_PACKAGE_HOOK) |
michael@0 | 110 | # call a hook for apps to build the stub installer |
michael@0 | 111 | ifdef MOZ_STUB_INSTALLER |
michael@0 | 112 | $(STUB_HOOK) |
michael@0 | 113 | endif |
michael@0 | 114 | $(PYTHON) $(MOZILLA_DIR)/toolkit/mozapps/installer/l10n-repack.py $(STAGEDIST) $(DIST)/xpi-stage/locale-$(AB_CD) \ |
michael@0 | 115 | $(if $(filter omni,$(MOZ_PACKAGER_FORMAT)),$(if $(NON_OMNIJAR_FILES),--non-resource $(NON_OMNIJAR_FILES))) |
michael@0 | 116 | ifneq (en,$(AB)) |
michael@0 | 117 | ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) |
michael@0 | 118 | mv $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_DIR)/$(_APPNAME)/Contents/Resources/en.lproj $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_DIR)/$(_APPNAME)/Contents/Resources/$(AB).lproj |
michael@0 | 119 | endif |
michael@0 | 120 | endif |
michael@0 | 121 | $(NSINSTALL) -D $(DIST)/l10n-stage/$(PKG_PATH) |
michael@0 | 122 | cd $(DIST)/l10n-stage; \ |
michael@0 | 123 | $(MAKE_PACKAGE) |
michael@0 | 124 | ifdef MAKE_COMPLETE_MAR |
michael@0 | 125 | $(MAKE) -C $(MOZDEPTH)/tools/update-packaging full-update AB_CD=$(AB_CD) \ |
michael@0 | 126 | MOZ_PKG_PRETTYNAMES=$(MOZ_PKG_PRETTYNAMES) \ |
michael@0 | 127 | PACKAGE_BASE_DIR='$(_ABS_DIST)/l10n-stage' \ |
michael@0 | 128 | DIST='$(_ABS_DIST)' |
michael@0 | 129 | endif |
michael@0 | 130 | # packaging done, undo l10n stuff |
michael@0 | 131 | ifneq (en,$(AB)) |
michael@0 | 132 | ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) |
michael@0 | 133 | mv $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_DIR)/$(_APPNAME)/Contents/Resources/$(AB).lproj $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_DIR)/$(_APPNAME)/Contents/Resources/en.lproj |
michael@0 | 134 | endif |
michael@0 | 135 | endif |
michael@0 | 136 | $(NSINSTALL) -D $(DIST)/$(PKG_PATH) |
michael@0 | 137 | mv -f '$(DIST)/l10n-stage/$(PACKAGE)' '$(ZIP_OUT)' |
michael@0 | 138 | if test -f '$(DIST)/l10n-stage/$(PACKAGE).asc'; then mv -f '$(DIST)/l10n-stage/$(PACKAGE).asc' '$(ZIP_OUT).asc'; fi |
michael@0 | 139 | |
michael@0 | 140 | repackage-zip-%: $(STAGEDIST) |
michael@0 | 141 | @$(MAKE) repackage-zip AB_CD=$* ZIP_IN='$(ZIP_IN)' |
michael@0 | 142 | |
michael@0 | 143 | APP_DEFINES = $(firstword $(wildcard $(LOCALE_SRCDIR)/defines.inc) \ |
michael@0 | 144 | $(srcdir)/en-US/defines.inc) |
michael@0 | 145 | TK_DEFINES = $(firstword \ |
michael@0 | 146 | $(wildcard $(call EXPAND_LOCALE_SRCDIR,toolkit/locales)/defines.inc) \ |
michael@0 | 147 | $(MOZILLA_DIR)/toolkit/locales/en-US/defines.inc) |
michael@0 | 148 | |
michael@0 | 149 | # Dealing with app sub dirs: If DIST_SUBDIRS is defined it contains a |
michael@0 | 150 | # listing of app sub-dirs we should include in langpack xpis. If not, |
michael@0 | 151 | # check DIST_SUBDIR, and if that isn't present, just package the default |
michael@0 | 152 | # chrome directory. |
michael@0 | 153 | PKG_ZIP_DIRS = chrome $(or $(DIST_SUBDIRS),$(DIST_SUBDIR)) |
michael@0 | 154 | |
michael@0 | 155 | langpack-%: LANGPACK_FILE=$(_ABS_DIST)/$(PKG_LANGPACK_PATH)$(PKG_LANGPACK_BASENAME).xpi |
michael@0 | 156 | langpack-%: AB_CD=$* |
michael@0 | 157 | langpack-%: XPI_NAME=locale-$* |
michael@0 | 158 | langpack-%: libs-% |
michael@0 | 159 | @echo 'Making langpack $(LANGPACK_FILE)' |
michael@0 | 160 | $(NSINSTALL) -D $(DIST)/$(PKG_LANGPACK_PATH) |
michael@0 | 161 | $(call py_action,preprocessor,$(DEFINES) $(ACDEFINES) \ |
michael@0 | 162 | -I$(TK_DEFINES) -I$(APP_DEFINES) $(srcdir)/generic/install.rdf -o $(DIST)/xpi-stage/$(XPI_NAME)/install.rdf) |
michael@0 | 163 | cd $(DIST)/xpi-stage/locale-$(AB_CD) && \ |
michael@0 | 164 | $(ZIP) -r9D $(LANGPACK_FILE) install.rdf $(PKG_ZIP_DIRS) chrome.manifest |
michael@0 | 165 | |
michael@0 | 166 | # This variable is to allow the wget-en-US target to know which ftp server to download from |
michael@0 | 167 | ifndef EN_US_BINARY_URL |
michael@0 | 168 | EN_US_BINARY_URL = $(error You must set EN_US_BINARY_URL) |
michael@0 | 169 | endif |
michael@0 | 170 | |
michael@0 | 171 | # This make target allows us to wget the latest en-US binary from a specified website |
michael@0 | 172 | # The make installers-% target needs the en-US binary in dist/ |
michael@0 | 173 | # and for the windows repackages we need the .installer.exe in dist/sea |
michael@0 | 174 | wget-en-US: |
michael@0 | 175 | ifndef WGET |
michael@0 | 176 | $(error Wget not installed) |
michael@0 | 177 | endif |
michael@0 | 178 | $(NSINSTALL) -D $(_ABS_DIST)/$(PKG_PATH) |
michael@0 | 179 | (cd $(_ABS_DIST)/$(PKG_PATH) && $(WGET) --no-cache -nv -N '$(EN_US_BINARY_URL)/$(PACKAGE)') |
michael@0 | 180 | @echo 'Downloaded $(EN_US_BINARY_URL)/$(PACKAGE) to $(_ABS_DIST)/$(PKG_PATH)/$(PACKAGE)' |
michael@0 | 181 | ifdef RETRIEVE_WINDOWS_INSTALLER |
michael@0 | 182 | ifeq ($(OS_ARCH), WINNT) |
michael@0 | 183 | $(NSINSTALL) -D $(_ABS_DIST)/$(PKG_INST_PATH) |
michael@0 | 184 | (cd $(_ABS_DIST)/$(PKG_INST_PATH) && $(WGET) --no-cache -nv -N '$(EN_US_BINARY_URL)/$(PKG_PATH)$(PKG_INST_BASENAME).exe') |
michael@0 | 185 | @echo 'Downloaded $(EN_US_BINARY_URL)/$(PKG_PATH)$(PKG_INST_BASENAME).exe to $(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe' |
michael@0 | 186 | endif |
michael@0 | 187 | endif |
michael@0 | 188 | |
michael@0 | 189 | generate-snippet-%: |
michael@0 | 190 | $(PYTHON) $(MOZILLA_DIR)/tools/update-packaging/generatesnippet.py \ |
michael@0 | 191 | --mar-path=$(_ABS_DIST)/update \ |
michael@0 | 192 | --application-ini-file=$(STAGEDIST)/application.ini \ |
michael@0 | 193 | --locale=$* \ |
michael@0 | 194 | --product=$(MOZ_PKG_APPNAME) \ |
michael@0 | 195 | --platform=$(MOZ_PKG_PLATFORM) \ |
michael@0 | 196 | --download-base-URL=$(DOWNLOAD_BASE_URL) \ |
michael@0 | 197 | --verbose |