SHA256
3
0
forked from pool/make

- Update to 3.82

- Bug fixes
  - Backwards Incompatibilities:
    - Makefiles with .POSIX target: shells called with -e
    - $? contains prerequisites even if not existent
    - Prerequisite with '=' cannot be backslash escaped any more
      (use variable with '=' instead)
    - Variable names may not contain whitespaces any more
    - Mixture of explicit and pattern targets didn't always fail
    - Pattern specific rules application order changed
    - Library search behavior now compatible with standard linker
  - New features
    - --eval=STRING: Evaluate makefile syntax string before makefile
    - Variable .RECIPEPREFIX: Exchange TAB character
    - Variable .SHELLFLAGS:   Options passed to shells
    - Target   .ONESHELL:     Single instance of shell for recipe
    - Modifier  private:      Suppresses inheritance of variables
    - Directive undefine:     Undefine variable
  - Changed features
    - Multiple modifiers for variables allowed now.
    - Directive define:       Allow variable assignment operator.
- Nuke memory-hog-2.diff which didn't apply since 3.81
- Addapt make-slowdown-parallelism.diff to new parallelization tests
- Separate make checks into %checks section

OBS-URL: https://build.opensuse.org/package/show/Base:System/make?expand=0&rev=10
This commit is contained in:
Matthias Hopf 2010-08-25 16:25:13 +00:00 committed by Git OBS Bridge
parent 4b93516cae
commit 0f6ebe3101
7 changed files with 132 additions and 290 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f3e69023771e23908f5d5592954d8271d3d6af09693cecfd29cee6fde8550dc8
size 1151445

3
make-3.82.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e2c1a73f179c40c71e2fe8abf8a8a0688b8499538512984da4a76958d0402966
size 1242186

View File

@ -1,13 +0,0 @@
Index: make-3.81/tests/scripts/features/recursion
===================================================================
--- make-3.81.orig/tests/scripts/features/recursion 2005-02-10 01:10:58.000000000 +0100
+++ make-3.81/tests/scripts/features/recursion 2010-05-24 19:08:50.647462945 +0200
@@ -16,7 +16,7 @@ last:
@echo MAKELEVEL = $(MAKELEVEL)
@echo THE END
',
- ('CFLAGS=-O -w' . ($parallel_jobs ? '-j 2' : '')),
+ ('CFLAGS=-O -w' . ($parallel_jobs ? ' -j 2' : '')),
($vos
? "#MAKE#: Entering directory `#PWD#'
make 'CFLAGS=-O' -f #MAKEFILE# foo

View File

@ -1,259 +0,0 @@
GNU make 3.80 is a HUGE memory hog. It calls xstrdup to build
dependency list. gnu-src-gcc.deps in libjava has 3000+ targets depend
the same 3000+ files, whose filenames are more than 260K. For this
dependency alone, make takes 3000*260K == 761MB.
This patch is a quick hack. It reduces the memory from 1.6GB to around
600MB for "make -f gnu-src-gcc.deps". I think make should use a better
memory management for strings. If my approach is OK, I can try to
use it through out make.
H.J.
----
--- make-3.80/file.c.memory 2002-10-03 19:13:42.000000000 -0700
+++ make-3.80/file.c 2006-02-01 10:45:32.000000000 -0800
@@ -434,7 +434,7 @@ snap_deps ()
if (d->file == 0)
d->file = enter_file (d->name);
else
- free (d->name);
+ hash_strfree (d->name);
d->name = 0;
}
free (file_slot_0);
--- make-3.80/implicit.c.memory 2002-09-04 00:26:19.000000000 -0700
+++ make-3.80/implicit.c 2006-02-01 10:45:32.000000000 -0800
@@ -539,7 +539,7 @@ pattern_search (file, archive, depth, re
dep->file = enter_file (dep->name);
/* enter_file uses dep->name _if_ we created a new file. */
if (dep->name != dep->file->name)
- free (dep->name);
+ hash_strfree (dep->name);
dep->name = 0;
dep->file->tried_implicit |= dep->changed;
}
--- make-3.80/main.c.memory 2002-08-09 18:27:17.000000000 -0700
+++ make-3.80/main.c 2006-02-01 10:45:32.000000000 -0800
@@ -501,6 +501,7 @@ initialize_global_hash_tables ()
init_hash_files ();
hash_init_directories ();
hash_init_function_table ();
+ init_hash_strings ();
}
static struct file *
--- make-3.80/make.h.memory 2002-09-11 09:55:44.000000000 -0700
+++ make-3.80/make.h 2006-02-01 10:45:32.000000000 -0800
@@ -427,6 +427,11 @@ extern char *find_char_unquote PARAMS ((
extern char *find_percent PARAMS ((char *));
extern FILE *open_tmpfile PARAMS ((char **, const char *));
+extern void init_hash_strings PARAMS ((void));
+extern char *hash_strdup PARAMS ((const char *));
+extern char *hash_savestring PARAMS ((const char *, unsigned int));
+extern void hash_strfree PARAMS ((char *));
+
#ifndef NO_ARCHIVES
extern int ar_name PARAMS ((char *));
extern void ar_parse_name PARAMS ((char *, char **, char **));
--- make-3.80/misc.c.memory 2002-09-12 15:15:58.000000000 -0700
+++ make-3.80/misc.c 2006-02-01 11:05:44.000000000 -0800
@@ -18,8 +18,10 @@ along with GNU Make; see the file COPYIN
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+#include <assert.h>
#include "make.h"
#include "dep.h"
+#include "hash.h"
#include "debug.h"
/* Variadic functions. We go through contortions to allow proper function
@@ -564,7 +566,7 @@ copy_dep_chain (d)
c = (struct dep *) xmalloc (sizeof (struct dep));
bcopy ((char *) d, (char *) c, sizeof (struct dep));
if (c->name != 0)
- c->name = xstrdup (c->name);
+ c->name = hash_strdup (c->name);
c->next = 0;
if (firstnew == 0)
firstnew = lastnew = c;
@@ -891,3 +893,154 @@ atomic_readdir(dir)
}
#endif /* HAVE_BROKEN_RESTART */
+
+/* Hash table of duplicated strings. */
+
+struct hash_string
+{
+ char *string;
+ unsigned int count;
+};
+
+static unsigned long
+string_hash_1 (key)
+ const void *key;
+{
+ return_ISTRING_HASH_1 (((const struct hash_string *) key)->string);
+}
+
+static unsigned long
+string_hash_2 (key)
+ const void *key;
+{
+ return_ISTRING_HASH_2 (((const struct hash_string *) key)->string);
+}
+
+static int
+string_hash_cmp (x, y)
+ const void *x;
+ const void *y;
+{
+ return_ISTRING_COMPARE (((const struct hash_string *) x)->string,
+ ((const struct hash_string *) y)->string);
+}
+
+static struct hash_table strings;
+
+void
+init_hash_strings ()
+{
+ hash_init (&strings, 1000, string_hash_1, string_hash_2,
+ string_hash_cmp);
+}
+
+/* Keep track duplicated string and return the old one if exists. */
+
+char *
+hash_strdup (ptr)
+ const char *ptr;
+{
+ struct hash_string *h, key;
+
+ if (*ptr == '\0')
+ return "";
+
+ key.string = (char *) ptr;
+ key.count = 0;
+ h = (struct hash_string *) hash_find_item (&strings, &key);
+ if (h == NULL)
+ {
+ char *result = (char *) malloc (strlen (ptr) + 1);
+
+ if (result == NULL)
+ fatal (NILF, _("virtual memory exhausted"));
+
+ strcpy (result, ptr);
+
+ h = (struct hash_string *) malloc (sizeof (struct hash_string));
+ if (h == NULL)
+ fatal (NILF, _("virtual memory exhausted"));
+
+ h->string = result;
+ h->count = 1;
+ hash_insert (&strings, h);
+ }
+ else
+ {
+ h->count++;
+ assert (h->count != 0);
+ }
+
+ return h->string;
+}
+
+char *
+hash_savestring (str, length)
+ const char *str;
+ unsigned int length;
+{
+ struct hash_string *h, key;
+
+ if (length == 0 || *str == '\0')
+ return "";
+
+ key.string = alloca (length + 1);
+ key.count = 0;
+ bcopy (str, key.string, length);
+ key.string [length] = '\0';
+
+ h = (struct hash_string *) hash_find_item (&strings, &key);
+ if (h == NULL)
+ {
+ char *out = (char *) xmalloc (length + 1);
+ bcopy (str, out, length);
+ out[length] = '\0';
+
+ h = (struct hash_string *) malloc (sizeof (struct hash_string));
+ if (h == NULL)
+ fatal (NILF, _("virtual memory exhausted"));
+
+ h->string = out;
+ h->count = 1;
+ hash_insert (&strings, h);
+ }
+ else
+ {
+ h->count++;
+ assert (h->count != 0);
+ }
+
+ return h->string;
+}
+
+void
+hash_strfree (ptr)
+ char *ptr;
+{
+ struct hash_string *h, key;
+
+ if (*ptr == '\0')
+ return;
+
+ key.string = ptr;
+ key.count = 0;
+ h = (struct hash_string *) hash_find_item (&strings, &key);
+
+ /* Check if string comes from hash_strdup or hash_savestring. */
+ if (h == NULL || h->string != ptr)
+ {
+ free (ptr);
+ return;
+ }
+
+ h->count--;
+ if (h->count == 0)
+ {
+ struct hash_string *d;
+
+ d = hash_delete (&strings, h);
+ assert (d == h);
+ free (h->string);
+ free (h);
+ }
+}
--- make-3.80/read.c.memory 2006-02-01 10:45:32.000000000 -0800
+++ make-3.80/read.c 2006-02-01 10:45:32.000000000 -0800
@@ -1871,8 +1871,8 @@ record_files (filenames, pattern, patter
fatal (flocp,
_("target `%s' leaves prerequisite pattern empty"),
name);
- free (d->name);
- d->name = savestring (buffer, o - buffer);
+ hash_strfree (d->name);
+ d->name = hash_savestring (buffer, o - buffer);
}
}
}
@@ -2017,7 +2017,7 @@ record_files (filenames, pattern, patter
while (d != 0)
{
struct dep *nextd = d->next;
- free (d->name);
+ hash_strfree (d->name);
free ((char *)d);
d = nextd;
}

View File

@ -1,7 +1,21 @@
diff -ur ../make-3.81.orig/tests/scripts/features/parallelism ./tests/scripts/features/parallelism
--- ../make-3.81.orig/tests/scripts/features/parallelism 2006-06-07 12:55:53.000000000 +0200
+++ ./tests/scripts/features/parallelism 2006-06-07 13:04:04.000000000 +0200
@@ -27,9 +27,9 @@
Index: tests/scripts/features/double_colon
===================================================================
--- tests/scripts/features/double_colon.orig
+++ tests/scripts/features/double_colon
@@ -23,7 +23,7 @@ all: baz
foo:: f1.h ; @echo foo FIRST
foo:: f2.h ; @echo foo SECOND
-bar:: ; @echo aaa; sleep 1; echo aaa done
+bar:: ; @echo aaa; sleep 4; echo aaa done
bar:: ; @echo bbb
baz:: ; @echo aaa
Index: tests/scripts/features/parallelism
===================================================================
--- tests/scripts/features/parallelism.orig
+++ tests/scripts/features/parallelism
@@ -27,9 +27,9 @@ else {
run_make_test("
all : def_1 def_2 def_3
@ -14,7 +28,7 @@ diff -ur ../make-3.81.orig/tests/scripts/features/parallelism ./tests/scripts/fe
'-j4', "ONE\nFOUR\nTHREE\nTWO");
# Test parallelism with included files. Here we sleep/echo while
@@ -38,8 +38,8 @@
@@ -38,8 +38,8 @@ def_3 : ; \@$sleep_command 1 ; echo FOUR
run_make_test("
all: 1 2; \@echo success
-include 1.inc 2.inc
@ -25,7 +39,7 @@ diff -ur ../make-3.81.orig/tests/scripts/features/parallelism ./tests/scripts/fe
"-j4",
"ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n");
@@ -57,8 +57,8 @@
@@ -57,8 +57,8 @@ ifeq (\$(INC),yes)
-include 1.inc 2.inc
endif
@ -36,12 +50,86 @@ diff -ur ../make-3.81.orig/tests/scripts/features/parallelism ./tests/scripts/fe
"-j4",
"ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n");
@@ -95,7 +95,7 @@
@@ -74,37 +74,37 @@ rmfiles(qw(1.inc 2.inc));
run_make_test("
export HI = \$(shell \$(\$\@.CMD))
first.CMD = echo hi
-second.CMD = $sleep_command 4; echo hi
+second.CMD = $sleep_command 16; echo hi
.PHONY: all first second
all: first second
-first second: ; \@echo \$\@; $sleep_command 1; echo \$\@",
- '-j2', "first\nfirst\nsecond\nsecond", 0, 7);
+first second: ; \@echo \$\@; $sleep_command 4; echo \$\@",
+ '-j2', "first\nfirst\nsecond\nsecond", 0, 28);
# Michael Matz <matz@suse.de> reported a bug where if make is running in
# parallel without -k and two jobs die in a row, but not too close to each
# other, then make will quit without waiting for the rest of the jobs to die.
run_make_test("
-.PHONY: all fail.1 fail.2 fail.3 ok
-all: fail.1 ok fail.2 fail.3
+.PHONY: all fail.3 fail.6 fail.9 ok
+all: fail.3 ok fail.6 fail.9
-fail.1 fail.2 fail.3:
+fail.3 fail.6 fail.9:
\@sleep \$(patsubst fail.%,%,\$\@)
\@echo Fail
\@exit 1
ok:
- \@sleep 4
+ \@sleep 8
+ \@sleep 12
\@echo Ok done",
'-rR -j5', 'Fail
#MAKE#: *** [fail.1] Error 1
-#MAKE#: *** [fail.1] Error 1
+#MAKE#: *** [fail.3] Error 1
#MAKE#: *** Waiting for unfinished jobs....
Fail
-#MAKE#: *** [fail.2] Error 1
+#MAKE#: *** [fail.6] Error 1
Fail
-#MAKE#: *** [fail.3] Error 1
+#MAKE#: *** [fail.9] Error 1
Ok done',
512);
Index: tests/scripts/options/dash-l
===================================================================
--- tests/scripts/options/dash-l.orig
+++ tests/scripts/options/dash-l
@@ -25,7 +25,7 @@ SHELL = /bin/sh
define test
if [ ! -f test-file ]; then \
- echo >> test-file; sleep 2; rm -f test-file; \
+ echo >> test-file; sleep 8; rm -f test-file; \
else \
echo $@ FAILED; \
fi
@@ -46,7 +46,7 @@ $mkoptions = "-l 0.0001";
$mkoptions .= " -j 4" if ($parallel_jobs);
# We have to wait longer than the default (5s).
-&run_make_with_options($makefile, $mkoptions, &get_logfile, 0, 8);
+&run_make_with_options($makefile, $mkoptions, &get_logfile, 0, 32);
$slurp = &read_file_into_string (&get_logfile(1));
if ($slurp !~ /cannot enforce load limit/) {
Index: tests/test_driver.pl
===================================================================
--- tests/test_driver.pl.orig
+++ tests/test_driver.pl
@@ -52,7 +52,7 @@ $test_passed = 1;
# Timeout in seconds. If the test takes longer than this we'll fail it.
-$test_timeout = 5;
+$test_timeout = 20;
# Path to Perl
$perl_name = $^X;

View File

@ -1,3 +1,31 @@
-------------------------------------------------------------------
Mon Aug 23 13:39:12 UTC 2010 - mhopf@novell.com
- Update to 3.82
- Bug fixes
- Backwards Incompatibilities:
- Makefiles with .POSIX target: shells called with -e
- $? contains prerequisites even if not existent
- Prerequisite with '=' cannot be backslash escaped any more
(use variable with '=' instead)
- Variable names may not contain whitespaces any more
- Mixture of explicit and pattern targets didn't always fail
- Pattern specific rules application order changed
- Library search behavior now compatible with standard linker
- New features
- --eval=STRING: Evaluate makefile syntax string before makefile
- Variable .RECIPEPREFIX: Exchange TAB character
- Variable .SHELLFLAGS: Options passed to shells
- Target .ONESHELL: Single instance of shell for recipe
- Modifier private: Suppresses inheritance of variables
- Directive undefine: Undefine variable
- Changed features
- Multiple modifiers for variables allowed now.
- Directive define: Allow variable assignment operator.
- Nuke memory-hog-2.diff which didn't apply since 3.81
- Addapt make-slowdown-parallelism.diff to new parallelization tests
- Separate make checks into %checks section
-------------------------------------------------------------------
Mon Jun 28 06:38:35 UTC 2010 - jengelh@medozas.de

View File

@ -25,13 +25,11 @@ Group: Development/Tools/Building
Provides: gmake
PreReq: %install_info_prereq
AutoReqProv: on
Version: 3.81
Version: 3.82
Release: 131
Summary: GNU make
Source: make-3.81.tar.bz2
Patch1: make-memory-hog-2.diff
Source: make-%version.tar.bz2
Patch2: make-slowdown-parallelism.diff
Patch3: make-fix-testcase.patch
Patch64: make-library-search-path.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -40,9 +38,7 @@ The GNU make command with extensive documentation.
%prep
%setup
#%patch1 -p1
%patch2
%patch3 -p1
if [ %_lib == lib64 ]; then
%patch64
fi
@ -51,6 +47,8 @@ fi
CFLAGS=$RPM_OPT_FLAGS \
./configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info
make %{?_smp_mflags}
%check
make check
%install