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/.
5 include $(MOZILLA_DIR
)/toolkit
/mozapps
/installer
/package-name.mk
6 include $(MOZILLA_DIR
)/toolkit
/mozapps
/installer
/upload-files.mk
8 # This is how we create the binary packages we release to the public.
10 # browser/locales/Makefile uses this makefile for its variable defs, but
11 # doesn't want the libs:: rule.
12 ifndef PACKAGER_NO_LIBS
17 # This allows `RUN_{FIND_DUPES,MOZHARNESS_ZIP}=1 ./mach package` to test locally.
18 RUN_FIND_DUPES ?
= $(MOZ_AUTOMATION
)
19 RUN_MOZHARNESS_ZIP ?
= $(MOZ_AUTOMATION
)
24 stage-package
: multilocale.txt locale-manifest.in
$(MOZ_PKG_MANIFEST
) $(MOZ_PKG_MANIFEST_DEPS
)
25 NO_PKG_FILES
="$(NO_PKG_FILES)" \
26 $(PYTHON3
) $(MOZILLA_DIR
)/toolkit
/mozapps
/installer
/packager.py
$(DEFINES
) $(ACDEFINES
) \
27 --format
$(MOZ_PACKAGER_FORMAT
) \
28 $(addprefix --removals
,$(MOZ_PKG_REMOVALS
)) \
29 $(if
$(filter-out 0,$(MOZ_PKG_FATAL_WARNINGS
)),,--ignore-errors
) \
30 $(if
$(MOZ_AUTOMATION
),,--ignore-broken-symlinks
) \
31 $(if
$(MOZ_PACKAGER_MINIFY
),--minify
) \
32 $(if
$(MOZ_PACKAGER_MINIFY_JS
),--minify-js \
33 $(addprefix --js-binary
,$(JS_BINARY
)) \
35 $(addprefix --jarlog
,$(wildcard $(JARLOG_FILE_AB_CD
))) \
36 $(addprefix --compress
,$(JAR_COMPRESSION
)) \
37 $(MOZ_PKG_MANIFEST
) '$(DIST)' '$(DIST)'/$(MOZ_PKG_DIR
)$(if
$(MOZ_PKG_MANIFEST
),,$(_BINPATH
:%=/%)) \
38 $(if
$(filter omni
,$(MOZ_PACKAGER_FORMAT
)),$(if
$(NON_OMNIJAR_FILES
),--non-resource
$(NON_OMNIJAR_FILES
)))
40 $(PYTHON3
) $(MOZILLA_DIR
)/toolkit
/mozapps
/installer
/find-dupes.py
$(DEFINES
) $(ACDEFINES
) $(MOZ_PKG_DUPEFLAGS
) $(DIST
)/$(MOZ_PKG_DIR
)
41 endif # RUN_FIND_DUPES
42 ifndef MOZ_IS_COMM_TOPDIR
43 ifdef RUN_MOZHARNESS_ZIP
45 $(call py_action
,test_archive
$(MOZHARNESS_PACKAGE
), \
47 $(ABS_DIST
)/$(PKG_PATH
)$(MOZHARNESS_PACKAGE
))
48 endif # RUN_MOZHARNESS_ZIP
49 endif # MOZ_IS_COMM_TOPDIR
50 ifdef MOZ_PACKAGE_JSSHELL
51 # Package JavaScript Shell
52 @echo
'Packaging JavaScript Shell...'
55 endif # MOZ_PACKAGE_JSSHELL
57 ifdef MOZ_ARTIFACT_BUILD_SYMBOLS
58 @echo
'Packaging existing crashreporter symbols from artifact build...'
59 $(NSINSTALL
) -D
$(DIST
)/$(PKG_PATH
)
60 cd
$(DIST
)/crashreporter-symbols
&& \
61 zip
-r5D
'../$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip' .
-i
'*.sym' -i
'*.txt'
62 ifeq ($(MOZ_ARTIFACT_BUILD_SYMBOLS
),full
)
63 $(call py_action
,symbols_archive
$(SYMBOL_FULL_ARCHIVE_BASENAME
).
tar.zst
,'$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).tar.zst' \
64 $(abspath
$(DIST
)/crashreporter-symbols
) \
67 endif # MOZ_ARTIFACT_BUILD_SYMBOLS
68 endif # MOZ_AUTOMATION
69 ifdef MOZ_CODE_COVERAGE
70 @echo
'Generating chrome-map for coverage data...'
71 $(PYTHON3
) $(topsrcdir
)/mach build-backend
-b ChromeMap
72 @echo
'Packaging code coverage data...'
73 $(RM
) $(CODE_COVERAGE_ARCHIVE_BASENAME
).zip
74 $(PYTHON3
) -mmozbuild.codecoverage.packager \
75 --output-file
='$(DIST)/$(PKG_PATH)$(CODE_COVERAGE_ARCHIVE_BASENAME).zip'
77 ifdef ENABLE_MOZSEARCH_PLUGIN
78 @echo
'Generating mozsearch index tarball...'
79 $(RM
) $(MOZSEARCH_ARCHIVE_BASENAME
).zip
80 cd
$(topobjdir
)/mozsearch_index
&& \
81 zip
-r5D
'$(ABS_DIST)/$(PKG_PATH)$(MOZSEARCH_ARCHIVE_BASENAME).zip' .
82 @echo
'Generating mozsearch distinclude map...'
83 cd
$(topobjdir
)/ && cp _build_manifests
/install/dist_include
'$(ABS_DIST)/$(PKG_PATH)$(MOZSEARCH_INCLUDEMAP_BASENAME).map'
84 @echo
'Generating mozsearch scip index...'
85 $(RM
) $(MOZSEARCH_SCIP_INDEX_BASENAME
).zip
86 cp
$(topsrcdir
)/.cargo
/config.toml.in
$(topsrcdir
)/.cargo
/config.toml
88 CARGO
=$(MOZ_FETCHES_DIR
)/rustc
/bin
/cargo \
89 RUSTC
=$(MOZ_FETCHES_DIR
)/rustc
/bin
/rustc \
90 $(MOZ_FETCHES_DIR
)/rustc
/bin
/rust-analyzer scip .
&& \
91 zip
-r5D
'$(ABS_DIST)/$(PKG_PATH)$(MOZSEARCH_SCIP_INDEX_BASENAME).zip' \
93 rm $(topsrcdir
)/.cargo
/config.toml
94 ifeq ($(MOZ_BUILD_APP
),mobile
/android
)
95 @echo
'Generating mozsearch java/kotlin semanticdb tarball...'
96 $(RM
) $(MOZSEARCH_JAVA_INDEX_BASENAME
).zip
98 $(PYTHON3
) $(topsrcdir
)/mach android compile-all
&& \
99 cd
$(topobjdir
)/mozsearch_java_index
&& \
100 zip
-r5D
'$(ABS_DIST)/$(PKG_PATH)$(MOZSEARCH_JAVA_INDEX_BASENAME).zip' .
101 endif # MOZ_BUILD_APP == mobile/android
103 ifeq (Darwin
, $(OS_ARCH
))
104 ifneq (,$(MOZ_ASAN
)$(LIBFUZZER
)$(MOZ_UBSAN
))
105 @echo
"Rewriting sanitizer runtime dylib paths for all binaries in $(DIST)/$(MOZ_PKG_DIR)/$(_BINPATH) ..."
106 $(PYTHON3
) $(MOZILLA_DIR
)/build
/unix
/rewrite_sanitizer_dylib.py
'$(DIST)/$(MOZ_PKG_DIR)/$(_BINPATH)'
107 endif # MOZ_ASAN || LIBFUZZER || MOZ_UBSAN
109 ifndef MOZ_ARTIFACT_BUILDS
110 @echo
'Generating XPT artifacts archive ($(XPT_ARTIFACTS_ARCHIVE_BASENAME).zip)'
111 $(call py_action
,zip
$(XPT_ARTIFACTS_ARCHIVE_BASENAME
).zip
,-C
$(topobjdir
)/config
/makefiles
/xpidl
'$(ABS_DIST)/$(PKG_PATH)$(XPT_ARTIFACTS_ARCHIVE_BASENAME).zip' '*.xpt')
113 @echo
'Packaging existing XPT artifacts from artifact build into archive ($(XPT_ARTIFACTS_ARCHIVE_BASENAME).zip)'
114 $(call py_action
,zip
$(XPT_ARTIFACTS_ARCHIVE_BASENAME
).zip
,-C
$(ABS_DIST
)/xpt_artifacts
'$(ABS_DIST)/$(PKG_PATH)$(XPT_ARTIFACTS_ARCHIVE_BASENAME).zip' '*.xpt')
115 endif # MOZ_ARTIFACT_BUILDS
117 prepare-package
: stage-package
119 make-package-internal
: prepare-package make-sourcestamp-file
120 @echo
'Compressing...'
121 $(call MAKE_PACKAGE
,$(DIST
))
124 $(MAKE
) make-package-internal
125 ifeq (WINNT
,$(OS_ARCH
))
126 ifeq ($(MOZ_PKG_FORMAT
),ZIP
)
127 $(MAKE
) -C windows ZIP_IN
='$(ABS_DIST)/$(PACKAGE)' installer
131 cp
$(DEPTH
)/mozinfo.json
$(MOZ_MOZINFO_FILE
)
132 $(PYTHON3
) $(MOZILLA_DIR
)/toolkit
/mozapps
/installer
/informulate.py \
133 $(MOZ_BUILDINFO_FILE
) $(MOZ_BUILDHUB_JSON
) $(MOZ_BUILDID_INFO_TXT_FILE
) \
134 $(MOZ_PKG_PLATFORM
) \
135 $(if
$(or
$(filter-out mobile
/android
,$(MOZ_BUILD_APP
)),$(MOZ_ANDROID_WITH_FENNEC
)), \
136 --package
=$(DIST
)/$(PACKAGE
) --installer
=$(INSTALLER_PACKAGE
), \
142 GARBAGE
+= make-package
144 make-sourcestamp-file
::
145 $(NSINSTALL
) -D
$(DIST
)/$(PKG_PATH
)
146 @awk
'$$2 == "MOZ_BUILDID" {print $$3}' $(DEPTH
)/buildid.h
> $(MOZ_SOURCESTAMP_FILE
)
147 ifdef MOZ_INCLUDE_SOURCE_INFO
148 @awk
'$$2 == "MOZ_SOURCE_URL" {print $$3}' $(DEPTH
)/source-repo.h
>> $(MOZ_SOURCESTAMP_FILE
)
151 # The install target will install the application to prefix/lib/appname-version
152 install:: prepare-package
153 ifneq (,$(filter WINNT Darwin
,$(OS_TARGET
)))
154 $(error
"make install" is not supported on this platform. Use
"make package" instead.
)
156 $(NSINSTALL
) -D
$(DESTDIR
)$(installdir
)
157 (cd
$(DIST
)/$(MOZ_PKG_DIR
) && $(TAR
) --exclude
=precomplete
$(TAR_CREATE_FLAGS
) - .
) | \
158 (cd
$(DESTDIR
)$(installdir
) && tar -xf
-)
159 $(NSINSTALL
) -D
$(DESTDIR
)$(bindir)
160 $(RM
) -f
$(DESTDIR
)$(bindir)/$(MOZ_APP_NAME
)
161 ln
-s
$(installdir
)/$(MOZ_APP_NAME
) $(DESTDIR
)$(bindir)
164 $(PYTHON3
) -u
$(MOZILLA_DIR
)/build
/upload.py
--base-path
$(DIST
) $(UPLOAD_FILES
)
165 mkdir
-p
`dirname $(CHECKSUM_FILE)`
166 @
$(PYTHON3
) $(MOZILLA_DIR
)/build
/checksums.py \
167 -o
$(CHECKSUM_FILE
) \
168 $(CHECKSUM_ALGORITHM_PARAM
) \
170 @echo
'CHECKSUM FILE START'
171 @cat
$(CHECKSUM_FILE
)
172 @echo
'CHECKSUM FILE END'
173 $(PYTHON3
) -u
$(MOZILLA_DIR
)/build
/upload.py
--base-path
$(DIST
) $(CHECKSUM_FILES
)
175 # source-package creates a source tarball from the files in MOZ_PKG_SRCDIR,
176 # which is either set to a clean checkout or defaults to $topsrcdir
178 @echo
'Generate the sourcestamp file'
179 # Make sure to have repository information available and then generate the
181 $(MAKE
) -C
$(DEPTH
) 'source-repo.h' 'buildid.h'
182 $(MAKE
) make-sourcestamp-file
183 @echo
'Packaging source tarball...'
184 # We want to include the sourcestamp file in the source tarball, so copy it
185 # in the root source directory. This is useful to enable telemetry submissions
186 # from builds made from the source package with the correct revision information.
187 # Don't bother removing it as this is only used by automation.
188 @cp
$(MOZ_SOURCESTAMP_FILE
) '$(MOZ_PKG_SRCDIR)/sourcestamp.txt'
189 $(MKDIR
) -p
$(DIST
)/$(PKG_SRCPACK_PATH
)
190 (cd
$(MOZ_PKG_SRCDIR
) && $(CREATE_SOURCE_TAR
) - .
/ ) | xz
-9e
> $(SOURCE_TAR
)
193 $(MKDIR
) -p
$(DIST
)/$(PKG_SRCPACK_PATH
)
194 $(CREATE_HG_BUNDLE_CMD
)
197 $(MAKE
) upload UPLOAD_FILES
='$(SOURCE_UPLOAD_FILES)' CHECKSUM_FILE
='$(SOURCE_CHECKSUM_FILE)'
200 ALL_LOCALES
= $(if
$(filter en-US
,$(LOCALES
)),$(LOCALES
),$(LOCALES
) en-US
)
202 # Firefox uses @RESPATH@.
203 # Fennec uses @BINPATH@ and doesn't have the @RESPATH@ variable defined.
204 ifeq ($(MOZ_BUILD_APP
),mobile
/android
)
206 MULTILOCALE_DIR
= $(DIST
)/$(BINPATH
)/res
209 MULTILOCALE_DIR
= $(DIST
)/$(RESPATH
)/res
212 # This version of the target uses MOZ_CHROME_MULTILOCALE to build multilocale.txt
213 # and places it in dist/bin/res - it should be used when packaging a build.
214 multilocale.txt
: LOCALES?
=$(MOZ_CHROME_MULTILOCALE
)
216 $(call py_action
,file_generate
$@
,$(MOZILLA_DIR
)/toolkit
/locales
/gen_multilocale.py main
'$(MULTILOCALE_DIR)/multilocale.txt' $(MDDEPDIR
)/multilocale.txt.pp
'$(MULTILOCALE_DIR)/multilocale.txt' $(ALL_LOCALES
))
218 # This version of the target uses AB_CD to build multilocale.txt and places it
219 # in the $(XPI_NAME)/res dir - it should be used when repackaging a build.
220 multilocale.txt-
%: LOCALES?
=$(AB_CD
)
221 multilocale.txt-
%: MULTILOCALE_DIR
=$(DIST
)/xpi-stage
/$(XPI_NAME
)/res
223 $(call py_action
,file_generate multilocale.txt
,$(MOZILLA_DIR
)/toolkit
/locales
/gen_multilocale.py main
'$(MULTILOCALE_DIR)/multilocale.txt' $(MDDEPDIR
)/multilocale.txt.pp
'$(MULTILOCALE_DIR)/multilocale.txt' $(ALL_LOCALES
))
225 locale-manifest.in
: LOCALES?
=$(MOZ_CHROME_MULTILOCALE
)
226 locale-manifest.in
: $(GLOBAL_DEPS
) FORCE
227 printf
'\n[multilocale]\n' > $@
228 printf
'$(BASE_PATH)/res/multilocale.txt\n' >> $@
229 for LOCALE in
$(ALL_LOCALES
) ;\
231 for ENTRY in
$(MOZ_CHROME_LOCALE_ENTRIES
) ;\
233 printf
"$$ENTRY""$$LOCALE"'@JAREXT@\n' >> $@
; \
234 printf
"$$ENTRY""$$LOCALE"'.manifest\n' >> $@
; \