diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d7a1c4b..9607a8b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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: @@ -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: @@ -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 @@ -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 diff --git a/Dockerfile2014_arm b/Dockerfile2014_arm new file mode 100644 index 0000000..75ba4c6 --- /dev/null +++ b/Dockerfile2014_arm @@ -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 diff --git a/jar-pack.sh b/jar-pack.sh index 7fc49e9..551d10f 100755 --- a/jar-pack.sh +++ b/jar-pack.sh @@ -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/* diff --git a/linux.sh b/linux.sh index a6970ca..7494700 100755 --- a/linux.sh +++ b/linux.sh @@ -3,7 +3,11 @@ 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 @@ -11,3 +15,6 @@ mkdir build cd build ../configure --with-java make +if [ "$(uname -i)" = aarch64 ]; then + mv .libs/libturbojpeg.so .libs/libturbojpeg-arm64.so +fi