From 808bf6d34add1211e0b16bff64d1b392fbbcdcdd Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 19 Jan 2009 18:49:58 +0000 Subject: [PATCH] * Make the nested output patch in GNU Make runtime configurable (by setting the NIX_INDENT_MAKE variable; disabled by default) so we don't need a separate gnumakeNix package. svn path=/nixpkgs/branches/stdenv-updates/; revision=13807 --- .../tools/build-managers/gnumake/default.nix | 12 ++-- .../tools/build-managers/gnumake/log.patch | 65 +++++++++++-------- pkgs/stdenv/common-path.nix | 2 +- pkgs/stdenv/linux/default.nix | 2 +- pkgs/stdenv/linux/make-bootstrap-tools.nix | 4 +- pkgs/stdenv/mingw/pkgs/default.nix | 2 +- pkgs/top-level/all-packages.nix | 14 ++-- 7 files changed, 52 insertions(+), 49 deletions(-) diff --git a/pkgs/development/tools/build-managers/gnumake/default.nix b/pkgs/development/tools/build-managers/gnumake/default.nix index cd4c2a98939..09ac6b9142e 100644 --- a/pkgs/development/tools/build-managers/gnumake/default.nix +++ b/pkgs/development/tools/build-managers/gnumake/default.nix @@ -1,4 +1,4 @@ -{stdenv, fetchurl, log2xmlSupport ? true}: +{stdenv, fetchurl}: stdenv.mkDerivation { name = "gnumake-3.81"; @@ -9,13 +9,11 @@ stdenv.mkDerivation { }; patches = - (if log2xmlSupport - # Provide nested log output for subsequent pretty-printing by - # nix-log2xml. - then [ ./log.patch ] - else []) - ++ [ + # Provide nested log output for subsequent pretty-printing by + # nix-log2xml. + ./log.patch + # Purity: don't look for library dependencies (of the form # `-lfoo') in /lib and /usr/lib. It's a stupid feature anyway. # Likewise, when searching for included Makefiles, don't look in diff --git a/pkgs/development/tools/build-managers/gnumake/log.patch b/pkgs/development/tools/build-managers/gnumake/log.patch index 3104e1f2bde..0f3ed6d7299 100644 --- a/pkgs/development/tools/build-managers/gnumake/log.patch +++ b/pkgs/development/tools/build-managers/gnumake/log.patch @@ -1,6 +1,6 @@ diff -rc make-3.81-orig/job.c make-3.81/job.c *** make-3.81-orig/job.c 2006-03-20 04:03:04.000000000 +0100 ---- make-3.81/job.c 2008-02-20 17:41:25.000000000 +0100 +--- make-3.81/job.c 2009-01-19 19:37:28.000000000 +0100 *************** *** 1083,1089 **** appear. */ @@ -14,24 +14,24 @@ diff -rc make-3.81-orig/job.c make-3.81/job.c appear. */ message (0, (just_print_flag || (!(flags & COMMANDS_SILENT) && !silent_flag)) -! ? "\e[3s\e[a%s\e[b" : (char *) 0, p); +! ? (enable_nested_output ? "\e[3s\e[a%s\e[b" : "%s") : (char *) 0, p); /* Tell update_goal_chain that a command has been started on behalf of this target. It is important that this happens here and not in diff -rc make-3.81-orig/main.c make-3.81/main.c *** make-3.81-orig/main.c 2006-03-20 03:36:37.000000000 +0100 ---- make-3.81/main.c 2008-02-20 17:41:25.000000000 +0100 +--- make-3.81/main.c 2009-01-19 19:41:41.000000000 +0100 *************** *** 886,891 **** --- 886,900 ---- } -+ static void closeNesting() ++ static void close_nesting() + { -+ while (logNestingStdout--) ++ while (stdout_nesting_level--) + printf("\e[q"); -+ while (logNestingStderr--) ++ while (stderr_nesting_level--) + fprintf(stderr, "\e[q"); + } + @@ -41,25 +41,28 @@ diff -rc make-3.81-orig/main.c make-3.81/main.c main (int argc, char **argv) *************** *** 931,936 **** ---- 940,947 ---- +--- 940,950 ---- atexit (close_stdout); #endif -+ atexit(closeNesting); ++ atexit(close_nesting); ++ ++ if (getenv("NIX_INDENT_MAKE")) ++ enable_nested_output = 1; + /* Needed for OS/2 */ initialize_main(&argc, &argv); *************** *** 3095,3100 **** ---- 3106,3117 ---- +--- 3109,3120 ---- /* Use entire sentences to give the translators a fighting chance. */ -+ if (entering) ++ if (entering && enable_nested_output) + { + printf("\e[p"); -+ logNestingStdout++; ++ stdout_nesting_level++; + } + if (makelevel == 0) @@ -67,48 +70,56 @@ diff -rc make-3.81-orig/main.c make-3.81/main.c if (entering) *************** *** 3124,3129 **** ---- 3141,3155 ---- +--- 3144,3159 ---- printf (_("%s[%u]: Leaving directory `%s'\n"), program, makelevel, starting_directory); -+ if (!entering) ++ if (!entering && enable_nested_output) + { + printf("\e[q"); -+ logNestingStdout--; ++ stdout_nesting_level--; + } + /* Flush stdout to be sure this comes before any stderr output. */ fflush (stdout); } + -+ int logNestingStdout = 0; -+ int logNestingStderr = 0; ++ int enable_nested_output = 0; ++ int stdout_nesting_level = 0; ++ int stderr_nesting_level = 0; diff -rc make-3.81-orig/make.h make-3.81/make.h *** make-3.81-orig/make.h 2006-02-16 00:54:43.000000000 +0100 ---- make-3.81/make.h 2008-02-20 17:41:25.000000000 +0100 +--- make-3.81/make.h 2009-01-19 19:32:03.000000000 +0100 *************** *** 609,611 **** ---- 609,613 ---- +--- 609,614 ---- #define ENULLLOOP(_v,_c) do{ errno = 0; \ while (((_v)=_c)==0 && errno==EINTR); }while(0) -+ extern int logNestingStdout; -+ extern int logNestingStderr; ++ extern int enable_nested_output; ++ extern int stdout_nesting_level; ++ extern int stderr_nesting_level; diff -rc make-3.81-orig/remake.c make-3.81/remake.c *** make-3.81-orig/remake.c 2006-03-20 03:36:37.000000000 +0100 ---- make-3.81/remake.c 2008-02-20 17:44:01.000000000 +0100 +--- make-3.81/remake.c 2009-01-19 19:39:40.000000000 +0100 *************** *** 1120,1126 **** ---- 1120,1131 ---- +--- 1120,1137 ---- /* The normal case: start some commands. */ if (!touch_flag || file->cmds->any_recurse) { -+ log_working_directory (1); -+ fprintf(stderr, "\e[pbuilding %s\n", file->name); -+ logNestingStderr++; ++ if (enable_nested_output) ++ { ++ log_working_directory (1); ++ fprintf(stderr, "\e[pbuilding %s\n", file->name); ++ stderr_nesting_level++; ++ } execute_file_commands (file); -+ fprintf(stderr, "\e[q"); -+ logNestingStderr--; ++ if (enable_nested_output) ++ { ++ fprintf(stderr, "\e[q"); ++ stderr_nesting_level--; ++ } return; } diff --git a/pkgs/stdenv/common-path.nix b/pkgs/stdenv/common-path.nix index 227870a943a..3b267a543c6 100644 --- a/pkgs/stdenv/common-path.nix +++ b/pkgs/stdenv/common-path.nix @@ -8,7 +8,7 @@ pkgs.gnutar pkgs.gzip pkgs.bzip2 - pkgs.gnumakeNix + pkgs.gnumake pkgs.bash pkgs.patch pkgs.replace diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index da97b6a4c19..21594bad5a9 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -218,7 +218,7 @@ rec { inherit (stdenvLinuxBoot2Pkgs) binutils /* gcc */ glibc; inherit (stdenvLinuxBoot3Pkgs) gzip bzip2 bash coreutils diffutils findutils gawk - gnumakeNix gnused gnutar gnugrep patch patchelf + gnumake gnused gnutar gnugrep patch patchelf attr acl; }; }; diff --git a/pkgs/stdenv/linux/make-bootstrap-tools.nix b/pkgs/stdenv/linux/make-bootstrap-tools.nix index 9d381cca7e1..71aa638378c 100644 --- a/pkgs/stdenv/linux/make-bootstrap-tools.nix +++ b/pkgs/stdenv/linux/make-bootstrap-tools.nix @@ -10,7 +10,7 @@ let # dietlibc. pkgsToRemove = [ "binutils" "gcc" "coreutils" "findutils" "diffutils" "gnused" "gnugrep" - "gawk" "gnutar" "gzip" "bzip2" "gnumakeNix" "bash" "patch" "patchelf" + "gawk" "gnutar" "gzip" "bzip2" "gnumake" "bash" "patch" "patchelf" ]; pkgsDiet = import ../../top-level/all-packages.nix { @@ -28,7 +28,7 @@ let inherit (pkgsDiet) coreutils diffutils gnugrep - gzip bzip2 gnumakeNix bash patch binutils curl; + gzip bzip2 gnumake bash patch binutils curl; findutils = pkgsDiet.findutils4227; # 4.2.28 is broken diff --git a/pkgs/stdenv/mingw/pkgs/default.nix b/pkgs/stdenv/mingw/pkgs/default.nix index c0bad491e78..6c843e8d394 100755 --- a/pkgs/stdenv/mingw/pkgs/default.nix +++ b/pkgs/stdenv/mingw/pkgs/default.nix @@ -150,7 +150,7 @@ rec { pkgs.gnutar pkgs.gzip pkgs.bzip2 - pkgs.gnumakeNix + pkgs.gnumake pkgs.bash pkgs.patch */ diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 52281a9b5c9..b7e92e3a1e6 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2386,16 +2386,10 @@ let inherit fetchurl stdenv; }; - gnumake = import ../development/tools/build-managers/gnumake { - inherit fetchurl stdenv; - log2xmlSupport = getConfig [ "gnuMake" "log2xmlSupport" ] false; - }; - - # The modified version of GNU Make with support for `nix-log2xml'. - gnumakeNix = import ../development/tools/build-managers/gnumake { - inherit fetchurl stdenv; - log2xmlSupport = true; - }; + gnumake = useFromStdenv "gnumake" + (import ../development/tools/build-managers/gnumake { + inherit fetchurl stdenv; + }); gnumake380 = import ../development/tools/build-managers/gnumake-3.80 { inherit fetchurl stdenv;