diff options
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/java/junixsocket')
-rw-r--r-- | nixpkgs/pkgs/development/libraries/java/junixsocket/darwin.patch | 20 | ||||
-rw-r--r-- | nixpkgs/pkgs/development/libraries/java/junixsocket/default.nix | 42 |
2 files changed, 62 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/java/junixsocket/darwin.patch b/nixpkgs/pkgs/development/libraries/java/junixsocket/darwin.patch new file mode 100644 index 000000000000..97fd42d0b81b --- /dev/null +++ b/nixpkgs/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/nixpkgs/pkgs/development/libraries/java/junixsocket/default.nix b/nixpkgs/pkgs/development/libraries/java/junixsocket/default.nix new file mode 100644 index 000000000000..7a7d6a933bc0 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/java/junixsocket/default.nix @@ -0,0 +1,42 @@ +{ lib, stdenv, fetchurl, ant, jdk, junit }: + +stdenv.mkDerivation rec { + name = "junixsocket-1.3"; + + src = fetchurl { + url = "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/junixsocket/${name}-src.tar.bz2"; + sha256 = "0c6p8vmiv5nk8i6g1hgivnl3mpb2k3lhjjz0ss9dlirisfrxf1ym"; + }; + + patches = [ ./darwin.patch ]; + + buildInputs = [ ant jdk junit ]; + + preConfigure = + '' + substituteInPlace src/main/org/newsclub/net/unix/NativeUnixSocketConfig.java \ + --replace /opt/newsclub/lib-native $out/lib + ''; + + buildPhase = "ant"; + + ANT_ARGS = + # Note that our OpenJDK on Darwin is currently 32-bit, so we have to build a 32-bit dylib. + (if stdenv.is64bit then [ "-Dskip32=true" ] else [ "-Dskip64=true" ]) + ++ [ "-Dgcc=cc" "-Dant.build.javac.source=1.6" ] + ++ lib.optional stdenv.isDarwin "-DisMac=true"; + + installPhase = + '' + mkdir -p $out/share/java $out/lib + cp -v dist/*.jar $out/share/java + cp -v lib-native/*.so lib-native/*.dylib $out/lib/ + ''; + + meta = { + description = "A Java/JNI library for using Unix Domain Sockets from Java"; + homepage = "https://github.com/kohlschutter/junixsocket"; + license = lib.licenses.asl20; + platforms = lib.platforms.linux ++ lib.platforms.darwin; + }; +} |