Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/C/Firefox/build/moz.configure/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 3 kB image not shown  

Quelle  clang_plugin.configure   Sprache: unbekannt

 
Spracherkennung für: .configure vermutete Sprache: Unknown {[0] [0] [0]} [Methode: Schwerpunktbildung, einfache Gewichte, sechs Dimensionen]

# -*- Mode: python; 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/.


@depends(host_library_name_info, build_environment, when="--enable-clang-plugin")
def clang_plugin_path(library_name_info, build_env):
    topobjdir = build_env.topobjdir
    if topobjdir.endswith("/js/src"):
        topobjdir = topobjdir[:-7]
    return os.path.abspath(
        os.path.join(
            topobjdir,
            "build",
            "clang-plugin",
            "%sclang-plugin%s"
            % (library_name_info.dll.prefix, library_name_info.dll.suffix),
        )
    )


set_config("CLANG_PLUGIN", clang_plugin_path)

option(
    "--enable-clang-plugin-alpha",
    env="ENABLE_CLANG_PLUGIN_ALPHA",
    help="Enable static analysis with clang-plugin alpha checks",
    when="--enable-clang-plugin",
)


set_config("ENABLE_CLANG_PLUGIN_ALPHA", True, when="--enable-clang-plugin-alpha")
set_define("MOZ_CLANG_PLUGIN_ALPHA", True, when="--enable-clang-plugin-alpha")


option(
    "--enable-mozsearch-plugin",
    env="ENABLE_MOZSEARCH_PLUGIN",
    help="Enable building with the mozsearch indexer plugin",
    when="--enable-clang-plugin",
)


set_config("ENABLE_MOZSEARCH_PLUGIN", True, when="--enable-mozsearch-plugin")


@depends(
    clang_plugin_path,
    host,
    llvm_config,
    "--enable-mozsearch-plugin",
    build_environment,
    when="--enable-clang-plugin",
)
def clang_plugin_flags(
    clang_plugin,
    host,
    llvm_config,
    enable_mozsearch_plugin,
    build_environment,
):
    llvm_cxxflags = check_cmd_output(llvm_config, "--cxxflags").split()
    llvm_ldflags = check_cmd_output(llvm_config, "--ldflags").replace("\n", " ").split()

    if host.kernel == "WINNT":
        # Replace any backslashes from paths with forward slash.
        llvm_cxxflags = [arg.replace("\\", "/") for arg in llvm_cxxflags]
        llvm_ldflags = [arg.replace("\\", "/") for arg in llvm_ldflags]

    clang_plugin_flags = [
        "-Xclang",
        "-load",
        "-Xclang",
        clang_plugin,
        "-Xclang",
        "-add-plugin",
        "-Xclang",
        "moz-check",
    ]

    if enable_mozsearch_plugin:
        clang_plugin_flags.extend(
            ["-Xclang", "-add-plugin", "-Xclang", "mozsearch-index"]
        )
        # Parameters are: srcdir, outdir (path where output JSON is stored), objdir.
        parameters = [
            build_environment.topsrcdir,
            os.path.join(build_environment.topobjdir, "mozsearch_index"),
            build_environment.topobjdir,
        ]
        for parameter in parameters:
            clang_plugin_flags.extend(
                ["-Xclang", "-plugin-arg-mozsearch-index", "-Xclang", parameter]
            )

    return namespace(
        plugin_flags=clang_plugin_flags,
        llvm_cxxflags=llvm_cxxflags,
        llvm_ldflags=llvm_ldflags,
    )


set_config(
    "CLANG_PLUGIN_FLAGS",
    depends(clang_plugin_flags)(lambda plugin: plugin.plugin_flags if plugin else []),
)
set_config(
    "LLVM_CXXFLAGS",
    depends(clang_plugin_flags)(lambda plugin: plugin.llvm_cxxflags if plugin else []),
)
set_config(
    "LLVM_LDFLAGS",
    depends(clang_plugin_flags)(lambda plugin: plugin.llvm_ldflags if plugin else []),
)

[ Dauer der Verarbeitung: 0.37 Sekunden  ]