Skip to content

Commit

Permalink
Build cpython for Mac OSX ARM64
Browse files Browse the repository at this point in the history
  • Loading branch information
nightscape authored and saudet committed Jun 14, 2023
1 parent 5b31213 commit 06b45bf
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/cpython.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
15 changes: 14 additions & 1 deletion cpython/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion cpython/platform/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@
<version>${project.version}</version>
<classifier>${javacpp.platform.macosx-x86_64}</classifier>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${javacpp.moduleId}</artifactId>
<version>${project.version}</version>
<classifier>${javacpp.platform.macosx-arm64}</classifier>
</dependency>
<!-- <dependency>-->
<!-- <groupId>${project.groupId}</groupId>-->
<!-- <artifactId>${javacpp.moduleId}</artifactId>-->
Expand All @@ -90,7 +96,7 @@
<configuration>
<archive>
<manifestEntries>
<Class-Path>${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</Class-Path>
<Class-Path>${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</Class-Path>
</manifestEntries>
</archive>
</configuration>
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1460,6 +1460,7 @@
<module>libraw</module>
<module>leptonica</module>
<module>tesseract</module>
<module>cpython</module>
</modules>
<properties>
<javacpp.platform.android-arm></javacpp.platform.android-arm>
Expand Down

0 comments on commit 06b45bf

Please sign in to comment.