summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2008-08-24 18:48:09 +0000
committerLudovic Courtès <ludo@gnu.org>2008-08-24 18:48:09 +0000
commiteddce10d13f29eb55bbce4910a21683e5bc7e3ea (patch)
treed8bdc4eed21058f4be53db0c422578fdcf02626a
parenta5deaa8e0779c2043f87b5885a7c48437346e1ea (diff)
downloadnixpkgs-eddce10d13f29eb55bbce4910a21683e5bc7e3ea.tar
nixpkgs-eddce10d13f29eb55bbce4910a21683e5bc7e3ea.tar.gz
nixpkgs-eddce10d13f29eb55bbce4910a21683e5bc7e3ea.tar.bz2
nixpkgs-eddce10d13f29eb55bbce4910a21683e5bc7e3ea.tar.lz
nixpkgs-eddce10d13f29eb55bbce4910a21683e5bc7e3ea.tar.xz
nixpkgs-eddce10d13f29eb55bbce4910a21683e5bc7e3ea.tar.zst
nixpkgs-eddce10d13f29eb55bbce4910a21683e5bc7e3ea.zip
Add GNUnet, GNU's anonymous peer-to-peer communication framework.
svn path=/nixpkgs/trunk/; revision=12699
-rw-r--r--pkgs/applications/networking/p2p/gnunet/daemontest.patch14
-rw-r--r--pkgs/applications/networking/p2p/gnunet/default.nix71
-rw-r--r--pkgs/applications/networking/p2p/gnunet/disable-broken-tests.patch52
-rw-r--r--pkgs/applications/networking/p2p/gnunet/disable-http-tests.patch17
-rw-r--r--pkgs/applications/networking/p2p/gnunet/identity-test.patch19
-rw-r--r--pkgs/applications/networking/p2p/gnunet/session-tests.patch17
-rw-r--r--pkgs/applications/networking/p2p/gnunet/tmpdir.patch93
-rw-r--r--pkgs/top-level/all-packages.nix8
8 files changed, 291 insertions, 0 deletions
diff --git a/pkgs/applications/networking/p2p/gnunet/daemontest.patch b/pkgs/applications/networking/p2p/gnunet/daemontest.patch
new file mode 100644
index 00000000000..5c54bb72cba
--- /dev/null
+++ b/pkgs/applications/networking/p2p/gnunet/daemontest.patch
@@ -0,0 +1,14 @@
+Don't run `daemontest' since it probably can't be run within the chroot
+and all.
+
+--- GNUnet-0.8.0b/src/util/os/Makefile.in	2008-08-16 02:02:23.000000000 +0200
++++ GNUnet-0.8.0b/src/util/os/Makefile.in	2008-08-23 00:39:42.000000000 +0200
+@@ -37,7 +37,7 @@ NORMAL_UNINSTALL = :
+ PRE_UNINSTALL = :
+ POST_UNINSTALL = :
+ host_triplet = @host@
+-check_PROGRAMS = daemontest$(EXEEXT) semaphoretest$(EXEEXT) \
++check_PROGRAMS = semaphoretest$(EXEEXT) \
+ 	statuscallstest$(EXEEXT)
+ subdir = src/util/os
+ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
diff --git a/pkgs/applications/networking/p2p/gnunet/default.nix b/pkgs/applications/networking/p2p/gnunet/default.nix
new file mode 100644
index 00000000000..015f52d4ed9
--- /dev/null
+++ b/pkgs/applications/networking/p2p/gnunet/default.nix
@@ -0,0 +1,71 @@
+{ stdenv, fetchurl, libextractor, libmicrohttpd, libgcrypt
+, zlib, gmp, curl, libtool, guile, adns, sqlite, pkgconfig
+, libxml2, ncurses, gettext, findutils
+, gtkSupport ? false, gtk ? null, libglade ? null }:
+
+assert gtkSupport -> (gtk != null) && (libglade != null);
+
+let version = "0.8.0b";
+in
+  stdenv.mkDerivation {
+    name = "gnunet-${version}";
+
+    src = fetchurl {
+      url = "http://gnunet.org/download/GNUnet-${version}.tar.bz2";
+      sha256 = "1d1abnfqbd1f8pjzq9p0za7jyy2lay7k8l09xadk83k8d96abwcs";
+    };
+
+    configureFlags = ''
+      --without-included-ltdl --disable-ltdl-install --with-ltdl-include=${libtool}/include --with-ltdl-lib=${libtool}/lib
+    '';
+
+    buildInputs = [
+      libextractor libmicrohttpd libgcrypt gmp curl libtool
+      zlib guile adns sqlite libxml2 ncurses
+      pkgconfig gettext findutils
+    ] ++ (if gtkSupport then [ gtk libglade ] else []);
+
+    patches = [
+      ./daemontest.patch ./tmpdir.patch
+      ./identity-test.patch ./session-tests.patch
+      ./disable-http-tests.patch
+      ./disable-broken-tests.patch
+    ];
+
+    preConfigure = ''
+      # Brute force: make sure the tests don't rely on `/tmp', for
+      # the sake of chroot builds.
+      for i in $(find . \( -iname \*test\*.c -or -name \*.conf \) \
+                      -exec grep -l /tmp {} \;)
+      do
+        echo "$i: replacing references to \`/tmp' by \`$TMPDIR'..."
+        substituteInPlace "$i" --replace "/tmp" "$TMPDIR"
+      done
+    '';
+
+    # FIXME: Re-enable tests when they are less broken.
+    doCheck = false;
+
+    meta = {
+      description = "GNUnet, GNU's decentralized anonymous and censorship-resistant P2P framework";
+
+      longDescription = ''
+        GNUnet is a framework for secure peer-to-peer networking that
+        does not use any centralized or otherwise trusted services.  A
+        first service implemented on top of the networking layer
+        allows anonymous censorship-resistant file-sharing.  Anonymity
+        is provided by making messages originating from a peer
+        indistinguishable from messages that the peer is routing.  All
+        peers act as routers and use link-encrypted connections with
+        stable bandwidth utilization to communicate with each other.
+        GNUnet uses a simple, excess-based economic model to allocate
+        resources.  Peers in GNUnet monitor each others behavior with
+        respect to resource usage; peers that contribute to the
+        network are rewarded with better service.
+      '';
+
+      homepage = http://gnunet.org/;
+
+      license = "GPLv2+";
+    };
+  }
diff --git a/pkgs/applications/networking/p2p/gnunet/disable-broken-tests.patch b/pkgs/applications/networking/p2p/gnunet/disable-broken-tests.patch
new file mode 100644
index 00000000000..b17fb81657c
--- /dev/null
+++ b/pkgs/applications/networking/p2p/gnunet/disable-broken-tests.patch
@@ -0,0 +1,52 @@
+This patch disables tests that appear to be broken or cannot run in the
+chroot.
+
+  * `timertest' fails without any message, which would indicate
+     something fishy in the test itself.
+
+  * `httptest' fails because it can't resolve some hostname.
+
+  * `hostlisttest' fails to connect to the daemon:
+     "Could not establish connection with peer."
+
+diff --git a/src/util/threads/Makefile.in b/src/util/threads/Makefile.in
+index d14152d..4bf6550 100644
+--- a/src/util/threads/Makefile.in
++++ b/src/util/threads/Makefile.in
+@@ -38,7 +38,7 @@ PRE_UNINSTALL = :
+ POST_UNINSTALL = :
+ host_triplet = @host@
+ check_PROGRAMS = semaphoretest$(EXEEXT) shutdowntest$(EXEEXT) \
+-	shutdowntest2$(EXEEXT) timertest$(EXEEXT)
++	shutdowntest2$(EXEEXT)
+ subdir = src/util/threads
+ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+
+diff --git a/src/applications/bootstrap_http/Makefile.in b/src/applications/bootstrap_http/Makefile.in
+index 29800af..ad5c6a1 100644
+--- a/src/applications/bootstrap_http/Makefile.in
++++ b/src/applications/bootstrap_http/Makefile.in
+@@ -37,7 +37,7 @@ NORMAL_UNINSTALL = :
+ PRE_UNINSTALL = :
+ POST_UNINSTALL = :
+ host_triplet = @host@
+-check_PROGRAMS = httptest$(EXEEXT)
++check_PROGRAMS =
+ subdir = src/applications/bootstrap_http
+ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+
+diff --git a/src/applications/hostlist/Makefile.in b/src/applications/hostlist/Makefile.in
+index 126df5e..2317c60 100644
+--- a/src/applications/hostlist/Makefile.in
++++ b/src/applications/hostlist/Makefile.in
+@@ -37,7 +37,7 @@ NORMAL_UNINSTALL = :
+ PRE_UNINSTALL = :
+ POST_UNINSTALL = :
+ host_triplet = @host@
+-check_PROGRAMS = hostlisttest$(EXEEXT)
++check_PROGRAMS =
+ subdir = src/applications/hostlist
+ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
diff --git a/pkgs/applications/networking/p2p/gnunet/disable-http-tests.patch b/pkgs/applications/networking/p2p/gnunet/disable-http-tests.patch
new file mode 100644
index 00000000000..1610946cb25
--- /dev/null
+++ b/pkgs/applications/networking/p2p/gnunet/disable-http-tests.patch
@@ -0,0 +1,17 @@
+Disable HTTP tests as they seem to deadlock when building in a chroot on NixOS.
+
+diff --git a/src/transports/Makefile.in b/src/transports/Makefile.in
+index b0b76a2..30a0bb5 100644
+--- a/src/transports/Makefile.in
++++ b/src/transports/Makefile.in
+@@ -38,8 +38,8 @@ PRE_UNINSTALL = :
+ POST_UNINSTALL = :
+ host_triplet = @host@
+ check_PROGRAMS = test_udp$(EXEEXT) test_tcp$(EXEEXT) \
+-	test_http$(EXEEXT) testrepeat_udp$(EXEEXT) \
+-	testrepeat_tcp$(EXEEXT) testrepeat_http$(EXEEXT)
++	testrepeat_udp$(EXEEXT) \
++	testrepeat_tcp$(EXEEXT)
+ subdir = src/transports
+ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
diff --git a/pkgs/applications/networking/p2p/gnunet/identity-test.patch b/pkgs/applications/networking/p2p/gnunet/identity-test.patch
new file mode 100644
index 00000000000..0d5a1640835
--- /dev/null
+++ b/pkgs/applications/networking/p2p/gnunet/identity-test.patch
@@ -0,0 +1,19 @@
+That test tries to load `libgnunetmodule_transport' but cannot locate it
+out of the box.
+
+diff --git a/src/applications/identity/Makefile.in b/src/applications/identity/Makefile.in
+index 0bc5efc..5341f41 100644
+--- a/src/applications/identity/Makefile.in
++++ b/src/applications/identity/Makefile.in
+@@ -337,6 +337,11 @@ libgnunetidentity_api_la_LIBADD = \
+   $(top_builddir)/src/util/libgnunetutil.la 
+ 
+ TESTS = $(check_PROGRAMS)
++
++# Allow `libgnunetmodule_transport' et al. to be located
++# by `GNUNET_CORE_p2p_init ()'.
++TESTS_ENVIRONMENT = LTDL_LIBRARY_PATH="$(top_builddir)/src/applications/transport:$(top_builddir)/src/transports:$(top_builddir)/src/transports/upnp:$(top_builddir)/src/applications/stats"
++
+ identitytest_SOURCES = \
+  identitytest.c 
+ 
diff --git a/pkgs/applications/networking/p2p/gnunet/session-tests.patch b/pkgs/applications/networking/p2p/gnunet/session-tests.patch
new file mode 100644
index 00000000000..62390da492f
--- /dev/null
+++ b/pkgs/applications/networking/p2p/gnunet/session-tests.patch
@@ -0,0 +1,17 @@
+Allow session tests to locate and run `gnunetd'.
+
+diff --git a/src/applications/session/Makefile.in b/src/applications/session/Makefile.in
+index b2717f9..3478aa8 100644
+--- a/src/applications/session/Makefile.in
++++ b/src/applications/session/Makefile.in
+@@ -352,6 +352,10 @@ libgnunetmodule_session_la_LDFLAGS = \
+   -export-dynamic -avoid-version -module
+ 
+ @HAVE_MHD_TRUE@httptest = sessiontest_http sessiontest_nat_http
++
++# Allow `gnunetd' to be located and executed.
++TESTS_ENVIRONMENT = PATH="$(top_builddir)/src/server:$$PATH" LTDL_LIBRARY_PATH="$(top_builddir)/src/applications/identity"
++
+ TESTS = $(check_PROGRAMS)
+ sessiontest_tcp_SOURCES = \
+   sessiontest.c 
diff --git a/pkgs/applications/networking/p2p/gnunet/tmpdir.patch b/pkgs/applications/networking/p2p/gnunet/tmpdir.patch
new file mode 100644
index 00000000000..e47a253e0f0
--- /dev/null
+++ b/pkgs/applications/networking/p2p/gnunet/tmpdir.patch
@@ -0,0 +1,93 @@
+Make sure the core libraries used by the tests honor $TMPDIR.
+
+diff --git a/src/applications/dstore_sqlite/dstore.c b/src/applications/dstore_sqlite/dstore.c
+index cdcae81..4bb45a3 100644
+--- a/src/applications/dstore_sqlite/dstore.c
++++ b/src/applications/dstore_sqlite/dstore.c
+@@ -129,6 +129,7 @@ db_reset ()
+   int fd;
+   sqlite3 *dbh;
+   char *tmpl;
++  const char *tmpdir;
+ 
+   if (fn != NULL)
+     {
+@@ -136,7 +137,15 @@ db_reset ()
+       GNUNET_free (fn);
+     }
+   payload = 0;
+-  tmpl = "/tmp/dstoreXXXXXX";
++
++  tmpdir = getenv ("TMPDIR");
++  tmpdir = tmpdir ? tmpdir : "/tmp";
++
++#define TEMPLATE "/gnunet-dstoreXXXXXX"
++  tmpl = alloca (strlen (tmpdir) + sizeof (TEMPLATE) + 1);
++  strcpy (tmpl, tmpdir);
++  strcat (tmpl, TEMPLATE);
++#undef TEMPLATE
+ 
+ #ifdef MINGW
+   fn = (char *) GNUNET_malloc (MAX_PATH + 1);
+diff --git a/src/applications/fs/collection/collection.c b/src/applications/fs/collection/collection.c
+index 5671cb3..da2b605 100644
+--- a/src/applications/fs/collection/collection.c
++++ b/src/applications/fs/collection/collection.c
+@@ -487,6 +487,7 @@ GNUNET_CO_collection_publish_now ()
+   char *dirData;
+   char this_revision_string[128];
+   char next_revision_string[128];
++  const char *tmpdir;
+ 
+   GNUNET_mutex_lock (lock);
+   if ((collectionData == NULL) ||
+@@ -495,7 +496,17 @@ GNUNET_CO_collection_publish_now ()
+       GNUNET_mutex_unlock (lock);
+       return;
+     }
+-  tmpName = GNUNET_strdup ("/tmp/gnunet-collectionXXXXXX");
++
++  tmpdir = getenv ("TMPDIR");
++  tmpdir = tmpdir ? tmpdir : "/tmp";
++
++#define TEMPLATE "/gnunet-collectionXXXXXX"
++  tmpName = alloca (strlen (tmpdir) + sizeof (TEMPLATE) + 1);
++  strcpy (tmpName, tmpdir);
++  strcat (tmpName, TEMPLATE);
++#undef TEMPLATE
++
++  tmpName = GNUNET_strdup (tmpName);
+   fd = mkstemp (tmpName);
+   if (fd == -1)
+     {
+diff --git a/src/applications/fs/fsui/upload.c b/src/applications/fs/fsui/upload.c
+index dc683a5..46a04af 100644
+--- a/src/applications/fs/fsui/upload.c
++++ b/src/applications/fs/fsui/upload.c
+@@ -159,6 +159,7 @@ createDirectoryHelper (struct GNUNET_GE_Context *ectx,
+   int handle;
+   struct GNUNET_GE_Memory *mem;
+   struct GNUNET_GE_Context *ee;
++  const char *tmpdir;
+ 
+   fis = NULL;
+   size = 0;
+@@ -208,7 +209,17 @@ createDirectoryHelper (struct GNUNET_GE_Context *ectx,
+       pos = pos->next;
+     }
+   GNUNET_GE_memory_reset (mem);
+-  tempName = GNUNET_strdup ("/tmp/gnunet-upload-dir.XXXXXX");
++
++  tmpdir = getenv ("TMPDIR");
++  tmpdir = tmpdir ? tmpdir : "/tmp";
++
++#define TEMPLATE "/gnunet-upload-dirXXXXXX"
++  tempName = alloca (strlen (tmpdir) + sizeof (TEMPLATE) + 1);
++  strcpy (tempName, tmpdir);
++  strcat (tempName, TEMPLATE);
++#undef TEMPLATE
++
++  tempName = GNUNET_strdup (tempName);
+   handle = mkstemp (tempName);
+   if (handle == -1)
+     {
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 7ea8289be12..12a123dda38 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -6185,6 +6185,14 @@ let pkgs = rec {
     GStreamer = gst_all.gstreamer;
   };
 
+  gnunet = import ../applications/networking/p2p/gnunet {
+    inherit fetchurl stdenv libextractor libmicrohttpd libgcrypt
+      gmp curl libtool guile adns sqlite gettext zlib pkgconfig
+      libxml2 ncurses findutils;
+    inherit (gnome) gtk libglade;
+    gtkSupport = getConfig [ "gnunet" "gtkSupport" ] true;
+  };
+
   gocr = composedArgsAndFun (selectVersion ../applications/graphics/gocr "0.44") {
     inherit builderDefs fetchurl stdenv;
   };