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.
1 # -*- makefile -*-
2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 #####################################################################################
7 # Dependency build overhead:
8 # o always create/update/hard link targets boomkarks.json & searchplugins
9 # o latest symlink will be correct for the current locale / local build.
10 # o logic is essentially FORCE for language packs w/o all the build overhead
11 # o phase 2: replace hard links with a user function able to derive path
12 # based on current locale.
13 #####################################################################################
15 include $(topsrcdir)/config/config.mk
17 USE_AUTOTARGETS_MK=1
18 include $(topsrcdir)/config/makefiles/makeutils.mk
20 # Separate items of contention
21 tgt-gendir = .deps/generated_$(AB_CD)
23 GENERATED_DIRS += .deps
25 ifdef LOCALE_MERGEDIR
26 vpath book%.inc $(LOCALE_MERGEDIR)/mobile/profile
27 endif
28 vpath book%.inc $(LOCALE_SRCDIR)/profile
29 ifdef LOCALE_MERGEDIR
30 vpath book%.inc @srcdir@/en-US/profile
31 endif
33 $(call errorIfEmpty,MOZ_BRANDING_DIRECTORY)
34 SUBMAKEFILES += \
35 $(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/Makefile \
36 $(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/locales/Makefile \
37 $(NULL)
39 DEFINES += \
40 -DAB_CD=$(AB_CD) \
41 $(NULL)
44 ###########################################################################
45 # Default target, preserve existing functionality for:
46 # gmake -C $obj/mobile/locales
47 ###########################################################################
48 search-jar-default: search-jar
51 ###########################################################################
52 bookmarks = bookmarks.json
53 bookmarks-ts = $(tgt-gendir)/$(bookmarks)
54 src-bookmarks = $(srcdir)/generic/profile/$(bookmarks).in
56 GARBAGE += $(bookmarks) $(bookmarks-ts)
57 # ---------------------------------------------------------------------------
58 # Note: Always symlink bookmarks.json to pickup the current build for a
59 # locale. Phase 2 edits should remove the common/symlink file and
60 # provide a user function able to derive the path.
61 ###########################################################################
63 ## Searchlist plugin config
64 plugin-file-array = \
65 $(wildcard $(LOCALE_SRCDIR)/searchplugins/list.txt) \
66 $(srcdir)/en-US/searchplugins/list.txt \
67 $(NULL)
69 ###########################################################################
70 plugin_file = $(firstword $(plugin-file-array))
71 plugin-file-ts = $(tgt-gendir)/$(subst $(topsrcdir)/,$(NULL),$(plugin_file)).ts
73 GARBAGE += $(plugin-file-ts)
74 # ---------------------------------------------------------------------------
75 # plugin-file-ts track searchlist file used ($path/list.txt)
76 # and time when the file was last modified.
77 ###########################################################################
78 plugin-file-ts-preqs = \
79 $(call mkdir_deps,$(dir $(plugin-file-ts))) \
80 $(plugin_file) \
81 $(NULL)
83 ###########################################################################
84 # Detect locale changes. Force stale deps when searchlist file
85 # or content has changed.
86 $(plugin-file-ts): $(plugin-file-ts-preqs)
87 @touch $@
90 ###########################################################################
91 search-jar-common = tmp-search.jar.mn
92 search-jar = $(tgt-gendir)/$(search-jar-common)
93 search-jar-ts = $(search-jar).ts
95 GARBAGE += $(search-jar) $(search-jar-ts) $(search-jar-common)
96 # ---------------------------------------------------------------------------
97 # search-jar contains a list of providers for the search plugin
98 ###########################################################################
99 SEARCH_PLUGINS = $(shell cat $(plugin_file))
100 $(call errorIfEmpty,SEARCH_PLUGINS)
102 search-jar-preqs = \
103 $(plugin-file-ts) \
104 $(if $(IS_LANGUAGE_REPACK),FORCE) \
105 $(NULL)
107 .PHONY: search-jar
108 search-jar: $(search-jar)
109 $(search-jar): $(search-jar-preqs)
110 @echo '\nGenerating: search-jar'
111 printf '$(AB_CD).jar:' > $@
112 ln -fn $@ .
113 printf '$(foreach plugin,$(SEARCH_PLUGINS),$(subst __PLUGIN_SUBST__,$(plugin), \n locale/$(AB_CD)/browser/searchplugins/__PLUGIN_SUBST__.xml (__PLUGIN_SUBST__.xml)))' >> $@
114 @echo >> $@
116 ###################
117 search-dir-deps = \
118 $(plugin-file) \
119 $(dir-chrome) \
120 $(NULL)
122 search-preqs =\
123 $(call mkdir_deps,$(dir $(search-jar-ts))) \
124 $(call mkdir_deps,$(FINAL_TARGET)/chrome) \
125 $(search-jar) \
126 $(search-dir-deps) \
127 $(if $(IS_LANGUAGE_REPACK),FORCE) \
128 $(GLOBAL_DEPS) \
129 $(NULL)
131 .PHONY: searchplugins
132 searchplugins: $(search-preqs)
133 $(call py_action,jar_maker,\
134 $(QUIET) -j $(FINAL_TARGET)/chrome \
135 -s $(topsrcdir)/$(relativesrcdir)/en-US/searchplugins \
136 -s $(LOCALE_SRCDIR)/searchplugins \
137 $(MAKE_JARS_FLAGS) $(search-jar))
138 $(TOUCH) $@
140 include $(topsrcdir)/config/rules.mk
143 #############
144 libs-preqs =\
145 $(call mkdir-deps,$(DIST)/install) \
146 $(NULL)
148 libs-%: $(libs-preqs)
149 $(display-deps)
150 @$(MAKE) -C $(DEPTH)/toolkit/locales libs-$*
151 @$(MAKE) -C $(DEPTH)/intl/locales AB_CD=$* XPI_NAME=locale-$*
152 @$(MAKE) -B $(bookmarks) AB_CD=$*
153 @$(MAKE) -B searchplugins AB_CD=$* XPI_NAME=locale-$*
154 @$(MAKE) libs AB_CD=$* XPI_NAME=locale-$* PREF_DIR=defaults/pref
155 @$(MAKE) -C $(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/locales AB_CD=$* XPI_NAME=locale-$*
157 # Tailored target to just add the chrome processing for multi-locale builds
158 chrome-%:
159 $(display-deps)
160 @$(MAKE) -B $(bookmarks) AB_CD=$*
161 @$(MAKE) -B searchplugins AB_CD=$*
162 @$(MAKE) chrome AB_CD=$*
163 @$(MAKE) -C $(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/locales chrome AB_CD=$*
165 NO_JA_JP_MAC_AB_CD := $(if $(filter ja-JP-mac, $(AB_CD)),ja,$(AB_CD))
168 # emulate vpath to gather deps with a path
169 has-mergedir = $(if $(strip $(LOCALE_MERGEDIR)),1)
170 bookmarks-inc-array = \
171 $(wildcard \
172 $(if $(has_mergedir),$(LOCALE_MERGEDIR)/mobile/profile/bookmarks.inc) \
173 $(LOCALE_SRCDIR)/profile/bookmarks.inc \
174 $(if $(has-mergedir),$(srcdir)/en-US/profile/bookmarks.inc) \
175 )
176 bookmarks-inc = $(firstword $(bookmarks-inc-array))
178 bookmarks-preqs = \
179 $(bookmarks-inc) \
180 $(src-bookmarks) \
181 generic/profile/$(bookmarks).in \
182 $(if $(IS_LANGUAGE_REPACK),FORCE) \
183 $(GLOBAL_DEPS) \
184 $(NULL)
186 $(bookmarks-ts): $(bookmarks-preqs)
187 $(display_deps)
188 $(call py_action,preprocessor, \
189 -I $< \
190 -DAB_CD=$(NO_JA_JP_MAC_AB_CD) \
191 $(src-bookmarks) \
192 -o $@)
194 .PHONY: bookmarks $(bookmarks)
195 bookmarks: $(bookmarks)
196 $(bookmarks): $(bookmarks-ts)
197 @echo '\nGenerating: $@'
198 ln -fn $< .
201 export:: searchplugins bookmarks