From be524e925b73865bc6d2a0c61ae641b6a634e7d0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= <bjorn.forsman@gmail.com>
Date: Sat, 31 May 2014 10:01:01 +0200
Subject: [PATCH] avrdude: rewrite expression

* Use stdenv.mkDerivation instead of composableDerivation.
  stdenv.mkDerivation is the current coding standard and is easier to
  read (IMHO).

* Remove the 'parportSupport' flag because it doesn't do anything.
  (Parallel port support is still enabled.)

* Remove unneeded --disable-dependency-tracking flag to ./configure; our
  default builder does that already.

* Fix documentation build. But it is still disabled (by default),
  because texLive is such a big dependency. There is always the man
  page.

* Update 'meta' attributes
---
 .../tools/misc/avrdude/default.nix            | 38 ++++++++++---------
 1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/pkgs/development/tools/misc/avrdude/default.nix b/pkgs/development/tools/misc/avrdude/default.nix
index 89e848df03b..18f2f86ea4a 100644
--- a/pkgs/development/tools/misc/avrdude/default.nix
+++ b/pkgs/development/tools/misc/avrdude/default.nix
@@ -1,8 +1,11 @@
-{ composableDerivation, fetchurl, yacc, flex, texLive, libusb }:
+{ stdenv, fetchurl, yacc, flex, libusb
+# docSupport is a big dependency, disabled by default
+, docSupport ? false, texLive ? null, texinfo ? null, texi2html ? null
+}:
 
-let edf = composableDerivation.edf; in
+assert docSupport -> texLive != null && texinfo != null && texi2html != null;
 
-composableDerivation.composableDerivation {} rec {
+stdenv.mkDerivation rec {
   name="avrdude-6.0.1";
 
   src = fetchurl {
@@ -10,22 +13,21 @@ composableDerivation.composableDerivation {} rec {
     sha256 = "0hfy1qkc6a5vpqsp9ahi1fpf9x4s10wq4bpyblc26sx9vxl4d066";
   };
 
-  configureFlags = [ "--disable-dependency-tracking" ];
+  configureFlags = stdenv.lib.optionalString docSupport "--enable-doc";
 
-  buildInputs = [ yacc flex libusb ];
+  buildInputs = [ yacc flex libusb ]
+    ++ stdenv.lib.optionals docSupport [ texLive texinfo texi2html ];
 
-  flags =
-       edf { name = "doc"; enable = { buildInputs = texLive; configureFlags = ["--enable-doc"]; }; }
-    // edf { name = "parport"; };
-
-  cfg = {
-    docSupport = false; # untested
-    parportSupport = true;
-  };
-
-  meta = {
-    license = "GPL-2";
-    description = "AVR Downloader/UploaDEr";
-    homepage = http://savannah.nongnu.org/projects/avrdude;
+  meta = with stdenv.lib; {
+    description = "Command-line tool for programming Atmel AVR microcontrollers";
+    longDescription = ''
+      AVRDUDE (AVR Downloader/UploaDEr) is an utility to
+      download/upload/manipulate the ROM and EEPROM contents of AVR
+      microcontrollers using the in-system programming technique (ISP).
+    '';
+    homepage = http://www.nongnu.org/avrdude/;
+    license = licenses.gpl2Plus;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.bjornfor ];
   };
 }