diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index c989983f..6dc4daaf 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -384,6 +384,82 @@ jobs: chmod +x ./mvnw ./mvnw -B --show-version -ntp clean package + Linux-ppc64le-Build-JDK8: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/cache@v3 + env: + cache-name: cache-m2-repository-${{ runner.os }}-jdk8-ppc64le + with: + path: ~/.m2/repository + key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-pr-${{ matrix.arch }}-pr-${{ env.cache-name }}-pr- + - uses: uraimo/run-on-arch-action@v2.3.0 + name: Run commands + id: runcmd + with: + arch: ppc64le + distro: ubuntu18.04 + + # Not required, but speeds up builds by storing container images in + # a GitHub package registry. + githubToken: ${{ github.token }} + + # Mount the .m2/repository + dockerRunArgs: | + --platform linux/ppc64le + --volume "/home/runner/.m2/repository/:/root/.m2/repository" + # Install dependencies + install: | + apt-get update + apt-get install -q -y curl gnupg2 autoconf automake libtool make tar git cmake build-essential openjdk-8-jdk + + run: | + chmod +x ./mvnw + ./mvnw -B -ntp clean package + - name: Upload the build + uses: actions/upload-artifact@v3 + with: + name: Linux-ppc64le-Build-JDK8 + path: /home/runner/work/Brotli4j/ + + Linux-ppc64le-Build-JDK11: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/cache@v3 + env: + cache-name: cache-m2-repository-${{ runner.os }}-jdk11-ppc64le + with: + path: ~/.m2/repository + key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-pr-${{ matrix.arch }}-pr-${{ env.cache-name }}-pr- + - uses: uraimo/run-on-arch-action@v2.3.0 + name: Run commands + id: runcmd + with: + arch: ppc64le + distro: ubuntu18.04 + + # Not required, but speeds up builds by storing container images in + # a GitHub package registry. + githubToken: ${{ github.token }} + + # Mount the .m2/repository + dockerRunArgs: | + --platform linux/ppc64le + --volume "/home/runner/.m2/repository/:/root/.m2/repository" + # Install dependencies + install: | + apt-get update + apt-get install -q -y curl gnupg2 autoconf automake libtool make tar git cmake build-essential openjdk-11-jdk + run: | + chmod +x ./mvnw + ./mvnw -B -ntp clean package + Linux-riscv64-Build-JDK11: runs-on: ubuntu-latest steps: diff --git a/README.md b/README.md index 15a2ffbe..0f3ccba2 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ Brotli4j provides Brotli compression and decompression for Java. | Linux (Ubuntu 18.04) | Aarch64 | JDK 1.8, JDK 11, JDK 17 | | Linux (Ubuntu 18.04) | ARMv7 | JDK 1.8, JDK 11 | | Linux (Ubuntu 18.04) | s390x | JDK 1.8, JDK 11 | +| Linux (Ubuntu 18.04) | ppc64le | JDK 1.8, JDK 11 | | Linux (Ubuntu 20.04) | RISC-V64 | JDK 1.8, JDK 11, JDK 17, JDK 21 | | macOS (Catalina) | x64 | JDK 1.8, JDK 11, JDK 17 | | macOS (Catalina) | Aarch64 | JDK 1.8, JDK 11, JDK 17 | diff --git a/all/pom.xml b/all/pom.xml index ec2d50f7..ea81ad2b 100644 --- a/all/pom.xml +++ b/all/pom.xml @@ -64,6 +64,11 @@ native-linux-s390x ${project.version} + + com.aayushatharva.brotli4j + native-linux-ppc64le + ${project.version} + com.aayushatharva.brotli4j native-linux-riscv64 diff --git a/brotli4j/pom.xml b/brotli4j/pom.xml index 6f95e5af..637c3f65 100644 --- a/brotli4j/pom.xml +++ b/brotli4j/pom.xml @@ -76,6 +76,23 @@ + + linux-ppc64le + + + Linux + ppc64le + + + + + com.aayushatharva.brotli4j + native-linux-ppc64le + ${project.parent.version} + + + + linux-aarch64 diff --git a/brotli4j/src/main/java/com/aayushatharva/brotli4j/Brotli4jLoader.java b/brotli4j/src/main/java/com/aayushatharva/brotli4j/Brotli4jLoader.java index 19ba205f..33ae1a26 100644 --- a/brotli4j/src/main/java/com/aayushatharva/brotli4j/Brotli4jLoader.java +++ b/brotli4j/src/main/java/com/aayushatharva/brotli4j/Brotli4jLoader.java @@ -128,6 +128,8 @@ private static String getPlatform() { return "linux-armv7"; } else if ("s390x".equalsIgnoreCase(archName)) { return "linux-s390x"; + } else if ("ppc64le".equalsIgnoreCase(archName)) { + return "linux-ppc64le"; } else if ("riscv64".equalsIgnoreCase(archName)) { return "linux-riscv64"; } diff --git a/natives/linux-ppc64le/build.sh b/natives/linux-ppc64le/build.sh new file mode 100644 index 00000000..468102f7 --- /dev/null +++ b/natives/linux-ppc64le/build.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +CURPATH=$(pwd) +TARGET_CLASSES_PATH="target/classes/lib/linux-ppc64le" +TARGET_PATH="target" + +exitWithError() { + cd ${CURPATH} + echo "*** An error occurred. Please check log messages. ***" + exit $1 +} + +mkdir -p "$TARGET_CLASSES_PATH" + +cd "$TARGET_PATH" +cmake ../../../ || exitWithError $? +make || exitWithError $? +rm -f "$CURPATH/${TARGET_CLASSES_PATH}/libbrotli.so" +cp "./libbrotli.so" "$CURPATH/${TARGET_CLASSES_PATH}" || exitWithError $? + +cd "${CURPATH}" diff --git a/natives/linux-ppc64le/pom.xml b/natives/linux-ppc64le/pom.xml new file mode 100644 index 00000000..7ea1d7af --- /dev/null +++ b/natives/linux-ppc64le/pom.xml @@ -0,0 +1,119 @@ + + + + + natives + com.aayushatharva.brotli4j + 1.12.0 + + 4.0.0 + + native-linux-ppc64le + jar + + + com.aayushatharva.brotli4j.linux.ppc64le + + + + + + org.moditect + moditect-maven-plugin + 1.0.0.RC2 + + + add-module-infos + package + + add-module-info + + + 9 + + + module ${javaModuleName} { + requires com.aayushatharva.brotli4j.service; + exports ${javaModuleName} to com.aayushatharva.brotli4j; + provides com.aayushatharva.brotli4j.service.BrotliNativeProvider with + ${javaModuleName}.NativeLoader; + } + + + + --multi-release + 9 + + + + + + + + + + + linux-ppc64le + + + Linux + ppc64le + + + + + + org.codehaus.mojo + exec-maven-plugin + 3.0.0 + + + build-native + process-classes + + exec + + + /bin/bash + + build.sh + + ${project.basedir} + + + + + + + + + + release + + + + resources + + + + + + diff --git a/natives/linux-ppc64le/src/main/java/com/aayushatharva/brotli4j/linux/ppc64le/NativeLoader.java b/natives/linux-ppc64le/src/main/java/com/aayushatharva/brotli4j/linux/ppc64le/NativeLoader.java new file mode 100644 index 00000000..5eac4a9c --- /dev/null +++ b/natives/linux-ppc64le/src/main/java/com/aayushatharva/brotli4j/linux/ppc64le/NativeLoader.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2020-2023, Aayush Atharva + * + * Brotli4j licenses this file to you under the + * Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aayushatharva.brotli4j.linux.ppc64le; + +import com.aayushatharva.brotli4j.service.BrotliNativeProvider; + +/** + * Service class to access the native lib in a JPMS context + */ +public class NativeLoader implements BrotliNativeProvider { + + @Override + public String platformName() { + return "linux-ppc64le"; + } +} diff --git a/natives/linux-x86_64/pom.xml b/natives/linux-x86_64/pom.xml index afe3fc45..9b90a691 100644 --- a/natives/linux-x86_64/pom.xml +++ b/natives/linux-x86_64/pom.xml @@ -31,6 +31,7 @@ com.aayushatharva.brotli4j.linux.s390x + com.aayushatharva.brotli4j.linux.ppc64le diff --git a/natives/pom.xml b/natives/pom.xml index 5c8d8076..218f008b 100644 --- a/natives/pom.xml +++ b/natives/pom.xml @@ -32,6 +32,7 @@ linux-aarch64 linux-armv7 linux-s390x + linux-ppc64le linux-riscv64 windows-x86_64 osx-x86_64 @@ -74,6 +75,19 @@ + + linux-ppc64le + + + Linux + ppc64le + + + + linux-ppc64le + + + linux-aarch64 @@ -159,6 +173,7 @@ linux-aarch64 linux-armv7 linux-s390x + linux-ppc64le linux-riscv64 windows-x86_64 osx-x86_64