mail/moz.configure
author Rob Lemley <rob@thunderbird.net>
Thu, 02 Sep 2021 06:23:00 -0400
changeset 33596 59bfc8893d6c51f280c99c7b3adbfa65993732a4
parent 32908 d0f8efdda8e58c674b07b7b994352bb658e0f53f
child 33625 56c3c3a87360237414e838ea8fe8547d597e0ff0
permissions -rw-r--r--
No bug - temporarily disable daily build. rs=rjl DONTBUILD

# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# 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)

imply_option("MOZ_APP_BASENAME", "Thunderbird")
set_config("MOZ_APPUPDATE_HOST", "aus.thunderbird.net")
imply_option("MOZ_CRASHREPORTER_URL", "https://crash-reports.thunderbird.net/")

imply_option("--enable-default-browser-agent", False)


@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_SERVICES_HEALTHREPORT", True)
imply_option("MOZ_DEDICATED_PROFILES", True)
imply_option("MOZ_BLOCK_PROFILE_DOWNGRADE", True)

with only_when(target_is_linux & compile_environment):
    option(env="MOZ_NO_PIE_COMPAT", help="Enable non-PIE wrapper")

    set_config("MOZ_NO_PIE_COMPAT", depends_if("MOZ_NO_PIE_COMPAT")(lambda _: True))


@depends("MOZ_AUTOMATION")
@imports(_from="os", _import="environ")
@imports(_from="six", _import="ensure_text")
def pkg_libotr(automation):
    if automation:
        fetch_dir = environ.get("MOZ_FETCHES_DIR", None)
        if fetch_dir:
            log.info("Including libotr from {}".format(fetch_dir))
            return ensure_text(fetch_dir)

        log.info("TB_LIBOTR_PREBUILT is set, but MOZ_FETCHES_DIR is invalid.")


set_config("TB_LIBOTR_PREBUILT", pkg_libotr)


set_config(
    "MOZ_TELEMETRY_EXTRA_HISTOGRAM_FILES",
    ["/comm/mail/components/telemetry/Histograms.json"],
)
set_config(
    "MOZ_TELEMETRY_EXTRA_SCALAR_FILES", ["/comm/mail/components/telemetry/Scalars.yaml"]
)
set_config(
    "MOZ_TELEMETRY_EXTRA_EVENT_FILES", ["/comm/mail/components/telemetry/Events.yaml"]
)

include("../build/moz.configure/gecko_source.configure")

include("../mailnews/moz.configure")

imply_option("--enable-app-system-headers", True)
include("../../toolkit/moz.configure")