mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-08-25 14:55:01 +08:00
Update builder images. Yay for GHC's improved cross-compiler support!
This commit is contained in:
@@ -1,46 +1,35 @@
|
||||
FROM ubuntu:24.04
|
||||
FROM ubuntu:25.04
|
||||
|
||||
ENV TARGETNAME linux.riscv64
|
||||
ENV TARGET riscv64-linux-gnu
|
||||
ENV TARGETNAME=linux.riscv64
|
||||
ENV TARGET=riscv64-linux-gnu
|
||||
|
||||
# Build dependencies
|
||||
USER root
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt-get update && apt-get install -y llvm-20 "gcc-$TARGET" "g++-$TARGET" ghc alex happy automake autoconf build-essential curl qemu-user-static
|
||||
RUN curl -L "https://downloads.haskell.org/~cabal/cabal-install-3.16.0.0/cabal-install-3.16.0.0-x86_64-linux-alpine3_20.tar.xz" | tar xJv -C /usr/local/bin && cabal update
|
||||
|
||||
# Init base
|
||||
RUN apt-get update -y
|
||||
# Build GHC
|
||||
WORKDIR /ghc
|
||||
RUN curl -L "https://downloads.haskell.org/~ghc/9.12.2/ghc-9.12.2-src.tar.xz" | tar xJ --strip-components=1
|
||||
RUN ./boot.source && ./configure --host x86_64-linux-gnu --build x86_64-linux-gnu --target "$TARGET"
|
||||
# GHC fails to build if it can't encode non-ascii
|
||||
ENV LC_CTYPE=C.utf8
|
||||
# We have to do a binary-dist instead of a direct install, otherwise the targest won't have
|
||||
# cross compilation prefixes in /usr/local/lib/aarch64-linux-gnu-ghc-*/lib/settings
|
||||
RUN ./hadrian/build --flavour=quickest --bignum=native -V -j --prefix=/usr/local install
|
||||
# Hadrian just outputs "gcc" as the name of gcc, without accounting for $TARGET. Manually fix up the paths:
|
||||
RUN sed -e 's/"\(gcc\|g++\|ld\)"/"'"$TARGET"'-\1"/g' -i /usr/local/lib/$TARGET-ghc-*/lib/settings
|
||||
|
||||
# Install qemu
|
||||
RUN apt-get install -y --no-install-recommends build-essential ninja-build python3 pkg-config libglib2.0-dev libpixman-1-dev curl ca-certificates python3-virtualenv git python3-setuptools debootstrap
|
||||
WORKDIR /qemu
|
||||
RUN git clone --depth 1 https://github.com/koalaman/qemu .
|
||||
RUN ./configure --target-list=riscv64-linux-user --static --disable-system --disable-pie --disable-werror
|
||||
RUN cd build && ninja qemu-riscv64
|
||||
ENV QEMU_EXECVE 1
|
||||
# Due to an apparent cabal bug, we specify our options directly to cabal
|
||||
# It won't reuse caches if ghc-options are specified in ~/.cabal/config
|
||||
ENV CABALOPTS="--ghc-options;-split-sections -optc-Os -optc-Wl,--gc-sections -optc-fPIC;--with-compiler=$TARGET-ghc;--with-hc-pkg=$TARGET-ghc-pkg;-c;hashable -arch-native"
|
||||
|
||||
# Convenience utility
|
||||
COPY scutil /bin/scutil
|
||||
# We have to copy to /usr/bin because debootstrap will try to symlink /bin and fail if it exists
|
||||
COPY scutil /chroot/usr/bin/scutil
|
||||
RUN chmod +x /bin/scutil /chroot/usr/bin/scutil
|
||||
|
||||
# Set up a riscv64 userspace
|
||||
WORKDIR /
|
||||
RUN debootstrap --arch=riscv64 --variant=minbase --components=main,universe --foreign noble /chroot http://ports.ubuntu.com/ubuntu-ports
|
||||
RUN cp /qemu/build/qemu-riscv64 /chroot/bin/qemu
|
||||
RUN scutil emu /debootstrap/debootstrap --second-stage
|
||||
|
||||
# Install deps in the chroot
|
||||
RUN scutil emu apt-get update
|
||||
RUN scutil emu apt-get install -y --no-install-recommends ghc cabal-install
|
||||
RUN scutil emu cabal update
|
||||
|
||||
# Generated with: cabal freeze -c 'hashable -arch-native'. We put it in /etc so cabal won't find it.
|
||||
COPY cabal.project.freeze /chroot/etc
|
||||
|
||||
# Build all dependencies from the freeze file. The emulator segfaults at random,
|
||||
# so retry a few times.
|
||||
RUN scutil install_from_freeze /chroot/etc/cabal.project.freeze retry 5 emu cabal install --keep-going
|
||||
# Prebuild the dependencies
|
||||
RUN cabal update && IFS=';' && cabal install --dependencies-only $CABALOPTS ShellCheck
|
||||
|
||||
# Copy the build script
|
||||
COPY build /chroot/bin/build
|
||||
ENTRYPOINT ["/bin/scutil", "emu", "/bin/build"]
|
||||
COPY build /usr/bin
|
||||
|
||||
WORKDIR /scratch
|
||||
ENTRYPOINT ["/usr/bin/build"]
|
||||
|
@@ -1,21 +1,14 @@
|
||||
#!/bin/sh
|
||||
set -xe
|
||||
IFS=';'
|
||||
{
|
||||
mkdir -p /tmp/scratch
|
||||
cd /tmp/scratch
|
||||
tar xzv --strip-components=1
|
||||
chmod +x striptests && ./striptests
|
||||
# Use a freeze file to ensure we use the same dependencies we cached during
|
||||
# the docker image build. We don't want to spend time compiling anything new.
|
||||
cp /etc/cabal.project.freeze .
|
||||
mkdir "$TARGETNAME"
|
||||
# Retry in case of random segfault
|
||||
scutil retry 3 cabal build --enable-executable-static
|
||||
( IFS=';'; cabal build $CABALOPTS --enable-executable-static )
|
||||
find . -name shellcheck -type f -exec mv {} "$TARGETNAME/" \;
|
||||
ls -l "$TARGETNAME"
|
||||
"$TARGET-strip" -s "$TARGETNAME/shellcheck"
|
||||
ls -l "$TARGETNAME"
|
||||
"$TARGETNAME/shellcheck" --version
|
||||
"qemu-${TARGET%%-*}-static" "$TARGETNAME/shellcheck" --version
|
||||
} >&2
|
||||
tar czv "$TARGETNAME"
|
||||
|
@@ -1,93 +0,0 @@
|
||||
active-repositories: hackage.haskell.org:merge
|
||||
constraints: any.Diff ==0.5,
|
||||
any.OneTuple ==0.4.2,
|
||||
any.QuickCheck ==2.14.3,
|
||||
QuickCheck -old-random +templatehaskell,
|
||||
any.StateVar ==1.2.2,
|
||||
any.aeson ==2.2.3.0,
|
||||
aeson +ordered-keymap,
|
||||
any.array ==0.5.4.0,
|
||||
any.assoc ==1.1.1,
|
||||
assoc -tagged,
|
||||
any.base ==4.17.2.0,
|
||||
any.base-orphans ==0.9.2,
|
||||
any.bifunctors ==5.6.2,
|
||||
bifunctors +tagged,
|
||||
any.binary ==0.8.9.1,
|
||||
any.bytestring ==0.11.5.2,
|
||||
any.character-ps ==0.1,
|
||||
any.comonad ==5.0.8,
|
||||
comonad +containers +distributive +indexed-traversable,
|
||||
any.containers ==0.6.7,
|
||||
any.contravariant ==1.5.5,
|
||||
contravariant +semigroups +statevar +tagged,
|
||||
any.data-fix ==0.3.3,
|
||||
any.deepseq ==1.4.8.0,
|
||||
any.directory ==1.3.7.1,
|
||||
any.distributive ==0.6.2.1,
|
||||
distributive +semigroups +tagged,
|
||||
any.dlist ==1.0,
|
||||
dlist -werror,
|
||||
any.exceptions ==0.10.5,
|
||||
any.fgl ==5.8.2.0,
|
||||
fgl +containers042,
|
||||
any.filepath ==1.4.2.2,
|
||||
any.foldable1-classes-compat ==0.1,
|
||||
foldable1-classes-compat +tagged,
|
||||
any.generically ==0.1.1,
|
||||
any.ghc-bignum ==1.3,
|
||||
any.ghc-boot-th ==9.4.7,
|
||||
any.ghc-prim ==0.9.1,
|
||||
any.hashable ==1.4.6.0,
|
||||
hashable -arch-native +integer-gmp -random-initial-seed,
|
||||
any.indexed-traversable ==0.1.4,
|
||||
any.indexed-traversable-instances ==0.1.2,
|
||||
any.integer-conversion ==0.1.1,
|
||||
any.integer-logarithms ==1.0.3.1,
|
||||
integer-logarithms -check-bounds +integer-gmp,
|
||||
any.mtl ==2.2.2,
|
||||
any.network-uri ==2.6.4.2,
|
||||
any.os-string ==2.0.3,
|
||||
any.parsec ==3.1.16.1,
|
||||
any.pretty ==1.1.3.6,
|
||||
any.primitive ==0.9.0.0,
|
||||
any.process ==1.6.17.0,
|
||||
any.random ==1.2.1.2,
|
||||
any.regex-base ==0.94.0.2,
|
||||
any.regex-tdfa ==1.3.2.2,
|
||||
regex-tdfa +doctest -force-o2,
|
||||
any.rts ==1.0.2,
|
||||
any.scientific ==0.3.8.0,
|
||||
scientific -integer-simple,
|
||||
any.semialign ==1.3.1,
|
||||
semialign +semigroupoids,
|
||||
any.semigroupoids ==6.0.1,
|
||||
semigroupoids +comonad +containers +contravariant +distributive +tagged +unordered-containers,
|
||||
any.splitmix ==0.1.0.5,
|
||||
splitmix -optimised-mixer,
|
||||
any.stm ==2.5.1.0,
|
||||
any.strict ==0.5,
|
||||
any.tagged ==0.8.8,
|
||||
tagged +deepseq +transformers,
|
||||
any.template-haskell ==2.19.0.0,
|
||||
any.text ==2.0.2,
|
||||
any.text-iso8601 ==0.1.1,
|
||||
any.text-short ==0.1.6,
|
||||
text-short -asserts,
|
||||
any.th-abstraction ==0.7.0.0,
|
||||
any.th-compat ==0.1.5,
|
||||
any.these ==1.2.1,
|
||||
any.time ==1.12.2,
|
||||
any.time-compat ==1.9.7,
|
||||
any.transformers ==0.5.6.2,
|
||||
any.transformers-compat ==0.7.2,
|
||||
transformers-compat -five +five-three -four +generic-deriving +mtl -three -two,
|
||||
any.unix ==2.7.3,
|
||||
any.unordered-containers ==0.2.20,
|
||||
unordered-containers -debug,
|
||||
any.uuid-types ==1.0.6,
|
||||
any.vector ==0.13.1.0,
|
||||
vector +boundschecks -internalchecks -unsafechecks -wall,
|
||||
any.vector-stream ==0.1.0.1,
|
||||
any.witherable ==0.5
|
||||
index-state: hackage.haskell.org 2024-06-17T00:48:51Z
|
Reference in New Issue
Block a user