From 99ba14ee7a94d5f809d024e6fa4bfffba7984040 Mon Sep 17 00:00:00 2001
From: Moritz Maxeiner <moritz@ucworks.org>
Date: Tue, 4 Feb 2014 20:02:46 +0100
Subject: [PATCH 1/4] Add packages for libzdb, libsearpc, ccnet,
 seafile-shared, and seafile-client

---
 .../networking/seafile-client/default.nix     |  38 ++++++
 .../libraries/libsearpc/default.nix           |  31 +++++
 .../libraries/libsearpc/libsearpc.pc.patch    |  10 ++
 pkgs/development/libraries/libzdb/default.nix |  23 ++++
 ...Add-autoconfiguration-for-libjansson.patch | 121 ++++++++++++++++++
 pkgs/misc/seafile-shared/default.nix          |  42 ++++++
 ...Add-autoconfiguration-for-libjansson.patch |  72 +++++++++++
 pkgs/tools/networking/ccnet/default.nix       |  36 ++++++
 pkgs/tools/networking/ccnet/libccnet.pc.patch |  10 ++
 pkgs/top-level/all-packages.nix               |  10 ++
 10 files changed, 393 insertions(+)
 create mode 100644 pkgs/applications/networking/seafile-client/default.nix
 create mode 100644 pkgs/development/libraries/libsearpc/default.nix
 create mode 100644 pkgs/development/libraries/libsearpc/libsearpc.pc.patch
 create mode 100644 pkgs/development/libraries/libzdb/default.nix
 create mode 100644 pkgs/misc/seafile-shared/0003-Add-autoconfiguration-for-libjansson.patch
 create mode 100644 pkgs/misc/seafile-shared/default.nix
 create mode 100644 pkgs/tools/networking/ccnet/0001-Add-autoconfiguration-for-libjansson.patch
 create mode 100644 pkgs/tools/networking/ccnet/default.nix
 create mode 100644 pkgs/tools/networking/ccnet/libccnet.pc.patch

diff --git a/pkgs/applications/networking/seafile-client/default.nix b/pkgs/applications/networking/seafile-client/default.nix
new file mode 100644
index 000000000000..8640389f9d3b
--- /dev/null
+++ b/pkgs/applications/networking/seafile-client/default.nix
@@ -0,0 +1,38 @@
+{stdenv, fetchurl, writeScript, pkgconfig, cmake, qt4, seafileShared, ccnet, makeWrapper}:
+
+stdenv.mkDerivation rec
+{
+  version = "2.1.1";
+  name = "seafile-client-${version}";
+
+  src = fetchurl
+  {
+    url = "https://github.com/haiwen/seafile-client/archive/v${version}.tar.gz";
+    sha256 = "d98515ea229df702cbe973d85ec0bd5cf3f5282ef1022ba0157d5301b521c8e0";
+  };
+
+  buildInputs = [ pkgconfig cmake qt4 seafileShared makeWrapper ];
+
+  builder = writeScript "${name}-builder.sh" ''
+  source $stdenv/setup
+
+  tar xvfz $src
+  cd seafile-client-*
+
+  cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_SKIP_BUILD_RPATH=ON -DCMAKE_INSTALL_PREFIX="$out" .
+  make -j1
+
+  make install
+
+  wrapProgram $out/bin/seafile-applet \
+    --suffix PATH : ${ccnet}/bin:${seafileShared}/bin
+  '';
+
+  meta =
+  {
+    homepage = "https://github.com/haiwen/seafile-clients";
+    description = "Desktop client for Seafile, the Next-generation Open Source Cloud Storage";
+    license = stdenv.lib.licenses.asl20;
+    maintainers = [ stdenv.lib.maintainers.calrama ];
+  };
+}
diff --git a/pkgs/development/libraries/libsearpc/default.nix b/pkgs/development/libraries/libsearpc/default.nix
new file mode 100644
index 000000000000..b27519fa66c6
--- /dev/null
+++ b/pkgs/development/libraries/libsearpc/default.nix
@@ -0,0 +1,31 @@
+{stdenv, fetchurl, automake, autoconf, pkgconfig, libtool, python, pythonPackages, glib, jansson}:
+
+stdenv.mkDerivation rec
+{
+  version = "1.2.1";
+  seafileVersion = "2.1.1";
+  name = "libsearpc-${version}";
+
+  src = fetchurl
+  {
+    url = "https://github.com/haiwen/libsearpc/archive/v${seafileVersion}.tar.gz";
+    sha256 = "c0e7cc812c642ebb1339c3701570e78ff5b8c8aa2a521e5a505e28d9666e89ec";
+  };
+
+  patches = [ ./libsearpc.pc.patch ];
+
+  buildInputs = [ automake autoconf pkgconfig libtool python pythonPackages.simplejson ];
+  propagatedBuildInputs = [ glib jansson ];
+
+  preConfigure = "./autogen.sh";
+
+  buildPhase = "make -j1";
+
+  meta =
+  {
+    homepage = "https://github.com/haiwen/libsearpc";
+    description = "A simple and easy-to-use C language RPC framework (including both server side & client side) based on GObject System.";
+    license = stdenv.lib.licenses.lgpl3;
+    maintainers = [ stdenv.lib.maintainers.calrama ];
+  };
+}
\ No newline at end of file
diff --git a/pkgs/development/libraries/libsearpc/libsearpc.pc.patch b/pkgs/development/libraries/libsearpc/libsearpc.pc.patch
new file mode 100644
index 000000000000..6f30932ba6db
--- /dev/null
+++ b/pkgs/development/libraries/libsearpc/libsearpc.pc.patch
@@ -0,0 +1,10 @@
+From: Aaron Lindsay <aaron@aclindsay.com>
+
+--- a/libsearpc.pc.in	2013-01-10 01:35:24.000000000 -0500
++++ b/libsearpc.pc.in	2013-01-19 11:31:50.479301798 -0500
+@@ -1,4 +1,4 @@
+-prefix=(DESTDIR)@prefix@
++prefix=@prefix@
+ exec_prefix=@exec_prefix@
+ libdir=@libdir@
+ includedir=@includedir@
diff --git a/pkgs/development/libraries/libzdb/default.nix b/pkgs/development/libraries/libzdb/default.nix
new file mode 100644
index 000000000000..25eef6c7a990
--- /dev/null
+++ b/pkgs/development/libraries/libzdb/default.nix
@@ -0,0 +1,23 @@
+{stdenv, fetchurl, sqlite}:
+
+stdenv.mkDerivation rec
+{
+  version = "3.0";
+  name = "libzdb-${version}";
+
+  src = fetchurl
+  {
+    url = "http://www.tildeslash.com/libzdb/dist/libzdb-${version}.tar.gz";
+    sha256 = "e334bcb9ca1410e863634a164e3b1b5784018eb6e90b6c2b527780fc29a123c8";
+  };
+
+  buildInputs = [ sqlite ];
+
+  meta =
+  {
+    homepage = "http://www.tildeslash.com/libzdb/";
+    description = "A small, easy to use Open Source Database Connection Pool Library.";
+    license = stdenv.lib.licenses.gpl3;
+    maintainers = [ stdenv.lib.maintainers.calrama ];
+  };
+}
\ No newline at end of file
diff --git a/pkgs/misc/seafile-shared/0003-Add-autoconfiguration-for-libjansson.patch b/pkgs/misc/seafile-shared/0003-Add-autoconfiguration-for-libjansson.patch
new file mode 100644
index 000000000000..7966d1e683b9
--- /dev/null
+++ b/pkgs/misc/seafile-shared/0003-Add-autoconfiguration-for-libjansson.patch
@@ -0,0 +1,121 @@
+diff -r -u a/app/Makefile.am b/app/Makefile.am
+--- a/app/Makefile.am	2014-01-10 11:38:46.000000000 +0100
++++ b/app/Makefile.am	2014-01-16 14:22:24.584094619 +0100
+@@ -21,7 +21,7 @@
+ seafile_LDADD =  @CCNET_LIBS@ \
+ 	$(top_builddir)/lib/libseafile.la \
+ 	$(top_builddir)/lib/libseafile_common.la \
+-	@SEARPC_LIBS@ \
++	@SEARPC_LIBS@ @JANSSON_LIBS@ \
+ 	@GLIB2_LIBS@  @GOBJECT_LIBS@ -lssl @LIB_RT@ @LIB_UUID@ -lsqlite3
+ 
+ seafile_LDFALGS = @STATIC_COMPILE@ @CONSOLE@
+@@ -29,7 +29,7 @@
+ if COMPILE_SERVER
+ seafserv_tool_SOURCES = seafserv-tool.c
+ seafserv_tool_LDADD =  @CCNET_LIBS@ \
+-	$(top_builddir)/lib/libseafile.la @SEARPC_LIBS@ \
++	$(top_builddir)/lib/libseafile.la @SEARPC_LIBS@ @JANSSON_LIBS@ \
+ 	@GLIB2_LIBS@  @GOBJECT_LIBS@ -lssl @LIB_RT@ @LIB_UUID@ -lsqlite3
+ 
+ seafserv_tool_LDFLAGS = @STATIC_COMPILE@ @CONSOLE@ @SERVER_PKG_RPATH@
+diff -r -u a/configure.ac b/configure.ac
+--- a/configure.ac	2014-01-10 11:38:46.000000000 +0100
++++ b/configure.ac	2014-01-16 14:22:24.584094619 +0100
+@@ -233,6 +233,7 @@
+ GLIB_REQUIRED=2.16.0
+ CCNET_REQUIRED=0.9.3
+ SEARPC_REQUIRED=1.0
++JANSSON_REQUIRED=2.2.1
+ ZDB_REQUIRED=2.10
+ #LIBNAUTILUS_EXTENSION_REQUIRED=2.30.1
+ CURL_REQUIRED=7.17
+@@ -254,6 +255,11 @@
+ AC_SUBST(SEARPC_CFLAGS)
+ AC_SUBST(SEARPC_LIBS)
+ 
++PKG_CHECK_MODULES(JANSSON, [jansson >= $JANSSON_REQUIRED])
++AC_SUBST(JANSSON_CFLAGS)
++AC_SUBST(JANSSON_LIBS)
++
++
+ PKG_CHECK_MODULES(LIBEVENT, [libevent >= $LIBEVENT_REQUIRED])
+ AC_SUBST(LIBEVENT_CFLAGS)
+ AC_SUBST(LIBEVENT_LIBS)
+diff -r -u a/daemon/Makefile.am b/daemon/Makefile.am
+--- a/daemon/Makefile.am	2014-01-10 11:38:46.000000000 +0100
++++ b/daemon/Makefile.am	2014-01-16 14:22:24.587427993 +0100
+@@ -139,7 +139,7 @@
+ 	@GLIB2_LIBS@  @GOBJECT_LIBS@ -lssl @LIB_RT@ @LIB_UUID@ -lsqlite3 -levent \
+ 	$(top_builddir)/common/cdc/libcdc.la \
+ 	$(top_builddir)/common/index/libindex.la ${LIB_WS32} \
+-	@SEARPC_LIBS@ @CCNET_LIBS@ @GNOME_KEYRING_LIBS@
++	@SEARPC_LIBS@ @CCNET_LIBS@ @GNOME_KEYRING_LIBS@ @JANSSON_LIBS@
+ 
+ seaf_daemon_LDFLAGS = @STATIC_COMPILE@ @CONSOLE@
+ 
+diff -r -u a/server/gc/Makefile.am b/server/gc/Makefile.am
+--- a/server/gc/Makefile.am	2014-01-10 11:38:46.000000000 +0100
++++ b/server/gc/Makefile.am	2014-01-16 14:23:20.991449822 +0100
+@@ -50,7 +50,7 @@
+ 	$(top_builddir)/common/cdc/libcdc.la \
+ 	$(top_builddir)/lib/libseafile_common.la \
+ 	@GLIB2_LIBS@ @GOBJECT_LIBS@ -lssl @LIB_RT@ @LIB_UUID@ -lsqlite3 -levent \
+-	@SEARPC_LIBS@ @ZDB_LIBS@ @CURL_LIBS@ ${LIB_WS32}
++	@SEARPC_LIBS@ @JANSSON_LIBS@ @ZDB_LIBS@ @CURL_LIBS@ ${LIB_WS32}
+ 
+ seafserv_gc_LDFLAGS = @STATIC_COMPILE@ @SERVER_PKG_RPATH@
+ 
+@@ -63,6 +63,6 @@
+ 	$(top_builddir)/common/cdc/libcdc.la \
+ 	$(top_builddir)/lib/libseafile_common.la \
+ 	@GLIB2_LIBS@ @GOBJECT_LIBS@ -lssl @LIB_RT@ @LIB_UUID@ -lsqlite3 -levent \
+-	@SEARPC_LIBS@ @ZDB_LIBS@ @CURL_LIBS@ ${LIB_WS32}
++	@SEARPC_LIBS@ @JANSSON_LIBS@ @ZDB_LIBS@ @CURL_LIBS@ ${LIB_WS32}
+ 
+ seaf_fsck_LDFLAGS = @STATIC_COMPILE@ @SERVER_PKG_RPATH@
+diff -r -u a/server/Makefile.am b/server/Makefile.am
+--- a/server/Makefile.am	2014-01-10 11:38:46.000000000 +0100
++++ b/server/Makefile.am	2014-01-16 14:23:40.498354610 +0100
+@@ -99,6 +99,6 @@
+ 	$(top_builddir)/common/index/libindex.la \
+ 	@GLIB2_LIBS@ @GOBJECT_LIBS@ -lssl @LIB_RT@ @LIB_UUID@ -lsqlite3 -levent \
+ 	$(top_builddir)/common/cdc/libcdc.la \
+-	@SEARPC_LIBS@ @ZDB_LIBS@ @CURL_LIBS@ ${LIB_WS32}
++	@SEARPC_LIBS@ @JANSSON_LIBS@ @ZDB_LIBS@ @CURL_LIBS@ ${LIB_WS32}
+ 
+ seaf_server_LDFLAGS = @STATIC_COMPILE@ @SERVER_PKG_RPATH@
+diff -r -u a/httpserver/Makefile.am b/httpserver/Makefile.am
+--- a/httpserver/Makefile.am	2014-01-10 11:38:46.000000000 +0100
++++ b/httpserver/Makefile.am	2014-01-16 14:26:48.673985279 +0100
+@@ -50,7 +50,7 @@
+ 	@CCNET_LIBS@ \
+ 	$(top_builddir)/lib/libseafile.la \
+ 	$(top_builddir)/common/cdc/libcdc.la \
+-	@SEARPC_LIBS@ @ZDB_LIBS@ @CURL_LIBS@ \
++	@SEARPC_LIBS@ @JANSSON_LIBS@ @ZDB_LIBS@ @CURL_LIBS@ \
+ 	@LIBARCHIVE_LIBS@ ${LIB_WS32}
+ 
+ httpserver_LDFLAGS = @STATIC_COMPILE@
+diff -r -u a/controller/Makefile.am b/controller/Makefile.am
+--- a/controller/Makefile.am	2014-01-10 11:38:46.000000000 +0100
++++ b/controller/Makefile.am	2014-01-16 14:29:42.076102675 +0100
+@@ -18,6 +18,6 @@
+ seafile_controller_LDADD = @CCNET_LIBS@ \
+ 	$(top_builddir)/lib/libseafile_common.la \
+ 	@GLIB2_LIBS@  @GOBJECT_LIBS@ -lssl @LIB_RT@ @LIB_UUID@ -levent \
+-	@SEARPC_LIBS@
++	@SEARPC_LIBS@ @JANSSON_LIBS@
+ 
+ seafile_controller_LDFLAGS = @STATIC_COMPILE@ @SERVER_PKG_RPATH@
+diff -r -u a/fuse/Makefile.am b/fuse/Makefile.am
+--- a/fuse/Makefile.am	2014-01-10 11:38:46.000000000 +0100
++++ b/fuse/Makefile.am	2014-01-16 14:31:44.764267711 +0100
+@@ -43,6 +43,6 @@
+ 				  @GLIB2_LIBS@ @GOBJECT_LIBS@ -lssl @LIB_RT@ @LIB_UUID@ \
+                   -lsqlite3 -levent \
+ 				  $(top_builddir)/common/cdc/libcdc.la \
+-				  @SEARPC_LIBS@ @ZDB_LIBS@ @FUSE_LIBS@
++				  @SEARPC_LIBS@ @JANSSON_LIBS@ @ZDB_LIBS@ @FUSE_LIBS@
+ 
+ seaf_fuse_LDFLAGS = @STATIC_COMPILE@ @SERVER_PKG_RPATH@
diff --git a/pkgs/misc/seafile-shared/default.nix b/pkgs/misc/seafile-shared/default.nix
new file mode 100644
index 000000000000..f392e9ece7ae
--- /dev/null
+++ b/pkgs/misc/seafile-shared/default.nix
@@ -0,0 +1,42 @@
+{stdenv, fetchurl, which, automake, autoconf, pkgconfig, libtool, vala, python, intltool, fuse, ccnet}:
+
+stdenv.mkDerivation rec
+{
+  version = "2.1.1";
+  name = "seafile-shared-${version}";
+
+  src = fetchurl
+  {
+    url = "https://github.com/haiwen/seafile/archive/v${version}.tar.gz";
+    sha256 = "f07b09ab1eb1cb33f92cee74e499d0350941624396910a4c1a7d79abb45acaa6";
+  };
+
+  patches = [ ./0003-Add-autoconfiguration-for-libjansson.patch ];
+
+  buildInputs = [ which automake autoconf pkgconfig libtool vala python intltool fuse ];
+  propagatedBuildInputs = [ ccnet ];
+
+  preConfigure = ''
+  sed -ie 's|/bin/bash|/bin/sh|g' ./autogen.sh
+  ./autogen.sh
+  '';
+
+  configureFlags = "--disable-server --disable-console";
+
+  buildPhase = "make -j1";
+
+  postInstall = ''
+  # Remove seafile binary
+  rm -rf "$out/bin/seafile"
+  # Remove cli client binary
+  rm -rf "$out/bin/seaf-cli"
+  '';
+
+  meta =
+  {
+    homepage = "https://github.com/haiwen/seafile";
+    description = "Shared components of Seafile: seafile-daemon, libseafile, libseafile python bindings, manuals, and icons";
+    license = stdenv.lib.licenses.gpl3;
+    maintainers = [ stdenv.lib.maintainers.calrama ];
+  };
+}
diff --git a/pkgs/tools/networking/ccnet/0001-Add-autoconfiguration-for-libjansson.patch b/pkgs/tools/networking/ccnet/0001-Add-autoconfiguration-for-libjansson.patch
new file mode 100644
index 000000000000..83cdbad7bbac
--- /dev/null
+++ b/pkgs/tools/networking/ccnet/0001-Add-autoconfiguration-for-libjansson.patch
@@ -0,0 +1,72 @@
+From f730ba82d641029dd262d05e8533fc7643f4c4b9 Mon Sep 17 00:00:00 2001
+From: Aaron Lindsay <aaron@aclindsay.com>
+Date: Wed, 15 Jan 2014 13:49:40 -0500
+Subject: [PATCH] Add autoconfiguration for libjansson
+
+---
+ configure.ac           | 5 +++++
+ net/daemon/Makefile.am | 4 ++--
+ net/server/Makefile.am | 2 +-
+ 3 files changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 64e74b5..0911671 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -248,6 +248,7 @@ SEARPC_REQUIRED=1.0
+ ZDB_REQUIRED=2.10
+ LIBNAUTILUS_EXTENSION_REQUIRED=2.30.1
+ SEARPC_REQUIRED=1.0
++JANSSON_REQUIRED=2.2.1
+ CURL_REQUIRED=7.17
+ 
+ PKG_CHECK_MODULES(GLIB2, [glib-2.0 >= $GLIB_REQUIRED])
+@@ -262,6 +263,10 @@ PKG_CHECK_MODULES(SEARPC, [libsearpc >= $SEARPC_REQUIRED])
+ AC_SUBST(SEARPC_CFLAGS)
+ AC_SUBST(SEARPC_LIBS)
+ 
++PKG_CHECK_MODULES(JANSSON, [jansson >= $JANSSON_REQUIRED])
++AC_SUBST(JANSSON_CFLAGS)
++AC_SUBST(JANSSON_LIBS)
++
+ if test x${compile_python} = xyes; then
+    AM_PATH_PYTHON([2.6])
+ 
+diff --git a/net/daemon/Makefile.am b/net/daemon/Makefile.am
+index 35d1a3c..0e28c6a 100644
+--- a/net/daemon/Makefile.am
++++ b/net/daemon/Makefile.am
+@@ -95,7 +95,7 @@ ccnet_SOURCES = ccnet-daemon.c \
+ 
+ ccnet_LDADD = -levent $(top_builddir)/lib/libccnetd.la \
+            @GLIB2_LIBS@ @GOBJECT_LIBS@ -lssl @LIB_RT@ @LIB_UUID@ -lsqlite3 \
+-           @LIB_WS32@ @LIB_INTL@ @LIB_IPHLPAPI@ @SEARPC_LIBS@
++           @LIB_WS32@ @LIB_INTL@ @LIB_IPHLPAPI@ @SEARPC_LIBS@ @JANSSON_LIBS@
+ 
+ 
+ ccnet_LDFLAGS = @STATIC_COMPILE@ @CONSOLE@ @SERVER_PKG_RPATH@ -no-undefined
+@@ -106,7 +106,7 @@ ccnet_test_SOURCES = ccnet-test.c daemon-session.c $(common_srcs)
+ 
+ ccnet_test_LDADD = -levent $(top_builddir)/lib/libccnetd.la \
+ 	@GLIB2_LIBS@ @GOBJECT_LIBS@  -lssl @LIB_RT@ @LIB_UUID@ -lsqlite3 \
+-	@LIB_WS32@ @LIB_INTL@ @LIB_IPHLPAPI@ @SEARPC_LIBS@
++	@LIB_WS32@ @LIB_INTL@ @LIB_IPHLPAPI@ @SEARPC_LIBS@ @JANSSON_LIBS@
+ 
+ ccnet_test_LDFLAGS = @STATIC_COMPILE@ -no-undefined @CONSOLE@
+ 
+diff --git a/net/server/Makefile.am b/net/server/Makefile.am
+index d587f48..b048936 100644
+--- a/net/server/Makefile.am
++++ b/net/server/Makefile.am
+@@ -103,7 +103,7 @@ ccnet_server_LDADD = -levent $(top_builddir)/lib/libccnetd.la \
+            @GLIB2_LIBS@ @GOBJECT_LIBS@ -lssl @LIB_RT@ @LIB_UUID@ -lsqlite3 \
+ 	       -lpthread \
+            @LIB_WS32@ @LIB_INTL@ @LIB_IPHLPAPI@ @SEARPC_LIBS@ @ZDB_LIBS@ \
+-	  	   @LDAP_LIBS@
++	  	   @LDAP_LIBS@ @JANSSON_LIBS@
+ 
+ 
+ ccnet_server_LDFLAGS = @STATIC_COMPILE@ @CONSOLE@ @SERVER_PKG_RPATH@ -no-undefined
+-- 
+1.8.5.2
+
diff --git a/pkgs/tools/networking/ccnet/default.nix b/pkgs/tools/networking/ccnet/default.nix
new file mode 100644
index 000000000000..95479b8598e9
--- /dev/null
+++ b/pkgs/tools/networking/ccnet/default.nix
@@ -0,0 +1,36 @@
+{stdenv, fetchurl, which, automake, autoconf, pkgconfig, libtool, vala, python, libsearpc, libzdb, libuuid, libevent, sqlite, openssl}:
+
+stdenv.mkDerivation rec
+{
+  version = "1.4.0";
+  seafileVersion = "2.1.1";
+  name = "ccnet-${version}";
+
+  src = fetchurl
+  {
+    url = "https://github.com/haiwen/ccnet/archive/v${seafileVersion}.tar.gz";
+    sha256 = "6882eb1a3066897e4f91fb60a3405b3f58b4b794334deaca73617003f77a7eb0";
+  };
+
+  patches = [ ./libccnet.pc.patch ./0001-Add-autoconfiguration-for-libjansson.patch ];
+
+  buildInputs = [ which automake autoconf pkgconfig libtool vala  python ];
+  propagatedBuildInputs = [ libsearpc libzdb libuuid libevent sqlite openssl ];
+
+  preConfigure = ''
+  sed -ie 's|/bin/bash|/bin/sh|g' ./autogen.sh
+  ./autogen.sh
+  '';
+
+  configureFlags = "--enable-server";
+
+  buildPhase = "make -j1";
+
+  meta =
+  {
+    homepage = "https://github.com/haiwen/ccnet";
+    description = "A framework for writing networked applications in C.";
+    license = stdenv.lib.licenses.gpl3Plus;
+    maintainers = [ stdenv.lib.maintainers.calrama ];
+  };
+}
diff --git a/pkgs/tools/networking/ccnet/libccnet.pc.patch b/pkgs/tools/networking/ccnet/libccnet.pc.patch
new file mode 100644
index 000000000000..0d9fea552bcd
--- /dev/null
+++ b/pkgs/tools/networking/ccnet/libccnet.pc.patch
@@ -0,0 +1,10 @@
+From: Aaron Lindsay <aaron@aclindsay.com>
+
+--- a/libccnet.pc.in	2013-01-10 01:35:24.000000000 -0500
++++ b/libccnet.pc.in	2013-01-19 11:31:50.479301798 -0500
+@@ -1,4 +1,4 @@
+-prefix=(DESTDIR)@prefix@
++prefix=@prefix@
+ exec_prefix=@exec_prefix@
+ libdir=@libdir@
+ includedir=@includedir@
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index bbae9a7946e7..19261ef2fe18 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -562,6 +562,8 @@ let
 
   catdoc = callPackage ../tools/text/catdoc { };
 
+  ccnet = callPackage ../tools/networking/ccnet { };
+
   ditaa = callPackage ../tools/graphics/ditaa { };
 
   direnv = callPackage ../tools/misc/direnv { };
@@ -4943,6 +4945,8 @@ let
 
   librsync = callPackage ../development/libraries/librsync { };
 
+  libsearpc = callPackage ../development/libraries/libsearpc { };
+
   libsigcxx = callPackage ../development/libraries/libsigcxx { };
 
   libsigcxx12 = callPackage ../development/libraries/libsigcxx/1.2.nix { };
@@ -5101,6 +5105,8 @@ let
 
   libzip = callPackage ../development/libraries/libzip { };
 
+  libzdb = callPackage ../development/libraries/libzdb { };
+
   libzrtpcpp = callPackage ../development/libraries/libzrtpcpp { };
   libzrtpcpp_1_6 = callPackage ../development/libraries/libzrtpcpp/1.6.nix {
     ccrtp = ccrtp_1_8;
@@ -8706,6 +8712,8 @@ let
     inherit (gnome) libart_lgpl;
   };
 
+  seafileClient = callPackage ../applications/networking/seafile-client { };
+
   seeks = callPackage ../tools/networking/p2p/seeks {
     opencv = opencv_2_1;
   };
@@ -10227,6 +10235,8 @@ let
 
   saneFrontends = callPackage ../applications/graphics/sane/frontends.nix { };
 
+  seafileShared = callPackage ../misc/seafile-shared { };
+
   slock = callPackage ../misc/screensavers/slock { };
 
   sourceAndTags = import ../misc/source-and-tags {

From 3d7010b5b70cf9008da986874a76231a37708ffb Mon Sep 17 00:00:00 2001
From: Moritz Maxeiner <moritz@ucworks.org>
Date: Wed, 5 Feb 2014 18:25:43 +0100
Subject: [PATCH 2/4] Dashify seafileShared and seafileClient

---
 pkgs/applications/networking/seafile-client/default.nix | 6 +++---
 pkgs/top-level/all-packages.nix                         | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/pkgs/applications/networking/seafile-client/default.nix b/pkgs/applications/networking/seafile-client/default.nix
index 8640389f9d3b..82e5d08da413 100644
--- a/pkgs/applications/networking/seafile-client/default.nix
+++ b/pkgs/applications/networking/seafile-client/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, writeScript, pkgconfig, cmake, qt4, seafileShared, ccnet, makeWrapper}:
+{stdenv, fetchurl, writeScript, pkgconfig, cmake, qt4, seafile-shared, ccnet, makeWrapper}:
 
 stdenv.mkDerivation rec
 {
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec
     sha256 = "d98515ea229df702cbe973d85ec0bd5cf3f5282ef1022ba0157d5301b521c8e0";
   };
 
-  buildInputs = [ pkgconfig cmake qt4 seafileShared makeWrapper ];
+  buildInputs = [ pkgconfig cmake qt4 seafile-shared makeWrapper ];
 
   builder = writeScript "${name}-builder.sh" ''
   source $stdenv/setup
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec
   make install
 
   wrapProgram $out/bin/seafile-applet \
-    --suffix PATH : ${ccnet}/bin:${seafileShared}/bin
+    --suffix PATH : ${ccnet}/bin:${seafile-shared}/bin
   '';
 
   meta =
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 19261ef2fe18..7425338225f5 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -8712,7 +8712,7 @@ let
     inherit (gnome) libart_lgpl;
   };
 
-  seafileClient = callPackage ../applications/networking/seafile-client { };
+  seafile-client = callPackage ../applications/networking/seafile-client { };
 
   seeks = callPackage ../tools/networking/p2p/seeks {
     opencv = opencv_2_1;
@@ -10235,7 +10235,7 @@ let
 
   saneFrontends = callPackage ../applications/graphics/sane/frontends.nix { };
 
-  seafileShared = callPackage ../misc/seafile-shared { };
+  seafile-shared = callPackage ../misc/seafile-shared { };
 
   slock = callPackage ../misc/screensavers/slock { };
 

From 0fef1c502b3de6e28596308e5e6208a8ea1e3f71 Mon Sep 17 00:00:00 2001
From: Moritz Maxeiner <moritz@ucworks.org>
Date: Fri, 28 Feb 2014 17:06:18 +0100
Subject: [PATCH 3/4] Add indentation for multi-line strings in seafile-client
 expression

---
 .../networking/seafile-client/default.nix      | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/pkgs/applications/networking/seafile-client/default.nix b/pkgs/applications/networking/seafile-client/default.nix
index 82e5d08da413..4ab0a9f80690 100644
--- a/pkgs/applications/networking/seafile-client/default.nix
+++ b/pkgs/applications/networking/seafile-client/default.nix
@@ -14,19 +14,19 @@ stdenv.mkDerivation rec
   buildInputs = [ pkgconfig cmake qt4 seafile-shared makeWrapper ];
 
   builder = writeScript "${name}-builder.sh" ''
-  source $stdenv/setup
+    source $stdenv/setup
 
-  tar xvfz $src
-  cd seafile-client-*
+    tar xvfz $src
+    cd seafile-client-*
 
-  cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_SKIP_BUILD_RPATH=ON -DCMAKE_INSTALL_PREFIX="$out" .
-  make -j1
+    cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_SKIP_BUILD_RPATH=ON -DCMAKE_INSTALL_PREFIX="$out" .
+    make -j1
 
-  make install
+    make install
 
-  wrapProgram $out/bin/seafile-applet \
-    --suffix PATH : ${ccnet}/bin:${seafile-shared}/bin
-  '';
+    wrapProgram $out/bin/seafile-applet \
+      --suffix PATH : ${ccnet}/bin:${seafile-shared}/bin
+    '';
 
   meta =
   {

From 997fffb54e9fa969db9e3a31e8aece744016312d Mon Sep 17 00:00:00 2001
From: Moritz Maxeiner <moritz@ucworks.org>
Date: Fri, 28 Feb 2014 17:10:43 +0100
Subject: [PATCH 4/4] Set meta.platforms attribute to platforms.linux for
 Seafile packages and their prerequisites

---
 pkgs/applications/networking/seafile-client/default.nix | 1 +
 pkgs/development/libraries/libsearpc/default.nix        | 1 +
 pkgs/development/libraries/libzdb/default.nix           | 1 +
 pkgs/misc/seafile-shared/default.nix                    | 1 +
 pkgs/tools/networking/ccnet/default.nix                 | 1 +
 5 files changed, 5 insertions(+)

diff --git a/pkgs/applications/networking/seafile-client/default.nix b/pkgs/applications/networking/seafile-client/default.nix
index 4ab0a9f80690..d24437aabb6b 100644
--- a/pkgs/applications/networking/seafile-client/default.nix
+++ b/pkgs/applications/networking/seafile-client/default.nix
@@ -33,6 +33,7 @@ stdenv.mkDerivation rec
     homepage = "https://github.com/haiwen/seafile-clients";
     description = "Desktop client for Seafile, the Next-generation Open Source Cloud Storage";
     license = stdenv.lib.licenses.asl20;
+    platforms = stdenv.lib.platforms.linux;
     maintainers = [ stdenv.lib.maintainers.calrama ];
   };
 }
diff --git a/pkgs/development/libraries/libsearpc/default.nix b/pkgs/development/libraries/libsearpc/default.nix
index b27519fa66c6..863a42b741ba 100644
--- a/pkgs/development/libraries/libsearpc/default.nix
+++ b/pkgs/development/libraries/libsearpc/default.nix
@@ -26,6 +26,7 @@ stdenv.mkDerivation rec
     homepage = "https://github.com/haiwen/libsearpc";
     description = "A simple and easy-to-use C language RPC framework (including both server side & client side) based on GObject System.";
     license = stdenv.lib.licenses.lgpl3;
+    platforms = stdenv.lib.platforms.linux;
     maintainers = [ stdenv.lib.maintainers.calrama ];
   };
 }
\ No newline at end of file
diff --git a/pkgs/development/libraries/libzdb/default.nix b/pkgs/development/libraries/libzdb/default.nix
index 25eef6c7a990..90692569f089 100644
--- a/pkgs/development/libraries/libzdb/default.nix
+++ b/pkgs/development/libraries/libzdb/default.nix
@@ -18,6 +18,7 @@ stdenv.mkDerivation rec
     homepage = "http://www.tildeslash.com/libzdb/";
     description = "A small, easy to use Open Source Database Connection Pool Library.";
     license = stdenv.lib.licenses.gpl3;
+    platforms = stdenv.lib.platforms.linux;
     maintainers = [ stdenv.lib.maintainers.calrama ];
   };
 }
\ No newline at end of file
diff --git a/pkgs/misc/seafile-shared/default.nix b/pkgs/misc/seafile-shared/default.nix
index f392e9ece7ae..53092e3a8b74 100644
--- a/pkgs/misc/seafile-shared/default.nix
+++ b/pkgs/misc/seafile-shared/default.nix
@@ -37,6 +37,7 @@ stdenv.mkDerivation rec
     homepage = "https://github.com/haiwen/seafile";
     description = "Shared components of Seafile: seafile-daemon, libseafile, libseafile python bindings, manuals, and icons";
     license = stdenv.lib.licenses.gpl3;
+    platforms = stdenv.lib.platforms.linux;
     maintainers = [ stdenv.lib.maintainers.calrama ];
   };
 }
diff --git a/pkgs/tools/networking/ccnet/default.nix b/pkgs/tools/networking/ccnet/default.nix
index 95479b8598e9..14b88ddafe84 100644
--- a/pkgs/tools/networking/ccnet/default.nix
+++ b/pkgs/tools/networking/ccnet/default.nix
@@ -31,6 +31,7 @@ stdenv.mkDerivation rec
     homepage = "https://github.com/haiwen/ccnet";
     description = "A framework for writing networked applications in C.";
     license = stdenv.lib.licenses.gpl3Plus;
+    platforms = stdenv.lib.platforms.linux;
     maintainers = [ stdenv.lib.maintainers.calrama ];
   };
 }