From 4ffc5f735def87efda3a3f1ff2f0db1de74c4d17 Mon Sep 17 00:00:00 2001 From: KOSHIKAWA Kenichi Date: Tue, 4 Jan 2022 00:22:15 +0900 Subject: [PATCH] cross-compilation settings for arm-apple-darwin ("M1 Macs") Signed-off-by: KOSHIKAWA Kenichi --- .github/workflows/test.yml | 41 +++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8ce4661..a666064 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,20 +26,47 @@ jobs: ifconfig - name: Install build dependencies of VDE run: brew install autoconf automake - - name: Install VDE + - name: Make and Install VDE run: | git clone https://github.com/virtualsquare/vde-2.git /tmp/vde-2 cd /tmp/vde-2 # Dec 12, 2021 git checkout 74278b9b7cf816f0356181f387012fdeb6d65b52 autoreconf -fis + # compile for x86_64 ./configure --prefix=/opt/vde - make - sudo make install - - name: Make - run: make PREFIX=/opt/vde - - name: Install - run: sudo make PREFIX=/opt/vde install + make PREFIX=/opt/vde + sudo make PREFIX=/opt/vde install + # cleanup + make distclean + # cross-compile for arm64 + export SDKROOT=$(xcrun --sdk macosx --show-sdk-path) + export CC=$(xcrun --sdk macosx --find clang) + export CXX=$(xcrun --sdk macosx --find clang++) + export CFLAGS="-arch arm64e -isysroot $SDKROOT -Wno-error=implicit-function-declaration" + export CXXFLAGS=$CFLAGS + ./configure --prefix=/opt/vde.arm64 --host=arm-apple-darwin --target=arm-apple-darwin --build=x86_64-apple-darwin + make PREFIX=/opt/vde.arm64 + sudo make PREFIX=/opt/vde.arm64 install + unset SDKROOT CC CXX CFLAGS CXXFLAGS + - name: Make and Install vde_vmnet (x86_64) + run: | + git clone https://github.com/lima-vm/vde_vmnet.git /tmp/vde_vmnet + cd /tmp/vde_vmnet + make PREFIX=/opt/vde + sudo make PREFIX=/opt/vde install + - name: Cleanup + run: | + make clean + - name: Make and Install vde_vmnet (arm64) + run: | + export SDKROOT=$(xcrun --sdk macosx --show-sdk-path) + export CC=$(xcrun --sdk macosx --find clang) + export CXX=$(xcrun --sdk macosx --find clang++) + export CFLAGS="-arch arm64e -isysroot $SDKROOT -Wno-error=implicit-function-declaration" + export CXXFLAGS=$CFLAGS + make PREFIX=/opt/vde.arm64 + sudo make PREFIX=/opt/vde.arm64 install - name: Print launchd status (shared mode) run: launchctl print system/io.github.lima-vm.vde_vmnet.plist - name: Install test dependencies