diff --git a/make-4.0-err-reporting.patch b/make-4.0-err-reporting.patch new file mode 100644 index 0000000..fb015a7 --- /dev/null +++ b/make-4.0-err-reporting.patch @@ -0,0 +1,151 @@ +diff -Nrup a/job.c b/job.c +--- a/job.c 2015-10-29 17:19:17.209430335 -0400 ++++ b/job.c 2015-10-29 18:24:04.452169281 -0400 +@@ -1033,7 +1033,7 @@ free_child (struct child *child) + + EINTRLOOP (r, write (job_fds[1], &token, 1)); + if (r != 1) +- pfatal_with_name (_("write jobserver")); ++ pfatal_with_name_err (_("write jobserver"), errno); + + DB (DB_JOBS, (_("Released token for child %p (%s).\n"), + child, child->file->name)); +@@ -2008,6 +2008,7 @@ new_job (struct file *file) + #else + /* Set interruptible system calls, and read() for a job token. */ + set_child_handler_action_flags (1, waiting_jobs != NULL); ++ errno = 0; + got_token = read (job_rfd, &token, 1); + saved_errno = errno; + set_child_handler_action_flags (0, waiting_jobs != NULL); +@@ -2024,10 +2025,14 @@ new_job (struct file *file) + #ifndef WINDOWS32 + /* If the error _wasn't_ expected (EINTR or EBADF), punt. Otherwise, + go back and reap_children(), and try again. */ +- errno = saved_errno; +- if (errno != EINTR && errno != EBADF) +- pfatal_with_name (_("read jobs pipe")); +- if (errno == EBADF) ++ if (saved_errno != EINTR && saved_errno != EBADF) ++ { ++ if (got_token == 0) ++ O (fatal, NILF, _("read jobs pipe EOF")); ++ else ++ pfatal_with_name_err (_("read jobs pipe"), saved_errno); ++ } ++ if (saved_errno == EBADF) + DB (DB_JOBS, ("Read returned EBADF.\n")); + #endif + } +@@ -2170,7 +2175,9 @@ load_too_high (void) + O (error, NILF, + _("cannot enforce load limits on this operating system")); + else +- perror_with_name (_("cannot enforce load limit: "), "getloadavg"); ++ perror_with_name_err (_("cannot enforce load limit: "), ++ "getloadavg", errno); ++ + } + lossage = errno; + load = 0; +diff -Nrup a/main.c b/main.c +--- a/main.c 2015-10-29 17:19:17.198430225 -0400 ++++ b/main.c 2015-10-29 19:12:15.599567039 -0400 +@@ -1564,7 +1564,7 @@ main (int argc, char **argv, char **envp + || (job_rfd = dup (job_fds[0])) < 0) + { + if (errno != EBADF) +- pfatal_with_name (_("dup jobserver")); ++ pfatal_with_name_err (_("dup jobserver"), errno); + + O (error, NILF, + _("warning: jobserver unavailable: using -j1. Add '+' to parent make rule.")); +@@ -1777,13 +1777,13 @@ main (int argc, char **argv, char **envp + strcat (template, DEFAULT_TMPFILE); + outfile = output_tmpfile (&stdin_nm, template); + if (outfile == 0) +- pfatal_with_name (_("fopen (temporary file)")); ++ pfatal_with_name_err (_("fopen (temporary file)"), errno); + while (!feof (stdin) && ! ferror (stdin)) + { + char buf[2048]; + unsigned int n = fread (buf, 1, sizeof (buf), stdin); + if (n > 0 && fwrite (buf, 1, n, outfile) != n) +- pfatal_with_name (_("fwrite (temporary file)")); ++ pfatal_with_name_err (_("fwrite (temporary file)"), errno); + } + fclose (outfile); + +@@ -2019,7 +2019,8 @@ main (int argc, char **argv, char **envp + char c = '+'; + + if (pipe (job_fds) < 0 || (job_rfd = dup (job_fds[0])) < 0) +- pfatal_with_name (_("creating jobs pipe")); ++ pfatal_with_name_err (_("creating jobs pipe"), errno); ++ + #endif + + /* Every make assumes that it always has one job it can run. For the +@@ -2039,7 +2040,7 @@ main (int argc, char **argv, char **envp + + EINTRLOOP (r, write (job_fds[1], &c, 1)); + if (r != 1) +- pfatal_with_name (_("init jobserver pipe")); ++ pfatal_with_name_err (_("init jobserver pipe"), errno); + } + #endif + +@@ -2464,7 +2465,7 @@ main (int argc, char **argv, char **envp + /* If there is a temp file from reading a makefile from stdin, get rid of + it now. */ + if (stdin_nm && unlink (stdin_nm) < 0 && errno != ENOENT) +- perror_with_name (_("unlink (temporary file): "), stdin_nm); ++ perror_with_name_err (_("unlink (temporary file): "), stdin_nm, errno); + + /* If there were no command-line goals, use the default. */ + if (goals == 0) +diff -Nrup a/makeint.h b/makeint.h +--- a/makeint.h 2015-10-29 17:19:17.168429926 -0400 ++++ b/makeint.h 2015-10-29 18:30:44.364147393 -0400 +@@ -458,6 +458,8 @@ void fatal (const gmk_floc *flocp, size_ + void die (int) __attribute__ ((noreturn)); + void pfatal_with_name (const char *) __attribute__ ((noreturn)); + void perror_with_name (const char *, const char *); ++void pfatal_with_name_err (const char *, int errnum) __attribute__ ((noreturn)); ++void perror_with_name_err (const char *, const char *, int errnum); + #define xstrlen(_s) ((_s)==NULL ? 0 : strlen (_s)) + void *xmalloc (unsigned int); + void *xcalloc (unsigned int); +diff -Nrup a/output.c b/output.c +--- a/output.c 2014-10-05 12:24:51.000000000 -0400 ++++ b/output.c 2015-10-29 19:04:05.332692965 -0400 +@@ -705,6 +705,13 @@ fatal (const gmk_floc *flocp, size_t len + /* Print an error message from errno. */ + + void ++perror_with_name_err (const char *str, const char *name, int errnum) ++{ ++ const char *err = strerror (errnum); ++ OSSS (error, NILF, _("%s%s: %s"), str, name, err); ++} ++ ++void + perror_with_name (const char *str, const char *name) + { + const char *err = strerror (errno); +@@ -714,6 +721,15 @@ perror_with_name (const char *str, const + /* Print an error message from errno and exit. */ + + void ++pfatal_with_name_err (const char *name, int errnum) ++{ ++ const char *err = strerror (errnum); ++ OSS (fatal, NILF, _("%s: %s"), name, err); ++ ++ /* NOTREACHED */ ++} ++ ++void + pfatal_with_name (const char *name) + { + const char *err = strerror (errno); diff --git a/make-4.0-getcwd.patch b/make-4.0-getcwd.patch new file mode 100644 index 0000000..c0bb459 --- /dev/null +++ b/make-4.0-getcwd.patch @@ -0,0 +1,12 @@ +diff -Nrup a/makeint.h b/makeint.h +--- a/makeint.h 2013-10-09 00:22:40.000000000 -0400 ++++ b/makeint.h 2014-02-03 17:46:24.969618708 -0500 +@@ -528,7 +528,7 @@ long int lseek (); + #endif /* Not GNU C library or POSIX. */ + + #ifdef HAVE_GETCWD +-# if !defined(VMS) && !defined(__DECC) ++# if !defined(VMS) && !defined(__DECC) && !defined(getcwd) + char *getcwd (); + # endif + #else diff --git a/make-4.0-j8k.patch b/make-4.0-j8k.patch new file mode 100644 index 0000000..a6fab1a --- /dev/null +++ b/make-4.0-j8k.patch @@ -0,0 +1,24 @@ +diff -Nrup a/main.c b/main.c +--- a/main.c 2013-10-09 00:22:40.000000000 -0400 ++++ b/main.c 2014-02-03 17:18:04.238609236 -0500 +@@ -1987,6 +1987,20 @@ main (int argc, char **argv, char **envp + } + #endif + ++#ifdef PIPE_BUF ++ if (job_slots > PIPE_BUF) ++#elif defined _POSIX_PIPE_BUF ++ if (job_slots > _POSIX_PIPE_BUF) ++#else ++ if (job_slots > 512) ++#endif ++ { ++ O (error, NILF, ++ _("More parallel jobs (-jN) than this platform can handle requested.")); ++ O (error, NILF, _("Resetting to single job (-j1) mode.")); ++ job_slots = 1; ++ } ++ + #ifdef MAKE_JOBSERVER + /* If we have >1 slot but no jobserver-fds, then we're a top-level make. + Set up the pipe and install the fds option for our children. */ diff --git a/make-4.0-newlines.patch b/make-4.0-newlines.patch new file mode 100644 index 0000000..add32c5 --- /dev/null +++ b/make-4.0-newlines.patch @@ -0,0 +1,19 @@ +diff -Nrup a/job.c b/job.c +--- a/job.c 2014-02-03 18:23:45.936436714 -0500 ++++ b/job.c 2014-02-04 00:17:53.232074893 -0500 +@@ -3269,13 +3269,14 @@ construct_command_argv_internal (char *l + #endif + if (PRESERVE_BSNL) + { +- *(ap++) = '\\'; ++ *(ap++) = '\''; + /* Only non-batch execution needs another backslash, + because it will be passed through a recursive + invocation of this function. */ + if (!batch_mode_shell) + *(ap++) = '\\'; + *(ap++) = '\n'; ++ *(ap++) = '\''; + } + ++p; + continue; diff --git a/make-4.0-noclock_gettime.patch b/make-4.0-noclock_gettime.patch new file mode 100644 index 0000000..f63e1fc --- /dev/null +++ b/make-4.0-noclock_gettime.patch @@ -0,0 +1,14 @@ +diff -up make-3.82/configure\~ make-3.82/configure +--- make-3.82/configure~ 2010-07-28 07:41:51.000000000 +0200 ++++ make-3.82/configure 2010-08-11 15:07:50.000000000 +0200 +@@ -7215,7 +7215,7 @@ return clock_gettime (); + return 0; + } + _ACEOF +-for ac_lib in '' rt posix4; do ++for ac_lib in '' posix4; do + if test -z "$ac_lib"; then + ac_res="none required" + else + +Diff finished. Wed Aug 11 15:07:59 2010 diff --git a/make-4.0-weird-shell.patch b/make-4.0-weird-shell.patch new file mode 100644 index 0000000..dfdaf89 --- /dev/null +++ b/make-4.0-weird-shell.patch @@ -0,0 +1,16 @@ +diff -up make-3.82/job.c\~ make-3.82/job.c +--- make-3.82/job.c~ 2010-08-11 16:13:33.000000000 +0200 ++++ make-3.82/job.c 2010-08-12 14:20:08.000000000 +0200 +@@ -2442,7 +2442,11 @@ construct_command_argv_internal (char *l + + /* See if it is safe to parse commands internally. */ + if (shell == 0) +- shell = default_shell; ++ { ++ shell = default_shell; ++ if (shellflags == 0) ++ shellflags = "-c"; ++ } + #ifdef WINDOWS32 + else if (strcmp (shell, default_shell)) + { diff --git a/make.spec b/make.spec index 4d61bda..5e75ce0 100644 --- a/make.spec +++ b/make.spec @@ -3,19 +3,34 @@ Summary: A GNU tool which simplifies the build process for users Name: make Epoch: 1 Version: 4.1 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv3+ Group: Development/Tools URL: http://www.gnu.org/software/make/ Source: ftp://ftp.gnu.org/gnu/make/make-%{version}.tar.bz2 -Patch0: make-getcwd.patch -Patch1: make-newlines.patch +Patch0: make-4.0-getcwd.patch +Patch1: make-4.0-newlines.patch +# Assume we don't have clock_gettime in configure, so that +# make is not linked against -lpthread (and thus does not +# limit stack to 2MB). +Patch2: make-4.0-noclock_gettime.patch + +# BZs #142691, #17374 +Patch3: make-4.0-j8k.patch + +# make sure errno for error reporting is not lost accross _() calls +Patch4: make-4.0-err-reporting.patch + +# Upstream: https://savannah.gnu.org/bugs/?30748 +# The default value of .SHELL_FLAGS is -c. +Patch5: make-4.0-weird-shell.patch + +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires(post): /sbin/install-info Requires(preun): /sbin/install-info BuildRequires: procps -BuildRequires: git %description A GNU tool for controlling the generation of executables and other @@ -33,7 +48,13 @@ Group: Development/Libraries The make-devel package contains gnumake.h. %prep -%autosetup -p0 -Sgit +%setup -q +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 rm -f tests/scripts/features/parallelism.orig @@ -42,7 +63,8 @@ rm -f tests/scripts/features/parallelism.orig make %{?_smp_mflags} %install -%make_install +rm -rf ${RPM_BUILD_ROOT} +make DESTDIR=$RPM_BUILD_ROOT install ln -sf make ${RPM_BUILD_ROOT}/%{_bindir}/gmake ln -sf make.1 ${RPM_BUILD_ROOT}/%{_mandir}/man1/gmake.1 rm -f ${RPM_BUILD_ROOT}/%{_infodir}/dir @@ -54,6 +76,9 @@ echo ============TESTING=============== /usr/bin/env LANG=C make check && true echo ============END TESTING=========== +%clean +rm -rf ${RPM_BUILD_ROOT} + %post if [ -f %{_infodir}/make.info.gz ]; then # for --excludedocs /sbin/install-info %{_infodir}/make.info.gz %{_infodir}/dir --entry="* Make: (make). The GNU make utility." || : @@ -67,17 +92,22 @@ if [ $1 = 0 ]; then fi %files -f %{name}.lang -%license COPYING -%doc NEWS README AUTHORS +%defattr(-,root,root) +%doc NEWS README COPYING AUTHORS %{_bindir}/* %{_mandir}/man*/* %{_infodir}/*.info* %{_includedir}/gnumake.h %files devel +%defattr(-,root,root) %{_includedir}/gnumake.h %changelog +* Thu Oct 29 2015 Patsy Franklin 1:4.1-2 +- Include patches dropped in last update as they fix reported bugs and + update the spec file to include more info on the patches. + * Sat Oct 24 2015 Zbigniew Jędrzejewski-Szmek - 1:4.1-1 - Update to latest version