diff --git a/pkgs/tools/misc/coreutils-diet/coreutils-dummy.patch b/pkgs/tools/misc/coreutils-diet/coreutils-dummy.patch deleted file mode 100644 index bb444bedf0e..00000000000 --- a/pkgs/tools/misc/coreutils-diet/coreutils-dummy.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff -ruN coreutils-5.2.1/src/paste.c coreutils-5.2.1.new/src/paste.c ---- coreutils-5.2.1/src/paste.c 2004-01-23 09:57:02.000000000 +0100 -+++ coreutils-5.2.1.new/src/paste.c 2005-08-28 16:03:10.000000000 +0200 -@@ -52,13 +52,16 @@ - /* Indicates that no delimiter should be added in the current position. */ - #define EMPTY_DELIM '\0' - --static FILE dummy_closed; -+/* static FILE dummy_closed; */ - /* Element marking a file that has reached EOF and been closed. */ --#define CLOSED (&dummy_closed) -+/* #define CLOSED (&dummy_closed) */ - --static FILE dummy_endlist; -+/* static FILE dummy_endlist; */ - /* Element marking end of list of open files. */ --#define ENDLIST (&dummy_endlist) -+/* #define ENDLIST (&dummy_endlist) */ -+ -+#define CLOSED ((FILE *)-1) -+#define ENDLIST ((FILE *)-2) - - /* Name this program was run with. */ - char *program_name; diff --git a/pkgs/tools/misc/coreutils-diet/default.nix b/pkgs/tools/misc/coreutils-diet/default.nix deleted file mode 100644 index d372c7ec949..00000000000 --- a/pkgs/tools/misc/coreutils-diet/default.nix +++ /dev/null @@ -1,15 +0,0 @@ -{stdenv, fetchurl, dietgcc, perl}: - -stdenv.mkDerivation { - name = "coreutils-diet-5.2.1"; - src = fetchurl { - url = http://nix.cs.uu.nl/dist/tarballs/coreutils-5.2.1.tar.bz2; - md5 = "172ee3c315af93d3385ddfbeb843c53f"; - }; - # patch from - # http://invaders.mars-attacks.org/~boklm/browse/doc/srs2005/alink/files/patch-coreutils-5.2.1-alink0.1.diff - patches = [./coreutils-dummy.patch]; - buildInputs = [perl]; - NIX_GCC = dietgcc; - NIX_CFLAGS_COMPILE="-D_BSD_SOURCE=1"; -} diff --git a/pkgs/tools/misc/coreutils/default.nix b/pkgs/tools/misc/coreutils/default.nix index 8d3c9365ffc..bd550a7a758 100644 --- a/pkgs/tools/misc/coreutils/default.nix +++ b/pkgs/tools/misc/coreutils/default.nix @@ -1,9 +1,12 @@ {stdenv, fetchurl}: -stdenv.mkDerivation { +stdenv.mkDerivation ({ name = "coreutils-5.97"; src = fetchurl { url = http://nix.cs.uu.nl/dist/tarballs/coreutils-5.97.tar.gz; md5 = "bdec4b75c76ac9bf51b6dd1747d3b06e"; }; -} +} // (if stdenv ? isDietLibC then { + NIX_CFLAGS_COMPILE="-D_BSD_SOURCE=1"; + patches = [./uclibc.patch]; +} else {})) diff --git a/pkgs/tools/misc/coreutils/uclibc.patch b/pkgs/tools/misc/coreutils/uclibc.patch new file mode 100644 index 00000000000..82c03334b01 --- /dev/null +++ b/pkgs/tools/misc/coreutils/uclibc.patch @@ -0,0 +1,35 @@ +diff -rc coreutils-5.97-orig/lib/strftime.c coreutils-5.97/lib/strftime.c +*** coreutils-5.97-orig/lib/strftime.c 2006-10-18 17:10:16.000000000 +0200 +--- coreutils-5.97/lib/strftime.c 2006-10-18 17:08:16.000000000 +0200 +*************** +*** 180,185 **** +--- 180,191 ---- + # define memset_zero(P, Len) (memset (P, '0', Len), (P) += (Len)) + #endif + ++ #if FPRINTFTIME ++ #define advance(p, n) ; ++ #else ++ #define advance(p, n) p += _n; ++ #endif ++ + #define add(n, f) \ + do \ + { \ +*************** +*** 198,204 **** + memset_space (p, _delta); \ + } \ + f; \ +! p += FPRINTFTIME ? 0 : _n; \ + } \ + i += _incr; \ + } while (0) +--- 204,210 ---- + memset_space (p, _delta); \ + } \ + f; \ +! advance(p, n); \ + } \ + i += _incr; \ + } while (0) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 96a78e173a3..27de01bae86 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -82,7 +82,9 @@ rec { # These are added *after* the command-line flags, so we'll # always optimise for size. - NIX_CFLAGS_COMPILE = "-Os -s"; + NIX_CFLAGS_COMPILE = + (if args ? NIX_CFLAGS_COMPILE then args.NIX_CFLAGS_COMPILE else "") + + " -Os -s"; configureFlags = (if args ? configureFlags then args.configureFlags else "") @@ -96,6 +98,7 @@ rec { nativeGlibc = false; }; }); + isDietLibC = true; }; # Applying this to an attribute set will cause nix-env to look @@ -217,8 +220,9 @@ rec { inherit fetchurl stdenv; }); - coreutilsDiet = import ../tools/misc/coreutils-diet { - inherit fetchurl stdenv dietgcc perl; + coreutilsDiet = import ../tools/misc/coreutils { + inherit fetchurl; + stdenv = useDietLibC stdenv; }; cpio = import ../tools/archivers/cpio {