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 Jul 13, 2023
1 parent 11e33fc commit 23ff757
Show file tree
Hide file tree
Showing 4 changed files with 28 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 @@ -37,6 +37,10 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: bytedeco/javacpp-presets/.github/actions/deploy-ubuntu@actions
macosx-arm64:
runs-on: macos-11
steps:
- uses: bytedeco/javacpp-presets/.github/actions/deploy-macosx@actions
macosx-x86_64:
runs-on: macos-11
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-arm64, macosx-x86_64, 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
9 changes: 8 additions & 1 deletion cpython/platform/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@
<version>${project.version}</version>
<classifier>${javacpp.platform.linux-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 Down Expand Up @@ -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-arm64.jar ${javacpp.moduleId}-macosx-x86_64.jar ${javacpp.moduleId}-windows-x86.jar ${javacpp.moduleId}-windows-x86_64.jar</Class-Path>
</manifestEntries>
</archive>
</configuration>
Expand Down Expand Up @@ -140,6 +146,7 @@
// requires static org.bytedeco.${javacpp.moduleId}.linux.ppc64le;
// requires static org.bytedeco.${javacpp.moduleId}.linux.x86;
requires static org.bytedeco.${javacpp.moduleId}.linux.x86_64;
requires static org.bytedeco.${javacpp.moduleId}.macosx.arm64;
requires static org.bytedeco.${javacpp.moduleId}.macosx.x86_64;
// requires static org.bytedeco.${javacpp.moduleId}.windows.x86;
requires static org.bytedeco.${javacpp.moduleId}.windows.x86_64;
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1454,6 +1454,7 @@
<module>ffmpeg</module>
<module>lz4</module>
<module>openblas</module>
<module>cpython</module>
<module>llvm</module>
<module>libffi</module>
<module>libpostal</module>
Expand Down

0 comments on commit 23ff757

Please sign in to comment.