# 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.8.1.tar.gz
            sha256: 030e8a7a6d590e4eaeb403ee25675615cd80d236f3ab8a0b56dcc84181158b05
        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-gcc-10:
    description: "gcc 10 for Debian jessie"
    treeherder:
        symbol: Deb8(gcc-10)
    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: https://snapshot.debian.org/archive/debian/20240328T144713Z/pool/main/g/gcc-10/gcc-10_10.5.0-4.dsc
            sha256: 4fd04f9b3c06959f5f9ccf8f0f17ce1ea3e78f49eab4b2fb59ec823949ffa91f
        # autoconf and quilt necessary to run the `debian/rules control` command to
        # generate an updated debian/control.
        # removing the libzstd-dev build dependency that doesn't exist in jessie.
        # uncommenting `with_common_libs` makes the packaging create the libstdc++6 package.
        # `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.
        # autoconf2.69 is available in jessie, but as autoconf, not autoconf2.69.
        # we relax the libc6 requirements to be compatible with jessie.
        # the removal of debhelper/generated lines from debian/rules2 works around
        # an issue that arises from triggers not being generated for the libgcc-s1 package
        # for some reason, and it's simpler to just not care about the triggers than
        # figuring out why, as we only really care about the package contents, and the
        # triggers are irrelevant.
        # `NT=` overrides the use of `:native` which is not supported by dpkg on jessie.
        # biarchx32archs= removes x32 build dependencies that don't exist in jessie.
        # the lib32gcc-s1 build dependency is removed as it's missing in jessie.
        pre-build-command: >-
            apt install autoconf quilt &&
            sed -i 's/libzstd-dev,//' debian/control.m4 &&
            sed -i 's/#with_common_libs/with_common_libs/' 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 &&
            sed -i 's/autoconf_version = 2.69/autoconf_version =/' debian/rules.conf debian/rules.patch &&
            sed -i 's/libc_ver := 2.23/libc_ver := 2.19/' debian/rules.conf &&
            sed -i 's/libc_dev_ver := 2.30-1~/libc_dev_ver := 2.19/' debian/rules.conf &&
            sed -i '/debhelper\/generated/d' debian/rules2 &&
            debian/rules control NT= biarchx32archs= &&
            sed -i 's/lib32gcc-s1 \[[^,]*, //' debian/control

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"
