Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Niven/macos arm64build #1893

Merged
merged 3 commits into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/build-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,20 @@ jobs:
with:
name: defichain-${{ env.BUILD_VERSION }}-x86_64-apple-darwin
path: ./build/defichain-${{ env.BUILD_VERSION }}-x86_64-apple-darwin.tar.gz

mac-aarch64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Populate environment
run: GIT_VERSION=1 ./make.sh ci-export-vars

- name: Build and package
run: GIT_VERSION=1 TARGET="aarch64-apple-darwin" ./make.sh docker-release

- name: Publish artifact - aarch64-apple-darwin
uses: actions/upload-artifact@v3
with:
name: defichain-${{ env.BUILD_VERSION }}-aarch64-apple-darwin
path: ./build/defichain-${{ env.BUILD_VERSION }}-aarch64-apple-darwin.tar.gz
24 changes: 24 additions & 0 deletions contrib/dockerfiles/aarch64-apple-darwin.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
ARG TARGET=aarch64-apple-darwin

# -----------
FROM --platform=linux/amd64 ubuntu:latest as builder
ARG TARGET
LABEL org.defichain.name="defichain-builder"
LABEL org.defichain.arch=${TARGET}

WORKDIR /work
COPY ./make.sh .

RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_update_base
RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_deps
RUN export DEBIAN_FRONTEND=noninteractive && ./make.sh pkg_install_deps_osx_tools

COPY . .
RUN ./make.sh clean-depends && ./make.sh build-deps
RUN ./make.sh clean-conf && ./make.sh build-conf
RUN ./make.sh build-make

RUN mkdir /app && cd build/${TARGET} && \
make -s prefix=/ DESTDIR=/app install

# NOTE: These are not runnable images. So we do not add into a scratch base image.
2 changes: 1 addition & 1 deletion contrib/dockerfiles/aarch64-linux-gnu.dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARG TARGET=aarch64-linux-gnu

# -----------
FROM ubuntu:latest as builder
FROM --platform=linux/amd64 ubuntu:latest as builder
ARG TARGET
LABEL org.defichain.name="defichain-builder"
LABEL org.defichain.arch=${TARGET}
Expand Down
2 changes: 1 addition & 1 deletion contrib/dockerfiles/arm-linux-gnueabihf.dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARG TARGET=arm-linux-gnueabihf

# -----------
FROM ubuntu:latest as builder
FROM --platform=linux/amd64 ubuntu:latest as builder
ARG TARGET
LABEL org.defichain.name="defichain-builder"
LABEL org.defichain.arch=${TARGET}
Expand Down
2 changes: 1 addition & 1 deletion contrib/dockerfiles/x86_64-apple-darwin.dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARG TARGET=x86_64-apple-darwin

# -----------
FROM ubuntu:latest as builder
FROM --platform=linux/amd64 ubuntu:latest as builder
ARG TARGET
LABEL org.defichain.name="defichain-builder"
LABEL org.defichain.arch=${TARGET}
Expand Down
4 changes: 2 additions & 2 deletions contrib/dockerfiles/x86_64-pc-linux-gnu-clang.dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARG TARGET=x86_64-pc-linux-gnu

# -----------
FROM debian:10 as builder
FROM --platform=linux/amd64 debian:10 as builder
ARG TARGET
ARG CLANG_VERSION=15
LABEL org.defichain.name="defichain-builder"
Expand Down Expand Up @@ -31,7 +31,7 @@ RUN mkdir /app && cd build/${TARGET} && \

# -----------
### Actual image that contains defi binaries
FROM debian:10
FROM --platform=linux/amd64 debian:10
ARG TARGET
LABEL org.defichain.name="defichain"
LABEL org.defichain.arch=${TARGET}
Expand Down
4 changes: 2 additions & 2 deletions contrib/dockerfiles/x86_64-pc-linux-gnu.dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARG TARGET=x86_64-pc-linux-gnu

# -----------
FROM ubuntu:latest as builder
FROM --platform=linux/amd64 ubuntu:latest as builder
ARG TARGET
LABEL org.defichain.name="defichain-builder"
LABEL org.defichain.arch=${TARGET}
Expand All @@ -23,7 +23,7 @@ RUN mkdir /app && cd build/${TARGET} && \

# -----------
### Actual image that contains defi binaries
FROM ubuntu:latest
FROM --platform=linux/amd64 ubuntu:latest
ARG TARGET
LABEL org.defichain.name="defichain"
LABEL org.defichain.arch=${TARGET}
Expand Down
2 changes: 1 addition & 1 deletion contrib/dockerfiles/x86_64-w64-mingw32.dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARG TARGET=x86_64-w64-mingw32

# -----------
FROM ubuntu:latest as builder
FROM --platform=linux/amd64 ubuntu:latest as builder
ARG TARGET
LABEL org.defichain.name="defichain-builder"
LABEL org.defichain.arch=${TARGET}
Expand Down
2 changes: 1 addition & 1 deletion doc/build-quick.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ an environment with correct arch and pre-requisites configured.

- aarch64-linux-gnu
- arm-linux-gnueabihf
- arm-apple-darwin
- aarch64-apple-darwin

## Defined `env` variables

Expand Down
8 changes: 7 additions & 1 deletion make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,13 @@ clean() {
_get_default_target() {
local default_target=""
if [[ "${OSTYPE}" == "darwin"* ]]; then
default_target="x86_64-apple-darwin"
local macos_arch=""
macos_arch=$(uname -m || true)
if [[ "$macos_arch" == "x86_64" ]]; then
default_target="x86_64-apple-darwin"
else
default_target="aarch64-apple-darwin"
fi
elif [[ "${OSTYPE}" == "msys" ]]; then
default_target="x86_64-w64-mingw32"
else
Expand Down