Initial version of an ARM64 macOS build
This commit is contained in:
parent
d80fdfa9e8
commit
8c4c112c25
|
@ -47,7 +47,7 @@ jobs:
|
||||||
needs: package_source
|
needs: package_source
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
build: [linux.x86_64, linux.aarch64, linux.armv6hf, darwin.x86_64, windows.x86_64]
|
build: [linux.x86_64, linux.aarch64, linux.armv6hf, darwin.x86_64, darwin.aarch64, windows.x86_64]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
FROM ghcr.io/shepherdjerred/macos-cross-compiler:latest
|
||||||
|
|
||||||
|
ENV TARGET aarch64-apple-darwin22
|
||||||
|
ENV TARGETNAME darwin.aarch64
|
||||||
|
|
||||||
|
# Build dependencies
|
||||||
|
USER root
|
||||||
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
|
ENV LC_ALL C.utf8
|
||||||
|
|
||||||
|
# Install basic deps
|
||||||
|
RUN apt-get update && apt-get install -y automake autoconf build-essential curl xz-utils qemu-user-static
|
||||||
|
|
||||||
|
# Install a more suitable host compiler
|
||||||
|
WORKDIR /host-ghc
|
||||||
|
RUN curl -L "https://downloads.haskell.org/~cabal/cabal-install-3.9.0.0/cabal-install-3.9-x86_64-linux-alpine.tar.xz" | tar xJv -C /usr/local/bin
|
||||||
|
RUN curl -L 'https://downloads.haskell.org/~ghc/8.10.7/ghc-8.10.7-x86_64-deb10-linux.tar.xz' | tar xJ --strip-components=1
|
||||||
|
RUN ./configure && make install
|
||||||
|
|
||||||
|
# Build GHC. We have to use an old version because cross-compilation across OS has since broken.
|
||||||
|
WORKDIR /ghc
|
||||||
|
RUN curl -L "https://downloads.haskell.org/~ghc/8.10.7/ghc-8.10.7-src.tar.xz" | tar xJ --strip-components=1
|
||||||
|
RUN apt-get install -y llvm-12
|
||||||
|
RUN ./boot && ./configure --host x86_64-linux-gnu --build x86_64-linux-gnu --target "$TARGET"
|
||||||
|
RUN cp mk/flavours/quick-cross.mk mk/build.mk && make -j "$(nproc)"
|
||||||
|
RUN make install
|
||||||
|
|
||||||
|
# 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;-optc-Os -optc-fPIC;--with-ghc=$TARGET-ghc;--with-hc-pkg=$TARGET-ghc-pkg;--constraint=hashable==1.3.5.0"
|
||||||
|
|
||||||
|
# Prebuild the dependencies
|
||||||
|
RUN cabal update
|
||||||
|
RUN IFS=';' && cabal install --dependencies-only $CABALOPTS ShellCheck
|
||||||
|
|
||||||
|
# Copy the build script
|
||||||
|
COPY build /usr/bin
|
||||||
|
|
||||||
|
WORKDIR /scratch
|
||||||
|
ENTRYPOINT ["/usr/bin/build"]
|
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/sh
|
||||||
|
set -xe
|
||||||
|
{
|
||||||
|
tar xzv --strip-components=1
|
||||||
|
chmod +x striptests && ./striptests
|
||||||
|
mkdir "$TARGETNAME"
|
||||||
|
cabal update
|
||||||
|
( IFS=';'; cabal build $CABALOPTS )
|
||||||
|
find . -name shellcheck -type f -exec mv {} "$TARGETNAME/" \;
|
||||||
|
ls -l "$TARGETNAME"
|
||||||
|
"$TARGET-strip" "$TARGETNAME/shellcheck"
|
||||||
|
ls -l "$TARGETNAME"
|
||||||
|
file "$TARGETNAME/shellcheck" | grep "Mach-O 64-bit arm64 executable"
|
||||||
|
} >&2
|
||||||
|
tar czv "$TARGETNAME"
|
|
@ -0,0 +1 @@
|
||||||
|
koalaman/scbuilder-darwin-aarch64
|
Loading…
Reference in New Issue