Bug 1490867 - replace configure.in with moz.configure. r=philipp
authorRob Lemley <rob@thunderbird.net>
Wed, 10 Oct 2018 18:36:41 +0000
changeset 33406 0a30492067741f0f6f458f165b570b0be4b72001
parent 33405 c818d0a484d571351c9e21fb67a06bff37d4cb85
child 33407 2506123465df5501cec105ead8607b241d1f4cbd
push id387
push userclokep@gmail.com
push dateMon, 10 Dec 2018 21:30:47 +0000
reviewersphilipp
bugs1490867, 1490765
Bug 1490867 - replace configure.in with moz.configure. r=philipp This removes Thunderbird's reliance on being a subconfigure. This was necessary after the completion of Bug 1490765. Updated per :Fallen. Keep the moztopsrcdir, commtopsrcdir and related variables. This saves a lot of editing, and makes the patch far less intrusive. - Move remaining mail/configure.in pieces to moz.configure - Move moz* and comm* variables from confvars.sh to moz.configure - Remove configure.in Differential Revision: https://phabricator.services.mozilla.com/D7629
mail/configure.in
mail/confvars.sh
mail/moz.configure
deleted file mode 100644
--- a/mail/configure.in
+++ /dev/null
@@ -1,16 +0,0 @@
-dnl -*- Mode: Autoconf; tab-width: 2; indent-tabs-mode: nil; -*-
-dnl vi: set tabstop=2 shiftwidth=2 expandtab:
-dnl This Source Code Form is subject to the terms of the Mozilla Public
-dnl License, v. 2.0. If a copy of the MPL was not distributed with this
-dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-dnl Things we need to carry from confvars.sh
-AC_SUBST(THUNDERBIRD_VERSION)
-AC_SUBST(MOZ_BUNDLED_FONTS)
-
-dnl More things we need to carry from confvars.sh
-AC_SUBST(moztopsrcdir)
-AC_SUBST(commtopsrcdir)
-AC_SUBST(mozreltopsrcdir)
-AC_SUBST(commreltopsrcdir)
-AC_SUBST(commtopobjdir)
--- a/mail/confvars.sh
+++ b/mail/confvars.sh
@@ -1,40 +1,25 @@
 #! /bin/sh
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-export moztopsrcdir=${srcdir}
-export commtopsrcdir=${srcdir}/comm
-export mozreltopsrcdir=.
-export commreltopsrcdir=comm
-export commtopobjdir=${_objdir}/comm
-tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1
-m4 "${srcdir}/build/autoconf/subconfigure.m4" \
-   "${srcdir}/build/autoconf/altoptions.m4" \
-   "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
-. $tmpscript
-rm -f $tmpscript
-
 MOZ_APP_BASENAME=Thunderbird
 MOZ_APP_NAME=thunderbird
 MOZ_UPDATER=1
 
 if test "$OS_ARCH" = "WINNT"; then
   if ! test "$HAVE_64BIT_BUILD"; then
     MOZ_VERIFY_MAR_SIGNATURE=1
   fi
 fi
 
-MOZ_APP_VERSION_TXT=${_topsrcdir}/$MOZ_BUILD_APP/config/version.txt
-MOZ_APP_VERSION=`cat $MOZ_APP_VERSION_TXT`
-MOZ_APP_VERSION_DISPLAY_TXT=${_topsrcdir}/$MOZ_BUILD_APP/config/version_display.txt
-MOZ_APP_VERSION_DISPLAY=`cat $MOZ_APP_VERSION_DISPLAY_TXT`
-THUNDERBIRD_VERSION=$MOZ_APP_VERSION
+MOZ_APP_VERSION=$THUNDERBIRD_VERSION
+MOZ_APP_VERSION_DISPLAY=$THUNDERBIRD_VERSION_DISPLAY
 
 BROWSER_CHROME_URL=chrome://messenger/content/messengercompose/messengercompose.xul
 
 MOZ_BRANDING_DIRECTORY=$commreltopsrcdir/mail/branding/nightly
 MOZ_OFFICIAL_BRANDING_DIRECTORY=$commreltopsrcdir/mail/branding/thunderbird
 
 MOZ_APP_ID={3550f703-e582-4d05-9a08-453d09bdfdc6}
 # This should usually be the same as the value MAR_CHANNEL_ID.
--- a/mail/moz.configure
+++ b/mail/moz.configure
@@ -2,34 +2,77 @@
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 set_config('MOZ_THUNDERBIRD', True)
 set_define('MOZ_THUNDERBIRD', True)
 
+@depends(target_is_windows, target_is_linux)
+def bundled_fonts(is_windows, is_linux):
+    if is_windows or is_linux:
+        return True
+
+set_config('MOZ_BUNDLED_FONTS', bundled_fonts)
+add_old_configure_assignment('MOZ_BUNDLED_FONTS', bundled_fonts)
+
+@depends(check_build_environment, '--help')
+def comm_paths(build_env, _):
+    topsrcdir = build_env.topsrcdir
+    topobjdir = build_env.topobjdir
+
+    moztopsrcdir=topsrcdir
+    commtopsrcdir='%s/comm' % topsrcdir
+    mozreltopsrcdir='.'
+    commreltopsrcdir='comm'
+    commtopobjdir='%s/comm' % topobjdir
+
+    return namespace(moztopsrcdir=moztopsrcdir,
+                     commtopsrcdir=commtopsrcdir,
+                     mozreltopsrcdir=mozreltopsrcdir,
+                     commreltopsrcdir=commreltopsrcdir,
+                     commtopobjdir=commtopobjdir)
+
+@template
+def set_defconf(k,v):
+    set_config(k,v)
+    set_define(k,v)
+    add_old_configure_assignment(k,v)
+
+set_defconf('moztopsrcdir', comm_paths.moztopsrcdir)
+set_defconf('commtopsrcdir', comm_paths.commtopsrcdir)
+set_defconf('mozreltopsrcdir', comm_paths.mozreltopsrcdir)
+set_defconf('commreltopsrcdir', comm_paths.commreltopsrcdir)
+set_defconf('commtopobjdir', comm_paths.commtopobjdir)
+
+
+@depends(check_build_environment, application)
+@imports(_from='os.path', _import='exists')
+@imports(_from='__builtin__', _import='open')
+def thunderbird_version(build_env, app_path):
+    version_file = os.path.join(build_env.topsrcdir, app_path[0],
+                                'config', 'version.txt')
+    version_file_display = os.path.join(build_env.topsrcdir, app_path[0],
+                                'config', 'version_display.txt')
+    rv = []
+    for f in [ version_file, version_file_display ]:
+        if exists(f):
+            f_value = open(f).read().strip()
+        else:
+            f_value = 'unknown'
+        rv.append(f_value)
+
+    return namespace(version=rv[0],
+                     version_display=rv[1])
+
+set_defconf('THUNDERBIRD_VERSION', thunderbird_version.version)
+set_defconf('THUNDERBIRD_VERSION_DISPLAY', thunderbird_version.version_display)
+
 set_define('MOZ_SEPARATE_MANIFEST_FOR_THEME_OVERRIDES', True)
 
 imply_option('MOZ_PLACES', True)
 imply_option('MOZ_ALLOW_LEGACY_EXTENSIONS', True)
 imply_option('MOZ_DEDICATED_PROFILES', True)
 imply_option('MOZ_BLOCK_PROFILE_DOWNGRADE', True)
 
-
-@depends(application)
-def is_comm_topdir(app):
-    return not app[0].startswith('comm/')
-
-
-set_config('MOZ_IS_COMM_TOPDIR', is_comm_topdir)
-
-
-@depends(is_comm_topdir)
-def toolkit_configure(is_comm_topdir):
-    if is_comm_topdir:
-        return '../mozilla/toolkit/moz.configure'
-    else:
-        return '../../toolkit/moz.configure'
-
-
 include('../mailnews/moz.configure')
-include(toolkit_configure)
+include('../../toolkit/moz.configure')