toolkit/mozapps/installer/packager.mk

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 # This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 # License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
michael@0 4
michael@0 5 include $(MOZILLA_DIR)/toolkit/mozapps/installer/package-name.mk
michael@0 6
michael@0 7 # This is how we create the binary packages we release to the public.
michael@0 8
michael@0 9 ifndef MOZ_PKG_FORMAT
michael@0 10 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
michael@0 11 MOZ_PKG_FORMAT = DMG
michael@0 12 else
michael@0 13 ifeq (,$(filter-out WINNT, $(OS_ARCH)))
michael@0 14 MOZ_PKG_FORMAT = ZIP
michael@0 15 else
michael@0 16 ifeq (,$(filter-out SunOS, $(OS_ARCH)))
michael@0 17 MOZ_PKG_FORMAT = BZ2
michael@0 18 else
michael@0 19 ifeq (,$(filter-out gtk2 gtk3 qt, $(MOZ_WIDGET_TOOLKIT)))
michael@0 20 MOZ_PKG_FORMAT = BZ2
michael@0 21 else
michael@0 22 ifeq (android,$(MOZ_WIDGET_TOOLKIT))
michael@0 23 MOZ_PKG_FORMAT = APK
michael@0 24 else
michael@0 25 MOZ_PKG_FORMAT = TGZ
michael@0 26 endif
michael@0 27 endif
michael@0 28 endif
michael@0 29 endif
michael@0 30 endif
michael@0 31 endif # MOZ_PKG_FORMAT
michael@0 32
michael@0 33 ifeq ($(OS_ARCH),WINNT)
michael@0 34 INSTALLER_DIR = windows
michael@0 35 endif
michael@0 36
michael@0 37 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
michael@0 38 ifndef _APPNAME
michael@0 39 _APPNAME = $(MOZ_MACBUNDLE_NAME)
michael@0 40 endif
michael@0 41 ifndef _BINPATH
michael@0 42 _BINPATH = /$(_APPNAME)/Contents/MacOS
michael@0 43 endif # _BINPATH
michael@0 44 ifdef UNIVERSAL_BINARY
michael@0 45 STAGEPATH = universal/
michael@0 46 endif
michael@0 47 endif
michael@0 48
michael@0 49 PACKAGE_BASE_DIR = $(_ABS_DIST)
michael@0 50 PACKAGE = $(PKG_PATH)$(PKG_BASENAME)$(PKG_SUFFIX)
michael@0 51
michael@0 52 # By default, the SDK uses the same packaging type as the main bundle,
michael@0 53 # but on mac it is a .tar.bz2
michael@0 54 SDK_PATH = $(PKG_PATH)
michael@0 55 ifeq ($(MOZ_APP_NAME),xulrunner)
michael@0 56 SDK_PATH = sdk/
michael@0 57 # Don't codesign xulrunner internally
michael@0 58 MOZ_INTERNAL_SIGNING_FORMAT =
michael@0 59 endif
michael@0 60 SDK_SUFFIX = $(PKG_SUFFIX)
michael@0 61 SDK = $(SDK_PATH)$(PKG_BASENAME).sdk$(SDK_SUFFIX)
michael@0 62 ifdef UNIVERSAL_BINARY
michael@0 63 SDK = $(SDK_PATH)$(PKG_BASENAME)-$(TARGET_CPU).sdk$(SDK_SUFFIX)
michael@0 64 endif
michael@0 65
michael@0 66 # JavaScript Shell packaging
michael@0 67 ifndef LIBXUL_SDK
michael@0 68 JSSHELL_BINS = \
michael@0 69 $(DIST)/bin/js$(BIN_SUFFIX) \
michael@0 70 $(DIST)/bin/$(DLL_PREFIX)mozglue$(DLL_SUFFIX) \
michael@0 71 $(NULL)
michael@0 72 ifndef MOZ_NATIVE_NSPR
michael@0 73 ifeq ($(_MSC_VER),1400)
michael@0 74 JSSHELL_BINS += $(DIST)/bin/Microsoft.VC80.CRT.manifest
michael@0 75 JSSHELL_BINS += $(DIST)/bin/msvcr80.dll
michael@0 76 JSSHELL_BINS += $(DIST)/bin/msvcp80.dll
michael@0 77 endif
michael@0 78 ifeq ($(_MSC_VER),1500)
michael@0 79 JSSHELL_BINS += $(DIST)/bin/Microsoft.VC90.CRT.manifest
michael@0 80 JSSHELL_BINS += $(DIST)/bin/msvcr90.dll
michael@0 81 JSSHELL_BINS += $(DIST)/bin/msvcp90.dll
michael@0 82 endif
michael@0 83 ifeq ($(_MSC_VER),1600)
michael@0 84 JSSHELL_BINS += $(DIST)/bin/msvcr100.dll
michael@0 85 JSSHELL_BINS += $(DIST)/bin/msvcp100.dll
michael@0 86 endif
michael@0 87 ifeq ($(_MSC_VER),1700)
michael@0 88 JSSHELL_BINS += $(DIST)/bin/msvcr110.dll
michael@0 89 JSSHELL_BINS += $(DIST)/bin/msvcp110.dll
michael@0 90 endif
michael@0 91 ifeq ($(_MSC_VER),1800)
michael@0 92 JSSHELL_BINS += $(DIST)/bin/msvcr120.dll
michael@0 93 JSSHELL_BINS += $(DIST)/bin/msvcp120.dll
michael@0 94 endif
michael@0 95 ifdef MOZ_FOLD_LIBS
michael@0 96 JSSHELL_BINS += $(DIST)/bin/$(DLL_PREFIX)nss3$(DLL_SUFFIX)
michael@0 97 else
michael@0 98 JSSHELL_BINS += \
michael@0 99 $(DIST)/bin/$(DLL_PREFIX)nspr4$(DLL_SUFFIX) \
michael@0 100 $(DIST)/bin/$(DLL_PREFIX)plds4$(DLL_SUFFIX) \
michael@0 101 $(DIST)/bin/$(DLL_PREFIX)plc4$(DLL_SUFFIX) \
michael@0 102 $(NULL)
michael@0 103 endif # MOZ_FOLD_LIBS
michael@0 104 endif # MOZ_NATIVE_NSPR
michael@0 105 ifdef MOZ_SHARED_ICU
michael@0 106 ifeq ($(OS_TARGET), WINNT)
michael@0 107 ifdef MOZ_DEBUG
michael@0 108 JSSHELL_BINS += \
michael@0 109 $(DIST)/bin/icudtd$(MOZ_ICU_VERSION).dll \
michael@0 110 $(DIST)/bin/icuind$(MOZ_ICU_VERSION).dll \
michael@0 111 $(DIST)/bin/icuucd$(MOZ_ICU_VERSION).dll \
michael@0 112 $(NULL)
michael@0 113 else
michael@0 114 JSSHELL_BINS += \
michael@0 115 $(DIST)/bin/icudt$(MOZ_ICU_VERSION).dll \
michael@0 116 $(DIST)/bin/icuin$(MOZ_ICU_VERSION).dll \
michael@0 117 $(DIST)/bin/icuuc$(MOZ_ICU_VERSION).dll \
michael@0 118 $(NULL)
michael@0 119 endif # MOZ_DEBUG
michael@0 120 else
michael@0 121 ifeq ($(OS_TARGET), Darwin)
michael@0 122 JSSHELL_BINS += \
michael@0 123 $(DIST)/bin/libicudata.$(MOZ_ICU_VERSION).dylib \
michael@0 124 $(DIST)/bin/libicui18n.$(MOZ_ICU_VERSION).dylib \
michael@0 125 $(DIST)/bin/libicuuc.$(MOZ_ICU_VERSION).dylib \
michael@0 126 $(NULL)
michael@0 127 else
michael@0 128 JSSHELL_BINS += \
michael@0 129 $(DIST)/bin/libicudata.so.$(MOZ_ICU_VERSION) \
michael@0 130 $(DIST)/bin/libicui18n.so.$(MOZ_ICU_VERSION) \
michael@0 131 $(DIST)/bin/libicuuc.so.$(MOZ_ICU_VERSION) \
michael@0 132 $(NULL)
michael@0 133 endif # Darwin
michael@0 134 endif # WINNT
michael@0 135 endif # MOZ_STATIC_JS
michael@0 136 MAKE_JSSHELL = $(PYTHON) $(topsrcdir)/toolkit/mozapps/installer/dozip.py $(PKG_JSSHELL) $(abspath $(JSSHELL_BINS))
michael@0 137 endif # LIBXUL_SDK
michael@0 138
michael@0 139 _ABS_DIST = $(abspath $(DIST))
michael@0 140 JARLOG_DIR = $(abspath $(DEPTH)/jarlog/)
michael@0 141 JARLOG_FILE_AB_CD = $(JARLOG_DIR)/$(AB_CD).log
michael@0 142
michael@0 143 TAR_CREATE_FLAGS := --exclude=.mkdir.done $(TAR_CREATE_FLAGS)
michael@0 144 CREATE_FINAL_TAR = $(TAR) -c --owner=0 --group=0 --numeric-owner \
michael@0 145 --mode=go-w --exclude=.mkdir.done -f
michael@0 146 UNPACK_TAR = tar -xf-
michael@0 147
michael@0 148 ifeq ($(MOZ_PKG_FORMAT),TAR)
michael@0 149 PKG_SUFFIX = .tar
michael@0 150 INNER_MAKE_PACKAGE = $(CREATE_FINAL_TAR) - $(MOZ_PKG_DIR) > $(PACKAGE)
michael@0 151 INNER_UNMAKE_PACKAGE = $(UNPACK_TAR) < $(UNPACKAGE)
michael@0 152 MAKE_SDK = $(CREATE_FINAL_TAR) - $(MOZ_APP_NAME)-sdk > $(SDK)
michael@0 153 endif
michael@0 154 ifeq ($(MOZ_PKG_FORMAT),TGZ)
michael@0 155 PKG_SUFFIX = .tar.gz
michael@0 156 INNER_MAKE_PACKAGE = $(CREATE_FINAL_TAR) - $(MOZ_PKG_DIR) | gzip -vf9 > $(PACKAGE)
michael@0 157 INNER_UNMAKE_PACKAGE = gunzip -c $(UNPACKAGE) | $(UNPACK_TAR)
michael@0 158 MAKE_SDK = $(CREATE_FINAL_TAR) - $(MOZ_APP_NAME)-sdk | gzip -vf9 > $(SDK)
michael@0 159 endif
michael@0 160 ifeq ($(MOZ_PKG_FORMAT),BZ2)
michael@0 161 PKG_SUFFIX = .tar.bz2
michael@0 162 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
michael@0 163 INNER_MAKE_PACKAGE = $(CREATE_FINAL_TAR) - -C $(STAGEPATH)$(MOZ_PKG_DIR) $(_APPNAME) | bzip2 -vf > $(PACKAGE)
michael@0 164 else
michael@0 165 INNER_MAKE_PACKAGE = $(CREATE_FINAL_TAR) - $(MOZ_PKG_DIR) | bzip2 -vf > $(PACKAGE)
michael@0 166 endif
michael@0 167 INNER_UNMAKE_PACKAGE = bunzip2 -c $(UNPACKAGE) | $(UNPACK_TAR)
michael@0 168 MAKE_SDK = $(CREATE_FINAL_TAR) - $(MOZ_APP_NAME)-sdk | bzip2 -vf > $(SDK)
michael@0 169 endif
michael@0 170 ifeq ($(MOZ_PKG_FORMAT),ZIP)
michael@0 171 ifdef MOZ_EXTERNAL_SIGNING_FORMAT
michael@0 172 # We can't use signcode on zip files
michael@0 173 MOZ_EXTERNAL_SIGNING_FORMAT := $(filter-out signcode,$(MOZ_EXTERNAL_SIGNING_FORMAT))
michael@0 174 endif
michael@0 175 PKG_SUFFIX = .zip
michael@0 176 INNER_MAKE_PACKAGE = $(ZIP) -r9D $(PACKAGE) $(MOZ_PKG_DIR) \
michael@0 177 -x \*/.mkdir.done
michael@0 178 INNER_UNMAKE_PACKAGE = $(UNZIP) $(UNPACKAGE)
michael@0 179 MAKE_SDK = $(ZIP) -r9D $(SDK) $(MOZ_APP_NAME)-sdk
michael@0 180 endif
michael@0 181 ifeq ($(MOZ_PKG_FORMAT),SFX7Z)
michael@0 182 PKG_SUFFIX = .exe
michael@0 183 INNER_MAKE_PACKAGE = rm -f app.7z && \
michael@0 184 mv $(MOZ_PKG_DIR) core && \
michael@0 185 $(CYGWIN_WRAPPER) 7z a -r -t7z app.7z -mx -m0=BCJ2 -m1=LZMA:d25 \
michael@0 186 -m2=LZMA:d19 -m3=LZMA:d19 -mb0:1 -mb0s1:2 -mb0s2:3 && \
michael@0 187 mv core $(MOZ_PKG_DIR) && \
michael@0 188 cat $(SFX_HEADER) app.7z > $(PACKAGE) && \
michael@0 189 chmod 0755 $(PACKAGE)
michael@0 190 INNER_UNMAKE_PACKAGE = $(CYGWIN_WRAPPER) 7z x $(UNPACKAGE) core && \
michael@0 191 mv core $(MOZ_PKG_DIR)
michael@0 192 endif
michael@0 193
michael@0 194 #Create an RPM file
michael@0 195 ifeq ($(MOZ_PKG_FORMAT),RPM)
michael@0 196 PKG_SUFFIX = .rpm
michael@0 197 MOZ_NUMERIC_APP_VERSION = $(shell echo $(MOZ_PKG_VERSION) | sed 's/[^0-9.].*//' )
michael@0 198 MOZ_RPM_RELEASE = $(shell echo $(MOZ_PKG_VERSION) | sed 's/[0-9.]*//' )
michael@0 199
michael@0 200 RPMBUILD_TOPDIR=$(_ABS_DIST)/rpmbuild
michael@0 201 RPMBUILD_RPMDIR=$(_ABS_DIST)
michael@0 202 RPMBUILD_SRPMDIR=$(_ABS_DIST)
michael@0 203 RPMBUILD_SOURCEDIR=$(RPMBUILD_TOPDIR)/SOURCES
michael@0 204 RPMBUILD_SPECDIR=$(topsrcdir)/toolkit/mozapps/installer/linux/rpm
michael@0 205 RPMBUILD_BUILDDIR=$(_ABS_DIST)/..
michael@0 206
michael@0 207 SPEC_FILE = $(RPMBUILD_SPECDIR)/mozilla.spec
michael@0 208 RPM_INCIDENTALS=$(topsrcdir)/toolkit/mozapps/installer/linux/rpm
michael@0 209
michael@0 210 RPM_CMD = \
michael@0 211 echo Creating RPM && \
michael@0 212 $(PYTHON) -m mozbuild.action.preprocessor \
michael@0 213 -DMOZ_APP_NAME=$(MOZ_APP_NAME) \
michael@0 214 -DMOZ_APP_DISPLAYNAME='$(MOZ_APP_DISPLAYNAME)' \
michael@0 215 $(RPM_INCIDENTALS)/mozilla.desktop \
michael@0 216 -o $(RPMBUILD_SOURCEDIR)/$(MOZ_APP_NAME).desktop && \
michael@0 217 rm -rf $(_ABS_DIST)/$(TARGET_CPU) && \
michael@0 218 $(RPMBUILD) -bb \
michael@0 219 $(SPEC_FILE) \
michael@0 220 --target $(TARGET_CPU) \
michael@0 221 --buildroot $(RPMBUILD_TOPDIR)/BUILDROOT \
michael@0 222 --define 'moz_app_name $(MOZ_APP_NAME)' \
michael@0 223 --define 'moz_app_displayname $(MOZ_APP_DISPLAYNAME)' \
michael@0 224 --define 'moz_app_version $(MOZ_APP_VERSION)' \
michael@0 225 --define 'moz_numeric_app_version $(MOZ_NUMERIC_APP_VERSION)' \
michael@0 226 --define 'moz_rpm_release $(MOZ_RPM_RELEASE)' \
michael@0 227 --define 'buildid $(BUILDID)' \
michael@0 228 --define 'moz_source_repo $(MOZ_SOURCE_REPO)' \
michael@0 229 --define 'moz_source_stamp $(MOZ_SOURCE_STAMP)' \
michael@0 230 --define 'moz_branding_directory $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)' \
michael@0 231 --define '_topdir $(RPMBUILD_TOPDIR)' \
michael@0 232 --define '_rpmdir $(RPMBUILD_RPMDIR)' \
michael@0 233 --define '_sourcedir $(RPMBUILD_SOURCEDIR)' \
michael@0 234 --define '_specdir $(RPMBUILD_SPECDIR)' \
michael@0 235 --define '_srcrpmdir $(RPMBUILD_SRPMDIR)' \
michael@0 236 --define '_builddir $(RPMBUILD_BUILDDIR)' \
michael@0 237 --define '_prefix $(prefix)' \
michael@0 238 --define '_libdir $(libdir)' \
michael@0 239 --define '_bindir $(bindir)' \
michael@0 240 --define '_datadir $(datadir)' \
michael@0 241 --define '_installdir $(installdir)'
michael@0 242
michael@0 243 ifdef ENABLE_TESTS
michael@0 244 RPM_CMD += \
michael@0 245 --define 'createtests yes' \
michael@0 246 --define '_testsinstalldir $(shell basename $(installdir))'
michael@0 247 endif
michael@0 248
michael@0 249 ifdef INSTALL_SDK
michael@0 250 RPM_CMD += \
michael@0 251 --define 'createdevel yes' \
michael@0 252 --define '_idldir $(idldir)' \
michael@0 253 --define '_sdkdir $(sdkdir)' \
michael@0 254 --define '_includedir $(includedir)'
michael@0 255 endif
michael@0 256
michael@0 257 #For each of the main, tests, sdk rpms we want to make sure that
michael@0 258 #if they exist that they are in objdir/dist/ and that they get
michael@0 259 #uploaded and that they are beside the other build artifacts
michael@0 260 MAIN_RPM= $(MOZ_APP_NAME)-$(MOZ_NUMERIC_APP_VERSION)-$(MOZ_RPM_RELEASE).$(BUILDID).$(TARGET_CPU)$(PKG_SUFFIX)
michael@0 261 UPLOAD_EXTRA_FILES += $(MAIN_RPM)
michael@0 262 RPM_CMD += && mv $(TARGET_CPU)/$(MAIN_RPM) $(_ABS_DIST)/
michael@0 263
michael@0 264 ifdef ENABLE_TESTS
michael@0 265 TESTS_RPM=$(MOZ_APP_NAME)-tests-$(MOZ_NUMERIC_APP_VERSION)-$(MOZ_RPM_RELEASE).$(BUILDID).$(TARGET_CPU)$(PKG_SUFFIX)
michael@0 266 UPLOAD_EXTRA_FILES += $(TESTS_RPM)
michael@0 267 RPM_CMD += && mv $(TARGET_CPU)/$(TESTS_RPM) $(_ABS_DIST)/
michael@0 268 endif
michael@0 269
michael@0 270 ifdef INSTALL_SDK
michael@0 271 SDK_RPM=$(MOZ_APP_NAME)-devel-$(MOZ_NUMERIC_APP_VERSION)-$(MOZ_RPM_RELEASE).$(BUILDID).$(TARGET_CPU)$(PKG_SUFFIX)
michael@0 272 UPLOAD_EXTRA_FILES += $(SDK_RPM)
michael@0 273 RPM_CMD += && mv $(TARGET_CPU)/$(SDK_RPM) $(_ABS_DIST)/
michael@0 274 endif
michael@0 275
michael@0 276 INNER_MAKE_PACKAGE = $(RPM_CMD)
michael@0 277 #Avoiding rpm repacks, going to try creating/uploading xpi in rpm files instead
michael@0 278 INNER_UNMAKE_PACKAGE = $(error Try using rpm2cpio and cpio)
michael@0 279
michael@0 280 endif #Create an RPM file
michael@0 281
michael@0 282
michael@0 283 ifeq ($(MOZ_PKG_FORMAT),APK)
michael@0 284
michael@0 285 JAVA_CLASSPATH = $(ANDROID_SDK)/android.jar
michael@0 286 include $(MOZILLA_DIR)/config/android-common.mk
michael@0 287
michael@0 288 # DEBUG_JARSIGNER is defined by android-common.mk and always debug
michael@0 289 # signs. We want to release sign if possible.
michael@0 290 ifdef MOZ_SIGN_CMD
michael@0 291 RELEASE_JARSIGNER := $(MOZ_SIGN_CMD) -f jar
michael@0 292 else
michael@0 293 RELEASE_JARSIGNER := $(DEBUG_JARSIGNER)
michael@0 294 endif
michael@0 295
michael@0 296 DIST_FILES =
michael@0 297
michael@0 298 # Place the files in the order they are going to be opened by the linker
michael@0 299 DIST_FILES += libmozalloc.so
michael@0 300 ifndef MOZ_FOLD_LIBS
michael@0 301 DIST_FILES += \
michael@0 302 libnspr4.so \
michael@0 303 libplc4.so \
michael@0 304 libplds4.so \
michael@0 305 libmozsqlite3.so \
michael@0 306 libnssutil3.so \
michael@0 307 $(NULL)
michael@0 308 endif
michael@0 309 DIST_FILES += libnss3.so
michael@0 310 ifndef MOZ_FOLD_LIBS
michael@0 311 DIST_FILES += \
michael@0 312 libssl3.so \
michael@0 313 libsmime3.so \
michael@0 314 $(NULL)
michael@0 315 endif
michael@0 316 DIST_FILES += \
michael@0 317 libxul.so \
michael@0 318 libnssckbi.so \
michael@0 319 libfreebl3.so \
michael@0 320 libsoftokn3.so \
michael@0 321 resources.arsc \
michael@0 322 AndroidManifest.xml \
michael@0 323 chrome \
michael@0 324 components \
michael@0 325 defaults \
michael@0 326 modules \
michael@0 327 hyphenation \
michael@0 328 res \
michael@0 329 lib \
michael@0 330 extensions \
michael@0 331 application.ini \
michael@0 332 package-name.txt \
michael@0 333 platform.ini \
michael@0 334 greprefs.js \
michael@0 335 browserconfig.properties \
michael@0 336 blocklist.xml \
michael@0 337 chrome.manifest \
michael@0 338 update.locale \
michael@0 339 removed-files \
michael@0 340 distribution \
michael@0 341 $(NULL)
michael@0 342
michael@0 343 NON_DIST_FILES = \
michael@0 344 classes.dex \
michael@0 345 $(NULL)
michael@0 346
michael@0 347 UPLOAD_EXTRA_FILES += gecko-unsigned-unaligned.apk
michael@0 348
michael@0 349 DIST_FILES += $(MOZ_CHILD_PROCESS_NAME)
michael@0 350
michael@0 351 GECKO_APP_AP_PATH = $(abspath $(DEPTH)/mobile/android/base)
michael@0 352
michael@0 353 ifdef ENABLE_TESTS
michael@0 354 INNER_ROBOCOP_PACKAGE=echo
michael@0 355 INNER_BACKGROUND_TESTS_PACKAGE=echo
michael@0 356 ifeq ($(MOZ_BUILD_APP),mobile/android)
michael@0 357 UPLOAD_EXTRA_FILES += robocop.apk
michael@0 358 UPLOAD_EXTRA_FILES += fennec_ids.txt
michael@0 359 UPLOAD_EXTRA_FILES += geckoview_library/geckoview_library.zip
michael@0 360 UPLOAD_EXTRA_FILES += geckoview_library/geckoview_assets.zip
michael@0 361 UPLOAD_EXTRA_FILES += ../embedding/android/geckoview_example/geckoview_example.apk
michael@0 362
michael@0 363 # Robocop/Robotium tests, Android Background tests, and Fennec need to
michael@0 364 # be signed with the same key, which means release signing them all.
michael@0 365
michael@0 366 # $(1) is the full path to input: foo-debug-unsigned-unaligned.apk.
michael@0 367 # $(2) is the full path to output: foo.apk.
michael@0 368 RELEASE_SIGN_ANDROID_APK = \
michael@0 369 cp $(1) $(2)-unaligned.apk && \
michael@0 370 $(RELEASE_JARSIGNER) $(2)-unaligned.apk && \
michael@0 371 $(ZIPALIGN) -f -v 4 $(2)-unaligned.apk $(2) && \
michael@0 372 $(RM) $(2)-unaligned.apk
michael@0 373
michael@0 374 ROBOCOP_PATH = $(abspath $(_ABS_DIST)/../build/mobile/robocop)
michael@0 375 # Normally, $(NSINSTALL) would be used instead of cp, but INNER_ROBOCOP_PACKAGE
michael@0 376 # is used in a series of commands that run under a "cd something", while
michael@0 377 # $(NSINSTALL) is relative.
michael@0 378 INNER_ROBOCOP_PACKAGE= \
michael@0 379 cp $(GECKO_APP_AP_PATH)/fennec_ids.txt $(_ABS_DIST) && \
michael@0 380 $(call RELEASE_SIGN_ANDROID_APK,$(ROBOCOP_PATH)/robocop-debug-unsigned-unaligned.apk,$(_ABS_DIST)/robocop.apk)
michael@0 381
michael@0 382 BACKGROUND_TESTS_PATH = $(abspath $(_ABS_DIST)/../mobile/android/tests/background/junit3)
michael@0 383 INNER_BACKGROUND_TESTS_PACKAGE= \
michael@0 384 $(call RELEASE_SIGN_ANDROID_APK,$(BACKGROUND_TESTS_PATH)/background-junit3-debug-unsigned-unaligned.apk,$(_ABS_DIST)/background-junit3.apk)
michael@0 385
michael@0 386 BROWSER_TESTS_PATH = $(abspath $(_ABS_DIST)/../mobile/android/tests/browser/junit3)
michael@0 387 INNER_BROWSER_TESTS_PACKAGE= \
michael@0 388 $(call RELEASE_SIGN_ANDROID_APK,$(BROWSER_TESTS_PATH)/browser-junit3-debug-unsigned-unaligned.apk,$(_ABS_DIST)/browser-junit3.apk)
michael@0 389 endif
michael@0 390 else
michael@0 391 INNER_ROBOCOP_PACKAGE=echo 'Testing is disabled - No Android Robocop for you'
michael@0 392 INNER_BACKGROUND_TESTS_PACKAGE=echo 'Testing is disabled - No Android Background JUnit 3 tests for you'
michael@0 393 INNER_BROWSER_TESTS_PACKAGE=echo 'Testing is disabled - No Android Browser JUnit 3tests for you'
michael@0 394 endif
michael@0 395
michael@0 396 # Create geckoview_library/geckoview_{assets,library}.zip for third-party GeckoView consumers.
michael@0 397 ifdef NIGHTLY_BUILD
michael@0 398 ifndef MOZ_DISABLE_GECKOVIEW
michael@0 399 INNER_MAKE_GECKOVIEW_LIBRARY= \
michael@0 400 $(MAKE) -C ../mobile/android/geckoview_library package
michael@0 401 INNER_MAKE_GECKOVIEW_EXAMPLE= \
michael@0 402 $(MAKE) -C ../embedding/android/geckoview_example package
michael@0 403 else
michael@0 404 INNER_MAKE_GECKOVIEW_LIBRARY=echo 'GeckoView library packaging is disabled'
michael@0 405 INNER_MAKE_GECKOVIEW_EXAMPLE=echo 'GeckoView example packaging is disabled'
michael@0 406 endif
michael@0 407 else
michael@0 408 INNER_MAKE_GECKOVIEW_LIBRARY=echo 'GeckoView library packaging is only enabled on Nightly'
michael@0 409 INNER_MAKE_GECKOVIEW_EXAMPLE=echo 'GeckoView example packaging is only enabled on Nightly'
michael@0 410 endif
michael@0 411
michael@0 412 ifdef MOZ_OMX_PLUGIN
michael@0 413 DIST_FILES += libomxplugin.so libomxplugingb.so libomxplugingb235.so \
michael@0 414 libomxpluginhc.so libomxpluginfroyo.so libomxpluginkk.so
michael@0 415 endif
michael@0 416
michael@0 417 SO_LIBRARIES := $(filter %.so,$(DIST_FILES))
michael@0 418 # These libraries are placed in the assets/ directory by packager.py.
michael@0 419 ASSET_SO_LIBRARIES := $(addprefix assets/,$(filter-out libmozglue.so $(MOZ_CHILD_PROCESS_NAME),$(SO_LIBRARIES)))
michael@0 420
michael@0 421 DIST_FILES := $(filter-out $(SO_LIBRARIES),$(DIST_FILES))
michael@0 422 NON_DIST_FILES += libmozglue.so $(MOZ_CHILD_PROCESS_NAME) $(ASSET_SO_LIBRARIES)
michael@0 423
michael@0 424 ifdef MOZ_ENABLE_SZIP
michael@0 425 # These libraries are szipped in-place in the assets/ directory.
michael@0 426 SZIP_LIBRARIES := $(ASSET_SO_LIBRARIES)
michael@0 427 endif
michael@0 428
michael@0 429 # Fennec's OMNIJAR_NAME can include a directory; for example, it might
michael@0 430 # be "assets/omni.ja". This path specifies where the omni.ja file
michael@0 431 # lives in the APK, but should not root the resources it contains
michael@0 432 # under assets/ (i.e., resources should not live at chrome://assets/).
michael@0 433 # packager.py writes /omni.ja in order to be consistent with the
michael@0 434 # layout expected by language repacks. Therefore, we move it to the
michael@0 435 # correct path here, in INNER_MAKE_PACKAGE. See comment about
michael@0 436 # OMNIJAR_NAME in configure.in.
michael@0 437
michael@0 438 # OMNIJAR_DIR is './' for "omni.ja", 'assets/' for "assets/omni.ja".
michael@0 439 OMNIJAR_DIR := $(dir $(OMNIJAR_NAME))
michael@0 440 OMNIJAR_NAME := $(notdir $(OMNIJAR_NAME))
michael@0 441
michael@0 442 # We force build an ap_ that does not check dependencies below.
michael@0 443 # Language repacks take advantage of this unchecked dependency ap_ to
michael@0 444 # insert additional resources (translated strings) into the ap_
michael@0 445 # without the build system's participation. This can do the wrong
michael@0 446 # thing if there are resource changes in between build time and
michael@0 447 # package time. We try to prevent mismatched resources by erroring
michael@0 448 # out if the compiled resource IDs are not the same as the resource
michael@0 449 # IDs being packaged. If we're doing a single locale repack, however,
michael@0 450 # we don't have a complete object directory, so we can't compare
michael@0 451 # resource IDs.
michael@0 452
michael@0 453 # A note on the res/ directory. We unzip the ap_ during packaging,
michael@0 454 # which produces the res/ directory. This directory is then included
michael@0 455 # in the final package. When we unpack (during locale repacks), we
michael@0 456 # need to remove the res/ directory because these resources confuse
michael@0 457 # the l10n packaging script that updates omni.ja: the script tries to
michael@0 458 # localize the contents of the res/ directory, which fails. Instead,
michael@0 459 # after the l10n packaging script completes, we build the ap_
michael@0 460 # described above (which includes freshly localized Android resources)
michael@0 461 # and the res/ directory is taken from the ap_ as part of the regular
michael@0 462 # packaging.
michael@0 463
michael@0 464 PKG_SUFFIX = .apk
michael@0 465 INNER_MAKE_PACKAGE = \
michael@0 466 $(if $(ALREADY_SZIPPED),,$(foreach lib,$(SZIP_LIBRARIES),host/bin/szip $(MOZ_SZIP_FLAGS) $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)/$(lib) && )) \
michael@0 467 make -C $(GECKO_APP_AP_PATH) gecko-nodeps.ap_ && \
michael@0 468 cp $(GECKO_APP_AP_PATH)/gecko-nodeps.ap_ $(_ABS_DIST)/gecko.ap_ && \
michael@0 469 ( (test ! -f $(GECKO_APP_AP_PATH)/R.txt && echo "*** Warning: The R.txt that is being packaged might not agree with the R.txt that was built. This is normal during l10n repacks.") || \
michael@0 470 diff $(GECKO_APP_AP_PATH)/R.txt $(GECKO_APP_AP_PATH)/gecko-nodeps/R.txt >/dev/null || \
michael@0 471 (echo "*** Error: The R.txt that was built and the R.txt that is being packaged are not the same. Rebuild mobile/android/base and re-package." && exit 1)) && \
michael@0 472 ( cd $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH) && \
michael@0 473 mkdir -p lib/$(ANDROID_CPU_ARCH) && \
michael@0 474 mv libmozglue.so $(MOZ_CHILD_PROCESS_NAME) lib/$(ANDROID_CPU_ARCH) && \
michael@0 475 unzip -o $(_ABS_DIST)/gecko.ap_ && \
michael@0 476 rm $(_ABS_DIST)/gecko.ap_ && \
michael@0 477 $(ZIP) $(if $(MOZ_ENABLE_SZIP),-0 )$(_ABS_DIST)/gecko.ap_ $(ASSET_SO_LIBRARIES) && \
michael@0 478 $(ZIP) -r9D $(_ABS_DIST)/gecko.ap_ $(DIST_FILES) -x $(NON_DIST_FILES) $(SZIP_LIBRARIES) && \
michael@0 479 $(if $(filter-out ./,$(OMNIJAR_DIR)), \
michael@0 480 mkdir -p $(OMNIJAR_DIR) && mv $(OMNIJAR_NAME) $(OMNIJAR_DIR) && ) \
michael@0 481 $(ZIP) -0 $(_ABS_DIST)/gecko.ap_ $(OMNIJAR_DIR)$(OMNIJAR_NAME)) && \
michael@0 482 rm -f $(_ABS_DIST)/gecko.apk && \
michael@0 483 cp $(_ABS_DIST)/gecko.ap_ $(_ABS_DIST)/gecko.apk && \
michael@0 484 $(ZIP) -j0 $(_ABS_DIST)/gecko.apk $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)/classes.dex && \
michael@0 485 cp $(_ABS_DIST)/gecko.apk $(_ABS_DIST)/gecko-unsigned-unaligned.apk && \
michael@0 486 $(RELEASE_JARSIGNER) $(_ABS_DIST)/gecko.apk && \
michael@0 487 $(ZIPALIGN) -f -v 4 $(_ABS_DIST)/gecko.apk $(PACKAGE) && \
michael@0 488 $(INNER_ROBOCOP_PACKAGE) && \
michael@0 489 $(INNER_BACKGROUND_TESTS_PACKAGE) && \
michael@0 490 $(INNER_BROWSER_TESTS_PACKAGE) && \
michael@0 491 $(INNER_MAKE_GECKOVIEW_LIBRARY) && \
michael@0 492 $(INNER_MAKE_GECKOVIEW_EXAMPLE)
michael@0 493
michael@0 494 # Language repacks root the resources contained in assets/omni.ja
michael@0 495 # under assets/, but the repacks expect them to be rooted at /.
michael@0 496 # Therefore, we we move the omnijar back to / so the resources are
michael@0 497 # under the root here, in INNER_UNMAKE_PACKAGE. See comments about
michael@0 498 # OMNIJAR_NAME earlier in this file and in configure.in.
michael@0 499
michael@0 500 INNER_UNMAKE_PACKAGE = \
michael@0 501 mkdir $(MOZ_PKG_DIR) && \
michael@0 502 ( cd $(MOZ_PKG_DIR) && \
michael@0 503 $(UNZIP) $(UNPACKAGE) && \
michael@0 504 mv lib/$(ANDROID_CPU_ARCH)/libmozglue.so . && \
michael@0 505 mv lib/$(ANDROID_CPU_ARCH)/*plugin-container* $(MOZ_CHILD_PROCESS_NAME) && \
michael@0 506 rm -rf lib/$(ANDROID_CPU_ARCH) && \
michael@0 507 rm -rf res \
michael@0 508 $(if $(filter-out ./,$(OMNIJAR_DIR)), \
michael@0 509 && mv $(OMNIJAR_DIR)$(OMNIJAR_NAME) $(OMNIJAR_NAME)) )
michael@0 510 endif
michael@0 511
michael@0 512 ifeq ($(MOZ_PKG_FORMAT),DMG)
michael@0 513 PKG_SUFFIX = .dmg
michael@0 514 PKG_DMG_FLAGS =
michael@0 515 ifneq (,$(MOZ_PKG_MAC_DSSTORE))
michael@0 516 PKG_DMG_FLAGS += --copy '$(MOZ_PKG_MAC_DSSTORE):/.DS_Store'
michael@0 517 endif
michael@0 518 ifneq (,$(MOZ_PKG_MAC_BACKGROUND))
michael@0 519 PKG_DMG_FLAGS += --mkdir /.background --copy '$(MOZ_PKG_MAC_BACKGROUND):/.background'
michael@0 520 endif
michael@0 521 ifneq (,$(MOZ_PKG_MAC_ICON))
michael@0 522 PKG_DMG_FLAGS += --icon '$(MOZ_PKG_MAC_ICON)'
michael@0 523 endif
michael@0 524 ifneq (,$(MOZ_PKG_MAC_RSRC))
michael@0 525 PKG_DMG_FLAGS += --resource '$(MOZ_PKG_MAC_RSRC)'
michael@0 526 endif
michael@0 527 ifneq (,$(MOZ_PKG_MAC_EXTRA))
michael@0 528 PKG_DMG_FLAGS += $(MOZ_PKG_MAC_EXTRA)
michael@0 529 endif
michael@0 530 _ABS_MOZSRCDIR = $(shell cd $(MOZILLA_DIR) && pwd)
michael@0 531 ifndef PKG_DMG_SOURCE
michael@0 532 PKG_DMG_SOURCE = $(STAGEPATH)$(MOZ_PKG_DIR)
michael@0 533 endif
michael@0 534 INNER_MAKE_PACKAGE = $(_ABS_MOZSRCDIR)/build/package/mac_osx/pkg-dmg \
michael@0 535 --source '$(PKG_DMG_SOURCE)' --target '$(PACKAGE)' \
michael@0 536 --volname '$(MOZ_APP_DISPLAYNAME)' $(PKG_DMG_FLAGS)
michael@0 537 INNER_UNMAKE_PACKAGE = \
michael@0 538 set -ex; \
michael@0 539 rm -rf $(_ABS_DIST)/unpack.tmp; \
michael@0 540 mkdir -p $(_ABS_DIST)/unpack.tmp; \
michael@0 541 $(_ABS_MOZSRCDIR)/build/package/mac_osx/unpack-diskimage $(UNPACKAGE) /tmp/$(MOZ_PKG_APPNAME)-unpack $(_ABS_DIST)/unpack.tmp; \
michael@0 542 rsync -a '$(_ABS_DIST)/unpack.tmp/$(_APPNAME)' $(MOZ_PKG_DIR); \
michael@0 543 test -n '$(MOZ_PKG_MAC_DSSTORE)' && \
michael@0 544 rsync -a '$(_ABS_DIST)/unpack.tmp/.DS_Store' '$(MOZ_PKG_MAC_DSSTORE)'; \
michael@0 545 test -n '$(MOZ_PKG_MAC_BACKGROUND)' && \
michael@0 546 rsync -a '$(_ABS_DIST)/unpack.tmp/.background/$(notdir $(MOZ_PKG_MAC_BACKGROUND))' '$(MOZ_PKG_MAC_BACKGROUND)'; \
michael@0 547 test -n '$(MOZ_PKG_MAC_ICON)' && \
michael@0 548 rsync -a '$(_ABS_DIST)/unpack.tmp/.VolumeIcon.icns' '$(MOZ_PKG_MAC_ICON)'; \
michael@0 549 rm -rf $(_ABS_DIST)/unpack.tmp; \
michael@0 550 if test -n '$(MOZ_PKG_MAC_RSRC)' ; then \
michael@0 551 cp $(UNPACKAGE) $(MOZ_PKG_APPNAME).tmp.dmg && \
michael@0 552 hdiutil unflatten $(MOZ_PKG_APPNAME).tmp.dmg && \
michael@0 553 { /Developer/Tools/DeRez -skip plst -skip blkx $(MOZ_PKG_APPNAME).tmp.dmg > '$(MOZ_PKG_MAC_RSRC)' || { rm -f $(MOZ_PKG_APPNAME).tmp.dmg && false; }; } && \
michael@0 554 rm -f $(MOZ_PKG_APPNAME).tmp.dmg; \
michael@0 555 fi
michael@0 556 # The plst and blkx resources are skipped because they belong to each
michael@0 557 # individual dmg and are created by hdiutil.
michael@0 558 SDK_SUFFIX = .tar.bz2
michael@0 559 SDK = $(MOZ_PKG_APPNAME)-$(MOZ_PKG_VERSION).$(AB_CD).mac-$(TARGET_CPU).sdk$(SDK_SUFFIX)
michael@0 560 ifeq ($(MOZ_APP_NAME),xulrunner)
michael@0 561 SDK = $(SDK_PATH)$(MOZ_APP_NAME)-$(MOZ_PKG_VERSION).$(AB_CD).mac-$(TARGET_CPU).sdk$(SDK_SUFFIX)
michael@0 562 endif
michael@0 563 MAKE_SDK = $(CREATE_FINAL_TAR) - $(MOZ_APP_NAME)-sdk | bzip2 -vf > $(SDK)
michael@0 564 endif
michael@0 565
michael@0 566 ifdef MOZ_INTERNAL_SIGNING_FORMAT
michael@0 567 MOZ_SIGN_PREPARED_PACKAGE_CMD=$(MOZ_SIGN_CMD) $(foreach f,$(MOZ_INTERNAL_SIGNING_FORMAT),-f $(f)) $(foreach i,$(SIGN_INCLUDES),-i $(i)) $(foreach x,$(SIGN_EXCLUDES),-x $(x))
michael@0 568 ifeq (WINNT,$(OS_ARCH))
michael@0 569 MOZ_SIGN_PREPARED_PACKAGE_CMD += --nsscmd '$(_ABS_DIST)/bin/shlibsign$(BIN_SUFFIX) -v -i'
michael@0 570 endif
michael@0 571 endif
michael@0 572
michael@0 573 # For final GPG / authenticode signing / dmg signing if required
michael@0 574 ifdef MOZ_EXTERNAL_SIGNING_FORMAT
michael@0 575 MOZ_SIGN_PACKAGE_CMD=$(MOZ_SIGN_CMD) $(foreach f,$(MOZ_EXTERNAL_SIGNING_FORMAT),-f $(f))
michael@0 576 endif
michael@0 577
michael@0 578 ifdef MOZ_SIGN_PREPARED_PACKAGE_CMD
michael@0 579 ifeq (Darwin, $(OS_ARCH))
michael@0 580 MAKE_PACKAGE = cd ./$(PKG_DMG_SOURCE) && $(MOZ_SIGN_PREPARED_PACKAGE_CMD) $(MOZ_MACBUNDLE_NAME) \
michael@0 581 && rm $(MOZ_MACBUNDLE_NAME)/Contents/CodeResources \
michael@0 582 && cp $(MOZ_MACBUNDLE_NAME)/Contents/_CodeSignature/CodeResources $(MOZ_MACBUNDLE_NAME)/Contents \
michael@0 583 && cd $(PACKAGE_BASE_DIR) \
michael@0 584 && $(INNER_MAKE_PACKAGE)
michael@0 585 else
michael@0 586 MAKE_PACKAGE = $(MOZ_SIGN_PREPARED_PACKAGE_CMD) \
michael@0 587 $(MOZ_PKG_DIR) && $(INNER_MAKE_PACKAGE)
michael@0 588 endif #Darwin
michael@0 589
michael@0 590 else
michael@0 591 MAKE_PACKAGE = $(INNER_MAKE_PACKAGE)
michael@0 592 endif
michael@0 593
michael@0 594 ifdef MOZ_SIGN_PACKAGE_CMD
michael@0 595 MAKE_PACKAGE += && $(MOZ_SIGN_PACKAGE_CMD) '$(PACKAGE)'
michael@0 596 endif
michael@0 597
michael@0 598 ifdef MOZ_SIGN_CMD
michael@0 599 MAKE_SDK += && $(MOZ_SIGN_CMD) -f gpg $(SDK)
michael@0 600 UPLOAD_EXTRA_FILES += $(SDK).asc
michael@0 601 endif
michael@0 602
michael@0 603 NO_PKG_FILES += \
michael@0 604 core \
michael@0 605 bsdecho \
michael@0 606 js \
michael@0 607 js-config \
michael@0 608 jscpucfg \
michael@0 609 nsinstall \
michael@0 610 viewer \
michael@0 611 TestGtkEmbed \
michael@0 612 elf-dynstr-gc \
michael@0 613 mangle* \
michael@0 614 maptsv* \
michael@0 615 mfc* \
michael@0 616 msdump* \
michael@0 617 msmap* \
michael@0 618 nm2tsv* \
michael@0 619 nsinstall* \
michael@0 620 res/samples \
michael@0 621 res/throbber \
michael@0 622 shlibsign* \
michael@0 623 ssltunnel* \
michael@0 624 certutil* \
michael@0 625 pk12util* \
michael@0 626 BadCertServer* \
michael@0 627 OCSPStaplingServer* \
michael@0 628 GenerateOCSPResponse* \
michael@0 629 winEmbed.exe \
michael@0 630 chrome/chrome.rdf \
michael@0 631 chrome/app-chrome.manifest \
michael@0 632 chrome/overlayinfo \
michael@0 633 components/compreg.dat \
michael@0 634 components/xpti.dat \
michael@0 635 content_unit_tests \
michael@0 636 necko_unit_tests \
michael@0 637 *.dSYM \
michael@0 638 $(NULL)
michael@0 639
michael@0 640 # browser/locales/Makefile uses this makefile for its variable defs, but
michael@0 641 # doesn't want the libs:: rule.
michael@0 642 ifndef PACKAGER_NO_LIBS
michael@0 643 libs:: make-package
michael@0 644 endif
michael@0 645
michael@0 646 DEFINES += -DDLL_PREFIX=$(DLL_PREFIX) -DDLL_SUFFIX=$(DLL_SUFFIX) -DBIN_SUFFIX=$(BIN_SUFFIX)
michael@0 647
michael@0 648 ifdef MOZ_FOLD_LIBS
michael@0 649 DEFINES += -DMOZ_FOLD_LIBS=1
michael@0 650 endif
michael@0 651
michael@0 652 GARBAGE += $(DIST)/$(PACKAGE) $(PACKAGE)
michael@0 653
michael@0 654 # The following target stages files into two directories: one directory for
michael@0 655 # core files, and one for optional extensions based on the information in
michael@0 656 # the MOZ_PKG_MANIFEST file.
michael@0 657
michael@0 658 PKG_ARG = , '$(pkg)'
michael@0 659
michael@0 660 installer-stage: prepare-package
michael@0 661 ifndef MOZ_PKG_MANIFEST
michael@0 662 $(error MOZ_PKG_MANIFEST unspecified!)
michael@0 663 endif
michael@0 664 @rm -rf $(DEPTH)/installer-stage $(DIST)/xpt
michael@0 665 @echo 'Staging installer files...'
michael@0 666 @$(NSINSTALL) -D $(DEPTH)/installer-stage/core
michael@0 667 @cp -av $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)/. $(DEPTH)/installer-stage/core
michael@0 668 @(cd $(DEPTH)/installer-stage/core && $(CREATE_PRECOMPLETE_CMD))
michael@0 669 ifdef MOZ_SIGN_PREPARED_PACKAGE_CMD
michael@0 670 # The && true is necessary to make sure Pymake spins a shell
michael@0 671 $(MOZ_SIGN_PREPARED_PACKAGE_CMD) $(DEPTH)/installer-stage && true
michael@0 672 endif
michael@0 673
michael@0 674 ifeq (gonk,$(MOZ_WIDGET_TOOLKIT))
michael@0 675 ELF_HACK_FLAGS = --fill
michael@0 676 endif
michael@0 677
michael@0 678 # MOZ_PKG_MANIFEST is the canonical way to define the package manifest (which
michael@0 679 # the packager will preprocess), but for a smooth transition, we derive it
michael@0 680 # from the now deprecated MOZ_PKG_MANIFEST_P when MOZ_PKG_MANIFEST is not
michael@0 681 # defined.
michael@0 682 ifndef MOZ_PKG_MANIFEST
michael@0 683 ifdef MOZ_PKG_MANIFEST_P
michael@0 684 MOZ_PKG_MANIFEST := $(MOZ_PKG_MANIFEST_P)
michael@0 685 endif # MOZ_PKG_MANIFEST_P
michael@0 686 endif # MOZ_PKG_MANIFEST
michael@0 687
michael@0 688 # For smooth transition of comm-central
michael@0 689 ifndef MOZ_PACKAGER_FORMAT
michael@0 690 ifeq ($(MOZ_CHROME_FILE_FORMAT),flat)
michael@0 691 ifdef MOZ_OMNIJAR
michael@0 692 MOZ_PACKAGER_FORMAT := omni
michael@0 693 else
michael@0 694 MOZ_PACKAGER_FORMAT := flat
michael@0 695 endif
michael@0 696 endif
michael@0 697 endif
michael@0 698 ifndef MOZ_PACKAGER_FORMAT
michael@0 699 MOZ_PACKAGER_FORMAT = $(error MOZ_PACKAGER_FORMAT is not set)
michael@0 700 endif
michael@0 701
michael@0 702 ifneq (android,$(MOZ_WIDGET_TOOLKIT))
michael@0 703 OPTIMIZEJARS = 1
michael@0 704 endif
michael@0 705
michael@0 706 export NO_PKG_FILES USE_ELF_HACK ELF_HACK_FLAGS
michael@0 707
michael@0 708 # A js binary is needed to perform verification of JavaScript minification.
michael@0 709 # We can only use the built binary when not cross-compiling. Environments
michael@0 710 # (such as release automation) can provide their own js binary to enable
michael@0 711 # verification when cross-compiling.
michael@0 712 ifndef JS_BINARY
michael@0 713 ifndef CROSS_COMPILE
michael@0 714 JS_BINARY = $(wildcard $(DIST)/bin/js)
michael@0 715 endif
michael@0 716 endif
michael@0 717
michael@0 718 # Override the value of OMNIJAR_NAME from config.status with the value
michael@0 719 # set earlier in this file.
michael@0 720
michael@0 721 stage-package: $(MOZ_PKG_MANIFEST)
michael@0 722 @rm -rf $(DIST)/$(PKG_PATH)$(PKG_BASENAME).tar $(DIST)/$(PKG_PATH)$(PKG_BASENAME).dmg $@ $(EXCLUDE_LIST)
michael@0 723 OMNIJAR_NAME=$(OMNIJAR_NAME) \
michael@0 724 $(PYTHON) $(MOZILLA_DIR)/toolkit/mozapps/installer/packager.py $(DEFINES) \
michael@0 725 --format $(MOZ_PACKAGER_FORMAT) \
michael@0 726 $(addprefix --removals ,$(MOZ_PKG_REMOVALS)) \
michael@0 727 $(if $(filter-out 0,$(MOZ_PKG_FATAL_WARNINGS)),,--ignore-errors) \
michael@0 728 $(if $(MOZ_PACKAGER_MINIFY),--minify) \
michael@0 729 $(if $(MOZ_PACKAGER_MINIFY_JS),--minify-js \
michael@0 730 $(addprefix --js-binary ,$(JS_BINARY)) \
michael@0 731 ) \
michael@0 732 $(if $(JARLOG_DIR),$(addprefix --jarlog ,$(wildcard $(JARLOG_FILE_AB_CD)))) \
michael@0 733 $(if $(OPTIMIZEJARS),--optimizejars) \
michael@0 734 $(addprefix --unify ,$(UNIFY_DIST)) \
michael@0 735 $(MOZ_PKG_MANIFEST) $(DIST) $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)$(if $(MOZ_PKG_MANIFEST),,$(_BINPATH)) \
michael@0 736 $(if $(filter omni,$(MOZ_PACKAGER_FORMAT)),$(if $(NON_OMNIJAR_FILES),--non-resource $(NON_OMNIJAR_FILES)))
michael@0 737 $(PYTHON) $(MOZILLA_DIR)/toolkit/mozapps/installer/find-dupes.py $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)
michael@0 738 ifndef LIBXUL_SDK
michael@0 739 ifdef MOZ_PACKAGE_JSSHELL
michael@0 740 # Package JavaScript Shell
michael@0 741 @echo 'Packaging JavaScript Shell...'
michael@0 742 $(RM) $(PKG_JSSHELL)
michael@0 743 $(MAKE_JSSHELL)
michael@0 744 endif # MOZ_PACKAGE_JSSHELL
michael@0 745 endif # LIBXUL_SDK
michael@0 746
michael@0 747 prepare-package: stage-package
michael@0 748
michael@0 749 make-package-internal: prepare-package make-sourcestamp-file make-buildinfo-file
michael@0 750 @echo 'Compressing...'
michael@0 751 cd $(DIST) && $(MAKE_PACKAGE)
michael@0 752
michael@0 753 make-package: FORCE
michael@0 754 $(MAKE) make-package-internal
michael@0 755 $(TOUCH) $@
michael@0 756
michael@0 757 GARBAGE += make-package
michael@0 758
michael@0 759 make-sourcestamp-file::
michael@0 760 $(NSINSTALL) -D $(DIST)/$(PKG_PATH)
michael@0 761 @echo '$(BUILDID)' > $(MOZ_SOURCESTAMP_FILE)
michael@0 762 @echo '$(MOZ_SOURCE_REPO)/rev/$(MOZ_SOURCE_STAMP)' >> $(MOZ_SOURCESTAMP_FILE)
michael@0 763
michael@0 764 .PHONY: make-buildinfo-file
michael@0 765 make-buildinfo-file:
michael@0 766 $(PYTHON) $(MOZILLA_DIR)/toolkit/mozapps/installer/informulate.py \
michael@0 767 $(MOZ_BUILDINFO_FILE) \
michael@0 768 BUILDID=$(BUILDID) \
michael@0 769 MOZ_SOURCE_REPO=$(MOZ_SOURCE_REPO) \
michael@0 770 MOZ_SOURCE_STAMP=$(MOZ_SOURCE_STAMP) \
michael@0 771 MOZ_PKG_PLATFORM=$(MOZ_PKG_PLATFORM)
michael@0 772
michael@0 773 # The install target will install the application to prefix/lib/appname-version
michael@0 774 # In addition if INSTALL_SDK is set, it will install the development headers,
michael@0 775 # libraries, and IDL files as follows:
michael@0 776 # dist/include -> prefix/include/appname-version
michael@0 777 # dist/idl -> prefix/share/idl/appname-version
michael@0 778 # dist/sdk/lib -> prefix/lib/appname-devel-version/lib
michael@0 779 # prefix/lib/appname-devel-version/* symlinks to the above directories
michael@0 780 install:: prepare-package
michael@0 781 ifeq ($(OS_ARCH),WINNT)
michael@0 782 $(error "make install" is not supported on this platform. Use "make package" instead.)
michael@0 783 endif
michael@0 784 ifeq (bundle,$(MOZ_FS_LAYOUT))
michael@0 785 $(error "make install" is not supported on this platform. Use "make package" instead.)
michael@0 786 endif
michael@0 787 $(NSINSTALL) -D $(DESTDIR)$(installdir)
michael@0 788 (cd $(DIST)/$(MOZ_PKG_DIR) && $(TAR) --exclude=precomplete $(TAR_CREATE_FLAGS) - .) | \
michael@0 789 (cd $(DESTDIR)$(installdir) && tar -xf -)
michael@0 790 $(NSINSTALL) -D $(DESTDIR)$(bindir)
michael@0 791 $(RM) -f $(DESTDIR)$(bindir)/$(MOZ_APP_NAME)
michael@0 792 ln -s $(installdir)/$(MOZ_APP_NAME) $(DESTDIR)$(bindir)
michael@0 793 ifdef INSTALL_SDK # Here comes the hard part
michael@0 794 $(NSINSTALL) -D $(DESTDIR)$(includedir)
michael@0 795 (cd $(DIST)/include && $(TAR) $(TAR_CREATE_FLAGS) - .) | \
michael@0 796 (cd $(DESTDIR)$(includedir) && tar -xf -)
michael@0 797 $(NSINSTALL) -D $(DESTDIR)$(idldir)
michael@0 798 (cd $(DIST)/idl && $(TAR) $(TAR_CREATE_FLAGS) - .) | \
michael@0 799 (cd $(DESTDIR)$(idldir) && tar -xf -)
michael@0 800 # SDK directory is the libs + a bunch of symlinks
michael@0 801 $(NSINSTALL) -D $(DESTDIR)$(sdkdir)/sdk/lib
michael@0 802 $(NSINSTALL) -D $(DESTDIR)$(sdkdir)/sdk/bin
michael@0 803 if test -f $(DIST)/include/xpcom-config.h; then \
michael@0 804 $(SYSINSTALL) $(IFLAGS1) $(DIST)/include/xpcom-config.h $(DESTDIR)$(sdkdir); \
michael@0 805 fi
michael@0 806 find $(DIST)/sdk -name '*.pyc' | xargs rm -f
michael@0 807 (cd $(DIST)/sdk/lib && $(TAR) $(TAR_CREATE_FLAGS) - .) | (cd $(DESTDIR)$(sdkdir)/sdk/lib && tar -xf -)
michael@0 808 (cd $(DIST)/sdk/bin && $(TAR) $(TAR_CREATE_FLAGS) - .) | (cd $(DESTDIR)$(sdkdir)/sdk/bin && tar -xf -)
michael@0 809 $(RM) -f $(DESTDIR)$(sdkdir)/lib $(DESTDIR)$(sdkdir)/bin $(DESTDIR)$(sdkdir)/include $(DESTDIR)$(sdkdir)/include $(DESTDIR)$(sdkdir)/sdk/idl $(DESTDIR)$(sdkdir)/idl
michael@0 810 ln -s $(sdkdir)/sdk/lib $(DESTDIR)$(sdkdir)/lib
michael@0 811 ln -s $(installdir) $(DESTDIR)$(sdkdir)/bin
michael@0 812 ln -s $(includedir) $(DESTDIR)$(sdkdir)/include
michael@0 813 ln -s $(idldir) $(DESTDIR)$(sdkdir)/idl
michael@0 814 endif # INSTALL_SDK
michael@0 815
michael@0 816 make-sdk:
michael@0 817 $(MAKE) stage-package UNIVERSAL_BINARY= STAGE_SDK=1 MOZ_PKG_DIR=sdk-stage
michael@0 818 @echo 'Packaging SDK...'
michael@0 819 $(RM) -rf $(DIST)/$(MOZ_APP_NAME)-sdk
michael@0 820 $(NSINSTALL) -D $(DIST)/$(MOZ_APP_NAME)-sdk/bin
michael@0 821 (cd $(DIST)/sdk-stage && $(TAR) $(TAR_CREATE_FLAGS) - .) | \
michael@0 822 (cd $(DIST)/$(MOZ_APP_NAME)-sdk/bin && tar -xf -)
michael@0 823 $(NSINSTALL) -D $(DIST)/$(MOZ_APP_NAME)-sdk/host/bin
michael@0 824 (cd $(DIST)/host/bin && $(TAR) $(TAR_CREATE_FLAGS) - .) | \
michael@0 825 (cd $(DIST)/$(MOZ_APP_NAME)-sdk/host/bin && tar -xf -)
michael@0 826 $(NSINSTALL) -D $(DIST)/$(MOZ_APP_NAME)-sdk/sdk
michael@0 827 find $(DIST)/sdk -name '*.pyc' | xargs rm -f
michael@0 828 (cd $(DIST)/sdk && $(TAR) $(TAR_CREATE_FLAGS) - .) | \
michael@0 829 (cd $(DIST)/$(MOZ_APP_NAME)-sdk/sdk && tar -xf -)
michael@0 830 $(NSINSTALL) -D $(DIST)/$(MOZ_APP_NAME)-sdk/include
michael@0 831 (cd $(DIST)/include && $(TAR) $(TAR_CREATE_FLAGS) - .) | \
michael@0 832 (cd $(DIST)/$(MOZ_APP_NAME)-sdk/include && tar -xf -)
michael@0 833 $(NSINSTALL) -D $(DIST)/$(MOZ_APP_NAME)-sdk/idl
michael@0 834 (cd $(DIST)/idl && $(TAR) $(TAR_CREATE_FLAGS) - .) | \
michael@0 835 (cd $(DIST)/$(MOZ_APP_NAME)-sdk/idl && tar -xf -)
michael@0 836 $(NSINSTALL) -D $(DIST)/$(MOZ_APP_NAME)-sdk/lib
michael@0 837 # sdk/lib is the same as sdk/sdk/lib
michael@0 838 (cd $(DIST)/sdk/lib && $(TAR) $(TAR_CREATE_FLAGS) - .) | \
michael@0 839 (cd $(DIST)/$(MOZ_APP_NAME)-sdk/lib && tar -xf -)
michael@0 840 $(NSINSTALL) -D $(DIST)/$(SDK_PATH)
michael@0 841 ifndef PKG_SKIP_STRIP
michael@0 842 USE_ELF_HACK= $(PYTHON) $(MOZILLA_DIR)/toolkit/mozapps/installer/strip.py $(DIST)/$(MOZ_APP_NAME)-sdk
michael@0 843 endif
michael@0 844 cd $(DIST) && $(MAKE_SDK)
michael@0 845
michael@0 846 ifeq ($(OS_TARGET), WINNT)
michael@0 847 INSTALLER_PACKAGE = $(DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe
michael@0 848 endif
michael@0 849
michael@0 850 # These are necessary because some of our packages/installers contain spaces
michael@0 851 # in their filenames and GNU Make's $(wildcard) function doesn't properly
michael@0 852 # deal with them.
michael@0 853 empty :=
michael@0 854 space = $(empty) $(empty)
michael@0 855 QUOTED_WILDCARD = $(if $(wildcard $(subst $(space),?,$(1))),'$(1)')
michael@0 856 ESCAPE_SPACE = $(subst $(space),\$(space),$(1))
michael@0 857 ESCAPE_WILDCARD = $(subst $(space),?,$(1))
michael@0 858
michael@0 859 # This variable defines which OpenSSL algorithm to use to
michael@0 860 # generate checksums for files that we upload
michael@0 861 CHECKSUM_ALGORITHM_PARAM = -d sha512 -d md5 -d sha1
michael@0 862
michael@0 863 # This variable defines where the checksum file will be located
michael@0 864 CHECKSUM_FILE = '$(DIST)/$(PKG_PATH)/$(CHECKSUMS_FILE_BASENAME).checksums'
michael@0 865 CHECKSUM_FILES = $(CHECKSUM_FILE)
michael@0 866
michael@0 867 ifeq (WINNT,$(OS_TARGET))
michael@0 868 UPLOAD_EXTRA_FILES += host/bin/mar.exe
michael@0 869 UPLOAD_EXTRA_FILES += host/bin/mbsdiff.exe
michael@0 870 else
michael@0 871 UPLOAD_EXTRA_FILES += host/bin/mar
michael@0 872 UPLOAD_EXTRA_FILES += host/bin/mbsdiff
michael@0 873 endif
michael@0 874
michael@0 875 UPLOAD_FILES= \
michael@0 876 $(call QUOTED_WILDCARD,$(DIST)/$(PACKAGE)) \
michael@0 877 $(call QUOTED_WILDCARD,$(INSTALLER_PACKAGE)) \
michael@0 878 $(call QUOTED_WILDCARD,$(DIST)/$(COMPLETE_MAR)) \
michael@0 879 $(call QUOTED_WILDCARD,$(DIST)/$(LANGPACK)) \
michael@0 880 $(call QUOTED_WILDCARD,$(wildcard $(DIST)/$(PARTIAL_MAR))) \
michael@0 881 $(call QUOTED_WILDCARD,$(DIST)/$(PKG_PATH)$(TEST_PACKAGE)) \
michael@0 882 $(call QUOTED_WILDCARD,$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip) \
michael@0 883 $(call QUOTED_WILDCARD,$(DIST)/$(SDK)) \
michael@0 884 $(call QUOTED_WILDCARD,$(MOZ_SOURCESTAMP_FILE)) \
michael@0 885 $(call QUOTED_WILDCARD,$(MOZ_BUILDINFO_FILE)) \
michael@0 886 $(call QUOTED_WILDCARD,$(PKG_JSSHELL)) \
michael@0 887 $(if $(UPLOAD_EXTRA_FILES), $(foreach f, $(UPLOAD_EXTRA_FILES), $(wildcard $(DIST)/$(f))))
michael@0 888
michael@0 889 ifdef MOZ_CRASHREPORTER_UPLOAD_FULL_SYMBOLS
michael@0 890 UPLOAD_FILES += \
michael@0 891 $(call QUOTED_WILDCARD,$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip)
michael@0 892 endif
michael@0 893
michael@0 894 SIGN_CHECKSUM_CMD=
michael@0 895 ifdef MOZ_SIGN_CMD
michael@0 896 # If we're signing with gpg, we'll have a bunch of extra detached signatures to
michael@0 897 # upload. We also want to sign our checksums file
michael@0 898 SIGN_CHECKSUM_CMD=$(MOZ_SIGN_CMD) -f gpg $(CHECKSUM_FILE)
michael@0 899
michael@0 900 CHECKSUM_FILES += $(CHECKSUM_FILE).asc
michael@0 901 UPLOAD_FILES += $(call QUOTED_WILDCARD,$(DIST)/$(COMPLETE_MAR).asc)
michael@0 902 UPLOAD_FILES += $(call QUOTED_WILDCARD,$(wildcard $(DIST)/$(PARTIAL_MAR).asc))
michael@0 903 UPLOAD_FILES += $(call QUOTED_WILDCARD,$(INSTALLER_PACKAGE).asc)
michael@0 904 UPLOAD_FILES += $(call QUOTED_WILDCARD,$(DIST)/$(PACKAGE).asc)
michael@0 905 endif
michael@0 906
michael@0 907 ifdef MOZ_STUB_INSTALLER
michael@0 908 UPLOAD_FILES += $(call QUOTED_WILDCARD,$(DIST)/$(PKG_INST_PATH)$(PKG_STUB_BASENAME).exe)
michael@0 909 endif
michael@0 910
michael@0 911 checksum:
michael@0 912 mkdir -p `dirname $(CHECKSUM_FILE)`
michael@0 913 @$(PYTHON) $(MOZILLA_DIR)/build/checksums.py \
michael@0 914 -o $(CHECKSUM_FILE) \
michael@0 915 $(CHECKSUM_ALGORITHM_PARAM) \
michael@0 916 -s $(call QUOTED_WILDCARD,$(DIST)) \
michael@0 917 $(UPLOAD_FILES)
michael@0 918 @echo 'CHECKSUM FILE START'
michael@0 919 @cat $(CHECKSUM_FILE)
michael@0 920 @echo 'CHECKSUM FILE END'
michael@0 921 $(SIGN_CHECKSUM_CMD)
michael@0 922
michael@0 923
michael@0 924 upload: checksum
michael@0 925 $(PYTHON) $(MOZILLA_DIR)/build/upload.py --base-path $(DIST) \
michael@0 926 $(UPLOAD_FILES) \
michael@0 927 $(CHECKSUM_FILES)
michael@0 928
michael@0 929 ifndef MOZ_PKG_SRCDIR
michael@0 930 MOZ_PKG_SRCDIR = $(topsrcdir)
michael@0 931 endif
michael@0 932
michael@0 933 DIR_TO_BE_PACKAGED ?= ../$(notdir $(topsrcdir))
michael@0 934 SRC_TAR_EXCLUDE_PATHS += \
michael@0 935 --exclude='.hg*' \
michael@0 936 --exclude='CVS' \
michael@0 937 --exclude='.cvs*' \
michael@0 938 --exclude='.mozconfig*' \
michael@0 939 --exclude='*.pyc' \
michael@0 940 --exclude='$(MOZILLA_DIR)/Makefile' \
michael@0 941 --exclude='$(MOZILLA_DIR)/dist'
michael@0 942 ifdef MOZ_OBJDIR
michael@0 943 SRC_TAR_EXCLUDE_PATHS += --exclude='$(MOZ_OBJDIR)'
michael@0 944 endif
michael@0 945 CREATE_SOURCE_TAR = $(TAR) -c --owner=0 --group=0 --numeric-owner \
michael@0 946 --mode=go-w $(SRC_TAR_EXCLUDE_PATHS) -f
michael@0 947
michael@0 948 SOURCE_TAR = $(DIST)/$(PKG_SRCPACK_PATH)$(PKG_SRCPACK_BASENAME).tar.bz2
michael@0 949 HG_BUNDLE_FILE = $(DIST)/$(PKG_SRCPACK_PATH)$(PKG_BUNDLE_BASENAME).bundle
michael@0 950 SOURCE_CHECKSUM_FILE = $(DIST)/$(PKG_SRCPACK_PATH)$(PKG_SRCPACK_BASENAME).checksums
michael@0 951 SOURCE_UPLOAD_FILES = $(SOURCE_TAR)
michael@0 952
michael@0 953 HG ?= hg
michael@0 954 CREATE_HG_BUNDLE_CMD = $(HG) -v -R $(topsrcdir) bundle --base null
michael@0 955 ifdef HG_BUNDLE_REVISION
michael@0 956 CREATE_HG_BUNDLE_CMD += -r $(HG_BUNDLE_REVISION)
michael@0 957 endif
michael@0 958 CREATE_HG_BUNDLE_CMD += $(HG_BUNDLE_FILE)
michael@0 959 ifdef UPLOAD_HG_BUNDLE
michael@0 960 SOURCE_UPLOAD_FILES += $(HG_BUNDLE_FILE)
michael@0 961 endif
michael@0 962
michael@0 963 ifdef MOZ_SIGN_CMD
michael@0 964 SIGN_SOURCE_TAR_CMD = $(MOZ_SIGN_CMD) -f gpg $(SOURCE_TAR)
michael@0 965 SOURCE_UPLOAD_FILES += $(SOURCE_TAR).asc
michael@0 966 SIGN_HG_BUNDLE_CMD = $(MOZ_SIGN_CMD) -f gpg $(HG_BUNDLE_FILE)
michael@0 967 ifdef UPLOAD_HG_BUNDLE
michael@0 968 SOURCE_UPLOAD_FILES += $(HG_BUNDLE_FILE).asc
michael@0 969 endif
michael@0 970 endif
michael@0 971
michael@0 972 # source-package creates a source tarball from the files in MOZ_PKG_SRCDIR,
michael@0 973 # which is either set to a clean checkout or defaults to $topsrcdir
michael@0 974 source-package:
michael@0 975 @echo 'Packaging source tarball...'
michael@0 976 $(MKDIR) -p $(DIST)/$(PKG_SRCPACK_PATH)
michael@0 977 (cd $(MOZ_PKG_SRCDIR) && $(CREATE_SOURCE_TAR) - $(DIR_TO_BE_PACKAGED)) | bzip2 -vf > $(SOURCE_TAR)
michael@0 978 $(SIGN_SOURCE_TAR_CMD)
michael@0 979
michael@0 980 hg-bundle:
michael@0 981 $(MKDIR) -p $(DIST)/$(PKG_SRCPACK_PATH)
michael@0 982 $(CREATE_HG_BUNDLE_CMD)
michael@0 983 $(SIGN_HG_BUNDLE_CMD)
michael@0 984
michael@0 985 source-upload:
michael@0 986 $(MAKE) upload UPLOAD_FILES='$(SOURCE_UPLOAD_FILES)' CHECKSUM_FILE='$(SOURCE_CHECKSUM_FILE)'

mercurial