# 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/.
---
task-defaults:
    worker-type: b-linux-gcp
    worker:
        max-run-time: 1800
    run:
        using: toolchain-script
        script: build-sysroot.sh
        toolchain-artifact: public/build/sysroot.tar.zst

sysroot-i686-linux-gnu:
    description: "Sysroot for linux32 builds"
    attributes:
        local-toolchain: true
    worker:
        env:
            PACKAGES_TASKS: {task-reference: '<gcc-8>'}
            GCC_VERSION: '8'
    treeherder:
        symbol: TL32(sysroot)
    dependencies:
        gcc-8: packages-deb8-32-gcc-8
    run:
        toolchain-artifact: public/build/sysroot-i686-linux-gnu.tar.zst
        arguments:
            - i386

sysroot-x86_64-linux-gnu:
    description: "Sysroot for linux64 builds"
    attributes:
        local-toolchain: true
    worker:
        env:
            PACKAGES_TASKS: {task-reference: '<gcc-8>'}
            GCC_VERSION: '8'
    treeherder:
        symbol: TL(sysroot)
    dependencies:
        gcc-8: packages-deb8-gcc-8
    run:
        toolchain-artifact: public/build/sysroot-x86_64-linux-gnu.tar.zst
        arguments:
            - amd64

sysroot-x86_64-linux-gnu-x11:
    description: "Sysroot for linux64 builds (X11-only)"
    attributes:
        local-toolchain: true
    worker:
        env:
            PACKAGES_TASKS: {task-reference: '<gcc-8> <gtk3>'}
            GCC_VERSION: '8'
    treeherder:
        symbol: TL(sysroot-x11)
    dependencies:
        gcc-8: packages-deb8-gcc-8
        gtk3: packages-deb8-gtk3
    run:
        toolchain-artifact: public/build/sysroot-x86_64-linux-gnu.tar.zst
        arguments:
            - amd64

sysroot-wasm32-wasi-clang-8.0:
    description: "Sysroot for wasi"
    attributes:
        local-toolchain: true
    treeherder:
        symbol: TL(sysroot-wasi-8)
    run:
        script: build-sysroot-wasi.sh
        toolchain-artifact: public/build/sysroot-wasm32-wasi.tar.zst
    fetches:
        fetch:
            - clang-8.0
            - wasi-sdk-11
        toolchain:
            - linux64-clang-8.0
            - wasm32-wasi-compiler-rt-8.0

sysroot-wasm32-wasi-clang-19:
    description: "Sysroot for wasi"
    attributes:
        local-toolchain: true
    treeherder:
        symbol: TL(sysroot-wasi-19)
    run:
        script: build-sysroot-wasi.sh
        arguments:
            - wasi-sdk.patch
        resources:
            - taskcluster/scripts/misc/wasi-sdk.patch
        toolchain-alias:
            by-project:
                toolchains: null
                default: sysroot-wasm32-wasi
        toolchain-artifact: public/build/sysroot-wasm32-wasi.tar.zst
    fetches:
        fetch:
            - clang-19
            - wasi-sdk
        toolchain:
            - linux64-clang-19-stage1
            - wasm32-wasi-compiler-rt-19

sysroot-wasm32-wasi-clang-20:
    description: "Sysroot for wasi"
    attributes:
        local-toolchain: true
    treeherder:
        symbol: TL(sysroot-wasi-20)
    run:
        script: build-sysroot-wasi.sh
        arguments:
            - wasi-sdk.patch
        resources:
            - taskcluster/scripts/misc/wasi-sdk.patch
        toolchain-artifact: public/build/sysroot-wasm32-wasi.tar.zst
    fetches:
        fetch:
            - clang-20
            - wasi-sdk
        toolchain:
            - linux64-clang-20-stage1
            - wasm32-wasi-compiler-rt-20

sysroot-wasm32-wasi-clang-trunk:
    description: "Sysroot for wasi"
    attributes:
        cached_task: false
    treeherder:
        symbol: TL(sysroot-wasi-trunk)
    run:
        script: build-sysroot-wasi.sh
        arguments:
            - wasi-sdk.patch
        resources:
            - taskcluster/scripts/misc/wasi-sdk.patch
        toolchain-alias:
            by-project:
                toolchains: sysroot-wasm32-wasi
                default: null
        toolchain-artifact: public/build/sysroot-wasm32-wasi.tar.zst
    fetches:
        fetch:
            - clang-trunk
            - wasi-sdk
        toolchain:
            - linux64-clang-trunk-stage1
            - wasm32-wasi-compiler-rt-trunk

sysroot-aarch64-linux-gnu:
    description: "Sysroot for linux64 aarch64 builds"
    attributes:
        local-toolchain: true
    treeherder:
        symbol: TLA64(sysroot)
    run:
        toolchain-artifact: public/build/sysroot-aarch64-linux-gnu.tar.zst
        arguments:
            - arm64

linux32-toolchain-sysroot:
    description: "Sysroot for linux32 toolchain builds"
    worker:
        env:
            PACKAGES_TASKS: {task-reference: '<gcc-8>'}
            GCC_VERSION: '8'
    treeherder:
        symbol: TL32(sysroot-toolchain)
    dependencies:
        gcc-8: packages-deb8-32-gcc-8
    run:
        arguments:
            - i386
            # For clang
            - binutils-dev
            - libxml2-dev
            # For minidump-stackwalk
            - libcurl4-openssl-dev
            - libssl-dev
            - libbz2-dev
            # For msix-package
            - libicu-dev

linux64-toolchain-sysroot:
    description: "Sysroot for linux64 toolchain builds"
    worker:
        env:
            PACKAGES_TASKS: {task-reference: '<gcc-8>'}
            GCC_VERSION: '8'
    treeherder:
        symbol: TL(sysroot-toolchain)
    dependencies:
        gcc-8: packages-deb8-gcc-8
    run:
        arguments:
            - amd64
            # For clang
            - binutils-dev
            - gcc-multilib
            - lib32stdc++-8-dev
            - libxml2-dev
            # For minidump-stackwalk
            - libcurl4-openssl-dev
            - libssl-dev
            - libbz2-dev
            # For msix-package
            - libicu-dev
            # For libdmg-hfsplus
            - liblzma-dev

linux64-toolchain-sysroot-gcc10:
    description: "Sysroot for linux64 toolchain builds"
    worker:
        env:
            PACKAGES_TASKS: {task-reference: '<gcc-10>'}
            GCC_VERSION: '10'
    treeherder:
        symbol: TL(sysroot-toolchain-gcc10)
    dependencies:
        gcc-10: packages-deb8-gcc-10
    run:
        arguments:
            - amd64
            # For clang
            - binutils-dev
            - gcc-multilib
            - lib32stdc++-10-dev
            - libxml2-dev
            # For minidump-stackwalk
            - libcurl4-openssl-dev
            - libssl-dev
            - libbz2-dev
            # For msix-package
            - libicu-dev
            # For libdmg-hfsplus
            - liblzma-dev

linux64-aarch64-toolchain-sysroot:
    description: "Sysroot for aarch64 linux64 toolchain builds"
    treeherder:
        symbol: TLA64(sysroot-toolchain)
    run:
        arguments:
            - arm64
            # For clang
            - binutils-dev
            - libxml2-dev
