view third_party/cef/cef_repository.bzl @ 282:6bd4a3990696 default tip

Add cross-platform canvas orchestration and typed composer Enable native ARM dependencies, macOS Copilot orchestration, portable service supervision, CPU dictation, and a shared N-key speak-or-type composer. Co-authored-by: Copilot <[email protected]> Copilot-Session: f68442b1-fa8f-46a0-9689-81710613bbd4
author MrJuneJune <me@mrjunejune.com>
date Thu, 20 Aug 2026 20:45:25 -0700
parents b55c22cff335
children
line wrap: on
line source

def _cef_repository_impl(repository_ctx):
    os_name = repository_ctx.os.name.lower()
    arch = repository_ctx.os.arch.lower()

    if "windows" in os_name:
        if arch in ["aarch64", "arm64"]:
            platform = "windowsarm64"
            sha256 = "2bac35bcbaa555bcd99ef1a3bf4baf71e7c50e379a281e21e2fc39f41c6008b4"
        else:
            platform = "windows64"
            sha256 = "47b08dfc9587e3c96fc2e51c1f15c07c85d2f28002eaf3c478941a0949be4da2"
    elif "mac" in os_name:
        if arch in ["aarch64", "arm64"]:
            platform = "macosarm64"
            sha256 = "70c8b97c4dead81b67a8fb29b80da12681e008d4ae9a9778f59e5a2f2adc4e08"
        else:
            platform = "macosx64"
            sha256 = "7ab55b3e45d7a89088d498a5fb6b231c3d3bd17fc1a3eb2aee6c8875f7bd842d"
    elif "linux" in os_name and arch in ["amd64", "x86_64"]:
        platform = "linux64"
        sha256 = "554c2c107a4ca8d555273c0c0d0c1efdfbbb5a2d9ba3a2387dbdf3b622bdb24c"
    else:
        fail("CEF is not configured for host %s/%s" % (os_name, arch))

    version = "151.3.18+gbeff58d+chromium-151.0.7922.138"
    archive = "cef_binary_%s_%s_minimal.tar.bz2" % (version, platform)
    repository_ctx.download_and_extract(
        url = "https://cef-builds.spotifycdn.com/%s" % archive.replace("+", "%2B"),
        sha256 = sha256,
        stripPrefix = archive[:-8],
    )

    build = repository_ctx.read("BUILD.bazel")
    build = build.replace(
        'srcs = glob(\n        [\n            "libcef_dll/**/*.mm",\n        ]\n    ),',
        'srcs = glob(\n        [\n            "libcef_dll/**/*.mm",\n        ],\n        allow_empty = True,\n    ),',
    )
    build = build.replace(
        '"//conditions:default": "@cef//:resources_dbg",',
        '"//conditions:default": "@cef//:resources_opt",',
    )
    build = build.replace(
        '"//conditions:default": "@cef//:sos_opt",',
        '"//conditions:default": "@cef//:sos_opt",',
    )
    repository_ctx.file("BUILD.bazel", build)

    linux_variables = repository_ctx.read("bazel/linux/variables.bzl")
    linux_variables = linux_variables.replace(
        "COMMON_COPTS = [\n]",
        'COMMON_COPTS = [\n    "-std=c++20",\n]',
    )
    repository_ctx.file("bazel/linux/variables.bzl", linux_variables)

    windows_variables = repository_ctx.read("bazel/win/variables.bzl")
    windows_variables = windows_variables.replace(
        'COMMON_COPTS = [\n    "/GF",',
        'COMMON_COPTS = [\n    "/std:c++20",\n    "/GF",',
    )
    repository_ctx.file("bazel/win/variables.bzl", windows_variables)

cef_repository = repository_rule(
    implementation = _cef_repository_impl,
)