Skip to content

Commit

Permalink
#302 Fixed running snappy-java as OSGi bundle on Apple Silicon (M1 Pr…
Browse files Browse the repository at this point in the history
…o) (#303)

Co-authored-by: Mikhail Zhukov <zh.muxa@gmail.com>
  • Loading branch information
zh-muxa and Mikhail Zhukov committed May 18, 2022
1 parent 1d01f87 commit 78354b6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion build.sbt
Expand Up @@ -86,8 +86,9 @@ OsgiKeys.additionalHeaders := Map(
"org/xerial/snappy/native/Windows/x86_64/snappyjava.dll;osname=win32;processor=x64",
"org/xerial/snappy/native/Windows/x86_64/snappyjava.dll;osname=win32;processor=amd64",
"org/xerial/snappy/native/Windows/x86/snappyjava.dll;osname=win32;processor=x86",
"org/xerial/snappy/native/Mac/x86/libsnappyjava.dylib;osname=macosx;processor=x86",
"org/xerial/snappy/native/Mac/x86/libsnappyjava.jnilib;osname=macosx;processor=x86",
"org/xerial/snappy/native/Mac/x86_64/libsnappyjava.dylib;osname=macosx;processor=x86-64",
"org/xerial/snappy/native/Mac/aarch64/libsnappyjava.dylib;osname=macosx;processor=aarch64",
"org/xerial/snappy/native/Linux/x86_64/libsnappyjava.so;osname=linux;processor=x86-64",
"org/xerial/snappy/native/Linux/x86_64/libsnappyjava.so;osname=linux;processor=x64",
"org/xerial/snappy/native/Linux/x86_64/libsnappyjava.so;osname=linux;processor=amd64",
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/org/xerial/snappy/SnappyBundleActivator.java
Expand Up @@ -51,7 +51,9 @@ public void start(BundleContext context)
throws Exception
{
String library = System.mapLibraryName(LIBRARY_NAME);
if (library.toLowerCase().endsWith(".dylib")) {
String osArch = System.getProperty("os.arch");

if (library.toLowerCase().endsWith(".dylib") && "x86".equals(osArch)) {
// some MacOS JDK7+ vendors map to dylib instead of jnilib
library = library.replace(".dylib", ".jnilib");
}
Expand Down

0 comments on commit 78354b6

Please sign in to comment.