Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arm macos + linux by using the upcoming github m1 host #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 60 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,41 @@ on:
pull_request:

jobs:
build-macos-arm64:
runs-on: macos-latest-xlarge
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
- name: Install build dependencies
run: brew install automake libtool
- name: Build native code
run: |
export CPPFLAGS="-I${JAVA_HOME}/include -I${JAVA_HOME}/include/darwin"
cd libjpeg-turbo
autoreconf -fiv
rm -rf build && mkdir build
cd build
../configure --with-java
make
mv .libs/libturbojpeg.dylib .libs/libturbojpeg-arm64.dylib
- uses: actions/upload-artifact@v3
if: failure()
with:
name: configure log
path: libjpeg-turbo/build/config.log
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: artifacts-macos-arm64
path: libjpeg-turbo/build/.libs/libturbojpeg-arm64.dylib
if-no-files-found: error
build-macos-x86_64:
runs-on: macos-latest
steps:
Expand Down Expand Up @@ -40,6 +75,28 @@ jobs:
name: artifacts-macos-x86_64
path: libjpeg-turbo/build/.libs/libturbojpeg.dylib
if-no-files-found: error
build-linux-arm64:
runs-on: macos-latest-xlarge
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v3
with:
submodules: recursive
- name: Build native code
run: |
docker build -f Dockerfile2014_arm . -t native_builder
docker run -v $(pwd):/build --user ${UID} -t native_builder /build/linux.sh
- uses: actions/upload-artifact@v3
if: failure()
with:
name: configure log
path: libjpeg-turbo/build/config.log
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: artifacts-linux-arm64
path: libjpeg-turbo/build/.libs/libturbojpeg-arm64.so
if-no-files-found: error
build-linux-x86_64:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -94,7 +151,7 @@ jobs:
path: libjpeg-turbo/build/**/turbojpeg.dll
if-no-files-found: error
build-package:
needs: [build-macos-x86_64, build-windows-x86_64, build-linux-x86_64]
needs: [build-macos-x86_64, build-windows-x86_64, build-linux-x86_64, build-macos-arm64, build-linux-arm64]
runs-on: ubuntu-latest
env:
gradle_commands: --stacktrace clean jar
Expand Down Expand Up @@ -158,4 +215,6 @@ jobs:
artifacts-macos-x86_64/*.dylib
artifacts-linux-x86_64/*.so
artifacts-windows-x86_64/Debug/*.dll
artifacts-macos-arm64/*.dylib
artifacts-linux-arm64/*.so
libjpeg-turbo-java/*.jar
6 changes: 6 additions & 0 deletions Dockerfile2014_arm
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Dockerfile for lowest common denominator Linux native artifact build
# --------------------------------------------------------------------
# Modified from TileDB-Java/ci/Dockerfile2010
FROM quay.io/pypa/manylinux2014_aarch64

RUN yum install -y java-1.8.0-openjdk-devel
4 changes: 4 additions & 0 deletions jar-pack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ mkdir -p META-INF/lib/osx_64
mv ../../artifacts-macos-x86_64/libturbojpeg.dylib META-INF/lib/osx_64/
mkdir -p META-INF/lib/linux_64
mv ../../artifacts-linux-x86_64/libturbojpeg.so META-INF/lib/linux_64/
mkdir -p META-INF/lib/osx_arm64
mv ../../artifacts-macos-arm64/libturbojpeg-arm64.dylib META-INF/lib/osx_arm64/libturbojpeg.dylib
mkdir -p META-INF/lib/linux_arm64
mv ../../artifacts-linux-arm64/libturbojpeg-arm64.so META-INF/lib/linux_arm64/libturbojpeg.so

# repack the jar file to include the native libraries
jar uvvf libjpeg-turbo*.jar META-INF/lib/*
9 changes: 8 additions & 1 deletion linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@
set -x

cd "$(dirname "${0}")"
export JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk.x86_64"
if [ "$(uname -i)" = aarch64 ]; then
export JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk"
else
export JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk.x86_64"
fi
export CPPFLAGS="-I${JAVA_HOME}/include -I${JAVA_HOME}/include/linux"
cd libjpeg-turbo
autoreconf -fiv
mkdir build
cd build
../configure --with-java
make
if [ "$(uname -i)" = aarch64 ]; then
mv .libs/libturbojpeg.so .libs/libturbojpeg-arm64.so
fi