# 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:
    run:
        using: debian-package
        dist: jessie

deb12-mercurial:
    description: "Modern Mercurial for Debian bookworm"
    treeherder:
        symbol: Deb12(hg)
    run:
        using: debian-package
        dist: bookworm
        tarball:
            url: https://www.mercurial-scm.org/release/mercurial-6.4.3.tar.gz
            sha256: a77fb62d325934a83a00b2fc6db109f44c67b86768fc40490366f513640c7f64
        pre-build-command: >-
            cp -r contrib/packaging/debian debian &&
            sed -i -e "s/__VERSION__/$(awk -F\" '$2 {print $2}' mercurial/__version__.py)-1.deb12moz1/" \
                         -e "s/__DATE__/$(date --rfc-2822)/" \
                         -e "s/__CODENAME__/bookworm/" debian/changelog

deb12-valgrind:
    description: "Valgrind for Debian bookworm"
    treeherder:
        symbol: Deb12(valgrind)
    run:
        dist: bookworm
        dsc:
            url: http://snapshot.debian.org/archive/debian/20230111T213757Z/pool/main/v/valgrind/valgrind_3.20.0-1.dsc
            sha256: e32d373bf2d4f0bd0e9673c711d0e4a8eed43c22ca81714ae3e2d85b2f315493
        patch: valgrind.diff

deb12-python-zstandard:
    description: "python-zstandard for Debian bookworm"
    treeherder:
        symbol: Deb12(python-zstandard)
    run:
        using: debian-package
        dist: bookworm
        tarball:
            url: https://files.pythonhosted.org/packages/ed/f6/2ac0287b442160a89d726b17a9184a4c615bb5237db763791a7fd16d9df1/zstandard-0.23.0.tar.gz
            sha256: b2d8c62d08e7255f68f7a740bae85b3c9b8e5466baa9cbf7f57f1cde0ac6bc09
        pre-build-command: debchange -v 0.23.0-1.deb12moz --distribution testing "Mozilla backport for bookworm"
        name: python-zstandard

deb8-gcc-8:
    description: "gcc 8 for Debian jessie"
    treeherder:
        symbol: Deb8(gcc-8)
    worker:
        max-run-time: 3600
        env:
            DEB_BUILD_OPTIONS: nocheck
            WITH_BOOTSTRAP: 'off'
            WITHOUT_LANG: ada brig cilkrts fortran d go objc obj-c++ asan lsan tsan ubsan jit nvptx
    run:
        using: debian-package
        dist: jessie
        dsc:
            url: http://snapshot.debian.org/archive/debian/20210202T150504Z/pool/main/g/gcc-8/gcc-8_8.4.0-7.dsc
            sha256: b93f13bc67f5a8f16e837fbb543d00d3475d5c95777a1b0b5a448fa2310a98c5
        # autoconf2.64 and quilt necessary to run the `debian/rules control` command to
        # generate an updated debian/control.
        # uncommenting `with_common_libs` makes the packaging create the libstdc++6 package.
        # `libstdcxx_abi = new` overrides the default that disables the new ABI on jessie
        # `BINUTILSBDV=2.25-3~` and `ISL_BUILD_DEP=libisl-dev,` override wrong versions
        # in build dependencies for jessie.
        # `OFFLOAD_BUILD_DEP=` overrides the dependency on nvptx, which is not available
        # in jessie.
        # `NT=` overrides the use of `:native` which is not supported by dpkg on jessie.
        pre-build-command: >-
            apt install autoconf2.64 quilt &&
            sed -i 's/#with_common_libs/with_common_libs/' debian/rules.defs &&
            echo libstdcxx_abi = new >> debian/rules.defs &&
            echo BINUTILSBDV=2.25-3~ >> debian/rules.conf &&
            echo ISL_BUILD_DEP=libisl-dev, >> debian/rules.conf &&
            echo OFFLOAD_BUILD_DEP= >> debian/rules.conf &&
            debian/rules control NT=

deb8-32-gcc-8:
    description: "gcc 8 for Debian jessie"
    treeherder:
        symbol: Deb8-32(gcc-8)
    worker:
        max-run-time: 3600
        env:
            DEB_BUILD_OPTIONS: nocheck
            WITH_BOOTSTRAP: 'off'
            WITHOUT_LANG: ada biarch brig cilkrts fortran d go objc obj-c++ asan lsan tsan ubsan jit nvptx
    run:
        using: debian-package
        dist: jessie
        dsc:
            url: http://snapshot.debian.org/archive/debian/20210202T150504Z/pool/main/g/gcc-8/gcc-8_8.4.0-7.dsc
            sha256: b93f13bc67f5a8f16e837fbb543d00d3475d5c95777a1b0b5a448fa2310a98c5
        pre-build-command: >-
            apt install autoconf2.64 quilt &&
            sed -i 's/#with_common_libs/with_common_libs/' debian/rules.defs &&
            echo libstdcxx_abi = new >> debian/rules.defs &&
            echo GCC_MULTILIB_BUILD_DEP='$(DPKG_BUILD_DEP)' >> debian/rules.conf &&
            echo BINUTILSBDV=2.25-3~ >> debian/rules.conf &&
            echo ISL_BUILD_DEP=libisl-dev, >> debian/rules.conf &&
            echo OFFLOAD_BUILD_DEP= >> debian/rules.conf &&
            debian/rules control NT=
        arch: i386

deb8-gtk3:
    description: "X11-only gtk+3 for Debian jessie"
    treeherder:
        symbol: Deb8(gtk)
    worker:
        max-run-time: 3600
        env:
            DEB_BUILD_OPTIONS: nocheck
    run:
        dist: jessie
        dsc:
            url: http://snapshot.debian.org/archive/debian/20150819T212910Z/pool/main/g/gtk+3.0/gtk+3.0_3.14.5-1+deb8u1.dsc
            sha256: b1808b03317b171c813e31185a4520df4dbde54580842a72a4c44540cd6bde17
        pre-build-command: >-
            sed -i /linux-any/d debian/control* debian/libgtk-3-0.symbols &&
            sed -i s/--enable-wayland-backend/--disable-wayland-backend/ debian/rules &&
            debchange -v 3.14.5-1.deb8moz --distribution jessie-backports "Mozilla rebuild without wayland support"
