···15151616 patches =
1717 [
1818- # Provide nested log output for subsequent pretty-printing by
1919- # nix-log2xml.
2020- ./log.patch
2121-2218 # Purity: don't look for library dependencies (of the form
2319 # `-lfoo') in /lib and /usr/lib. It's a stupid feature anyway.
2420 # Likewise, when searching for included Makefiles, don't look in
···11-diff -rc job.c job.c
22-*** job.c 2006-03-20 04:03:04.000000000 +0100
33---- job.c 2009-01-19 19:37:28.000000000 +0100
44-***************
55-*** 1083,1089 ****
66- appear. */
77-88- message (0, (just_print_flag || (!(flags & COMMANDS_SILENT) && !silent_flag))
99-! ? "%s" : (char *) 0, p);
1010-1111- /* Tell update_goal_chain that a command has been started on behalf of
1212- this target. It is important that this happens here and not in
1313---- 1083,1089 ----
1414- appear. */
1515-1616- message (0, (just_print_flag || (!(flags & COMMANDS_SILENT) && !silent_flag))
1717-! ? (enable_nested_output ? "\e[3s\e[a%s\e[b" : "%s") : (char *) 0, p);
1818-1919- /* Tell update_goal_chain that a command has been started on behalf of
2020- this target. It is important that this happens here and not in
2121-diff -rc main.c main.c
2222-*** main.c 2006-03-20 03:36:37.000000000 +0100
2323---- main.c 2009-01-19 19:41:41.000000000 +0100
2424-***************
2525-*** 886,891 ****
2626---- 886,900 ----
2727- }
2828-2929-3030-+ static void close_nesting()
3131-+ {
3232-+ while (stdout_nesting_level--)
3333-+ printf("\e[q");
3434-+ while (stderr_nesting_level--)
3535-+ fprintf(stderr, "\e[q");
3636-+ }
3737-+
3838-+
3939- #ifdef _AMIGA
4040- int
4141- main (int argc, char **argv)
4242-***************
4343-*** 931,936 ****
4444---- 940,950 ----
4545- atexit (close_stdout);
4646- #endif
4747-4848-+ atexit(close_nesting);
4949-+
5050-+ if (getenv("NIX_INDENT_MAKE"))
5151-+ enable_nested_output = 1;
5252-+
5353- /* Needed for OS/2 */
5454- initialize_main(&argc, &argv);
5555-5656-***************
5757-*** 3095,3100 ****
5858---- 3109,3120 ----
5959-6060- /* Use entire sentences to give the translators a fighting chance. */
6161-6262-+ if (entering && enable_nested_output)
6363-+ {
6464-+ printf("\e[p");
6565-+ stdout_nesting_level++;
6666-+ }
6767-+
6868- if (makelevel == 0)
6969- if (starting_directory == 0)
7070- if (entering)
7171-***************
7272-*** 3124,3129 ****
7373---- 3144,3159 ----
7474- printf (_("%s[%u]: Leaving directory `%s'\n"),
7575- program, makelevel, starting_directory);
7676-7777-+ if (!entering && enable_nested_output)
7878-+ {
7979-+ printf("\e[q");
8080-+ stdout_nesting_level--;
8181-+ }
8282-+
8383- /* Flush stdout to be sure this comes before any stderr output. */
8484- fflush (stdout);
8585- }
8686-+
8787-+ int enable_nested_output = 0;
8888-+ int stdout_nesting_level = 0;
8989-+ int stderr_nesting_level = 0;
9090-diff -rc make.h
9191-*** make.h 2006-02-16 00:54:43.000000000 +0100
9292---- make.h 2009-01-19 19:32:03.000000000 +0100
9393-***************
9494-*** 609,611 ****
9595---- 609,614 ----
9696-9797- #define ENULLLOOP(_v,_c) do { errno = 0; (_v) = _c; } \
9898- while((_v)==0 && errno==EINTR)
9999-+ extern int enable_nested_output;
100100-+ extern int stdout_nesting_level;
101101-+ extern int stderr_nesting_level;
102102-diff -rc reremake.c
103103-*** remake.c 2006-03-20 03:36:37.000000000 +0100
104104---- remake.c 2009-01-19 19:39:40.000000000 +0100
105105-***************
106106-*** 1120,1126 ****
107107---- 1120,1137 ----
108108- /* The normal case: start some commands. */
109109- if (!touch_flag || file->cmds->any_recurse)
110110- {
111111-+ if (enable_nested_output)
112112-+ {
113113-+ log_working_directory (1);
114114-+ fprintf(stderr, "\e[pbuilding %s\n", file->name);
115115-+ stderr_nesting_level++;
116116-+ }
117117- execute_file_commands (file);
118118-+ if (enable_nested_output)
119119-+ {
120120-+ fprintf(stderr, "\e[q");
121121-+ stderr_nesting_level--;
122122-+ }
123123- return;
124124- }
125125-
+4-32
pkgs/stdenv/generic/setup.sh
···7777######################################################################
7878# Logging.
79798080-nestingLevel=0
8181-8282-startNest() {
8383- # Assert natural as sanity check.
8484- let nestingLevel+=1 "nestingLevel>=0"
8585- echo -en "\033[$1p"
8686-}
8787-8888-stopNest() {
8989- # Assert natural as sanity check.
9090- let nestingLevel-=1 "nestingLevel>=0"
9191- echo -en "\033[q"
9292-}
9393-9494-header() {
9595- startNest "$2"
9696- echo "$1"
9797-}
9898-9999-# Make sure that even when we exit abnormally, the original nesting
100100-# level is properly restored.
101101-closeNest() {
102102- while [ $nestingLevel -gt 0 ]; do
103103- stopNest
104104- done
105105-}
8080+# Obsolete.
8181+stopNest() { true; }
8282+header() { echo "$1"; }
8383+closeNest() { true; }
1068410785# Prints a command such that all word splits are unambiguous. We need
10886# to split the command in three parts because the middle format string
···122100exitHandler() {
123101 exitCode=$?
124102 set +e
125125-126126- closeNest
127103128104 if [ -n "$showBuildStats" ]; then
129105 times > "$NIX_BUILD_TOP/.times"
···593569 echo "do not know how to unpack source archive $curSrc"
594570 exit 1
595571 fi
596596- stopNest
597572}
598573599574···688663 # "2>&1" is a hack to make patch fail if the decompressor fails (nonexistent patch, etc.)
689664 # shellcheck disable=SC2086
690665 $uncompress < "$i" 2>&1 | patch ${patchFlags:--p1}
691691- stopNest
692666 done
693667694668 runHook postPatch
···973947 echo
974948 echo "@ phase-succeeded $out $curPhase"
975949 fi
976976-977977- stopNest
978950 done
979951}
980952