toolkit/mozapps/installer/packager.mk

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/mozapps/installer/packager.mk	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,986 @@
     1.4 +# This Source Code Form is subject to the terms of the Mozilla Public
     1.5 +# License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 +# file, You can obtain one at http://mozilla.org/MPL/2.0/.
     1.7 +
     1.8 +include $(MOZILLA_DIR)/toolkit/mozapps/installer/package-name.mk
     1.9 +
    1.10 +# This is how we create the binary packages we release to the public.
    1.11 +
    1.12 +ifndef MOZ_PKG_FORMAT
    1.13 +ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
    1.14 +MOZ_PKG_FORMAT  = DMG
    1.15 +else
    1.16 +ifeq (,$(filter-out WINNT, $(OS_ARCH)))
    1.17 +MOZ_PKG_FORMAT  = ZIP
    1.18 +else
    1.19 +ifeq (,$(filter-out SunOS, $(OS_ARCH)))
    1.20 +   MOZ_PKG_FORMAT  = BZ2
    1.21 +else
    1.22 +   ifeq (,$(filter-out gtk2 gtk3 qt, $(MOZ_WIDGET_TOOLKIT)))
    1.23 +      MOZ_PKG_FORMAT  = BZ2
    1.24 +   else
    1.25 +      ifeq (android,$(MOZ_WIDGET_TOOLKIT))
    1.26 +          MOZ_PKG_FORMAT = APK
    1.27 +      else
    1.28 +          MOZ_PKG_FORMAT = TGZ
    1.29 +      endif
    1.30 +   endif
    1.31 +endif
    1.32 +endif
    1.33 +endif
    1.34 +endif # MOZ_PKG_FORMAT
    1.35 +
    1.36 +ifeq ($(OS_ARCH),WINNT)
    1.37 +INSTALLER_DIR   = windows
    1.38 +endif
    1.39 +
    1.40 +ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
    1.41 +ifndef _APPNAME
    1.42 +_APPNAME = $(MOZ_MACBUNDLE_NAME)
    1.43 +endif
    1.44 +ifndef _BINPATH
    1.45 +_BINPATH = /$(_APPNAME)/Contents/MacOS
    1.46 +endif # _BINPATH
    1.47 +ifdef UNIVERSAL_BINARY
    1.48 +STAGEPATH = universal/
    1.49 +endif
    1.50 +endif
    1.51 +
    1.52 +PACKAGE_BASE_DIR = $(_ABS_DIST)
    1.53 +PACKAGE       = $(PKG_PATH)$(PKG_BASENAME)$(PKG_SUFFIX)
    1.54 +
    1.55 +# By default, the SDK uses the same packaging type as the main bundle,
    1.56 +# but on mac it is a .tar.bz2
    1.57 +SDK_PATH      = $(PKG_PATH)
    1.58 +ifeq ($(MOZ_APP_NAME),xulrunner)
    1.59 +SDK_PATH = sdk/
    1.60 +# Don't codesign xulrunner internally
    1.61 +MOZ_INTERNAL_SIGNING_FORMAT =
    1.62 +endif
    1.63 +SDK_SUFFIX    = $(PKG_SUFFIX)
    1.64 +SDK           = $(SDK_PATH)$(PKG_BASENAME).sdk$(SDK_SUFFIX)
    1.65 +ifdef UNIVERSAL_BINARY
    1.66 +SDK           = $(SDK_PATH)$(PKG_BASENAME)-$(TARGET_CPU).sdk$(SDK_SUFFIX)
    1.67 +endif
    1.68 +
    1.69 +# JavaScript Shell packaging
    1.70 +ifndef LIBXUL_SDK
    1.71 +JSSHELL_BINS  = \
    1.72 +  $(DIST)/bin/js$(BIN_SUFFIX) \
    1.73 +  $(DIST)/bin/$(DLL_PREFIX)mozglue$(DLL_SUFFIX) \
    1.74 +  $(NULL)
    1.75 +ifndef MOZ_NATIVE_NSPR
    1.76 +ifeq ($(_MSC_VER),1400)
    1.77 +JSSHELL_BINS += $(DIST)/bin/Microsoft.VC80.CRT.manifest
    1.78 +JSSHELL_BINS += $(DIST)/bin/msvcr80.dll
    1.79 +JSSHELL_BINS += $(DIST)/bin/msvcp80.dll
    1.80 +endif
    1.81 +ifeq ($(_MSC_VER),1500)
    1.82 +JSSHELL_BINS += $(DIST)/bin/Microsoft.VC90.CRT.manifest
    1.83 +JSSHELL_BINS += $(DIST)/bin/msvcr90.dll
    1.84 +JSSHELL_BINS += $(DIST)/bin/msvcp90.dll
    1.85 +endif
    1.86 +ifeq ($(_MSC_VER),1600)
    1.87 +JSSHELL_BINS += $(DIST)/bin/msvcr100.dll
    1.88 +JSSHELL_BINS += $(DIST)/bin/msvcp100.dll
    1.89 +endif
    1.90 +ifeq ($(_MSC_VER),1700)
    1.91 +JSSHELL_BINS += $(DIST)/bin/msvcr110.dll
    1.92 +JSSHELL_BINS += $(DIST)/bin/msvcp110.dll
    1.93 +endif
    1.94 +ifeq ($(_MSC_VER),1800)
    1.95 +JSSHELL_BINS += $(DIST)/bin/msvcr120.dll
    1.96 +JSSHELL_BINS += $(DIST)/bin/msvcp120.dll
    1.97 +endif
    1.98 +ifdef MOZ_FOLD_LIBS
    1.99 +JSSHELL_BINS += $(DIST)/bin/$(DLL_PREFIX)nss3$(DLL_SUFFIX)
   1.100 +else
   1.101 +JSSHELL_BINS += \
   1.102 +  $(DIST)/bin/$(DLL_PREFIX)nspr4$(DLL_SUFFIX) \
   1.103 +  $(DIST)/bin/$(DLL_PREFIX)plds4$(DLL_SUFFIX) \
   1.104 +  $(DIST)/bin/$(DLL_PREFIX)plc4$(DLL_SUFFIX) \
   1.105 +  $(NULL)
   1.106 +endif # MOZ_FOLD_LIBS
   1.107 +endif # MOZ_NATIVE_NSPR
   1.108 +ifdef MOZ_SHARED_ICU
   1.109 +ifeq ($(OS_TARGET), WINNT)
   1.110 +ifdef MOZ_DEBUG
   1.111 +JSSHELL_BINS += \
   1.112 +  $(DIST)/bin/icudtd$(MOZ_ICU_VERSION).dll \
   1.113 +  $(DIST)/bin/icuind$(MOZ_ICU_VERSION).dll \
   1.114 +  $(DIST)/bin/icuucd$(MOZ_ICU_VERSION).dll \
   1.115 +  $(NULL)
   1.116 +else
   1.117 +JSSHELL_BINS += \
   1.118 +  $(DIST)/bin/icudt$(MOZ_ICU_VERSION).dll \
   1.119 +  $(DIST)/bin/icuin$(MOZ_ICU_VERSION).dll \
   1.120 +  $(DIST)/bin/icuuc$(MOZ_ICU_VERSION).dll \
   1.121 +  $(NULL)
   1.122 +endif # MOZ_DEBUG
   1.123 +else
   1.124 +ifeq ($(OS_TARGET), Darwin)
   1.125 +JSSHELL_BINS += \
   1.126 +  $(DIST)/bin/libicudata.$(MOZ_ICU_VERSION).dylib \
   1.127 +  $(DIST)/bin/libicui18n.$(MOZ_ICU_VERSION).dylib \
   1.128 +  $(DIST)/bin/libicuuc.$(MOZ_ICU_VERSION).dylib \
   1.129 +  $(NULL)
   1.130 +else
   1.131 +JSSHELL_BINS += \
   1.132 +  $(DIST)/bin/libicudata.so.$(MOZ_ICU_VERSION) \
   1.133 +  $(DIST)/bin/libicui18n.so.$(MOZ_ICU_VERSION) \
   1.134 +  $(DIST)/bin/libicuuc.so.$(MOZ_ICU_VERSION) \
   1.135 +  $(NULL)
   1.136 +endif # Darwin
   1.137 +endif # WINNT
   1.138 +endif # MOZ_STATIC_JS
   1.139 +MAKE_JSSHELL  = $(PYTHON) $(topsrcdir)/toolkit/mozapps/installer/dozip.py $(PKG_JSSHELL) $(abspath $(JSSHELL_BINS))
   1.140 +endif # LIBXUL_SDK
   1.141 +
   1.142 +_ABS_DIST = $(abspath $(DIST))
   1.143 +JARLOG_DIR = $(abspath $(DEPTH)/jarlog/)
   1.144 +JARLOG_FILE_AB_CD = $(JARLOG_DIR)/$(AB_CD).log
   1.145 +
   1.146 +TAR_CREATE_FLAGS := --exclude=.mkdir.done $(TAR_CREATE_FLAGS)
   1.147 +CREATE_FINAL_TAR = $(TAR) -c --owner=0 --group=0 --numeric-owner \
   1.148 +  --mode=go-w --exclude=.mkdir.done -f
   1.149 +UNPACK_TAR       = tar -xf-
   1.150 +
   1.151 +ifeq ($(MOZ_PKG_FORMAT),TAR)
   1.152 +PKG_SUFFIX	= .tar
   1.153 +INNER_MAKE_PACKAGE 	= $(CREATE_FINAL_TAR) - $(MOZ_PKG_DIR) > $(PACKAGE)
   1.154 +INNER_UNMAKE_PACKAGE	= $(UNPACK_TAR) < $(UNPACKAGE)
   1.155 +MAKE_SDK = $(CREATE_FINAL_TAR) - $(MOZ_APP_NAME)-sdk > $(SDK)
   1.156 +endif
   1.157 +ifeq ($(MOZ_PKG_FORMAT),TGZ)
   1.158 +PKG_SUFFIX	= .tar.gz
   1.159 +INNER_MAKE_PACKAGE 	= $(CREATE_FINAL_TAR) - $(MOZ_PKG_DIR) | gzip -vf9 > $(PACKAGE)
   1.160 +INNER_UNMAKE_PACKAGE	= gunzip -c $(UNPACKAGE) | $(UNPACK_TAR)
   1.161 +MAKE_SDK = $(CREATE_FINAL_TAR) - $(MOZ_APP_NAME)-sdk | gzip -vf9 > $(SDK)
   1.162 +endif
   1.163 +ifeq ($(MOZ_PKG_FORMAT),BZ2)
   1.164 +PKG_SUFFIX	= .tar.bz2
   1.165 +ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
   1.166 +INNER_MAKE_PACKAGE 	= $(CREATE_FINAL_TAR) - -C $(STAGEPATH)$(MOZ_PKG_DIR) $(_APPNAME) | bzip2 -vf > $(PACKAGE)
   1.167 +else
   1.168 +INNER_MAKE_PACKAGE 	= $(CREATE_FINAL_TAR) - $(MOZ_PKG_DIR) | bzip2 -vf > $(PACKAGE)
   1.169 +endif
   1.170 +INNER_UNMAKE_PACKAGE	= bunzip2 -c $(UNPACKAGE) | $(UNPACK_TAR)
   1.171 +MAKE_SDK = $(CREATE_FINAL_TAR) - $(MOZ_APP_NAME)-sdk | bzip2 -vf > $(SDK)
   1.172 +endif
   1.173 +ifeq ($(MOZ_PKG_FORMAT),ZIP)
   1.174 +ifdef MOZ_EXTERNAL_SIGNING_FORMAT
   1.175 +# We can't use signcode on zip files
   1.176 +MOZ_EXTERNAL_SIGNING_FORMAT := $(filter-out signcode,$(MOZ_EXTERNAL_SIGNING_FORMAT))
   1.177 +endif
   1.178 +PKG_SUFFIX	= .zip
   1.179 +INNER_MAKE_PACKAGE	= $(ZIP) -r9D $(PACKAGE) $(MOZ_PKG_DIR) \
   1.180 +  -x \*/.mkdir.done
   1.181 +INNER_UNMAKE_PACKAGE	= $(UNZIP) $(UNPACKAGE)
   1.182 +MAKE_SDK = $(ZIP) -r9D $(SDK) $(MOZ_APP_NAME)-sdk
   1.183 +endif
   1.184 +ifeq ($(MOZ_PKG_FORMAT),SFX7Z)
   1.185 +PKG_SUFFIX	= .exe
   1.186 +INNER_MAKE_PACKAGE	= rm -f app.7z && \
   1.187 +  mv $(MOZ_PKG_DIR) core && \
   1.188 +  $(CYGWIN_WRAPPER) 7z a -r -t7z app.7z -mx -m0=BCJ2 -m1=LZMA:d25 \
   1.189 +    -m2=LZMA:d19 -m3=LZMA:d19 -mb0:1 -mb0s1:2 -mb0s2:3 && \
   1.190 +  mv core $(MOZ_PKG_DIR) && \
   1.191 +  cat $(SFX_HEADER) app.7z > $(PACKAGE) && \
   1.192 +  chmod 0755 $(PACKAGE)
   1.193 +INNER_UNMAKE_PACKAGE	= $(CYGWIN_WRAPPER) 7z x $(UNPACKAGE) core && \
   1.194 +  mv core $(MOZ_PKG_DIR)
   1.195 +endif
   1.196 +
   1.197 +#Create an RPM file
   1.198 +ifeq ($(MOZ_PKG_FORMAT),RPM)
   1.199 +PKG_SUFFIX  = .rpm
   1.200 +MOZ_NUMERIC_APP_VERSION = $(shell echo $(MOZ_PKG_VERSION) | sed 's/[^0-9.].*//' )
   1.201 +MOZ_RPM_RELEASE = $(shell echo $(MOZ_PKG_VERSION) | sed 's/[0-9.]*//' )
   1.202 +
   1.203 +RPMBUILD_TOPDIR=$(_ABS_DIST)/rpmbuild
   1.204 +RPMBUILD_RPMDIR=$(_ABS_DIST)
   1.205 +RPMBUILD_SRPMDIR=$(_ABS_DIST)
   1.206 +RPMBUILD_SOURCEDIR=$(RPMBUILD_TOPDIR)/SOURCES
   1.207 +RPMBUILD_SPECDIR=$(topsrcdir)/toolkit/mozapps/installer/linux/rpm
   1.208 +RPMBUILD_BUILDDIR=$(_ABS_DIST)/..
   1.209 +
   1.210 +SPEC_FILE = $(RPMBUILD_SPECDIR)/mozilla.spec
   1.211 +RPM_INCIDENTALS=$(topsrcdir)/toolkit/mozapps/installer/linux/rpm
   1.212 +
   1.213 +RPM_CMD = \
   1.214 +  echo Creating RPM && \
   1.215 +  $(PYTHON) -m mozbuild.action.preprocessor \
   1.216 +	-DMOZ_APP_NAME=$(MOZ_APP_NAME) \
   1.217 +	-DMOZ_APP_DISPLAYNAME='$(MOZ_APP_DISPLAYNAME)' \
   1.218 +	$(RPM_INCIDENTALS)/mozilla.desktop \
   1.219 +	-o $(RPMBUILD_SOURCEDIR)/$(MOZ_APP_NAME).desktop && \
   1.220 +  rm -rf $(_ABS_DIST)/$(TARGET_CPU) && \
   1.221 +  $(RPMBUILD) -bb \
   1.222 +  $(SPEC_FILE) \
   1.223 +  --target $(TARGET_CPU) \
   1.224 +  --buildroot $(RPMBUILD_TOPDIR)/BUILDROOT \
   1.225 +  --define 'moz_app_name $(MOZ_APP_NAME)' \
   1.226 +  --define 'moz_app_displayname $(MOZ_APP_DISPLAYNAME)' \
   1.227 +  --define 'moz_app_version $(MOZ_APP_VERSION)' \
   1.228 +  --define 'moz_numeric_app_version $(MOZ_NUMERIC_APP_VERSION)' \
   1.229 +  --define 'moz_rpm_release $(MOZ_RPM_RELEASE)' \
   1.230 +  --define 'buildid $(BUILDID)' \
   1.231 +  --define 'moz_source_repo $(MOZ_SOURCE_REPO)' \
   1.232 +  --define 'moz_source_stamp $(MOZ_SOURCE_STAMP)' \
   1.233 +  --define 'moz_branding_directory $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)' \
   1.234 +  --define '_topdir $(RPMBUILD_TOPDIR)' \
   1.235 +  --define '_rpmdir $(RPMBUILD_RPMDIR)' \
   1.236 +  --define '_sourcedir $(RPMBUILD_SOURCEDIR)' \
   1.237 +  --define '_specdir $(RPMBUILD_SPECDIR)' \
   1.238 +  --define '_srcrpmdir $(RPMBUILD_SRPMDIR)' \
   1.239 +  --define '_builddir $(RPMBUILD_BUILDDIR)' \
   1.240 +  --define '_prefix $(prefix)' \
   1.241 +  --define '_libdir $(libdir)' \
   1.242 +  --define '_bindir $(bindir)' \
   1.243 +  --define '_datadir $(datadir)' \
   1.244 +  --define '_installdir $(installdir)' 
   1.245 +
   1.246 +ifdef ENABLE_TESTS
   1.247 +RPM_CMD += \
   1.248 +  --define 'createtests yes' \
   1.249 +  --define '_testsinstalldir $(shell basename $(installdir))' 
   1.250 +endif 
   1.251 +
   1.252 +ifdef INSTALL_SDK
   1.253 +RPM_CMD += \
   1.254 +  --define 'createdevel yes' \
   1.255 +  --define '_idldir $(idldir)' \
   1.256 +  --define '_sdkdir $(sdkdir)' \
   1.257 +  --define '_includedir $(includedir)' 
   1.258 +endif
   1.259 +
   1.260 +#For each of the main, tests, sdk rpms we want to make sure that
   1.261 +#if they exist that they are in objdir/dist/ and that they get 
   1.262 +#uploaded and that they are beside the other build artifacts
   1.263 +MAIN_RPM= $(MOZ_APP_NAME)-$(MOZ_NUMERIC_APP_VERSION)-$(MOZ_RPM_RELEASE).$(BUILDID).$(TARGET_CPU)$(PKG_SUFFIX)
   1.264 +UPLOAD_EXTRA_FILES += $(MAIN_RPM)
   1.265 +RPM_CMD += && mv $(TARGET_CPU)/$(MAIN_RPM) $(_ABS_DIST)/
   1.266 +
   1.267 +ifdef ENABLE_TESTS
   1.268 +TESTS_RPM=$(MOZ_APP_NAME)-tests-$(MOZ_NUMERIC_APP_VERSION)-$(MOZ_RPM_RELEASE).$(BUILDID).$(TARGET_CPU)$(PKG_SUFFIX)
   1.269 +UPLOAD_EXTRA_FILES += $(TESTS_RPM)
   1.270 +RPM_CMD += && mv $(TARGET_CPU)/$(TESTS_RPM) $(_ABS_DIST)/
   1.271 +endif
   1.272 +
   1.273 +ifdef INSTALL_SDK
   1.274 +SDK_RPM=$(MOZ_APP_NAME)-devel-$(MOZ_NUMERIC_APP_VERSION)-$(MOZ_RPM_RELEASE).$(BUILDID).$(TARGET_CPU)$(PKG_SUFFIX)
   1.275 +UPLOAD_EXTRA_FILES += $(SDK_RPM)
   1.276 +RPM_CMD += && mv $(TARGET_CPU)/$(SDK_RPM) $(_ABS_DIST)/
   1.277 +endif
   1.278 +
   1.279 +INNER_MAKE_PACKAGE = $(RPM_CMD)
   1.280 +#Avoiding rpm repacks, going to try creating/uploading xpi in rpm files instead
   1.281 +INNER_UNMAKE_PACKAGE = $(error Try using rpm2cpio and cpio)
   1.282 +
   1.283 +endif #Create an RPM file
   1.284 +
   1.285 +
   1.286 +ifeq ($(MOZ_PKG_FORMAT),APK)
   1.287 +
   1.288 +JAVA_CLASSPATH = $(ANDROID_SDK)/android.jar
   1.289 +include $(MOZILLA_DIR)/config/android-common.mk
   1.290 +
   1.291 +# DEBUG_JARSIGNER is defined by android-common.mk and always debug
   1.292 +# signs.  We want to release sign if possible.
   1.293 +ifdef MOZ_SIGN_CMD
   1.294 +RELEASE_JARSIGNER := $(MOZ_SIGN_CMD) -f jar
   1.295 +else
   1.296 +RELEASE_JARSIGNER := $(DEBUG_JARSIGNER)
   1.297 +endif
   1.298 +
   1.299 +DIST_FILES =
   1.300 +
   1.301 +# Place the files in the order they are going to be opened by the linker
   1.302 +DIST_FILES += libmozalloc.so
   1.303 +ifndef MOZ_FOLD_LIBS
   1.304 +DIST_FILES += \
   1.305 +  libnspr4.so \
   1.306 +  libplc4.so \
   1.307 +  libplds4.so \
   1.308 +  libmozsqlite3.so \
   1.309 +  libnssutil3.so \
   1.310 +  $(NULL)
   1.311 +endif
   1.312 +DIST_FILES += libnss3.so
   1.313 +ifndef MOZ_FOLD_LIBS
   1.314 +DIST_FILES += \
   1.315 +  libssl3.so \
   1.316 +  libsmime3.so \
   1.317 +  $(NULL)
   1.318 +endif
   1.319 +DIST_FILES += \
   1.320 +  libxul.so \
   1.321 +  libnssckbi.so \
   1.322 +  libfreebl3.so \
   1.323 +  libsoftokn3.so \
   1.324 +  resources.arsc \
   1.325 +  AndroidManifest.xml \
   1.326 +  chrome \
   1.327 +  components \
   1.328 +  defaults \
   1.329 +  modules \
   1.330 +  hyphenation \
   1.331 +  res \
   1.332 +  lib \
   1.333 +  extensions \
   1.334 +  application.ini \
   1.335 +  package-name.txt \
   1.336 +  platform.ini \
   1.337 +  greprefs.js \
   1.338 +  browserconfig.properties \
   1.339 +  blocklist.xml \
   1.340 +  chrome.manifest \
   1.341 +  update.locale \
   1.342 +  removed-files \
   1.343 +  distribution \
   1.344 +  $(NULL)
   1.345 +
   1.346 +NON_DIST_FILES = \
   1.347 +  classes.dex \
   1.348 +  $(NULL)
   1.349 +
   1.350 +UPLOAD_EXTRA_FILES += gecko-unsigned-unaligned.apk
   1.351 +
   1.352 +DIST_FILES += $(MOZ_CHILD_PROCESS_NAME)
   1.353 +
   1.354 +GECKO_APP_AP_PATH = $(abspath $(DEPTH)/mobile/android/base)
   1.355 +
   1.356 +ifdef ENABLE_TESTS
   1.357 +INNER_ROBOCOP_PACKAGE=echo
   1.358 +INNER_BACKGROUND_TESTS_PACKAGE=echo
   1.359 +ifeq ($(MOZ_BUILD_APP),mobile/android)
   1.360 +UPLOAD_EXTRA_FILES += robocop.apk
   1.361 +UPLOAD_EXTRA_FILES += fennec_ids.txt
   1.362 +UPLOAD_EXTRA_FILES += geckoview_library/geckoview_library.zip
   1.363 +UPLOAD_EXTRA_FILES += geckoview_library/geckoview_assets.zip
   1.364 +UPLOAD_EXTRA_FILES += ../embedding/android/geckoview_example/geckoview_example.apk
   1.365 +
   1.366 +# Robocop/Robotium tests, Android Background tests, and Fennec need to
   1.367 +# be signed with the same key, which means release signing them all.
   1.368 +
   1.369 +# $(1) is the full path to input:  foo-debug-unsigned-unaligned.apk.
   1.370 +# $(2) is the full path to output: foo.apk.
   1.371 +RELEASE_SIGN_ANDROID_APK = \
   1.372 +  cp $(1) $(2)-unaligned.apk && \
   1.373 +  $(RELEASE_JARSIGNER) $(2)-unaligned.apk && \
   1.374 +  $(ZIPALIGN) -f -v 4 $(2)-unaligned.apk $(2) && \
   1.375 +  $(RM) $(2)-unaligned.apk
   1.376 +
   1.377 +ROBOCOP_PATH = $(abspath $(_ABS_DIST)/../build/mobile/robocop)
   1.378 +# Normally, $(NSINSTALL) would be used instead of cp, but INNER_ROBOCOP_PACKAGE
   1.379 +# is used in a series of commands that run under a "cd something", while
   1.380 +# $(NSINSTALL) is relative.
   1.381 +INNER_ROBOCOP_PACKAGE= \
   1.382 +  cp $(GECKO_APP_AP_PATH)/fennec_ids.txt $(_ABS_DIST) && \
   1.383 +  $(call RELEASE_SIGN_ANDROID_APK,$(ROBOCOP_PATH)/robocop-debug-unsigned-unaligned.apk,$(_ABS_DIST)/robocop.apk)
   1.384 +
   1.385 +BACKGROUND_TESTS_PATH = $(abspath $(_ABS_DIST)/../mobile/android/tests/background/junit3)
   1.386 +INNER_BACKGROUND_TESTS_PACKAGE= \
   1.387 +  $(call RELEASE_SIGN_ANDROID_APK,$(BACKGROUND_TESTS_PATH)/background-junit3-debug-unsigned-unaligned.apk,$(_ABS_DIST)/background-junit3.apk)
   1.388 +
   1.389 +BROWSER_TESTS_PATH = $(abspath $(_ABS_DIST)/../mobile/android/tests/browser/junit3)
   1.390 +INNER_BROWSER_TESTS_PACKAGE= \
   1.391 +  $(call RELEASE_SIGN_ANDROID_APK,$(BROWSER_TESTS_PATH)/browser-junit3-debug-unsigned-unaligned.apk,$(_ABS_DIST)/browser-junit3.apk)
   1.392 +endif
   1.393 +else
   1.394 +INNER_ROBOCOP_PACKAGE=echo 'Testing is disabled - No Android Robocop for you'
   1.395 +INNER_BACKGROUND_TESTS_PACKAGE=echo 'Testing is disabled - No Android Background JUnit 3 tests for you'
   1.396 +INNER_BROWSER_TESTS_PACKAGE=echo 'Testing is disabled - No Android Browser JUnit 3tests for you'
   1.397 +endif
   1.398 +
   1.399 +# Create geckoview_library/geckoview_{assets,library}.zip for third-party GeckoView consumers.
   1.400 +ifdef NIGHTLY_BUILD
   1.401 +ifndef MOZ_DISABLE_GECKOVIEW
   1.402 +INNER_MAKE_GECKOVIEW_LIBRARY= \
   1.403 +  $(MAKE) -C ../mobile/android/geckoview_library package
   1.404 +INNER_MAKE_GECKOVIEW_EXAMPLE= \
   1.405 +	$(MAKE) -C ../embedding/android/geckoview_example package
   1.406 +else
   1.407 +INNER_MAKE_GECKOVIEW_LIBRARY=echo 'GeckoView library packaging is disabled'
   1.408 +INNER_MAKE_GECKOVIEW_EXAMPLE=echo 'GeckoView example packaging is disabled'
   1.409 +endif
   1.410 +else
   1.411 +INNER_MAKE_GECKOVIEW_LIBRARY=echo 'GeckoView library packaging is only enabled on Nightly'
   1.412 +INNER_MAKE_GECKOVIEW_EXAMPLE=echo 'GeckoView example packaging is only enabled on Nightly'
   1.413 +endif
   1.414 +
   1.415 +ifdef MOZ_OMX_PLUGIN
   1.416 +DIST_FILES += libomxplugin.so libomxplugingb.so libomxplugingb235.so \
   1.417 +              libomxpluginhc.so libomxpluginfroyo.so libomxpluginkk.so
   1.418 +endif
   1.419 +
   1.420 +SO_LIBRARIES := $(filter %.so,$(DIST_FILES))
   1.421 +# These libraries are placed in the assets/ directory by packager.py.
   1.422 +ASSET_SO_LIBRARIES := $(addprefix assets/,$(filter-out libmozglue.so $(MOZ_CHILD_PROCESS_NAME),$(SO_LIBRARIES)))
   1.423 +
   1.424 +DIST_FILES := $(filter-out $(SO_LIBRARIES),$(DIST_FILES))
   1.425 +NON_DIST_FILES += libmozglue.so $(MOZ_CHILD_PROCESS_NAME) $(ASSET_SO_LIBRARIES)
   1.426 +
   1.427 +ifdef MOZ_ENABLE_SZIP
   1.428 +# These libraries are szipped in-place in the assets/ directory.
   1.429 +SZIP_LIBRARIES := $(ASSET_SO_LIBRARIES)
   1.430 +endif
   1.431 +
   1.432 +# Fennec's OMNIJAR_NAME can include a directory; for example, it might
   1.433 +# be "assets/omni.ja". This path specifies where the omni.ja file
   1.434 +# lives in the APK, but should not root the resources it contains
   1.435 +# under assets/ (i.e., resources should not live at chrome://assets/).
   1.436 +# packager.py writes /omni.ja in order to be consistent with the
   1.437 +# layout expected by language repacks. Therefore, we move it to the
   1.438 +# correct path here, in INNER_MAKE_PACKAGE. See comment about
   1.439 +# OMNIJAR_NAME in configure.in.
   1.440 +
   1.441 +# OMNIJAR_DIR is './' for "omni.ja", 'assets/' for "assets/omni.ja".
   1.442 +OMNIJAR_DIR := $(dir $(OMNIJAR_NAME))
   1.443 +OMNIJAR_NAME := $(notdir $(OMNIJAR_NAME))
   1.444 +
   1.445 +# We force build an ap_ that does not check dependencies below.
   1.446 +# Language repacks take advantage of this unchecked dependency ap_ to
   1.447 +# insert additional resources (translated strings) into the ap_
   1.448 +# without the build system's participation.  This can do the wrong
   1.449 +# thing if there are resource changes in between build time and
   1.450 +# package time.  We try to prevent mismatched resources by erroring
   1.451 +# out if the compiled resource IDs are not the same as the resource
   1.452 +# IDs being packaged.  If we're doing a single locale repack, however,
   1.453 +# we don't have a complete object directory, so we can't compare
   1.454 +# resource IDs.
   1.455 +
   1.456 +# A note on the res/ directory.  We unzip the ap_ during packaging,
   1.457 +# which produces the res/ directory.  This directory is then included
   1.458 +# in the final package.  When we unpack (during locale repacks), we
   1.459 +# need to remove the res/ directory because these resources confuse
   1.460 +# the l10n packaging script that updates omni.ja: the script tries to
   1.461 +# localize the contents of the res/ directory, which fails.  Instead,
   1.462 +# after the l10n packaging script completes, we build the ap_
   1.463 +# described above (which includes freshly localized Android resources)
   1.464 +# and the res/ directory is taken from the ap_ as part of the regular
   1.465 +# packaging.
   1.466 +
   1.467 +PKG_SUFFIX      = .apk
   1.468 +INNER_MAKE_PACKAGE	= \
   1.469 +  $(if $(ALREADY_SZIPPED),,$(foreach lib,$(SZIP_LIBRARIES),host/bin/szip $(MOZ_SZIP_FLAGS) $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)/$(lib) && )) \
   1.470 +  make -C $(GECKO_APP_AP_PATH) gecko-nodeps.ap_ && \
   1.471 +  cp $(GECKO_APP_AP_PATH)/gecko-nodeps.ap_ $(_ABS_DIST)/gecko.ap_ && \
   1.472 +  ( (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.") || \
   1.473 +    diff $(GECKO_APP_AP_PATH)/R.txt $(GECKO_APP_AP_PATH)/gecko-nodeps/R.txt >/dev/null || \
   1.474 +    (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)) && \
   1.475 +  ( cd $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH) && \
   1.476 +    mkdir -p lib/$(ANDROID_CPU_ARCH) && \
   1.477 +    mv libmozglue.so $(MOZ_CHILD_PROCESS_NAME) lib/$(ANDROID_CPU_ARCH) && \
   1.478 +    unzip -o $(_ABS_DIST)/gecko.ap_ && \
   1.479 +    rm $(_ABS_DIST)/gecko.ap_ && \
   1.480 +    $(ZIP) $(if $(MOZ_ENABLE_SZIP),-0 )$(_ABS_DIST)/gecko.ap_ $(ASSET_SO_LIBRARIES) && \
   1.481 +    $(ZIP) -r9D $(_ABS_DIST)/gecko.ap_ $(DIST_FILES) -x $(NON_DIST_FILES) $(SZIP_LIBRARIES) && \
   1.482 +    $(if $(filter-out ./,$(OMNIJAR_DIR)), \
   1.483 +      mkdir -p $(OMNIJAR_DIR) && mv $(OMNIJAR_NAME) $(OMNIJAR_DIR) && ) \
   1.484 +    $(ZIP) -0 $(_ABS_DIST)/gecko.ap_ $(OMNIJAR_DIR)$(OMNIJAR_NAME)) && \
   1.485 +  rm -f $(_ABS_DIST)/gecko.apk && \
   1.486 +  cp $(_ABS_DIST)/gecko.ap_ $(_ABS_DIST)/gecko.apk && \
   1.487 +  $(ZIP) -j0 $(_ABS_DIST)/gecko.apk $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)/classes.dex && \
   1.488 +  cp $(_ABS_DIST)/gecko.apk $(_ABS_DIST)/gecko-unsigned-unaligned.apk && \
   1.489 +  $(RELEASE_JARSIGNER) $(_ABS_DIST)/gecko.apk && \
   1.490 +  $(ZIPALIGN) -f -v 4 $(_ABS_DIST)/gecko.apk $(PACKAGE) && \
   1.491 +  $(INNER_ROBOCOP_PACKAGE) && \
   1.492 +  $(INNER_BACKGROUND_TESTS_PACKAGE) && \
   1.493 +  $(INNER_BROWSER_TESTS_PACKAGE) && \
   1.494 +  $(INNER_MAKE_GECKOVIEW_LIBRARY) && \
   1.495 +  $(INNER_MAKE_GECKOVIEW_EXAMPLE)
   1.496 +
   1.497 +# Language repacks root the resources contained in assets/omni.ja
   1.498 +# under assets/, but the repacks expect them to be rooted at /.
   1.499 +# Therefore, we we move the omnijar back to / so the resources are
   1.500 +# under the root here, in INNER_UNMAKE_PACKAGE. See comments about
   1.501 +# OMNIJAR_NAME earlier in this file and in configure.in.
   1.502 +
   1.503 +INNER_UNMAKE_PACKAGE	= \
   1.504 +  mkdir $(MOZ_PKG_DIR) && \
   1.505 +  ( cd $(MOZ_PKG_DIR) && \
   1.506 +    $(UNZIP) $(UNPACKAGE) && \
   1.507 +    mv lib/$(ANDROID_CPU_ARCH)/libmozglue.so . && \
   1.508 +    mv lib/$(ANDROID_CPU_ARCH)/*plugin-container* $(MOZ_CHILD_PROCESS_NAME) && \
   1.509 +    rm -rf lib/$(ANDROID_CPU_ARCH) && \
   1.510 +    rm -rf res \
   1.511 +    $(if $(filter-out ./,$(OMNIJAR_DIR)), \
   1.512 +      && mv $(OMNIJAR_DIR)$(OMNIJAR_NAME) $(OMNIJAR_NAME)) )
   1.513 +endif
   1.514 +
   1.515 +ifeq ($(MOZ_PKG_FORMAT),DMG)
   1.516 +PKG_SUFFIX	= .dmg
   1.517 +PKG_DMG_FLAGS	=
   1.518 +ifneq (,$(MOZ_PKG_MAC_DSSTORE))
   1.519 +PKG_DMG_FLAGS += --copy '$(MOZ_PKG_MAC_DSSTORE):/.DS_Store'
   1.520 +endif
   1.521 +ifneq (,$(MOZ_PKG_MAC_BACKGROUND))
   1.522 +PKG_DMG_FLAGS += --mkdir /.background --copy '$(MOZ_PKG_MAC_BACKGROUND):/.background'
   1.523 +endif
   1.524 +ifneq (,$(MOZ_PKG_MAC_ICON))
   1.525 +PKG_DMG_FLAGS += --icon '$(MOZ_PKG_MAC_ICON)'
   1.526 +endif
   1.527 +ifneq (,$(MOZ_PKG_MAC_RSRC))
   1.528 +PKG_DMG_FLAGS += --resource '$(MOZ_PKG_MAC_RSRC)'
   1.529 +endif
   1.530 +ifneq (,$(MOZ_PKG_MAC_EXTRA))
   1.531 +PKG_DMG_FLAGS += $(MOZ_PKG_MAC_EXTRA)
   1.532 +endif
   1.533 +_ABS_MOZSRCDIR = $(shell cd $(MOZILLA_DIR) && pwd)
   1.534 +ifndef PKG_DMG_SOURCE
   1.535 +PKG_DMG_SOURCE = $(STAGEPATH)$(MOZ_PKG_DIR)
   1.536 +endif
   1.537 +INNER_MAKE_PACKAGE	= $(_ABS_MOZSRCDIR)/build/package/mac_osx/pkg-dmg \
   1.538 +  --source '$(PKG_DMG_SOURCE)' --target '$(PACKAGE)' \
   1.539 +  --volname '$(MOZ_APP_DISPLAYNAME)' $(PKG_DMG_FLAGS)
   1.540 +INNER_UNMAKE_PACKAGE	= \
   1.541 +  set -ex; \
   1.542 +  rm -rf $(_ABS_DIST)/unpack.tmp; \
   1.543 +  mkdir -p $(_ABS_DIST)/unpack.tmp; \
   1.544 +  $(_ABS_MOZSRCDIR)/build/package/mac_osx/unpack-diskimage $(UNPACKAGE) /tmp/$(MOZ_PKG_APPNAME)-unpack $(_ABS_DIST)/unpack.tmp; \
   1.545 +  rsync -a '$(_ABS_DIST)/unpack.tmp/$(_APPNAME)' $(MOZ_PKG_DIR); \
   1.546 +  test -n '$(MOZ_PKG_MAC_DSSTORE)' && \
   1.547 +    rsync -a '$(_ABS_DIST)/unpack.tmp/.DS_Store' '$(MOZ_PKG_MAC_DSSTORE)'; \
   1.548 +  test -n '$(MOZ_PKG_MAC_BACKGROUND)' && \
   1.549 +    rsync -a '$(_ABS_DIST)/unpack.tmp/.background/$(notdir $(MOZ_PKG_MAC_BACKGROUND))' '$(MOZ_PKG_MAC_BACKGROUND)'; \
   1.550 +  test -n '$(MOZ_PKG_MAC_ICON)' && \
   1.551 +    rsync -a '$(_ABS_DIST)/unpack.tmp/.VolumeIcon.icns' '$(MOZ_PKG_MAC_ICON)'; \
   1.552 +  rm -rf $(_ABS_DIST)/unpack.tmp; \
   1.553 +  if test -n '$(MOZ_PKG_MAC_RSRC)' ; then \
   1.554 +    cp $(UNPACKAGE) $(MOZ_PKG_APPNAME).tmp.dmg && \
   1.555 +    hdiutil unflatten $(MOZ_PKG_APPNAME).tmp.dmg && \
   1.556 +    { /Developer/Tools/DeRez -skip plst -skip blkx $(MOZ_PKG_APPNAME).tmp.dmg > '$(MOZ_PKG_MAC_RSRC)' || { rm -f $(MOZ_PKG_APPNAME).tmp.dmg && false; }; } && \
   1.557 +    rm -f $(MOZ_PKG_APPNAME).tmp.dmg; \
   1.558 +  fi
   1.559 +# The plst and blkx resources are skipped because they belong to each
   1.560 +# individual dmg and are created by hdiutil.
   1.561 +SDK_SUFFIX = .tar.bz2
   1.562 +SDK = $(MOZ_PKG_APPNAME)-$(MOZ_PKG_VERSION).$(AB_CD).mac-$(TARGET_CPU).sdk$(SDK_SUFFIX)
   1.563 +ifeq ($(MOZ_APP_NAME),xulrunner)
   1.564 +SDK = $(SDK_PATH)$(MOZ_APP_NAME)-$(MOZ_PKG_VERSION).$(AB_CD).mac-$(TARGET_CPU).sdk$(SDK_SUFFIX)
   1.565 +endif
   1.566 +MAKE_SDK = $(CREATE_FINAL_TAR) - $(MOZ_APP_NAME)-sdk | bzip2 -vf > $(SDK)
   1.567 +endif
   1.568 +
   1.569 +ifdef MOZ_INTERNAL_SIGNING_FORMAT
   1.570 +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))
   1.571 +ifeq (WINNT,$(OS_ARCH))
   1.572 +MOZ_SIGN_PREPARED_PACKAGE_CMD += --nsscmd '$(_ABS_DIST)/bin/shlibsign$(BIN_SUFFIX) -v -i'
   1.573 +endif
   1.574 +endif
   1.575 +
   1.576 +# For final GPG / authenticode signing / dmg signing if required
   1.577 +ifdef MOZ_EXTERNAL_SIGNING_FORMAT
   1.578 +MOZ_SIGN_PACKAGE_CMD=$(MOZ_SIGN_CMD) $(foreach f,$(MOZ_EXTERNAL_SIGNING_FORMAT),-f $(f))
   1.579 +endif
   1.580 +
   1.581 +ifdef MOZ_SIGN_PREPARED_PACKAGE_CMD
   1.582 +ifeq (Darwin, $(OS_ARCH))
   1.583 +MAKE_PACKAGE    = cd ./$(PKG_DMG_SOURCE) && $(MOZ_SIGN_PREPARED_PACKAGE_CMD) $(MOZ_MACBUNDLE_NAME) \
   1.584 +                  && rm $(MOZ_MACBUNDLE_NAME)/Contents/CodeResources \
   1.585 +                  && cp $(MOZ_MACBUNDLE_NAME)/Contents/_CodeSignature/CodeResources $(MOZ_MACBUNDLE_NAME)/Contents \
   1.586 +                  && cd $(PACKAGE_BASE_DIR) \
   1.587 +                  && $(INNER_MAKE_PACKAGE)
   1.588 +else
   1.589 +MAKE_PACKAGE    = $(MOZ_SIGN_PREPARED_PACKAGE_CMD) \
   1.590 +		  $(MOZ_PKG_DIR) && $(INNER_MAKE_PACKAGE)
   1.591 +endif #Darwin
   1.592 +
   1.593 +else
   1.594 +MAKE_PACKAGE    = $(INNER_MAKE_PACKAGE)
   1.595 +endif
   1.596 +
   1.597 +ifdef MOZ_SIGN_PACKAGE_CMD
   1.598 +MAKE_PACKAGE    += && $(MOZ_SIGN_PACKAGE_CMD) '$(PACKAGE)'
   1.599 +endif
   1.600 +
   1.601 +ifdef MOZ_SIGN_CMD
   1.602 +MAKE_SDK           += && $(MOZ_SIGN_CMD) -f gpg $(SDK)
   1.603 +UPLOAD_EXTRA_FILES += $(SDK).asc
   1.604 +endif
   1.605 +
   1.606 +NO_PKG_FILES += \
   1.607 +	core \
   1.608 +	bsdecho \
   1.609 +	js \
   1.610 +	js-config \
   1.611 +	jscpucfg \
   1.612 +	nsinstall \
   1.613 +	viewer \
   1.614 +	TestGtkEmbed \
   1.615 +	elf-dynstr-gc \
   1.616 +	mangle* \
   1.617 +	maptsv* \
   1.618 +	mfc* \
   1.619 +	msdump* \
   1.620 +	msmap* \
   1.621 +	nm2tsv* \
   1.622 +	nsinstall* \
   1.623 +	res/samples \
   1.624 +	res/throbber \
   1.625 +	shlibsign* \
   1.626 +	ssltunnel* \
   1.627 +	certutil* \
   1.628 +	pk12util* \
   1.629 +	BadCertServer* \
   1.630 +	OCSPStaplingServer* \
   1.631 +	GenerateOCSPResponse* \
   1.632 +	winEmbed.exe \
   1.633 +	chrome/chrome.rdf \
   1.634 +	chrome/app-chrome.manifest \
   1.635 +	chrome/overlayinfo \
   1.636 +	components/compreg.dat \
   1.637 +	components/xpti.dat \
   1.638 +	content_unit_tests \
   1.639 +	necko_unit_tests \
   1.640 +	*.dSYM \
   1.641 +	$(NULL)
   1.642 +
   1.643 +# browser/locales/Makefile uses this makefile for its variable defs, but
   1.644 +# doesn't want the libs:: rule.
   1.645 +ifndef PACKAGER_NO_LIBS
   1.646 +libs:: make-package
   1.647 +endif
   1.648 +
   1.649 +DEFINES += -DDLL_PREFIX=$(DLL_PREFIX) -DDLL_SUFFIX=$(DLL_SUFFIX) -DBIN_SUFFIX=$(BIN_SUFFIX)
   1.650 +
   1.651 +ifdef MOZ_FOLD_LIBS
   1.652 +DEFINES += -DMOZ_FOLD_LIBS=1
   1.653 +endif
   1.654 +
   1.655 +GARBAGE		+= $(DIST)/$(PACKAGE) $(PACKAGE)
   1.656 +
   1.657 +# The following target stages files into two directories: one directory for
   1.658 +# core files, and one for optional extensions based on the information in
   1.659 +# the MOZ_PKG_MANIFEST file.
   1.660 +
   1.661 +PKG_ARG = , '$(pkg)'
   1.662 +
   1.663 +installer-stage: prepare-package
   1.664 +ifndef MOZ_PKG_MANIFEST
   1.665 +	$(error MOZ_PKG_MANIFEST unspecified!)
   1.666 +endif
   1.667 +	@rm -rf $(DEPTH)/installer-stage $(DIST)/xpt
   1.668 +	@echo 'Staging installer files...'
   1.669 +	@$(NSINSTALL) -D $(DEPTH)/installer-stage/core
   1.670 +	@cp -av $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)/. $(DEPTH)/installer-stage/core
   1.671 +	@(cd $(DEPTH)/installer-stage/core && $(CREATE_PRECOMPLETE_CMD))
   1.672 +ifdef MOZ_SIGN_PREPARED_PACKAGE_CMD
   1.673 +# The && true is necessary to make sure Pymake spins a shell
   1.674 +	$(MOZ_SIGN_PREPARED_PACKAGE_CMD) $(DEPTH)/installer-stage && true
   1.675 +endif
   1.676 +
   1.677 +ifeq (gonk,$(MOZ_WIDGET_TOOLKIT))
   1.678 +ELF_HACK_FLAGS = --fill
   1.679 +endif
   1.680 +
   1.681 +# MOZ_PKG_MANIFEST is the canonical way to define the package manifest (which
   1.682 +# the packager will preprocess), but for a smooth transition, we derive it
   1.683 +# from the now deprecated MOZ_PKG_MANIFEST_P when MOZ_PKG_MANIFEST is not
   1.684 +# defined.
   1.685 +ifndef MOZ_PKG_MANIFEST
   1.686 +ifdef MOZ_PKG_MANIFEST_P
   1.687 +MOZ_PKG_MANIFEST := $(MOZ_PKG_MANIFEST_P)
   1.688 +endif # MOZ_PKG_MANIFEST_P
   1.689 +endif # MOZ_PKG_MANIFEST
   1.690 +
   1.691 +# For smooth transition of comm-central
   1.692 +ifndef MOZ_PACKAGER_FORMAT
   1.693 +ifeq ($(MOZ_CHROME_FILE_FORMAT),flat)
   1.694 +ifdef MOZ_OMNIJAR
   1.695 +MOZ_PACKAGER_FORMAT := omni
   1.696 +else
   1.697 +MOZ_PACKAGER_FORMAT := flat
   1.698 +endif
   1.699 +endif
   1.700 +endif
   1.701 +ifndef MOZ_PACKAGER_FORMAT
   1.702 +MOZ_PACKAGER_FORMAT = $(error MOZ_PACKAGER_FORMAT is not set)
   1.703 +endif
   1.704 +
   1.705 +ifneq (android,$(MOZ_WIDGET_TOOLKIT))
   1.706 +OPTIMIZEJARS = 1
   1.707 +endif
   1.708 +
   1.709 +export NO_PKG_FILES USE_ELF_HACK ELF_HACK_FLAGS
   1.710 +
   1.711 +# A js binary is needed to perform verification of JavaScript minification.
   1.712 +# We can only use the built binary when not cross-compiling. Environments
   1.713 +# (such as release automation) can provide their own js binary to enable
   1.714 +# verification when cross-compiling.
   1.715 +ifndef JS_BINARY
   1.716 +ifndef CROSS_COMPILE
   1.717 +JS_BINARY = $(wildcard $(DIST)/bin/js)
   1.718 +endif
   1.719 +endif
   1.720 +
   1.721 +# Override the value of OMNIJAR_NAME from config.status with the value
   1.722 +# set earlier in this file.
   1.723 +
   1.724 +stage-package: $(MOZ_PKG_MANIFEST)
   1.725 +	@rm -rf $(DIST)/$(PKG_PATH)$(PKG_BASENAME).tar $(DIST)/$(PKG_PATH)$(PKG_BASENAME).dmg $@ $(EXCLUDE_LIST)
   1.726 +	OMNIJAR_NAME=$(OMNIJAR_NAME) \
   1.727 +	$(PYTHON) $(MOZILLA_DIR)/toolkit/mozapps/installer/packager.py $(DEFINES) \
   1.728 +		--format $(MOZ_PACKAGER_FORMAT) \
   1.729 +		$(addprefix --removals ,$(MOZ_PKG_REMOVALS)) \
   1.730 +		$(if $(filter-out 0,$(MOZ_PKG_FATAL_WARNINGS)),,--ignore-errors) \
   1.731 +		$(if $(MOZ_PACKAGER_MINIFY),--minify) \
   1.732 +		$(if $(MOZ_PACKAGER_MINIFY_JS),--minify-js \
   1.733 +		  $(addprefix --js-binary ,$(JS_BINARY)) \
   1.734 +		) \
   1.735 +		$(if $(JARLOG_DIR),$(addprefix --jarlog ,$(wildcard $(JARLOG_FILE_AB_CD)))) \
   1.736 +		$(if $(OPTIMIZEJARS),--optimizejars) \
   1.737 +		$(addprefix --unify ,$(UNIFY_DIST)) \
   1.738 +		$(MOZ_PKG_MANIFEST) $(DIST) $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)$(if $(MOZ_PKG_MANIFEST),,$(_BINPATH)) \
   1.739 +		$(if $(filter omni,$(MOZ_PACKAGER_FORMAT)),$(if $(NON_OMNIJAR_FILES),--non-resource $(NON_OMNIJAR_FILES)))
   1.740 +	$(PYTHON) $(MOZILLA_DIR)/toolkit/mozapps/installer/find-dupes.py $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)
   1.741 +ifndef LIBXUL_SDK
   1.742 +ifdef MOZ_PACKAGE_JSSHELL
   1.743 +# Package JavaScript Shell
   1.744 +	@echo 'Packaging JavaScript Shell...'
   1.745 +	$(RM) $(PKG_JSSHELL)
   1.746 +	$(MAKE_JSSHELL)
   1.747 +endif # MOZ_PACKAGE_JSSHELL
   1.748 +endif # LIBXUL_SDK
   1.749 +
   1.750 +prepare-package: stage-package
   1.751 +
   1.752 +make-package-internal: prepare-package make-sourcestamp-file make-buildinfo-file
   1.753 +	@echo 'Compressing...'
   1.754 +	cd $(DIST) && $(MAKE_PACKAGE)
   1.755 +
   1.756 +make-package: FORCE
   1.757 +	$(MAKE) make-package-internal
   1.758 +	$(TOUCH) $@
   1.759 +
   1.760 +GARBAGE += make-package
   1.761 +
   1.762 +make-sourcestamp-file::
   1.763 +	$(NSINSTALL) -D $(DIST)/$(PKG_PATH)
   1.764 +	@echo '$(BUILDID)' > $(MOZ_SOURCESTAMP_FILE)
   1.765 +	@echo '$(MOZ_SOURCE_REPO)/rev/$(MOZ_SOURCE_STAMP)' >> $(MOZ_SOURCESTAMP_FILE)
   1.766 +
   1.767 +.PHONY: make-buildinfo-file
   1.768 +make-buildinfo-file:
   1.769 +	$(PYTHON) $(MOZILLA_DIR)/toolkit/mozapps/installer/informulate.py \
   1.770 +		$(MOZ_BUILDINFO_FILE) \
   1.771 +		BUILDID=$(BUILDID) \
   1.772 +		MOZ_SOURCE_REPO=$(MOZ_SOURCE_REPO) \
   1.773 +		MOZ_SOURCE_STAMP=$(MOZ_SOURCE_STAMP) \
   1.774 +		MOZ_PKG_PLATFORM=$(MOZ_PKG_PLATFORM)
   1.775 +
   1.776 +# The install target will install the application to prefix/lib/appname-version
   1.777 +# In addition if INSTALL_SDK is set, it will install the development headers,
   1.778 +# libraries, and IDL files as follows:
   1.779 +# dist/include -> prefix/include/appname-version
   1.780 +# dist/idl -> prefix/share/idl/appname-version
   1.781 +# dist/sdk/lib -> prefix/lib/appname-devel-version/lib
   1.782 +# prefix/lib/appname-devel-version/* symlinks to the above directories
   1.783 +install:: prepare-package
   1.784 +ifeq ($(OS_ARCH),WINNT)
   1.785 +	$(error "make install" is not supported on this platform. Use "make package" instead.)
   1.786 +endif
   1.787 +ifeq (bundle,$(MOZ_FS_LAYOUT))
   1.788 +	$(error "make install" is not supported on this platform. Use "make package" instead.)
   1.789 +endif
   1.790 +	$(NSINSTALL) -D $(DESTDIR)$(installdir)
   1.791 +	(cd $(DIST)/$(MOZ_PKG_DIR) && $(TAR) --exclude=precomplete $(TAR_CREATE_FLAGS) - .) | \
   1.792 +	  (cd $(DESTDIR)$(installdir) && tar -xf -)
   1.793 +	$(NSINSTALL) -D $(DESTDIR)$(bindir)
   1.794 +	$(RM) -f $(DESTDIR)$(bindir)/$(MOZ_APP_NAME)
   1.795 +	ln -s $(installdir)/$(MOZ_APP_NAME) $(DESTDIR)$(bindir)
   1.796 +ifdef INSTALL_SDK # Here comes the hard part
   1.797 +	$(NSINSTALL) -D $(DESTDIR)$(includedir)
   1.798 +	(cd $(DIST)/include && $(TAR) $(TAR_CREATE_FLAGS) - .) | \
   1.799 +	  (cd $(DESTDIR)$(includedir) && tar -xf -)
   1.800 +	$(NSINSTALL) -D $(DESTDIR)$(idldir)
   1.801 +	(cd $(DIST)/idl && $(TAR) $(TAR_CREATE_FLAGS) - .) | \
   1.802 +	  (cd $(DESTDIR)$(idldir) && tar -xf -)
   1.803 +# SDK directory is the libs + a bunch of symlinks
   1.804 +	$(NSINSTALL) -D $(DESTDIR)$(sdkdir)/sdk/lib
   1.805 +	$(NSINSTALL) -D $(DESTDIR)$(sdkdir)/sdk/bin
   1.806 +	if test -f $(DIST)/include/xpcom-config.h; then \
   1.807 +	  $(SYSINSTALL) $(IFLAGS1) $(DIST)/include/xpcom-config.h $(DESTDIR)$(sdkdir); \
   1.808 +	fi
   1.809 +	find $(DIST)/sdk -name '*.pyc' | xargs rm -f
   1.810 +	(cd $(DIST)/sdk/lib && $(TAR) $(TAR_CREATE_FLAGS) - .) | (cd $(DESTDIR)$(sdkdir)/sdk/lib && tar -xf -)
   1.811 +	(cd $(DIST)/sdk/bin && $(TAR) $(TAR_CREATE_FLAGS) - .) | (cd $(DESTDIR)$(sdkdir)/sdk/bin && tar -xf -)
   1.812 +	$(RM) -f $(DESTDIR)$(sdkdir)/lib $(DESTDIR)$(sdkdir)/bin $(DESTDIR)$(sdkdir)/include $(DESTDIR)$(sdkdir)/include $(DESTDIR)$(sdkdir)/sdk/idl $(DESTDIR)$(sdkdir)/idl
   1.813 +	ln -s $(sdkdir)/sdk/lib $(DESTDIR)$(sdkdir)/lib
   1.814 +	ln -s $(installdir) $(DESTDIR)$(sdkdir)/bin
   1.815 +	ln -s $(includedir) $(DESTDIR)$(sdkdir)/include
   1.816 +	ln -s $(idldir) $(DESTDIR)$(sdkdir)/idl
   1.817 +endif # INSTALL_SDK
   1.818 +
   1.819 +make-sdk:
   1.820 +	$(MAKE) stage-package UNIVERSAL_BINARY= STAGE_SDK=1 MOZ_PKG_DIR=sdk-stage
   1.821 +	@echo 'Packaging SDK...'
   1.822 +	$(RM) -rf $(DIST)/$(MOZ_APP_NAME)-sdk
   1.823 +	$(NSINSTALL) -D $(DIST)/$(MOZ_APP_NAME)-sdk/bin
   1.824 +	(cd $(DIST)/sdk-stage && $(TAR) $(TAR_CREATE_FLAGS) - .) | \
   1.825 +	  (cd $(DIST)/$(MOZ_APP_NAME)-sdk/bin && tar -xf -)
   1.826 +	$(NSINSTALL) -D $(DIST)/$(MOZ_APP_NAME)-sdk/host/bin
   1.827 +	(cd $(DIST)/host/bin && $(TAR) $(TAR_CREATE_FLAGS) - .) | \
   1.828 +	  (cd $(DIST)/$(MOZ_APP_NAME)-sdk/host/bin && tar -xf -)
   1.829 +	$(NSINSTALL) -D $(DIST)/$(MOZ_APP_NAME)-sdk/sdk
   1.830 +	find $(DIST)/sdk -name '*.pyc' | xargs rm -f
   1.831 +	(cd $(DIST)/sdk && $(TAR) $(TAR_CREATE_FLAGS) - .) | \
   1.832 +	  (cd $(DIST)/$(MOZ_APP_NAME)-sdk/sdk && tar -xf -)
   1.833 +	$(NSINSTALL) -D $(DIST)/$(MOZ_APP_NAME)-sdk/include
   1.834 +	(cd $(DIST)/include && $(TAR) $(TAR_CREATE_FLAGS) - .) | \
   1.835 +	  (cd $(DIST)/$(MOZ_APP_NAME)-sdk/include && tar -xf -)
   1.836 +	$(NSINSTALL) -D $(DIST)/$(MOZ_APP_NAME)-sdk/idl
   1.837 +	(cd $(DIST)/idl && $(TAR) $(TAR_CREATE_FLAGS) - .) | \
   1.838 +	  (cd $(DIST)/$(MOZ_APP_NAME)-sdk/idl && tar -xf -)
   1.839 +	$(NSINSTALL) -D $(DIST)/$(MOZ_APP_NAME)-sdk/lib
   1.840 +# sdk/lib is the same as sdk/sdk/lib
   1.841 +	(cd $(DIST)/sdk/lib && $(TAR) $(TAR_CREATE_FLAGS) - .) | \
   1.842 +	  (cd $(DIST)/$(MOZ_APP_NAME)-sdk/lib && tar -xf -)
   1.843 +	$(NSINSTALL) -D $(DIST)/$(SDK_PATH)
   1.844 +ifndef PKG_SKIP_STRIP
   1.845 +	USE_ELF_HACK= $(PYTHON) $(MOZILLA_DIR)/toolkit/mozapps/installer/strip.py $(DIST)/$(MOZ_APP_NAME)-sdk
   1.846 +endif
   1.847 +	cd $(DIST) && $(MAKE_SDK)
   1.848 +
   1.849 +ifeq ($(OS_TARGET), WINNT)
   1.850 +INSTALLER_PACKAGE = $(DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe
   1.851 +endif
   1.852 +
   1.853 +# These are necessary because some of our packages/installers contain spaces
   1.854 +# in their filenames and GNU Make's $(wildcard) function doesn't properly
   1.855 +# deal with them.
   1.856 +empty :=
   1.857 +space = $(empty) $(empty)
   1.858 +QUOTED_WILDCARD = $(if $(wildcard $(subst $(space),?,$(1))),'$(1)')
   1.859 +ESCAPE_SPACE = $(subst $(space),\$(space),$(1))
   1.860 +ESCAPE_WILDCARD = $(subst $(space),?,$(1))
   1.861 +
   1.862 +# This variable defines which OpenSSL algorithm to use to 
   1.863 +# generate checksums for files that we upload
   1.864 +CHECKSUM_ALGORITHM_PARAM = -d sha512 -d md5 -d sha1
   1.865 +
   1.866 +# This variable defines where the checksum file will be located
   1.867 +CHECKSUM_FILE = '$(DIST)/$(PKG_PATH)/$(CHECKSUMS_FILE_BASENAME).checksums'
   1.868 +CHECKSUM_FILES = $(CHECKSUM_FILE)
   1.869 +
   1.870 +ifeq (WINNT,$(OS_TARGET))
   1.871 +UPLOAD_EXTRA_FILES += host/bin/mar.exe
   1.872 +UPLOAD_EXTRA_FILES += host/bin/mbsdiff.exe
   1.873 +else
   1.874 +UPLOAD_EXTRA_FILES += host/bin/mar
   1.875 +UPLOAD_EXTRA_FILES += host/bin/mbsdiff
   1.876 +endif
   1.877 +
   1.878 +UPLOAD_FILES= \
   1.879 +  $(call QUOTED_WILDCARD,$(DIST)/$(PACKAGE)) \
   1.880 +  $(call QUOTED_WILDCARD,$(INSTALLER_PACKAGE)) \
   1.881 +  $(call QUOTED_WILDCARD,$(DIST)/$(COMPLETE_MAR)) \
   1.882 +  $(call QUOTED_WILDCARD,$(DIST)/$(LANGPACK)) \
   1.883 +  $(call QUOTED_WILDCARD,$(wildcard $(DIST)/$(PARTIAL_MAR))) \
   1.884 +  $(call QUOTED_WILDCARD,$(DIST)/$(PKG_PATH)$(TEST_PACKAGE)) \
   1.885 +  $(call QUOTED_WILDCARD,$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip) \
   1.886 +  $(call QUOTED_WILDCARD,$(DIST)/$(SDK)) \
   1.887 +  $(call QUOTED_WILDCARD,$(MOZ_SOURCESTAMP_FILE)) \
   1.888 +  $(call QUOTED_WILDCARD,$(MOZ_BUILDINFO_FILE)) \
   1.889 +  $(call QUOTED_WILDCARD,$(PKG_JSSHELL)) \
   1.890 +  $(if $(UPLOAD_EXTRA_FILES), $(foreach f, $(UPLOAD_EXTRA_FILES), $(wildcard $(DIST)/$(f))))
   1.891 +
   1.892 +ifdef MOZ_CRASHREPORTER_UPLOAD_FULL_SYMBOLS
   1.893 +UPLOAD_FILES += \
   1.894 +  $(call QUOTED_WILDCARD,$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip)
   1.895 +endif
   1.896 +
   1.897 +SIGN_CHECKSUM_CMD=
   1.898 +ifdef MOZ_SIGN_CMD
   1.899 +# If we're signing with gpg, we'll have a bunch of extra detached signatures to
   1.900 +# upload. We also want to sign our checksums file
   1.901 +SIGN_CHECKSUM_CMD=$(MOZ_SIGN_CMD) -f gpg $(CHECKSUM_FILE)
   1.902 +
   1.903 +CHECKSUM_FILES += $(CHECKSUM_FILE).asc
   1.904 +UPLOAD_FILES += $(call QUOTED_WILDCARD,$(DIST)/$(COMPLETE_MAR).asc)
   1.905 +UPLOAD_FILES += $(call QUOTED_WILDCARD,$(wildcard $(DIST)/$(PARTIAL_MAR).asc))
   1.906 +UPLOAD_FILES += $(call QUOTED_WILDCARD,$(INSTALLER_PACKAGE).asc)
   1.907 +UPLOAD_FILES += $(call QUOTED_WILDCARD,$(DIST)/$(PACKAGE).asc)
   1.908 +endif
   1.909 +
   1.910 +ifdef MOZ_STUB_INSTALLER
   1.911 +UPLOAD_FILES += $(call QUOTED_WILDCARD,$(DIST)/$(PKG_INST_PATH)$(PKG_STUB_BASENAME).exe)
   1.912 +endif
   1.913 +
   1.914 +checksum:
   1.915 +	mkdir -p `dirname $(CHECKSUM_FILE)`
   1.916 +	@$(PYTHON) $(MOZILLA_DIR)/build/checksums.py \
   1.917 +		-o $(CHECKSUM_FILE) \
   1.918 +		$(CHECKSUM_ALGORITHM_PARAM) \
   1.919 +		-s $(call QUOTED_WILDCARD,$(DIST)) \
   1.920 +		$(UPLOAD_FILES)
   1.921 +	@echo 'CHECKSUM FILE START'
   1.922 +	@cat $(CHECKSUM_FILE)
   1.923 +	@echo 'CHECKSUM FILE END'
   1.924 +	$(SIGN_CHECKSUM_CMD)
   1.925 +
   1.926 +
   1.927 +upload: checksum
   1.928 +	$(PYTHON) $(MOZILLA_DIR)/build/upload.py --base-path $(DIST) \
   1.929 +		$(UPLOAD_FILES) \
   1.930 +		$(CHECKSUM_FILES)
   1.931 +
   1.932 +ifndef MOZ_PKG_SRCDIR
   1.933 +MOZ_PKG_SRCDIR = $(topsrcdir)
   1.934 +endif
   1.935 +
   1.936 +DIR_TO_BE_PACKAGED ?= ../$(notdir $(topsrcdir))
   1.937 +SRC_TAR_EXCLUDE_PATHS += \
   1.938 +  --exclude='.hg*' \
   1.939 +  --exclude='CVS' \
   1.940 +  --exclude='.cvs*' \
   1.941 +  --exclude='.mozconfig*' \
   1.942 +  --exclude='*.pyc' \
   1.943 +  --exclude='$(MOZILLA_DIR)/Makefile' \
   1.944 +  --exclude='$(MOZILLA_DIR)/dist'
   1.945 +ifdef MOZ_OBJDIR
   1.946 +SRC_TAR_EXCLUDE_PATHS += --exclude='$(MOZ_OBJDIR)'
   1.947 +endif
   1.948 +CREATE_SOURCE_TAR = $(TAR) -c --owner=0 --group=0 --numeric-owner \
   1.949 +  --mode=go-w $(SRC_TAR_EXCLUDE_PATHS) -f
   1.950 +
   1.951 +SOURCE_TAR = $(DIST)/$(PKG_SRCPACK_PATH)$(PKG_SRCPACK_BASENAME).tar.bz2
   1.952 +HG_BUNDLE_FILE = $(DIST)/$(PKG_SRCPACK_PATH)$(PKG_BUNDLE_BASENAME).bundle
   1.953 +SOURCE_CHECKSUM_FILE = $(DIST)/$(PKG_SRCPACK_PATH)$(PKG_SRCPACK_BASENAME).checksums
   1.954 +SOURCE_UPLOAD_FILES = $(SOURCE_TAR)
   1.955 +
   1.956 +HG ?= hg
   1.957 +CREATE_HG_BUNDLE_CMD  = $(HG) -v -R $(topsrcdir) bundle --base null
   1.958 +ifdef HG_BUNDLE_REVISION
   1.959 +CREATE_HG_BUNDLE_CMD += -r $(HG_BUNDLE_REVISION)
   1.960 +endif
   1.961 +CREATE_HG_BUNDLE_CMD += $(HG_BUNDLE_FILE)
   1.962 +ifdef UPLOAD_HG_BUNDLE
   1.963 +SOURCE_UPLOAD_FILES  += $(HG_BUNDLE_FILE)
   1.964 +endif
   1.965 +
   1.966 +ifdef MOZ_SIGN_CMD
   1.967 +SIGN_SOURCE_TAR_CMD  = $(MOZ_SIGN_CMD) -f gpg $(SOURCE_TAR)
   1.968 +SOURCE_UPLOAD_FILES += $(SOURCE_TAR).asc
   1.969 +SIGN_HG_BUNDLE_CMD   = $(MOZ_SIGN_CMD) -f gpg $(HG_BUNDLE_FILE)
   1.970 +ifdef UPLOAD_HG_BUNDLE
   1.971 +SOURCE_UPLOAD_FILES += $(HG_BUNDLE_FILE).asc
   1.972 +endif
   1.973 +endif
   1.974 +
   1.975 +# source-package creates a source tarball from the files in MOZ_PKG_SRCDIR,
   1.976 +# which is either set to a clean checkout or defaults to $topsrcdir
   1.977 +source-package:
   1.978 +	@echo 'Packaging source tarball...'
   1.979 +	$(MKDIR) -p $(DIST)/$(PKG_SRCPACK_PATH)
   1.980 +	(cd $(MOZ_PKG_SRCDIR) && $(CREATE_SOURCE_TAR) - $(DIR_TO_BE_PACKAGED)) | bzip2 -vf > $(SOURCE_TAR)
   1.981 +	$(SIGN_SOURCE_TAR_CMD)
   1.982 +
   1.983 +hg-bundle:
   1.984 +	$(MKDIR) -p $(DIST)/$(PKG_SRCPACK_PATH)
   1.985 +	$(CREATE_HG_BUNDLE_CMD)
   1.986 +	$(SIGN_HG_BUNDLE_CMD)
   1.987 +
   1.988 +source-upload:
   1.989 +	$(MAKE) upload UPLOAD_FILES='$(SOURCE_UPLOAD_FILES)' CHECKSUM_FILE='$(SOURCE_CHECKSUM_FILE)'

mercurial