3
0
Fork 0
forked from mirrors/nixpkgs

* 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
This commit is contained in:
Eelco Dolstra 2009-01-19 18:49:58 +00:00
parent 72822ebbc0
commit 808bf6d34a
7 changed files with 52 additions and 49 deletions

View file

@ -1,4 +1,4 @@
{stdenv, fetchurl, log2xmlSupport ? true}: {stdenv, fetchurl}:
stdenv.mkDerivation { stdenv.mkDerivation {
name = "gnumake-3.81"; name = "gnumake-3.81";
@ -9,13 +9,11 @@ stdenv.mkDerivation {
}; };
patches = patches =
(if log2xmlSupport [
# Provide nested log output for subsequent pretty-printing by # Provide nested log output for subsequent pretty-printing by
# nix-log2xml. # nix-log2xml.
then [ ./log.patch ] ./log.patch
else [])
++
[
# Purity: don't look for library dependencies (of the form # Purity: don't look for library dependencies (of the form
# `-lfoo') in /lib and /usr/lib. It's a stupid feature anyway. # `-lfoo') in /lib and /usr/lib. It's a stupid feature anyway.
# Likewise, when searching for included Makefiles, don't look in # Likewise, when searching for included Makefiles, don't look in

View file

@ -1,6 +1,6 @@
diff -rc make-3.81-orig/job.c make-3.81/job.c 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-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 **** *** 1083,1089 ****
appear. */ appear. */
@ -14,24 +14,24 @@ diff -rc make-3.81-orig/job.c make-3.81/job.c
appear. */ appear. */
message (0, (just_print_flag || (!(flags & COMMANDS_SILENT) && !silent_flag)) 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 /* 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 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 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-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,891 ****
--- 886,900 ---- --- 886,900 ----
} }
+ static void closeNesting() + static void close_nesting()
+ { + {
+ while (logNestingStdout--) + while (stdout_nesting_level--)
+ printf("\e[q"); + printf("\e[q");
+ while (logNestingStderr--) + while (stderr_nesting_level--)
+ fprintf(stderr, "\e[q"); + 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) main (int argc, char **argv)
*************** ***************
*** 931,936 **** *** 931,936 ****
--- 940,947 ---- --- 940,950 ----
atexit (close_stdout); atexit (close_stdout);
#endif #endif
+ atexit(closeNesting); + atexit(close_nesting);
+
+ if (getenv("NIX_INDENT_MAKE"))
+ enable_nested_output = 1;
+ +
/* Needed for OS/2 */ /* Needed for OS/2 */
initialize_main(&argc, &argv); initialize_main(&argc, &argv);
*************** ***************
*** 3095,3100 **** *** 3095,3100 ****
--- 3106,3117 ---- --- 3109,3120 ----
/* Use entire sentences to give the translators a fighting chance. */ /* Use entire sentences to give the translators a fighting chance. */
+ if (entering) + if (entering && enable_nested_output)
+ { + {
+ printf("\e[p"); + printf("\e[p");
+ logNestingStdout++; + stdout_nesting_level++;
+ } + }
+ +
if (makelevel == 0) if (makelevel == 0)
@ -67,48 +70,56 @@ diff -rc make-3.81-orig/main.c make-3.81/main.c
if (entering) if (entering)
*************** ***************
*** 3124,3129 **** *** 3124,3129 ****
--- 3141,3155 ---- --- 3144,3159 ----
printf (_("%s[%u]: Leaving directory `%s'\n"), printf (_("%s[%u]: Leaving directory `%s'\n"),
program, makelevel, starting_directory); program, makelevel, starting_directory);
+ if (!entering) + if (!entering && enable_nested_output)
+ { + {
+ printf("\e[q"); + printf("\e[q");
+ logNestingStdout--; + stdout_nesting_level--;
+ } + }
+ +
/* Flush stdout to be sure this comes before any stderr output. */ /* Flush stdout to be sure this comes before any stderr output. */
fflush (stdout); fflush (stdout);
} }
+ +
+ int logNestingStdout = 0; + int enable_nested_output = 0;
+ int logNestingStderr = 0; + int stdout_nesting_level = 0;
+ int stderr_nesting_level = 0;
diff -rc make-3.81-orig/make.h make-3.81/make.h 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-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,611 ****
--- 609,613 ---- --- 609,614 ----
#define ENULLLOOP(_v,_c) do{ errno = 0; \ #define ENULLLOOP(_v,_c) do{ errno = 0; \
while (((_v)=_c)==0 && errno==EINTR); }while(0) while (((_v)=_c)==0 && errno==EINTR); }while(0)
+ extern int logNestingStdout; + extern int enable_nested_output;
+ extern int logNestingStderr; + extern int stdout_nesting_level;
+ extern int stderr_nesting_level;
diff -rc make-3.81-orig/remake.c make-3.81/remake.c 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-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,1126 ****
--- 1120,1131 ---- --- 1120,1137 ----
/* The normal case: start some commands. */ /* The normal case: start some commands. */
if (!touch_flag || file->cmds->any_recurse) if (!touch_flag || file->cmds->any_recurse)
{ {
+ if (enable_nested_output)
+ {
+ log_working_directory (1); + log_working_directory (1);
+ fprintf(stderr, "\e[pbuilding %s\n", file->name); + fprintf(stderr, "\e[pbuilding %s\n", file->name);
+ logNestingStderr++; + stderr_nesting_level++;
+ }
execute_file_commands (file); execute_file_commands (file);
+ if (enable_nested_output)
+ {
+ fprintf(stderr, "\e[q"); + fprintf(stderr, "\e[q");
+ logNestingStderr--; + stderr_nesting_level--;
+ }
return; return;
} }

View file

@ -8,7 +8,7 @@
pkgs.gnutar pkgs.gnutar
pkgs.gzip pkgs.gzip
pkgs.bzip2 pkgs.bzip2
pkgs.gnumakeNix pkgs.gnumake
pkgs.bash pkgs.bash
pkgs.patch pkgs.patch
pkgs.replace pkgs.replace

View file

@ -218,7 +218,7 @@ rec {
inherit (stdenvLinuxBoot2Pkgs) binutils /* gcc */ glibc; inherit (stdenvLinuxBoot2Pkgs) binutils /* gcc */ glibc;
inherit (stdenvLinuxBoot3Pkgs) inherit (stdenvLinuxBoot3Pkgs)
gzip bzip2 bash coreutils diffutils findutils gawk gzip bzip2 bash coreutils diffutils findutils gawk
gnumakeNix gnused gnutar gnugrep patch patchelf gnumake gnused gnutar gnugrep patch patchelf
attr acl; attr acl;
}; };
}; };

View file

@ -10,7 +10,7 @@ let
# dietlibc. # dietlibc.
pkgsToRemove = pkgsToRemove =
[ "binutils" "gcc" "coreutils" "findutils" "diffutils" "gnused" "gnugrep" [ "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 { pkgsDiet = import ../../top-level/all-packages.nix {
@ -28,7 +28,7 @@ let
inherit (pkgsDiet) inherit (pkgsDiet)
coreutils diffutils gnugrep 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 findutils = pkgsDiet.findutils4227; # 4.2.28 is broken

View file

@ -150,7 +150,7 @@ rec {
pkgs.gnutar pkgs.gnutar
pkgs.gzip pkgs.gzip
pkgs.bzip2 pkgs.bzip2
pkgs.gnumakeNix pkgs.gnumake
pkgs.bash pkgs.bash
pkgs.patch pkgs.patch
*/ */

View file

@ -2386,16 +2386,10 @@ let
inherit fetchurl stdenv; inherit fetchurl stdenv;
}; };
gnumake = import ../development/tools/build-managers/gnumake { gnumake = useFromStdenv "gnumake"
(import ../development/tools/build-managers/gnumake {
inherit fetchurl stdenv; 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;
};
gnumake380 = import ../development/tools/build-managers/gnumake-3.80 { gnumake380 = import ../development/tools/build-managers/gnumake-3.80 {
inherit fetchurl stdenv; inherit fetchurl stdenv;