mirror of https://github.com/WerWolv/ImHex.git
git: Add MacOS M1 GitHub Action (#1425)
I said I'll do it in #1414 Warning: the output zip does not pass SIP (System Integrity Protection), and I have no plan to do it for now. So if someone here has a Mac, feel free to to try to fix the problem (which is probably our build system) Link #1109 --------- Co-authored-by: Nik <werwolv98@gmail.com>
This commit is contained in:
parent
2036dc91e6
commit
f75d5dba84
|
@ -238,6 +238,46 @@ jobs:
|
|||
name: macOS DMG${{matrix.suffix}} x86_64
|
||||
path: build/*.dmg
|
||||
|
||||
macos-arm64:
|
||||
runs-on: ubuntu-22.04
|
||||
name: 🍎 macOS 12.1 arm64
|
||||
steps:
|
||||
- name: 🧰 Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: 📁 Restore docker /cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: cache
|
||||
key: build-macos-arm64-cache
|
||||
|
||||
- name: 🐳 Inject /cache into docker
|
||||
uses: reproducible-containers/buildkit-cache-dance@v2.1.2 # Doesn't work with a MacOS runner ?
|
||||
with:
|
||||
cache-source: cache
|
||||
cache-target: /cache
|
||||
|
||||
- name: 🛠️ Build using docker
|
||||
run: |
|
||||
docker buildx build . -f dist/macOS/arm64.Dockerfile --progress=plain --build-arg 'JOBS=4' --build-arg "BUILD_TYPE=$(BUILD_TYPE)" --build-context imhex=$(pwd) --output out
|
||||
|
||||
- name: ⬆️ Upload artifacts
|
||||
uses: actions/upload-pages-artifact@v2
|
||||
with:
|
||||
name: macOS ZIP arm64
|
||||
path: out/
|
||||
|
||||
# See https://github.com/actions/cache/issues/342#issuecomment-1711054115
|
||||
- name: 🗑️ Delete old cache
|
||||
continue-on-error: true
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
gh extension install actions/gh-actions-cache
|
||||
gh actions-cache delete "build-macos-arm64-cache" --confirm
|
||||
|
||||
# Ubuntu build
|
||||
ubuntu:
|
||||
strategy:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# see arm64.crosscompile.Dockerfile
|
||||
FROM crosscompile as build
|
||||
# This base image is also known as "crosscompile". See arm64.crosscompile.Dockerfile
|
||||
FROM ghcr.io/itrooz/macos-crosscompile:clang17-nosdk as build
|
||||
|
||||
ENV MACOSX_DEPLOYMENT_TARGET 12.1
|
||||
|
||||
|
@ -22,8 +22,16 @@ if [ "$CUSTOM_GLFW" ]; then
|
|||
fi
|
||||
EOF
|
||||
|
||||
## Assume the SDK has been removed from the image, and copy it again
|
||||
COPY SDK /osxcross/target/SDK
|
||||
RUN --mount=type=cache,target=/cache <<EOF
|
||||
## Download SDK is missing (it may have been removed from the image)
|
||||
set -xe
|
||||
if [ ! -d /osxcross/target/SDK/MacOSX14.0.sdk ]; then
|
||||
wget https://github.com/joseluisq/macosx-sdks/releases/download/14.0/MacOSX14.0.sdk.tar.xz -O /cache/MacOSX14.0.sdk.tar.xz -nc || true
|
||||
mkdir -p /osxcross/target/SDK
|
||||
tar -C /osxcross/target/SDK -xf /cache/MacOSX14.0.sdk.tar.xz
|
||||
fi
|
||||
EOF
|
||||
|
||||
|
||||
## Download libmagic
|
||||
### Clone libmagic
|
||||
|
@ -32,22 +40,28 @@ RUN git clone https://github.com/file/file /mnt/file
|
|||
RUN --mount=type=cache,target=/var/lib/apt/lists/ apt install -y libtool autoconf
|
||||
|
||||
# -- DOWNLOADING + BUILDING STUFF
|
||||
## Install libcurl dep
|
||||
RUN vcpkg install --triplet=arm-osx-mytriplet curl
|
||||
## Install mbedtls dep
|
||||
RUN vcpkg install --triplet=arm-osx-mytriplet mbedtls
|
||||
## Install freetype dep
|
||||
RUN vcpkg install --triplet=arm-osx-mytriplet freetype
|
||||
## Install jthread external library
|
||||
RUN vcpkg install --triplet=arm-osx-mytriplet josuttis-jthread
|
||||
|
||||
ENV VCPKG_DEFAULT_BINARY_CACHE /cache/vcpkg
|
||||
RUN --mount=type=cache,target=/cache <<EOF
|
||||
## Install dependencies with vcpkg
|
||||
set -xe
|
||||
|
||||
mkdir -p $VCPKG_DEFAULT_BINARY_CACHE
|
||||
|
||||
vcpkg install --triplet=arm-osx-mytriplet curl
|
||||
vcpkg install --triplet=arm-osx-mytriplet mbedtls
|
||||
vcpkg install --triplet=arm-osx-mytriplet freetype
|
||||
vcpkg install --triplet=arm-osx-mytriplet josuttis-jthread
|
||||
EOF
|
||||
|
||||
## Install glfw3 dep
|
||||
ARG CUSTOM_GLFW
|
||||
RUN <<EOF
|
||||
RUN --mount=type=cache,target=/cache <<EOF
|
||||
set -xe
|
||||
if [ "$CUSTOM_GLFW" ]; then
|
||||
echo "Flag confirmation: using custom GLFW for software rendering"
|
||||
else
|
||||
echo "Flag confirmation: using system GLFW"
|
||||
vcpkg install --triplet=arm-osx-mytriplet glfw3
|
||||
fi
|
||||
EOF
|
||||
|
@ -146,18 +160,6 @@ RUN --mount=type=cache,target=/cache --mount=type=cache,target=/mnt/ImHex/build/
|
|||
ccache -s
|
||||
EOF
|
||||
|
||||
# package ImHex
|
||||
## install genisoimage
|
||||
RUN --mount=type=cache,target=/var/lib/apt/lists/ apt install -y genisoimage
|
||||
## Move everything that need to be packaged inside a directory
|
||||
RUN <<EOF
|
||||
set -xe
|
||||
cd /mnt/ImHex/build
|
||||
mkdir installDir
|
||||
mv imhex.app installDir
|
||||
EOF
|
||||
## generate dmg file
|
||||
RUN cd /mnt/ImHex/build && genisoimage -V imhex.app -D -R -apple -no-pad -o imhex.dmg installDir
|
||||
|
||||
FROM scratch
|
||||
COPY --from=build /mnt/ImHex/build/imhex.dmg .
|
||||
COPY --from=build /mnt/ImHex/build/imhex.app imhex.app
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# This image is is provided for reference, but a (potentially more up to date) image should be available at https://github.com/iTrooz/macos-crosscompile
|
||||
# This image is is provided for reference, but a (probably more up to date) image should be available at https://github.com/iTrooz/macos-crosscompile
|
||||
FROM ubuntu:22.04
|
||||
|
||||
ENV PATH $PATH:/osxcross/target/bin
|
||||
|
|
Loading…
Reference in New Issue