summary refs log tree commit diff
path: root/pkgs/development
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-01-28 11:56:14 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-01-28 12:10:28 +0100
commite5995e0703de588af9d71e636eea7ddb1c695af0 (patch)
treeaffc30edd49401fbcdd8d9d4a18da43b4ca1f3e3 /pkgs/development
parent5150dbfdbe4144770d1dae868172fb94d7e6be55 (diff)
downloadnixpkgs-e5995e0703de588af9d71e636eea7ddb1c695af0.tar
nixpkgs-e5995e0703de588af9d71e636eea7ddb1c695af0.tar.gz
nixpkgs-e5995e0703de588af9d71e636eea7ddb1c695af0.tar.bz2
nixpkgs-e5995e0703de588af9d71e636eea7ddb1c695af0.tar.lz
nixpkgs-e5995e0703de588af9d71e636eea7ddb1c695af0.tar.xz
nixpkgs-e5995e0703de588af9d71e636eea7ddb1c695af0.tar.zst
nixpkgs-e5995e0703de588af9d71e636eea7ddb1c695af0.zip
junixsocket: Support Darwin
Patch borrowed from Rob Vermaas.
Diffstat (limited to 'pkgs/development')
-rw-r--r--pkgs/development/libraries/java/junixsocket/darwin.patch20
-rw-r--r--pkgs/development/libraries/java/junixsocket/default.nix14
2 files changed, 30 insertions, 4 deletions
diff --git a/pkgs/development/libraries/java/junixsocket/darwin.patch b/pkgs/development/libraries/java/junixsocket/darwin.patch
new file mode 100644
index 00000000000..97fd42d0b81
--- /dev/null
+++ b/pkgs/development/libraries/java/junixsocket/darwin.patch
@@ -0,0 +1,20 @@
+diff -rc junixsocket-1.3/src/main/org/newsclub/net/unix/NativeUnixSocket.java junixsocket-1.3-new/src/main/org/newsclub/net/unix/NativeUnixSocket.java
+*** junixsocket-1.3/src/main/org/newsclub/net/unix/NativeUnixSocket.java        Tue Jul 20 14:59:41 2010
+--- junixsocket-1.3-new/src/main/org/newsclub/net/unix/NativeUnixSocket.java    Sun May 27 22:26:15 2012
+***************
+*** 43,49 ****
+              String prefix = "lib";
+              String suffix = ".so";
+              String os = osName.replaceAll("[^A-Za-z0-9]", "").toLowerCase();
+!             if ("macosx".equals(os)) {
+                  suffix = ".dylib";
+              } else if ("linux".equals(os) || "freebsd".equals(os)
+                      || "sunos".equals(os)) {
+--- 43,49 ----
+              String prefix = "lib";
+              String suffix = ".so";
+              String os = osName.replaceAll("[^A-Za-z0-9]", "").toLowerCase();
+!             if ("macosx".equals(os) || "darwin".equals(os)) {
+                  suffix = ".dylib";
+              } else if ("linux".equals(os) || "freebsd".equals(os)
+                      || "sunos".equals(os)) {
diff --git a/pkgs/development/libraries/java/junixsocket/default.nix b/pkgs/development/libraries/java/junixsocket/default.nix
index 911cc6dd40d..e49e626aa00 100644
--- a/pkgs/development/libraries/java/junixsocket/default.nix
+++ b/pkgs/development/libraries/java/junixsocket/default.nix
@@ -8,11 +8,15 @@ stdenv.mkDerivation rec {
     sha256 = "0c6p8vmiv5nk8i6g1hgivnl3mpb2k3lhjjz0ss9dlirisfrxf1ym";
   };
 
+  patches = [ ./darwin.patch ];
+
   buildInputs = [ ant jdk junit ];
 
   preConfigure =
     ''
-      sed -i 's|/usr/bin/||' build.xml
+      substituteInPlace build.xml \
+        --replace /usr/bin/ "" \
+        --replace macosx darwin
       substituteInPlace src/main/org/newsclub/net/unix/NativeUnixSocketConfig.java \
         --replace /opt/newsclub/lib-native $out/lib
     '';
@@ -20,8 +24,10 @@ stdenv.mkDerivation rec {
   buildPhase = "ant";
 
   ANT_ARGS =
-    "-Dskip32=true -Dant.build.javac.source=1.6"
-    + stdenv.lib.optionalString stdenv.isDarwin " -DisMac=true";
+    # Note that our OpenJDK on Darwin is currently 32-bit, so we have to build a 32-bit dylib.
+    (if stdenv.is64bit && !stdenv.isDarwin then [ "-Dskip32=true" ] else [ "-Dskip64=true" ])
+    ++ [ "-Dgcc=cc" "-Dant.build.javac.source=1.6" ]
+    ++ stdenv.lib.optional stdenv.isDarwin "-DisMac=true";
 
   installPhase =
     ''
@@ -34,6 +40,6 @@ stdenv.mkDerivation rec {
     description = "A Java/JNI library for using Unix Domain Sockets from Java";
     homepage = https://code.google.com/p/junixsocket/;
     license = stdenv.lib.licenses.asl20;
-    platforms = stdenv.lib.platforms.linux;
+    platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
   };
 }