1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-21 13:10:33 +00:00

junixsocket: Support Darwin

Patch borrowed from Rob Vermaas.
This commit is contained in:
Eelco Dolstra 2014-01-28 11:56:14 +01:00
parent 5150dbfdbe
commit e5995e0703
2 changed files with 30 additions and 4 deletions

View file

@ -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)) {

View file

@ -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;
};
}