diff --git a/build.sbt b/build.sbt index 48b46b4..2321302 100644 --- a/build.sbt +++ b/build.sbt @@ -52,7 +52,14 @@ inThisBuild( if (isSnapshot.value) Some("snapshots" at nexus + "content/repositories/snapshots") else Some("releases" at nexus + "service/local/staging/deploy/maven2") }, - nativeArch := "x86_64", + nativeArch := { + System.getProperty("os.arch") match { + case "amd64" => + "x86_64" + case arch => + arch + } + }, nativeCompiler := "gcc", nativeCompileOptions := "-shared" :: "-O2" :: "-Wall" :: "-Wextra" :: Nil, nativePlatform := (System.getProperty("os.name").head.toLower match { diff --git a/src/main/java/org/scalasbt/ipcsocket/NativeLoader.java b/src/main/java/org/scalasbt/ipcsocket/NativeLoader.java index 44ab43c..ef4c95e 100644 --- a/src/main/java/org/scalasbt/ipcsocket/NativeLoader.java +++ b/src/main/java/org/scalasbt/ipcsocket/NativeLoader.java @@ -23,12 +23,18 @@ class NativeLoader { private static final boolean isMac; private static final boolean isLinux; private static final boolean isWindows; + private static final String arch; static { final String os = System.getProperty("os.name", "").toLowerCase(); isMac = os.startsWith("mac"); isLinux = os.startsWith("linux"); isWindows = os.startsWith("windows"); + String maybeArch = System.getProperty("os.arch", ""); + if ("amd64".equals(maybeArch)) { + maybeArch = "x86_64"; + } + arch = maybeArch; } private static final String pid = @@ -40,10 +46,6 @@ private static String tmpDirLocation() { static void load() throws UnsatisfiedLinkError { if (!loaded.get()) { - final String os = System.getProperty("os.name", "").toLowerCase(); - final boolean isMac = os.startsWith("mac"); - final boolean isLinux = os.startsWith("linux"); - final boolean isWindows = os.startsWith("windows"); final boolean is64bit = System.getProperty("sun.arch.data.model", "64").equals("64"); String tmpDir = tmpDirLocation(); if (is64bit && (isMac || isLinux || isWindows)) { @@ -51,7 +53,7 @@ static void load() throws UnsatisfiedLinkError { final String libName = (isWindows ? "" : "lib") + "sbtipcsocket" + extension; final String prefix = isMac ? "darwin" : isLinux ? "linux" : "win32"; - final String resource = prefix + "/x86_64/" + libName; + final String resource = prefix + "/" + arch + "/" + libName; final URL url = NativeLoader.class.getClassLoader().getResource(resource); if (url == null) throw new UnsatisfiedLinkError(resource + " not found on classpath"); try { diff --git a/src/main/resources/darwin/aarch64/libsbtipcsocket.dylib b/src/main/resources/darwin/aarch64/libsbtipcsocket.dylib new file mode 100755 index 0000000..ceab958 Binary files /dev/null and b/src/main/resources/darwin/aarch64/libsbtipcsocket.dylib differ