From c346f00658348fbb57716708ce8c326a15a22887 Mon Sep 17 00:00:00 2001 From: Fedor Date: Thu, 26 Nov 2020 05:41:52 +0200 Subject: [PATCH] Move chrome packaging options to ac configure. --- build/moz.configure/old.configure | 3 + config/config.mk | 2 +- config/tests/src-simple/Makefile.in | 2 +- old-configure.in | 95 +++++++++++++++++++ .../mozbuild/test/backend/test_build.py | 4 +- toolkit/moz.configure | 37 -------- 6 files changed, 102 insertions(+), 41 deletions(-) diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configure index d47431f0a..38ef7fee8 100644 --- a/build/moz.configure/old.configure +++ b/build/moz.configure/old.configure @@ -161,6 +161,8 @@ def old_configure_options(*options): '--enable-b2g-camera', '--enable-b2g-ril', '--enable-bundled-fonts', + '--enable-chrome-compression', + '--enable-chrome-format', '--enable-clang-plugin', '--enable-content-sandbox', '--enable-cookies', @@ -263,6 +265,7 @@ def old_configure_options(*options): '--with-app-name', '--with-arch', '--with-branding', + '--with-chrome-name', '--with-crashreporter-enable-percent', '--with-cross-lib', '--with-debug-label', diff --git a/config/config.mk b/config/config.mk index 5a352e529..6208d124e 100644 --- a/config/config.mk +++ b/config/config.mk @@ -216,7 +216,7 @@ endif # NO_PROFILE_GUIDED_OPTIMIZE MAKE_JARS_FLAGS = \ -t $(topsrcdir) \ - -f $(MOZ_JAR_MAKER_FILE_FORMAT) \ + -f $(MOZ_CHROME_FILE_FORMAT) \ $(NULL) ifdef USE_EXTENSION_MANIFEST diff --git a/config/tests/src-simple/Makefile.in b/config/tests/src-simple/Makefile.in index 55fdfd867..96f9a4154 100644 --- a/config/tests/src-simple/Makefile.in +++ b/config/tests/src-simple/Makefile.in @@ -22,7 +22,7 @@ REF_MANIFEST = $(if $(USE_EXTENSION_MANIFEST),chrome.manifest,test.manifest) check-%:: if test -d $(FINAL_TARGET); then rm -rf $(FINAL_TARGET); fi; - $(MAKE) realchrome MOZ_JAR_MAKER_FILE_FORMAT=$* + $(MAKE) realchrome MOZ_CHROME_FILE_FORMAT=$* @echo 'Comparing manifests...' @if ! sort $(MY_MANIFEST) | diff --text -U 0 $(srcdir)/../$(REF_MANIFEST).$* - ; then \ echo 'TEST-UNEXPECTED-FAIL | config/tests/$(REF_MANIFEST).$* | differing content in manifest!' ; \ diff --git a/old-configure.in b/old-configure.in index fd86939b9..64c9fac17 100644 --- a/old-configure.in +++ b/old-configure.in @@ -4313,6 +4313,101 @@ dnl = dnl ======================================================== MOZ_ARG_HEADER(Misc. Options) +dnl ========================================================= +dnl = Chrome format +dnl ========================================================= +MOZ_ARG_ENABLE_STRING([chrome-format], +[ --enable-chrome-format=jar|flat|omni + Select FORMAT of chrome files during packaging], + MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`) + +if test -z "$MOZ_CHROME_FILE_FORMAT"; then + MOZ_CHROME_FILE_FORMAT=omni +fi + +if test "$MOZ_CHROME_FILE_FORMAT" = "symlink"; then + AC_MSG_ERROR([--enable-chrome-format=symlink has been deprecated. It is now used by default in $DIST/bin on platforms that support it]) +fi + +if test "$MOZ_CHROME_FILE_FORMAT" != "jar" && + test "$MOZ_CHROME_FILE_FORMAT" != "flat" && + test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then + AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, or omni]) +fi + +dnl ========================================================= +dnl = Chrome compression +dnl ========================================================= +MOZ_ARG_ENABLE_STRING([chrome-compression], +[ --enable-chrome-compression=none|deflate|brotli + Select COMPRESSION type of chrome files during packaging], + JAR_COMPRESSION=`echo $enableval | tr A-Z a-z`) + +if test -z "$JAR_COMPRESSION"; then + JAR_COMPRESSION=deflate +fi + +if test "$JAR_COMPRESSION" != "none" && + test "$JAR_COMPRESSION" != "deflate" && + test "$JAR_COMPRESSION" != "brotli"; then + AC_MSG_ERROR([--enable-chrome-compression must be set to either none, deflate, or brotli]) +fi + +dnl ========================================================= +dnl Omnijar packaging (bug 552121) +dnl ========================================================= +dnl Omnijar packaging is compatible with flat packaging. +dnl In unpackaged builds, omnijar looks for files as if +dnl things were flat packaged. After packaging, all files +dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT +dnl is set to flat since putting files into jars is only +dnl done during packaging with omnijar. +if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then + MOZ_OMNIJAR=1 + AC_DEFINE(MOZ_OMNIJAR) +fi + +# Allow someone to change OMNIJAR_NAME in mozconfig +MOZ_ARG_WITH_STRING(chrome-name, +[ --with-chrome-name=CHROMENAME + Set chrome jar name (default=omni.ja)], +[ val=`echo $withval` + OMNIJAR_NAME="$val"]) + +# Default Omni Jar Name +if test -z "$OMNIJAR_NAME" ; then + OMNIJAR_NAME=omni.ja +fi + +# Fennec's static resources live in the assets/ folder of the +# APK. Adding a path to the name here works because we only +# have one omnijar file in the final package (which is not the +# case on desktop), and necessitates some contortions during +# packaging so that the resources in the omnijar are considered +# as rooted at / and not as rooted at assets/ (which again is +# not the case on desktop: there are omnijars rooted at webrtc/, +# etc). packager.mk handles changing the rooting of the single +# omnijar. + +case "$target" in +*-android*|*-linuxandroid*) + OMNIJAR_NAME="assets/$OMNIJAR_NAME" + ;; +esac + +MOZ_PACKAGER_FORMAT="$MOZ_CHROME_FILE_FORMAT" +if test "$OS_ARCH" = "WINNT"; then + MOZ_CHROME_FILE_FORMAT=flat +else + MOZ_CHROME_FILE_FORMAT=symlink +fi + +AC_SUBST(JAR_COMPRESSION) +AC_SUBST(OMNIJAR_NAME) +AC_SUBST(MOZ_OMNIJAR) +AC_SUBST(MOZ_PACKAGER_FORMAT) +AC_SUBST(MOZ_CHROME_FILE_FORMAT) + dnl ======================================================== dnl = Disable Jetpack dnl ======================================================== diff --git a/python/mozbuild/mozbuild/test/backend/test_build.py b/python/mozbuild/mozbuild/test/backend/test_build.py index d3f5fb6a9..d6111d85f 100644 --- a/python/mozbuild/mozbuild/test/backend/test_build.py +++ b/python/mozbuild/mozbuild/test/backend/test_build.py @@ -84,7 +84,7 @@ class TestBuild(unittest.TestCase): config.topobjdir) overrides = [ 'install_manifest_depends=', - 'MOZ_JAR_MAKER_FILE_FORMAT=flat', + 'MOZ_CHROME_FILE_FORMAT=flat', 'TEST_MOZBUILD=1', ] with self.line_handler() as handle_make_line: @@ -108,7 +108,7 @@ class TestBuild(unittest.TestCase): config.topobjdir) overrides = [ 'install_manifest_depends=', - 'MOZ_JAR_MAKER_FILE_FORMAT=flat', + 'MOZ_CHROME_FILE_FORMAT=flat', 'TEST_MOZBUILD=1', ] with self.line_handler() as handle_make_line: diff --git a/toolkit/moz.configure b/toolkit/moz.configure index f1e33c674..b6d6269a5 100644 --- a/toolkit/moz.configure +++ b/toolkit/moz.configure @@ -372,43 +372,6 @@ add_old_configure_assignment('MOZ_FMP4', fmp4) # Miscellaneous # ============================================================== -option(name='--enable-chrome-format', - help='Select FORMAT of chrome files during packaging.', - nargs=1, - choices=('omni', 'jar', 'flat'), - default='omni') - -@depends('--enable-chrome-format') -def packager_format(value): - return value[0] - -set_config('MOZ_PACKAGER_FORMAT', packager_format) - -@depends(host, build_project) -def jar_maker_format(host, build_project): - # Multilocales for mobile/android use the same mergedirs for all locales, - # so we can't use symlinks for those builds. - if host.os == 'WINNT' or build_project == 'mobile/android': - return 'flat' - return 'symlink' - -set_config('MOZ_JAR_MAKER_FILE_FORMAT', jar_maker_format) - -@depends(toolkit) -def omnijar_name(toolkit): - # Fennec's static resources live in the assets/ folder of the - # APK. Adding a path to the name here works because we only - # have one omnijar file in the final package (which is not the - # case on desktop), and necessitates some contortions during - # packaging so that the resources in the omnijar are considered - # as rooted at / and not as rooted at assets/ (which again is - # not the case on desktop: there are omnijars rooted at webrtc/, - # etc). packager.mk handles changing the rooting of the single - # omnijar. - return 'assets/omni.ja' if toolkit == 'android' else 'omni.ja' - -set_config('OMNIJAR_NAME', omnijar_name) - project_flag('MOZ_ANDROID_HISTORY', help='Enable Android History instead of Places', set_as_define=True)