From 06b45bfd7a82ba65a19f1b2cbb9d9cae268c25d8 Mon Sep 17 00:00:00 2001 From: Martin Mauch Date: Tue, 13 Jun 2023 19:09:53 +0200 Subject: [PATCH] Build cpython for Mac OSX ARM64 --- .github/workflows/cpython.yml | 6 +++++- cpython/cppbuild.sh | 15 ++++++++++++++- cpython/platform/pom.xml | 8 +++++++- pom.xml | 1 + 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cpython.yml b/.github/workflows/cpython.yml index ca3961363ce..030cfafee01 100644 --- a/.github/workflows/cpython.yml +++ b/.github/workflows/cpython.yml @@ -41,6 +41,10 @@ jobs: runs-on: macos-11 steps: - uses: bytedeco/javacpp-presets/.github/actions/deploy-macosx@actions + macosx-arm64: + runs-on: macos-11 + steps: + - uses: bytedeco/javacpp-presets/.github/actions/deploy-macosx@actions # windows-x86: # runs-on: windows-2019 # steps: @@ -50,7 +54,7 @@ jobs: steps: - uses: bytedeco/javacpp-presets/.github/actions/deploy-windows@actions redeploy: - needs: [linux-x86_64, macosx-x86_64, windows-x86_64] + needs: [linux-x86_64, macosx-x86_64, macosx-arm64, windows-x86_64] # needs: [linux-armhf, linux-arm64, linux-ppc64le, linux-x86, linux-x86_64, macosx-x86_64, windows-x86, windows-x86_64] runs-on: ubuntu-20.04 steps: diff --git a/cpython/cppbuild.sh b/cpython/cppbuild.sh index 36e01afb7d9..23eadd8101a 100755 --- a/cpython/cppbuild.sh +++ b/cpython/cppbuild.sh @@ -124,7 +124,20 @@ case $PLATFORM in make -j $MAKEJ make install ;; - macosx-*) + macosx-arm64) + cd ../$OPENSSL + ./Configure enable-rc5 zlib darwin64-arm64-cc no-asm -fPIC no-shared --prefix=$INSTALL_PATH --libdir=lib + make -s -j $MAKEJ + make install_sw + cd ../Python-$CPYTHON_VERSION + sedinplace 's/libintl.h//g' configure + sedinplace 's/ac_cv_lib_intl_textdomain=yes/ac_cv_lib_intl_textdomain=no/g' configure + ./configure --prefix=$INSTALL_PATH --enable-shared --with-openssl=$INSTALL_PATH LDFLAGS='-s -Wl,-rpath,@loader_path/,-rpath,@loader_path/../,-rpath,@loader_path/../lib/' ac_cv_working_openssl_hashlib=yes ac_cv_working_openssl_ssl=yes + sedinplace 's:-install_name,$(prefix)/lib/:-install_name,@rpath/:g' Makefile + make -j $MAKEJ + make install + ;; + macosx-x86_64) cd ../$OPENSSL ./Configure darwin64-x86_64-cc -fPIC no-shared --prefix=$INSTALL_PATH --libdir=lib make -s -j $MAKEJ diff --git a/cpython/platform/pom.xml b/cpython/platform/pom.xml index b224e877491..6d08c5d7bae 100644 --- a/cpython/platform/pom.xml +++ b/cpython/platform/pom.xml @@ -66,6 +66,12 @@ ${project.version} ${javacpp.platform.macosx-x86_64} + + ${project.groupId} + ${javacpp.moduleId} + ${project.version} + ${javacpp.platform.macosx-arm64} + @@ -90,7 +96,7 @@ - ${javacpp.moduleId}.jar ${javacpp.moduleId}-linux-armhf.jar ${javacpp.moduleId}-linux-arm64.jar ${javacpp.moduleId}-linux-ppc64le.jar ${javacpp.moduleId}-linux-x86.jar ${javacpp.moduleId}-linux-x86_64.jar ${javacpp.moduleId}-macosx-x86_64.jar ${javacpp.moduleId}-windows-x86.jar ${javacpp.moduleId}-windows-x86_64.jar + ${javacpp.moduleId}.jar ${javacpp.moduleId}-linux-armhf.jar ${javacpp.moduleId}-linux-arm64.jar ${javacpp.moduleId}-linux-ppc64le.jar ${javacpp.moduleId}-linux-x86.jar ${javacpp.moduleId}-linux-x86_64.jar ${javacpp.moduleId}-macosx-x86_64.jar ${javacpp.moduleId}-macosx-arm64.jar ${javacpp.moduleId}-windows-x86.jar ${javacpp.moduleId}-windows-x86_64.jar diff --git a/pom.xml b/pom.xml index f3d05cc6724..72024feaed3 100644 --- a/pom.xml +++ b/pom.xml @@ -1460,6 +1460,7 @@ libraw leptonica tesseract + cpython