summary refs log tree commit diff
path: root/pkgs/servers/shishi
diff options
context:
space:
mode:
authorWilliam A. Kennington III <william@wkennington.com>2015-05-02 04:05:32 -0700
committerWilliam A. Kennington III <william@wkennington.com>2015-05-02 04:12:06 -0700
commit44aad3817f94a013eaa5ec1218b45bdf8c8eea38 (patch)
tree158fb69f8f9cf5e4298e53d4c696013d7f0bf751 /pkgs/servers/shishi
parentbc8bbd52819a337f3b0c2ed3113ed73f34c2984e (diff)
downloadnixpkgs-44aad3817f94a013eaa5ec1218b45bdf8c8eea38.tar
nixpkgs-44aad3817f94a013eaa5ec1218b45bdf8c8eea38.tar.gz
nixpkgs-44aad3817f94a013eaa5ec1218b45bdf8c8eea38.tar.bz2
nixpkgs-44aad3817f94a013eaa5ec1218b45bdf8c8eea38.tar.lz
nixpkgs-44aad3817f94a013eaa5ec1218b45bdf8c8eea38.tar.xz
nixpkgs-44aad3817f94a013eaa5ec1218b45bdf8c8eea38.tar.zst
nixpkgs-44aad3817f94a013eaa5ec1218b45bdf8c8eea38.zip
shishi: Modernize Build
Diffstat (limited to 'pkgs/servers/shishi')
-rw-r--r--pkgs/servers/shishi/default.nix80
-rw-r--r--pkgs/servers/shishi/gcrypt-fix.patch34
2 files changed, 95 insertions, 19 deletions
diff --git a/pkgs/servers/shishi/default.nix b/pkgs/servers/shishi/default.nix
index a41915e5be8..a97e6847a45 100644
--- a/pkgs/servers/shishi/default.nix
+++ b/pkgs/servers/shishi/default.nix
@@ -1,5 +1,25 @@
-{ fetchurl, stdenv, libtasn1, libgcrypt, gnutls }:
+{ stdenv, fetchurl
+, libgcrypt, libgpgerror, libtasn1
 
+# Optional Dependencies
+, pam ? null, libidn ? null, gnutls ? null
+}:
+
+let
+  mkFlag = trueStr: falseStr: cond: name: val:
+    if cond == null then null else
+      "--${if cond != false then trueStr else falseStr}${name}${if val != null && cond != false then "=${val}" else ""}";
+  mkEnable = mkFlag "enable-" "disable-";
+  mkWith = mkFlag "with-" "without-";
+  mkOther = mkFlag "" "" true;
+
+  shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null;
+
+  optPam = shouldUsePkg pam;
+  optLibidn = shouldUsePkg libidn;
+  optGnutls = shouldUsePkg gnutls;
+in
+with stdenv.lib;
 stdenv.mkDerivation rec {
   name = "shishi-1.0.2";
 
@@ -8,30 +28,52 @@ stdenv.mkDerivation rec {
     sha256 = "032qf72cpjdfffq1yq54gz3ahgqf2ijca4vl31sfabmjzq9q370d";
   };
 
-  buildInputs = [ libtasn1 libgcrypt gnutls ] ;
+  # Fixes support for gcrypt 1.6+
+  patches = [ ./gcrypt-fix.patch ];
+
+  buildInputs = [ libgcrypt libgpgerror libtasn1 optPam optLibidn optGnutls ];
+
+  configureFlags = [
+    (mkOther                      "sysconfdir"    "/etc")
+    (mkOther                      "localstatedir" "/var")
+    (mkEnable true                "libgcrypt"     null)
+    (mkEnable (optPam != null)    "pam"           null)
+    (mkEnable true                "ipv6"          null)
+    (mkWith   (optLibidn != null) "stringprep"    null)
+    (mkEnable (optGnutls != null) "starttls"      null)
+    (mkEnable true                "des"           null)
+    (mkEnable true                "3des"          null)
+    (mkEnable true                "aes"           null)
+    (mkEnable true                "md"            null)
+    (mkEnable false               "null"          null)
+    (mkEnable true                "arcfour"       null)
+  ];
 
   NIX_CFLAGS_COMPILE
-    = stdenv.lib.optionalString stdenv.isDarwin "-DBIND_8_COMPAT";
+    = optionalString stdenv.isDarwin "-DBIND_8_COMPAT";
 
   doCheck = true;
 
+  installFlags = [ "sysconfdir=\${out}/etc" ];
+
+  # Fix *.la files
+  postInstall = ''
+    sed -i $out/lib/libshi{sa,shi}.la \
+  '' + optionalString (optLibidn != null) ''
+      -e 's,\(-lidn\),-L${optLibidn}/lib \1,' \
+  '' + optionalString (optGnutls != null) ''
+      -e 's,\(-lgnutls\),-L${optGnutls}/lib \1,' \
+  '' + ''
+      -e 's,\(-lgcrypt\),-L${libgcrypt}/lib \1,' \
+      -e 's,\(-lgpg-error\),-L${libgpgerror}/lib \1,' \
+      -e 's,\(-ltasn1\),-L${libtasn1}/lib \1,'
+  '';
+
   meta = {
-    description = "An implementation of the Kerberos 5 network security system";
     homepage    = http://www.gnu.org/software/shishi/;
-    license     = stdenv.lib.licenses.gpl3Plus;
-    maintainers = with stdenv.lib.maintainers; [ bjg lovek323 ];
-    platforms   = stdenv.lib.platforms.all;
-
-    longDescription =
-      '' GNU Shishi is an implementation of the Kerberos 5 network
-         authentication system, as specified in RFC 4120.  Shishi can be
-         used to authenticate users in distributed systems.
-
-         Shishi contains a library (`libshishi') that can be used by
-         application developers to add support for Kerberos 5.  Shishi
-         contains a command line utility (1shishi') that is used by
-         users to acquire and manage tickets (and more).  The server
-         side, a Key Distribution Center, is implemented by `shishid'.
-      '';
+    description = "An implementation of the Kerberos 5 network security system";
+    license     = licenses.gpl3Plus;
+    maintainers = with maintainers; [ bjg lovek323 wkennington ];
+    platforms   = platforms.all;
   };
 }
diff --git a/pkgs/servers/shishi/gcrypt-fix.patch b/pkgs/servers/shishi/gcrypt-fix.patch
new file mode 100644
index 00000000000..ccc37389401
--- /dev/null
+++ b/pkgs/servers/shishi/gcrypt-fix.patch
@@ -0,0 +1,34 @@
+diff --git a/configure b/configure
+index c9a442b..a596bfe 100755
+--- a/configure
++++ b/configure
+@@ -24491,12 +24491,6 @@ else
+ /* end confdefs.h.  */
+ 
+ #include <gcrypt.h>
+-/* GCRY_MODULE_ID_USER was added in 1.4.4 and gc-libgcrypt.c
+-   will fail on startup if we don't have 1.4.4 or later, so
+-   test for it early. */
+-#if !defined GCRY_MODULE_ID_USER
+-error too old libgcrypt
+-#endif
+ 
+ int
+ main ()
+diff --git a/gl/m4/gc.m4 b/gl/m4/gc.m4
+index b352e33..4bab9f4 100644
+--- a/gl/m4/gc.m4
++++ b/gl/m4/gc.m4
+@@ -12,12 +12,6 @@ AC_DEFUN([gl_GC],
+   if test "$libgcrypt" != no; then
+     AC_LIB_HAVE_LINKFLAGS([gcrypt], [gpg-error], [
+ #include <gcrypt.h>
+-/* GCRY_MODULE_ID_USER was added in 1.4.4 and gc-libgcrypt.c
+-   will fail on startup if we don't have 1.4.4 or later, so
+-   test for it early. */
+-#if !defined GCRY_MODULE_ID_USER
+-error too old libgcrypt
+-#endif
+ ])
+   fi
+ ])