Skip to content

Commit

Permalink
Enable basic support for riscv64
Browse files Browse the repository at this point in the history
  • Loading branch information
hamlin authored and luben committed Oct 18, 2023
1 parent b72307c commit a2cc976
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ The binary releases are architecture dependent because we are embedding the
native library in the provided Jar file. Currently they are built for
*linux-amd64*, *linux-i386*, *linux-aarch64*, *linux-armhf*, *linux-ppc64*,
*linux-ppc64le*, *linux-mips64*, *linux-s390x*, *win-amd64*, *win-x86*,
*darwin-x86_64* (MacOS X), *darwin-aarch64*, *freebsd-amd64*, and *freebsd-i386*.
*darwin-x86_64* (MacOS X), *darwin-aarch64*, *freebsd-amd64*, and *freebsd-i386*,
*linux-riscv64*.
More builds will be available if I get access to more platforms.

You can find published releases on Maven Central.
Expand Down
14 changes: 13 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ Compile / packageBin / packageOptions ++= Seq(
|linux/loongarch64/libzstd-jni-${version.value}.so;osname=Linux;processor=loongarch64,
|linux/ppc64/libzstd-jni-${version.value}.so;osname=Linux;processor=ppc64,
|linux/ppc64le/libzstd-jni-${version.value}.so;osname=Linux;processor=ppc64le,
|linux/riscv64/libzstd-jni-${version.value}.so;osname=Linux;processor=riscv64,
|linux/s390x/libzstd-jni-${version.value}.so;osname=Linux;processor=s390x,
|win/amd64/libzstd-jni-${version.value}.dll;osname=Win32;processor=amd64,
|win/x86/libzstd-jni-${version.value}.dll;osname=Win32;processor=x86""".stripMargin}),
Expand Down Expand Up @@ -206,7 +207,8 @@ OsgiKeys.importPackage := Seq("org.osgi.framework;resolution:=optional")
OsgiKeys.privatePackage := Seq(
"linux.amd64", "linux.i386", "linux.aarch64", "linux.arm", "linux.ppc64",
"linux.ppc64le", "linux.mips64", "linux.loongarch64", "linux.s390x", "darwin.x86_64",
"darwin.aarch64", "win.amd64", "win.x86", "freebsd.amd64", "freebsd.i386"
"darwin.aarch64", "win.amd64", "win.x86", "freebsd.amd64", "freebsd.i386",
"linux.riscv64"
)
// Explicitly specify the version of JavaSE required
// (rather depend on figuring that out from the JDK it was built with)
Expand Down Expand Up @@ -325,6 +327,16 @@ Linux_s390x / packageBin / packageOptions ++= Seq(
)
addArtifact(Artifact(nameValue, "linux_s390x"), Linux_s390x / packageBin)

lazy val Linux_riscv64 = config("linux_riscv64").extend(Compile)
inConfig(Linux_riscv64)(Defaults.compileSettings)
Linux_riscv64 / packageBin / mappings := {
(file(s"target/classes/linux/riscv64/libzstd-jni-${version.value}.so"), s"linux/riscv64/libzstd-jni-${version.value}.so") :: classes
}
Linux_riscv64 / packageBin / packageOptions ++= Seq(
Package.ManifestAttributes(new java.util.jar.Attributes.Name("Automatic-Module-Name") -> "com.github.luben.zstd_jni"),
)
addArtifact(Artifact(nameValue, "linux_riscv64"), Linux_riscv64 / packageBin)

/*
lazy val Aix_ppc64 = config("aix_ppc64").extend(Compile)
inConfig(Aix_ppc64)(Defaults.compileSettings)
Expand Down
1 change: 1 addition & 0 deletions make_so_cross.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ compile() {
cp $BUILD_DIR/libzstd-jni-$VERSION.so $INSTALL
}

compile riscv64 "riscv64-linux-gnu-gcc -march=rv64gcv"
compile arm arm-linux-gnueabihf-gcc
compile s390x "s390x-linux-gnu-gcc -march=z196"
#compile aarch64 aarch64-linux-gnu-gcc
Expand Down

0 comments on commit a2cc976

Please sign in to comment.