diff --git a/.ci/bindist/linux/debian/README.md b/.ci/bindist/linux/debian/README.md deleted file mode 100644 index a25f3392d1..0000000000 --- a/.ci/bindist/linux/debian/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Create Debian packages - -``` -./go.sh focal -``` - -All packages should be in `focal/build`. diff --git a/.ci/bindist/linux/debian/focal/Dockerfile b/.ci/bindist/linux/debian/focal/Dockerfile deleted file mode 100644 index a714761b18..0000000000 --- a/.ci/bindist/linux/debian/focal/Dockerfile +++ /dev/null @@ -1,56 +0,0 @@ -FROM ubuntu:focal - -ENV DEBIAN_FRONTEND=noninteractive LANG=C.UTF-8 LC_ALL=C.UTF-8 - -# Caches dependencies of scripts & CI -ARG DEPS_SCRIPTS="devscripts cabal-install cabal-debian haskell-devscripts haskell-stack python3 equivs zstd" -ARG DEPS_SYMBIYOSYS="pkg-config clang tclsh git python python3 build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev autoconf cmake" -ARG DEPS_VERILATOR="perl python3 make autoconf g++ flex bison ccache libgoogle-perftools-dev numactl perl-doc libfl2 libfl-dev zlibc zlib1g zlib1g-dev" -RUN apt-get update && apt-get install -y $DEPS_SCRIPTS $DEPS_SYMBIYOSYS $DEPS_VERILATOR - -ARG YOSYS_VERSION="8cfed1a97957e4c096d1e0a0304d978bcb27e116" -RUN git clone https://github.com/YosysHQ/yosys.git yosys \ - && cd yosys \ - && git checkout $YOSYS_VERSION \ - && make -j$(nproc) \ - && make install \ - && cd .. \ - && rm -Rf yosys - -ARG Z3_VERSION="z3-4.8.10" -RUN curl -L "https://github.com/Z3Prover/z3/archive/refs/tags/$Z3_VERSION.tar.gz" \ - | tar -xz \ - && cd z3-$Z3_VERSION \ - && python scripts/mk_make.py \ - && cd build \ - && make -j$(nproc) \ - && make install \ - && cd ../.. \ - && rm -Rf z3-$Z3_VERSION - -ARG SYMBIYOSYS_VERSION="66a458958dc93f8e12418d425e4c31848889937b" -RUN git clone https://github.com/cliffordwolf/SymbiYosys.git SymbiYosys \ - && cd SymbiYosys \ - && git checkout $SYMBIYOSYS_VERSION \ - && make install \ - && cd .. \ - && rm -Rf SymbiYosys - -ARG verilator_version="v4.214" -RUN git clone https://github.com/verilator/verilator verilator \ - && cd verilator \ - && git checkout $verilator_version \ - && autoconf \ - && ./configure \ - && make -j$(nproc) \ - && make install \ - && cd ../.. \ - && rm -Rf verilator - -# First apt-get is the transitive dependencies of clash-ghc-{dev,prof} -# Second apt-get is the result of scanning a build log for "newly installed packages" -# -# Note that we don't need these, they're there purely to speed up the build process on CI. -RUN apt-get install -y binutils binutils-common binutils-x86-64-linux-gnu cpp cpp-9 dpkg gcc gcc-10-base gcc-9 gcc-9-base ghc ghc-prof libacl1 libasan5 libatomic1 libbinutils libbsd-dev libbsd0 libbz2-1.0 libc-dev-bin libc6 libc6-dev libcc1-0 libcrypt-dev libcrypt1 libctf-nobfd0 libctf0 libffi-dev libffi7 libgcc-9-dev libgcc-s1 libghc-adjunctions-dev libghc-adjunctions-prof libghc-aeson-dev libghc-aeson-pretty-dev libghc-aeson-pretty-prof libghc-aeson-prof libghc-ansi-terminal-dev libghc-ansi-terminal-prof libghc-ansi-wl-pprint-dev libghc-ansi-wl-pprint-prof libghc-arrows-dev libghc-arrows-prof libghc-attoparsec-dev libghc-attoparsec-prof libghc-base-compat-dev libghc-base-compat-prof libghc-base-orphans-dev libghc-base-orphans-prof libghc-base16-bytestring-dev libghc-base16-bytestring-prof libghc-bifunctors-dev libghc-bifunctors-prof libghc-blaze-builder-dev libghc-blaze-builder-prof libghc-blaze-html-dev libghc-blaze-html-prof libghc-blaze-markup-dev libghc-blaze-markup-prof libghc-call-stack-dev libghc-call-stack-prof libghc-charset-dev libghc-charset-prof libghc-clock-dev libghc-clock-prof libghc-colour-dev libghc-colour-prof libghc-comonad-dev libghc-comonad-prof libghc-constraints-dev libghc-constraints-prof libghc-contravariant-dev libghc-contravariant-prof libghc-cryptohash-sha256-dev libghc-cryptohash-sha256-prof libghc-data-binary-ieee754-dev libghc-data-binary-ieee754-prof libghc-data-default-class-dev libghc-data-default-class-prof libghc-data-default-dev libghc-data-default-instances-containers-dev libghc-data-default-instances-containers-prof libghc-data-default-instances-dlist-dev libghc-data-default-instances-dlist-prof libghc-data-default-instances-old-locale-dev libghc-data-default-instances-old-locale-prof libghc-data-default-prof libghc-distributive-dev libghc-distributive-prof libghc-dlist-dev libghc-dlist-prof libghc-erf-dev libghc-erf-prof libghc-exceptions-dev libghc-exceptions-prof libghc-extra-dev libghc-extra-prof libghc-fingertree-dev libghc-fingertree-prof libghc-first-class-families-dev libghc-first-class-families-prof libghc-free-dev libghc-free-prof libghc-ghc-paths-dev libghc-ghc-paths-prof libghc-half-dev libghc-half-prof libghc-hashable-dev libghc-hashable-prof libghc-haskell-lexer-dev libghc-haskell-lexer-prof libghc-hint-dev libghc-hint-prof libghc-integer-logarithms-dev libghc-integer-logarithms-prof libghc-interpolate-dev libghc-interpolate-prof libghc-invariant-dev libghc-invariant-prof libghc-kan-extensions-dev libghc-kan-extensions-prof libghc-lazysmallcheck-dev libghc-lazysmallcheck-prof libghc-lens-dev libghc-lens-prof libghc-old-locale-dev libghc-old-locale-prof libghc-parallel-dev libghc-parallel-prof libghc-parsers-dev libghc-parsers-prof libghc-pretty-show-dev libghc-pretty-show-prof libghc-prettyprinter-dev libghc-prettyprinter-prof libghc-primitive-dev libghc-primitive-prof libghc-profunctors-dev libghc-profunctors-prof libghc-quickcheck2-dev libghc-quickcheck2-prof libghc-random-dev libghc-random-prof libghc-recursion-schemes-dev libghc-recursion-schemes-prof libghc-reducers-dev libghc-reducers-prof libghc-reflection-dev libghc-reflection-prof libghc-safe-dev libghc-safe-prof libghc-scientific-dev libghc-scientific-prof libghc-semigroupoids-dev libghc-semigroupoids-prof libghc-semigroups-dev libghc-semigroups-prof libghc-singletons-dev libghc-singletons-prof libghc-split-dev libghc-split-prof libghc-src-exts-dev libghc-src-exts-prof libghc-src-meta-dev libghc-src-meta-prof libghc-statevar-dev libghc-statevar-prof libghc-stream-dev libghc-stream-prof libghc-syb-dev libghc-syb-prof libghc-tagged-dev libghc-tagged-prof libghc-temporary-dev libghc-temporary-prof libghc-terminal-size-dev libghc-terminal-size-prof libghc-tf-random-dev libghc-tf-random-prof libghc-th-abstraction-dev libghc-th-abstraction-prof libghc-th-desugar-dev libghc-th-desugar-prof libghc-th-expand-syns-dev libghc-th-expand-syns-prof libghc-th-lift-dev libghc-th-lift-instances-dev libghc-th-lift-instances-prof libghc-th-lift-prof libghc-th-orphans-dev libghc-th-orphans-prof libghc-th-reify-many-dev libghc-th-reify-many-prof libghc-time-locale-compat-dev libghc-time-locale-compat-prof libghc-transformers-base-dev libghc-transformers-base-prof libghc-transformers-compat-dev libghc-transformers-compat-prof libghc-trifecta-dev libghc-trifecta-prof libghc-type-errors-dev libghc-type-errors-prof libghc-uniplate-dev libghc-uniplate-prof libghc-unordered-containers-dev libghc-unordered-containers-prof libghc-utf8-string-dev libghc-utf8-string-prof libghc-uuid-types-dev libghc-uuid-types-prof libghc-vector-binary-instances-dev libghc-vector-binary-instances-prof libghc-vector-dev libghc-vector-prof libghc-void-dev libghc-void-prof libgmp-dev libgmp10 libgmpxx4ldbl libgomp1 libisl22 libitm1 liblsan0 liblzma5 libmpc3 libmpfr6 libncurses-dev libncurses5-dev libncurses6 libncursesw6 libpcre2-8-0 libquadmath0 libselinux1 libstdc++6 libtinfo6 libtsan0 libubsan1 libzstd1 linux-libc-dev ncurses-bin tar zlib1g \ - && apt-get install -y libghc-base-orphans-doc libghc-bifunctors-doc libghc-comonad-doc libghc-distributive-doc libghc-profunctors-doc libghc-tagged-doc libghc-th-abstraction-doc libghc-unbounded-delays-dev libghc-unbounded-delays-doc libghc-unbounded-delays-prof doctest libghc-code-page-dev libghc-doctest-dev libpthread-stubs0-dev libghc-async-dev libghc-async-prof libghc-base-prelude-dev libghc-base-prelude-prof libghc-case-insensitive-dev libghc-case-insensitive-prof libghc-glob-dev libghc-glob-prof libghc-megaparsec-dev libghc-megaparsec-prof libghc-neat-interpolation-dev libghc-neat-interpolation-prof libghc-optparse-applicative-dev libghc-optparse-applicative-prof libghc-parser-combinators-dev libghc-parser-combinators-prof libghc-tasty-dev libghc-tasty-hunit-dev libghc-tasty-hunit-prof libghc-tasty-prof libghc-wcwidth-dev libghc-wcwidth-prof ghdl ghdl-llvm libgnat-9 libllvm10 zlib1g-dev libghc-base-orphans-doc libghc-bifunctors-doc libghc-comonad-doc libghc-distributive-doc libghc-profunctors-doc libghc-tagged-doc libghc-th-abstraction-doc \ - && cabal update diff --git a/.ci/bindist/linux/debian/focal/build-and-publish-docker-image.sh b/.ci/bindist/linux/debian/focal/build-and-publish-docker-image.sh deleted file mode 100755 index 8bb95fe83d..0000000000 --- a/.ci/bindist/linux/debian/focal/build-and-publish-docker-image.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash - -set -xeo pipefail - -REPO="ghcr.io/clash-lang" -NAME="bindist-debian-focal" - -DIR=$(dirname "$0") -now=$(date +%F) - -docker build -t "${REPO}/${NAME}:$now" "$DIR" -docker tag "${REPO}/${NAME}:$now" "${REPO}/${NAME}:latest" - -read -p "Push to GitHub? (y/N) " push - -if [[ $push =~ ^[Yy]$ ]]; then - docker push "${REPO}/${NAME}:$now" - docker push "${REPO}/${NAME}:latest" -else - echo "Skipping push to container registry" -fi diff --git a/.ci/bindist/linux/debian/focal/buildinfo.json b/.ci/bindist/linux/debian/focal/buildinfo.json deleted file mode 100644 index d3f7ad3e25..0000000000 --- a/.ci/bindist/linux/debian/focal/buildinfo.json +++ /dev/null @@ -1,100 +0,0 @@ -{ - "docker": "ghcr.io/clash-lang/bindist-debian-focal:2022-01-25", - "build-dependencies": [ - "devscripts", - "cabal-install", - "cabal-debian", - "haskell-devscripts", - "ghc", - "equivs" - ], - "packages": [ - { - "name": "indexed-profunctors", - "src": {"type": "hackage", "version": "0.1"} - }, - { - "name": "generic-lens-core", - "src": {"type": "hackage", "version": "2.0.0.0"} - }, - { - "name": "generic-lens", - "src": {"type": "hackage", "version": "2.0.0.0"} - }, - { - "name": "concurrent-extra", - "src": {"type": "hackage", "version": "0.7.0.12"}, - "cabal_debian_options": ["--disable-tests"] - }, - { - "name": "ghc-tcplugins-extra", - "src": {"type": "hackage"} - }, - { - "name": "ghc-typelits-natnormalise", - "src": {"type": "hackage"} - }, - { - "name": "ghc-typelits-knownnat", - "src": {"type": "hackage"} - }, - { - "name": "ghc-typelits-extra", - "src": {"type": "hackage"} - }, - { - "name": "bytestring-builder", - "src": {"type": "hackage", "version": "0.10.8.2.0"} - }, - { - "name": "ordered-containers", - "src": {"type": "hackage", "version": "0.2.2"} - }, - { - "name": "concurrent-supply", - "src": {"type": "hackage", "version": "0.1.8"} - }, - { - "name": "attoparsec-aeson", - "src": {"type": "hackage", "version": "2.1.0.0"} - }, - { - "name": "clash-prelude", - "cabal_debian_options": [ - "--disable-haddock", "--disable-tests", - "--build-dep", "doctest", - "--build-dep", "libghc-doctest-dev" - ], - "src": {"type": "local", "dir": "../../../../../clash-prelude"} - }, - { - "name": "clash-lib", - "cabal_debian_options": ["--disable-haddock", "--disable-tests"], - "src": {"type": "local", "dir": "../../../../../clash-lib"} - }, - { - "name": "clash-ghc", - "cabal_debian_options": [ - "--disable-haddock", - "--disable-tests", - "--cabal-flag", "dynamic" - ], - "src": {"type": "local", "dir": "../../../../../clash-ghc"} - }, - { - "name": "clash-testsuite", - "src": {"type": "local", "dir": "../../../../../tests"}, - "cabal_debian_options": [ - "--disable-haddock", - "--depends", "haskell-clash-testsuite-utils:iverilog", - "--depends", "haskell-clash-testsuite-utils:ghdl-llvm" - ], - "after_install": { - "cmd": ["clash-testsuite", "-p", "Calculator.Verilog"], - "env": {"USE_GLOBAL_CLASH": "1"}, - "cwd": "../../../../..", - "comment": "Sanity check" - } - } - ] -} diff --git a/.ci/bindist/linux/debian/go.sh b/.ci/bindist/linux/debian/go.sh deleted file mode 100755 index 2e22ca9827..0000000000 --- a/.ci/bindist/linux/debian/go.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -set -x -euf -o pipefail - -cd $(dirname $0) - -docker run \ - -v $(realpath ../../../..):/clash-compiler-src \ - $(cat $1/buildinfo.json | jq -r '.docker') \ - /clash-compiler-src/.ci/bindist/linux/debian/scripts/build.sh ${1} diff --git a/.ci/bindist/linux/debian/metapackages/clash b/.ci/bindist/linux/debian/metapackages/clash deleted file mode 100644 index f42a2922c7..0000000000 --- a/.ci/bindist/linux/debian/metapackages/clash +++ /dev/null @@ -1,10 +0,0 @@ -Section: Haskell -Priority: optional -Homepage: https://clash-lang.org -Standards-Version: 3.9.2 - -Package: clash -Maintainer: QBayLogic B.V. -Depends: haskell-clash-lib-utils, haskell-clash-ghc-utils, clash-dev -Recommends: haskell-stack, cabal-install -Description: Clash metapackage diff --git a/.ci/bindist/linux/debian/metapackages/clash-dev b/.ci/bindist/linux/debian/metapackages/clash-dev deleted file mode 100644 index 6dde5202a6..0000000000 --- a/.ci/bindist/linux/debian/metapackages/clash-dev +++ /dev/null @@ -1,9 +0,0 @@ -Section: Haskell -Priority: optional -Homepage: https://clash-lang.org -Standards-Version: 3.9.2 - -Package: clash-dev -Maintainer: QBayLogic B.V. -Depends: libghc-clash-prelude-dev, libghc-clash-lib-dev, libghc-clash-ghc-dev -Description: Clash development metapackage diff --git a/.ci/bindist/linux/debian/metapackages/clash-doc b/.ci/bindist/linux/debian/metapackages/clash-doc deleted file mode 100644 index 2ebff8836c..0000000000 --- a/.ci/bindist/linux/debian/metapackages/clash-doc +++ /dev/null @@ -1,9 +0,0 @@ -Section: Haskell -Priority: optional -Homepage: https://clash-lang.org -Standards-Version: 3.9.2 - -Package: clash-doc -Maintainer: QBayLogic B.V. -Depends: libghc-clash-prelude-doc, libghc-clash-lib-doc, libghc-clash-ghc-doc -Description: Clash documentation metapackage diff --git a/.ci/bindist/linux/debian/metapackages/clash-prof b/.ci/bindist/linux/debian/metapackages/clash-prof deleted file mode 100644 index e04645a4de..0000000000 --- a/.ci/bindist/linux/debian/metapackages/clash-prof +++ /dev/null @@ -1,9 +0,0 @@ -Section: Haskell -Priority: optional -Homepage: https://clash-lang.org -Standards-Version: 3.9.2 - -Package: clash-prof -Maintainer: QBayLogic B.V. -Depends: libghc-clash-prelude-prof, libghc-clash-lib-prof, libghc-clash-ghc-prof -Description: Clash profiling metapackage diff --git a/.ci/bindist/linux/debian/scripts/build.py b/.ci/bindist/linux/debian/scripts/build.py deleted file mode 100755 index c2f459dd98..0000000000 --- a/.ci/bindist/linux/debian/scripts/build.py +++ /dev/null @@ -1,152 +0,0 @@ -#!/usr/bin/env python3 -import os -import sys -import json -import subprocess -import shutil -import datetime - -os.environ["DEBIAN_FRONTEND"] = "noninteractive" - -DISTRIBUTION=sys.argv[1] -NOW=datetime.datetime.utcnow().strftime("%Y%m%dT%H%M%SZ") - -SCRIPT_DIR=os.path.dirname(os.path.abspath(__file__)) -METAPACKAGES_DIR=os.path.abspath(os.path.join(SCRIPT_DIR, "..", "metapackages")) -BUILDINFO_DIR=os.path.abspath(os.path.join(SCRIPT_DIR, "..", DISTRIBUTION)) -BUILD_DIR=os.path.abspath(os.path.join(BUILDINFO_DIR, "build")) - -class cd: - """ - Context manager for changing the current working directory - - Credits: https://stackoverflow.com/a/13197763 - """ - def __init__(self, new_path): - self.new_path = os.path.expanduser(new_path) - - def __enter__(self): - self.old_path = os.getcwd() - os.chdir(self.new_path) - - def __exit__(self, etype, value, traceback): - os.chdir(self.old_path) - -def run(*args, **kwargs): - """Same as subprocess.run(), but forces 'check' to True""" - kwargs["check"] = True - print("+", " ".join(args[0])) - return subprocess.run(*args, **kwargs) - -def get_buildinfo(): - """"Parse and return 'buildinfo.json'""" - path = os.path.join(SCRIPT_DIR, "..", DISTRIBUTION, "buildinfo.json") - return json.load(open(path, "rb")) - -def apt_install(pkgs): - """Install a package using system's 'apt'""" - return run(["apt-get", "install", "-y"] + list(pkgs)) - -def cabal_update(): - return run(["cabal", "update"]) - -def cabal_get(name, unpack_to, version=None): - """Fetch a package from hackage and unpack it""" - pkg = name - if version is not None: - pkg += "==" - pkg += version - - return run(["cabal", "get", pkg, "-d", unpack_to]) - -def local_get(name, unpack_to, dir): - os.makedirs(unpack_to) - shutil.copytree( - os.path.abspath(os.path.join(BUILDINFO_DIR, dir)), - os.path.join(unpack_to, os.path.basename(dir)) - ) - -def build_debs(name, cabal_debian_options=()): - # Create debian/ - cmd = ["cabal-debian"] - cmd += ["--disable-profiling"] - cmd += ["--native"] - cmd += ["--dep-map", "pthread:libpthread-stubs0-dev"] - cmd += ["--revision", "-" + NOW] - cmd += list(cabal_debian_options) - run(cmd) - - # Install dependencies - run([ - "mk-build-deps", "--install", - "--tool", "apt -o Debug::pkgProblemResolver=yes -y" - ]) - - # Build package - run(["dpkg-buildpackage"]) - -def install_debs(): - apt_install("./" + p for p in os.listdir(".") if p.endswith(".deb")) - -def main(): - # Install helpers - buildinfo = get_buildinfo() - apt_install(buildinfo["build-dependencies"]) - - # Build packages - cabal_update() - for pkg in buildinfo.get("packages", []): - unpack_dir = os.path.join(BUILD_DIR, pkg["name"]) - - # Don't do work if Debian packages are already built. - if os.path.exists(unpack_dir): - debs = [p for p in os.listdir(unpack_dir) if p.endswith(".deb")] - else: - debs = [] - - if not debs: - shutil.rmtree(unpack_dir, ignore_errors=True) - - src = pkg["src"] - src_type = src["type"] - del src["type"] - - if src_type == "hackage": - cabal_get(pkg["name"], unpack_dir, **src) - elif src_type == "local": - local_get(pkg["name"], unpack_dir, **src) - else: - raise Exception("Unrecognized src type: {}".format(src_type)) - - [pkg_dir] = os.listdir(unpack_dir) - pkg_dir = os.path.join(unpack_dir, pkg_dir) - with cd(pkg_dir): - build_debs(pkg, pkg.get("cabal_debian_options", [])) - shutil.rmtree(pkg_dir) - - with cd(unpack_dir): - install_debs() - - # Post install script - after_install = pkg.get("after_install") - if after_install is not None: - wd = after_install.get("cwd", ".") - with cd(os.path.abspath(os.path.join(BUILDINFO_DIR, wd))): - env = after_install.get("env", {}) - run(after_install["cmd"], env={**os.environ, **env}) - - # Build metapackages - with cd(METAPACKAGES_DIR): - for nm in os.listdir("."): - run(["equivs-build", nm]) - - for deb in [p for p in os.listdir(".") if p.endswith(".deb")]: - shutil.move(deb, BUILD_DIR) - - # Build package index - with cd(BUILD_DIR): - run(["bash", "-c", "dpkg-scanpackages . > Packages"]) - -if __name__ == '__main__': - os.makedirs(BUILD_DIR, exist_ok=True) - main() diff --git a/.ci/bindist/linux/debian/scripts/build.sh b/.ci/bindist/linux/debian/scripts/build.sh deleted file mode 100755 index 10303d5d8c..0000000000 --- a/.ci/bindist/linux/debian/scripts/build.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -# Bootstrap Python installation and run build.py -set -x -euf -o pipefail - -cd $(dirname $0) -apt-get update -apt-get install python3 -y -./build.py $@ diff --git a/.ci/bindist/linux/snap/Dockerfile b/.ci/bindist/linux/snap/Dockerfile deleted file mode 100644 index 5b8b92d0da..0000000000 --- a/.ci/bindist/linux/snap/Dockerfile +++ /dev/null @@ -1,68 +0,0 @@ -ARG RISK=stable -ARG UBUNTU=focal - -FROM ubuntu:$UBUNTU as builder -ARG RISK -ARG UBUNTU -RUN echo "Building snapcraft:$RISK in ubuntu:$UBUNTU" - -# Grab dependencies -RUN apt-get update -RUN apt-get dist-upgrade --yes -RUN apt-get install --yes \ - curl \ - jq \ - squashfs-tools - -# Grab the core snap (for backwards compatibility) from the stable channel and -# unpack it in the proper place. -RUN curl -L $(curl -H 'X-Ubuntu-Series: 16' 'https://api.snapcraft.io/api/v1/snaps/details/core' | jq '.download_url' -r) --output core.snap -RUN mkdir -p /snap/core -RUN unsquashfs -d /snap/core/current core.snap - -# Grab the core18 snap (which snapcraft uses as a base) from the stable channel -# and unpack it in the proper place. -RUN curl -L $(curl -H 'X-Ubuntu-Series: 16' 'https://api.snapcraft.io/api/v1/snaps/details/core18' | jq '.download_url' -r) --output core18.snap -RUN mkdir -p /snap/core18 -RUN unsquashfs -d /snap/core18/current core18.snap - -# Grab the core20 snap (which snapcraft uses as a base) from the stable channel -# and unpack it in the proper place. -RUN curl -L $(curl -H 'X-Ubuntu-Series: 16' 'https://api.snapcraft.io/api/v1/snaps/details/core20' | jq '.download_url' -r) --output core20.snap -RUN mkdir -p /snap/core20 -RUN unsquashfs -d /snap/core20/current core20.snap - -# Grab the snapcraft v6751, the last working version of snapcraft: -# https://forum.snapcraft.io/t/snapcraft-failed-in-container/27921 -RUN curl -L https://api.snapcraft.io/api/v1/snaps/download/vMTKRaLjnOJQetI78HjntT37VuoyssFE_6751.snap --output snapcraft.snap -RUN mkdir -p /snap/snapcraft -RUN unsquashfs -d /snap/snapcraft/current snapcraft.snap - -# Create a snapcraft runner (TODO: move version detection to the core of -# snapcraft). -RUN mkdir -p /snap/bin -RUN echo "#!/bin/sh" > /snap/bin/snapcraft -RUN snap_version="$(awk '/^version:/{print $2}' /snap/snapcraft/current/meta/snap.yaml)" && echo "export SNAP_VERSION=\"$snap_version\"" >> /snap/bin/snapcraft -RUN echo 'exec "$SNAP/usr/bin/python3" "$SNAP/bin/snapcraft" "$@"' >> /snap/bin/snapcraft -RUN chmod +x /snap/bin/snapcraft - -# Multi-stage build, only need the snaps from the builder. Copy them one at a -# time so they can be cached. -FROM ubuntu:$UBUNTU -COPY --from=builder /snap/core /snap/core -COPY --from=builder /snap/core18 /snap/core18 -COPY --from=builder /snap/core20 /snap/core20 -COPY --from=builder /snap/snapcraft /snap/snapcraft -COPY --from=builder /snap/bin/snapcraft /snap/bin/snapcraft - -# Generate locale and install dependencies. -RUN apt-get update && apt-get dist-upgrade --yes && apt-get install --yes snapd sudo locales && locale-gen en_US.UTF-8 - -# Set the proper environment. -ENV LANG="en_US.UTF-8" -ENV LANGUAGE="en_US:en" -ENV LC_ALL="en_US.UTF-8" -ENV PATH="/snap/bin:$PATH" -ENV SNAP="/snap/snapcraft/current" -ENV SNAP_NAME="snapcraft" -ENV SNAP_ARCH="amd64" diff --git a/.ci/bindist/linux/snap/build-and-publish-docker-image.sh b/.ci/bindist/linux/snap/build-and-publish-docker-image.sh deleted file mode 100755 index de47c5684f..0000000000 --- a/.ci/bindist/linux/snap/build-and-publish-docker-image.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash - -set -xeo pipefail - -REPO="ghcr.io/clash-lang" -NAME="snapcraft" - -DIR=$(dirname "$0") -now=$(date +%F) - -docker build -t "${REPO}/${NAME}:$now" "$DIR" -docker tag "${REPO}/${NAME}:$now" "${REPO}/${NAME}:latest" - -read -p "Push to GitHub? (y/N) " push - -if [[ $push =~ ^[Yy]$ ]]; then - docker push "${REPO}/${NAME}:$now" - docker push "${REPO}/${NAME}:latest" -else - echo "Skipping push to container registry" -fi diff --git a/.ci/bindist/linux/snap/go.sh b/.ci/bindist/linux/snap/go.sh deleted file mode 100755 index 8f12094021..0000000000 --- a/.ci/bindist/linux/snap/go.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -set -euo pipefail - -cd $(dirname $0) - -export SNAPCRAFT_BUILD_ENVIRONMENT_CPU=${THREADS:-$(nproc)} -export SNAPCRAFT_BUILD_ENVIRONMENT_MEMORY=8G - -DEBIAN_DIR=../debian - -#${DEBIAN_DIR}/go.sh focal -tar -cf focal-build.tar -C ${DEBIAN_DIR}/focal/build . -snapcraft clean -snapcraft diff --git a/.ci/bindist/linux/snap/snap/snapcraft.yaml b/.ci/bindist/linux/snap/snap/snapcraft.yaml deleted file mode 100644 index 644dba0543..0000000000 --- a/.ci/bindist/linux/snap/snap/snapcraft.yaml +++ /dev/null @@ -1,98 +0,0 @@ -name: clash -version: '1.6.5' -summary: 'Clash: from Haskell to hardware' -description: | - Clash is a functional hardware description language that borrows both its - syntax and semantics from the functional programming language Haskell. The - Clash compiler transforms these high-level descriptions to low-level - synthesizable VHDL, Verilog, or SystemVerilog. -confinement: strict -grade: devel -base: core20 - -parts: - prepare: - plugin: dump - source: focal-build.tar - build-packages: - - software-properties-common - override-pull: | - # Pull in focal-build.tar - snapcraftctl pull - - # Create local APT repository for stage-packages stage - mkdir /archives - mv * /archives - echo "deb [trusted=yes] file:/archives ./" | tee /etc/apt/sources.list.d/clash.list - apt-get update - - # Add HVR's ppa to pull in cabal-install 3.2 - add-apt-repository ppa:hvr/ghc -u -y - - clash: - plugin: nil - after: - - prepare - stage-packages: - - clash - - cabal-install-3.2 - # To save time on CI, we currently don't build profiling packages anymore. We should - # probably selectively build them on release branches and nightlies. - #- clash-prof - # The below packages are included in core20, but their -dev packages are - # not. Include them here to avoid broken symlinks from dev sonames. - - libbsd0 - - libffi7 - - libgmp10 - - libncurses6 - - libncursesw6 - - libtinfo6 - - libyaml-0-2 - override-prime: | - snapcraftctl prime - apt-get install -y ghc - ghc-pkg recache --package-db=var/lib/ghc/package.conf.d/ - - wrappers: - after: - - clash - plugin: dump - source: . - organize: - wrappers/clash.sh: bin/clash.sh - wrappers/clashi.sh: bin/clashi.sh - wrappers/cabal.sh: bin/cabal.sh - -apps: - clash: - command: bin/clash.sh - plugs: [home] - - clashi: - command: bin/clashi.sh - plugs: [home] - - cabal: - command: bin/cabal.sh - plugs: [home, network] - -layout: - # _Things_ - /usr/lib/x86_64-linux-gnu/libc_nonshared.a: - symlink: $SNAP/usr/lib/x86_64-linux-gnu/libc_nonshared.a - - # Primitive definitions - /usr/share/clash-lib: - symlink: $SNAP/usr/share/clash-lib - - # Cabal from HVR PPA - /opt/cabal: - symlink: $SNAP/opt/cabal - - # Package databases and packages - /usr/lib/ghc: - symlink: $SNAP/usr/lib/ghc - /usr/lib/haskell-packages: - symlink: $SNAP/usr/lib/haskell-packages - /var/lib/ghc: - symlink: $SNAP/var/lib/ghc diff --git a/.ci/bindist/linux/snap/wrappers/cabal.sh b/.ci/bindist/linux/snap/wrappers/cabal.sh deleted file mode 100755 index 224cbbcc73..0000000000 --- a/.ci/bindist/linux/snap/wrappers/cabal.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash -export CPATH=$SNAP/usr/include:$SNAP/usr/include/x86_64-linux-gnu -$(ls ${SNAP}/opt/cabal/bin/cabal-*) $@ diff --git a/.ci/bindist/linux/snap/wrappers/clash.sh b/.ci/bindist/linux/snap/wrappers/clash.sh deleted file mode 100755 index 59ac691989..0000000000 --- a/.ci/bindist/linux/snap/wrappers/clash.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash -export CPATH=$SNAP/usr/include:$SNAP/usr/include/x86_64-linux-gnu -$SNAP/usr/bin/clash $@ diff --git a/.ci/bindist/linux/snap/wrappers/clashi.sh b/.ci/bindist/linux/snap/wrappers/clashi.sh deleted file mode 100755 index fd4d4bbb40..0000000000 --- a/.ci/bindist/linux/snap/wrappers/clashi.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash -export CPATH=$SNAP/usr/include:$SNAP/usr/include/x86_64-linux-gnu -$SNAP/usr/bin/clashi $@ diff --git a/.ci/gitlab/common.yml b/.ci/gitlab/common.yml index 2e867da790..674406abeb 100644 --- a/.ci/gitlab/common.yml +++ b/.ci/gitlab/common.yml @@ -25,7 +25,7 @@ - tar -xf cache.tar.zst -C / || true - .ci/setup.sh after_script: - - tar -cf - $(ls -d /root/.cabal /root/.stack $(pwd)/.ci/bindist/linux/debian/*/build || true) | zstd -T${THREADS} -3 > cache.tar.zst + - tar -cf - $(ls -d /root/.cabal /root/.stack || true) | zstd -T${THREADS} -3 > cache.tar.zst # We run tests on local machines if: # diff --git a/.ci/gitlab/publish.yml b/.ci/gitlab/publish.yml index 449940d225..103408e108 100644 --- a/.ci/gitlab/publish.yml +++ b/.ci/gitlab/publish.yml @@ -27,79 +27,3 @@ hackage-sdist: - .ci/publish_sdist.sh clash-ghc retry: max: 2 - -# Run every night, when explicitly triggered, or when tagged (release) -.run-on-nightly-and-changes: - rules: - - if: $CI_PIPELINE_SOURCE == "schedule" - - if: $CI_PIPELINE_SOURCE == "trigger" - - if: '$CI_COMMIT_TAG != null' # tags - - if: '$CI_COMMIT_TAG == null' - changes: - - .gitlab.yml - - .ci/**/* - - .ci/* - - ./*/*.cabal - -# Create Debian packages. -debian-bindist: - extends: .common-local - needs: [] - image: ghcr.io/clash-lang/bindist-debian-focal:2022-01-25 - stage: pack - cache: - when: on_success - key: - files: - - .ci/bindist/linux/debian/focal/buildinfo.json - - .ci/bindist/linux/debian/scripts/build.py - prefix: ${CI_JOB_NAME}-${CI_JOB_IMAGE} - artifacts: - when: always - paths: - - .ci/bindist/linux/debian/focal/build - expire_in: 1 week - script: - - rm -rf .ci/bindist/linux/debian/focal/build/clash* || true - - .ci/bindist/linux/debian/scripts/build.sh focal - -# Test debian distribution. Ideally, this would be in the same stage as -# 'debian-bindist', but we can't yet do that with GitLab CI. -debian-bindist-test: - extends: .run-on-nightly-and-changes - needs: ["debian-bindist"] - image: ghcr.io/clash-lang/bindist-debian-focal:2022-01-25 - stage: pack-test - script: - - apt-get update - - cd .ci/bindist/linux/debian/focal/build && apt-get -y install ./*/*.deb && cd - - - apt-get -y install iverilog - - clash-testsuite -p '$(NF-3) == "Vector" && $(NF-1) == "Verilog"' --no-verilator - tags: - - local - -# Use binary distribution built in `snap-bindist` to build a snap package. -.snap: - timeout: 2 hours - image: ghcr.io/clash-lang/snapcraft:2022-01-23 - stage: publish - interruptible: false - cache: - key: snap-last-run-hash-$CI_COMMIT_REF_SLUG - paths: - - snap-last-run-hash - artifacts: - when: always - paths: - - .ci/bindist/linux/snap/*.snap - expire_in: 1 week - script: - - export THREADS=$(./.ci/effective_cpus.sh) - - .ci/snap.sh build - # TODO: Smoke test for snaps. Not sure how to do this on CI, as we need - # snapd to be running (?). - - .ci/snap.sh publish - retry: - max: 2 - tags: - - local diff --git a/.ci/setup.sh b/.ci/setup.sh index bdd41c8af8..a1e1e87c70 100755 --- a/.ci/setup.sh +++ b/.ci/setup.sh @@ -9,12 +9,12 @@ fi set -e -# Check whether version numbers in snap / clash-{prelude,lib,ghc} are the same +# Check whether version numbers in +# clash-{prelude{,-hedgehog},lib{,-hedgehog},ghc,cores} are the same cabal_files="clash-prelude/clash-prelude.cabal clash-prelude-hedgehog/clash-prelude-hedgehog.cabal clash-lib/clash-lib.cabal clash-lib-hedgehog/clash-lib-hedgehog.cabal clash-ghc/clash-ghc.cabal clash-cores/clash-cores.cabal" -snapcraft_file=".ci/bindist/linux/snap/snap/snapcraft.yaml" -versions=$(grep "^[vV]ersion" $cabal_files $snapcraft_file | grep -Eo '[0-9]+(\.[0-9]+)+') +versions=$(grep "^[vV]ersion" $cabal_files | grep -Eo '[0-9]+(\.[0-9]+)+') -if [[ $(echo $versions | tr ' ' '\n' | wc -l) == 7 ]]; then +if [[ $(echo $versions | tr ' ' '\n' | wc -l) == 6 ]]; then if [[ $(echo $versions | tr ' ' '\n' | uniq | wc -l) != 1 ]]; then echo "Expected all distributions to have the same version number. Found: $versions" exit 1; @@ -31,7 +31,7 @@ version=$(echo $versions | tr ' ' '\n' | head -n 1) tag_version=${CI_COMMIT_TAG:1:${#CI_COMMIT_TAG}-1} # Strip first character (v0.99 -> 0.99) # `tag_version` is set when a tag has been created on GitHub. We use this to -# trigger a release pipeline (release to Snap / Hackage). +# trigger a release pipeline (release to Hackage). if [[ ${tag_version} != "" ]]; then if [[ ${version} != ${tag_version} ]]; then diff --git a/.ci/snap.sh b/.ci/snap.sh deleted file mode 100755 index 4c31c108d0..0000000000 --- a/.ci/snap.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -set -euo pipefail -set -x - -# Install git to detect branch names / revisions -apt update -apt install git -y - -# Set release channel based on branch: -# -# A build with RELEASE_CHANNEL=beta_or_edge only runs at night as a schedule -# (or if a schedule is manually triggered). The schedules target either -# master or a release branch (1.0, 1.2, ..). If it's run on master it should -# go into Snap's 'edge' channel, otherwise it's a pre-release dot-version -# (i.e., latest released version + fixes accumulated in release branch) thus -# beta. -branch_name=${CI_COMMIT_REF_SLUG} -if [[ ${RELEASE_CHANNEL} == "beta_or_edge" ]]; then - if [[ ${branch_name} == "master" ]]; then - RELEASE_CHANNEL="edge" - else - RELEASE_CHANNEL="beta" - fi -fi - -# Prevent running if we've already published this revision -hash_file=snap-last-run-hash -revision=$(git rev-parse HEAD) - -touch ${hash_file} -if [ "$(cat ${hash_file})" == "${revision}" ]; then - echo "Already built and published ${revision} on ${RELEASE_CHANNEL}. Nothing to do!"; - exit 0; -fi - -cd .ci/bindist/linux/snap || exit - -if [[ ${RELEASE_CHANNEL} == "stable" || ${RELEASE_CHANNEL} == "beta" ]]; then - # The Snap Store only allows grade=stable for stable snaps - sed -i s/devel/stable/ snap/snapcraft.yaml -fi - -set +x - -if [[ $1 == "build" ]]; then - ./go.sh -fi - -if [[ $1 == "publish" ]]; then - echo "$SNAPCRAFT_LOGIN_FILE" | base64 --decode --ignore-garbage > snapcraft.login - snapcraft login --with snapcraft.login - snapcraft upload ./*.snap --release ${RELEASE_CHANNEL} - echo "${revision}" > ${hash_file} -fi diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 691798ab39..6fae49a56b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -21,7 +21,6 @@ stages: - pre - test - pack - - pack-test - publish - post @@ -97,23 +96,6 @@ hackage-release: rules: - if: '$CI_COMMIT_TAG != null' # tags -# Publish a release candidate (beta/edge) to snapcraft.io/clash -snap-beta-or-edge: - extends: .snap - variables: - RELEASE_CHANNEL: beta_or_edge - rules: - - if: $CI_PIPELINE_SOURCE == "schedule" - - if: $CI_PIPELINE_SOURCE == "trigger" - -# Publish a new version to stable channel on snapcraft.io/clash -snap-stable: - extends: .snap - variables: - RELEASE_CHANNEL: stable - rules: - - if: '$CI_COMMIT_TAG != null' # tags - # Work around https://gitlab.com/gitlab-org/gitlab/-/issues/216629 # # If we ever remove this, we may have to rethink the use of the interruptible flag diff --git a/.ci/bindist/README.md b/RELEASING.md similarity index 69% rename from .ci/bindist/README.md rename to RELEASING.md index 91c417f19d..a7844812b3 100644 --- a/.ci/bindist/README.md +++ b/RELEASING.md @@ -1,21 +1,15 @@ # Clash's release process -Clash actively deploys to two platforms: - - * [Hackage](http://hackage.haskell.org/package/clash-prelude), a source - distribution platform for Haskell applications. - * [The Snap Store](https://snapcraft.io/clash), a binary distribution platform - for most Linux distributions. +Clash actively deploys to one platform: [Hackage](http://hackage.haskell.org/package/clash-prelude), +a source distribution platform for Haskell applications. Development happens on the `master` branch. Released versions live in `1.0`, `1.2`, etc. Changes made to these branches automatically get published every night. This is achieved through [GitLab Pipeline Schedules](https://gitlab.com/clash-lang/clash-compiler/pipeline_schedules). (You need admin access to see that page.) At the time of writing it gets -triggered on `master` and `1.2`. For Hackage, a release candidate gets pushed out +triggered on `master` and `1.6`. A release candidate gets pushed out with the version numbers in the various cabal files. Candidates can be previewed on [a special Hackage page](http://hackage.haskell.org/package/clash-prelude/candidates/). -For the Snap Store, an _edge_ release gets made when triggered on `master`. When -triggered on any other branch a _beta_ release gets made. ## Branches overview * `master`: development branch @@ -33,7 +27,6 @@ triggered on any other branch a _beta_ release gets made. * `clash-lib-hedgehog/clash-lib-hedgehog.cabal` * `clash-ghc/clash-ghc.cabal` * `clash-cores/clash-cores.cabal` - * `.ci/bindist/linux/snap/snap/snapcraft.yaml` * `docs/conf.py` 2. Update the CHANGELOG (see changelog/README.md). 3. Create a release branch named after the major version of Clash you're trying to @@ -46,13 +39,13 @@ triggered on any other branch a _beta_ release gets made. 6. Ask someone with admin permissions on GitLab to create a new nightly schedule and trigger a test release build on [GitLab CI](https://gitlab.com/clash-lang/clash-compiler/pipeline_schedules). The new schedule should be the same as the old one, but targeting the new - release branch. Verify that both Snap and Hackage release fine, and preview - their releases. - * [Preview on Hackage](http://hackage.haskell.org/package/clash-prelude/candidates/) - * [Preview on Snap](https://snapcraft.io/clash) + release branch. Verify that the Hackage release deploys well, and preview + the release. [Preview on Hackage](http://hackage.haskell.org/package/clash-prelude/candidates/) 7. Write release notes for: Twitter, LinkedIn, and clash-lang.org. 8. Create a release on [GitHub's new release page](https://github.com/clash-lang/clash-compiler/releases/new) -9. After the release is on Hackage: run `changelog/comment-gh.py` and execute the commands it lists. This will inform users subscribed to specific issues that a fix for their issue is now in a released version. +9. After the release is on Hackage: run `changelog/comment-gh.py` and execute + the commands it lists. This will inform users subscribed to specific issues + that a fix for their issue is now in a released version. 10. Update the [starter projects](https://github.com/clash-lang/stack-templates/) 11. Update these docs if anything is missing :-) 12. Enjoy! @@ -65,18 +58,16 @@ triggered on any other branch a _beta_ release gets made. * `clash-lib-hedgehog/clash-lib-hedgehog.cabal` * `clash-ghc/clash-ghc.cabal` * `clash-cores/clash-cores.cabal` - * `.ci/bindist/linux/snap/snap/snapcraft.yaml` * `docs/conf.py` 2. Update the CHANGELOG (see changelog/README.md). 3. Ask someone with admin permissions on GitLab to trigger a nightly schedule, - or simply wait a day. Verify that both Snap and Hackage release fine, and - preview heir releases. - * [Preview on Hackage](http://hackage.haskell.org/package/clash-prelude/candidates/) - * [Preview on Snap](https://snapcraft.io/clash) - + or simply wait a day. Verify that the Hackage release deploys well, and + preview the release. [Preview on Hackage](http://hackage.haskell.org/package/clash-prelude/candidates/) 4. Create a release on [GitHub's new release page](https://github.com/clash-lang/clash-compiler/releases/new) 5. Update the [starter projects](https://github.com/clash-lang/stack-templates/) 6. Cherry-pick commit made in (2) to `master` -7. After the release is on Hackage: run `changelog/comment-gh.py` and execute the commands it lists. This will inform users subscribed to specific issues that a fix for their issue is now in a released version. +7. After the release is on Hackage: run `changelog/comment-gh.py` and execute + the commands it lists. This will inform users subscribed to specific issues + that a fix for their issue is now in a released version. 8. Update these docs if anything is missing :-) 9. Enjoy! diff --git a/changelog/2023-03-16T11_04_32+01_00_drop_snap b/changelog/2023-03-16T11_04_32+01_00_drop_snap new file mode 100644 index 0000000000..25f9db0def --- /dev/null +++ b/changelog/2023-03-16T11_04_32+01_00_drop_snap @@ -0,0 +1,14 @@ +REMOVED: Dropped the snap package + +The Clash snap package has not been a recommended way to use Clash for quite +some time, and it is a hassle to support. + +In order to build a snap package, we build .deb packages for Clash with Ubuntu +20.04 LTS. But the interaction between the Debian build system and GHC is +problematic, requiring significant effort to support and to upgrade to a more +recent Ubuntu release. + +Additionally, snap packages have their own issues on distributions other than +Ubuntu. Given that we no longer recommend people use our snap package and +given the effort required to keep supporting them, we have decided to drop the +snap package.