From ed977e9f25049a097a35fbf5106cf6e6f3ed772d Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 30 May 2021 11:59:57 -0500 Subject: [PATCH] mpy-cross: Build an arm64 (M1) bin and a universal bin --- .github/workflows/build.yml | 16 ++++++++++++++++ mpy-cross/Makefile.m1 | 11 +++++++++++ 2 files changed, 27 insertions(+) create mode 100644 mpy-cross/Makefile.m1 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0b23f4538e..8bc6e22f8b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -154,8 +154,24 @@ jobs: with: name: mpy-cross-macos-catalina path: mpy-cross/mpy-cross + - name: Select SDK for M1 build + run: sudo xcode-select -switch /Applications/Xcode_12.3.app + - name: Build mpy-cross (arm64) + run: make -C mpy-cross -j2 -f Makefile.m1 V=2 + - uses: actions/upload-artifact@v2 + with: + name: mpy-cross-macos-bigsur-arm64 + path: mpy-cross/mpy-cross-arm64 + - name: Make universal binary + run: lipo -create -output mpy-cross-macos-universal mpy-cross/mpy-cross mpy-cross/mpy-cross-arm64 + - uses: actions/upload-artifact@v2 + with: + name: mpy-cross-macos-universal + path: mpy-cross-macos-universal - name: Upload mpy-cross build to S3 run: | + [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross-macos-universal s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross-macos-universal-${{ env.CP_VERSION }} --no-progress --region us-east-1 + [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross-arm64 s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross-macos-bigsur-${{ env.CP_VERSION }}-arm64 --no-progress --region us-east-1 [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross-macos-catalina-${{ env.CP_VERSION }} --no-progress --region us-east-1 env: AWS_PAGER: '' diff --git a/mpy-cross/Makefile.m1 b/mpy-cross/Makefile.m1 new file mode 100644 index 0000000000..063036f597 --- /dev/null +++ b/mpy-cross/Makefile.m1 @@ -0,0 +1,11 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + +PROG=mpy-cross-arm64 +BUILD=build-arm64 + +include mpy-cross.mk +# Because mpy-cross.mk unconditionally overwrites CC for Darwin, we must set it BELOW the inclusion +CC := $(shell xcrun --sdk macosx11.1 --find clang) -isysroot $(shell xcrun --sdk macosx11.1 --show-sdk-path) -target arm64-apple-macos11 -DMICROPY_NLR_SETJMP=1 +$(info pt2 CC=$(CC))