gnumake42: bring this version back
This is almost a revert of commit 0cfe9f3a
(PR #86293). Version 4.3
https://lists.gnu.org/archive/html/info-gnu/2020-01/msg00004.html
brought some incompatibilities, so this will be useful for shorter-term
workarounds.
This commit is contained in:
parent
d30ac2e50c
commit
e978eb5986
5 changed files with 300 additions and 0 deletions
|
@ -0,0 +1,63 @@
|
|||
{ stdenv, fetchurl, guileSupport ? false, pkgconfig ? null , guile ? null }:
|
||||
|
||||
assert guileSupport -> ( pkgconfig != null && guile != null );
|
||||
|
||||
let
|
||||
version = "4.2.1";
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
pname = "gnumake";
|
||||
inherit version;
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://gnu/make/make-${version}.tar.bz2";
|
||||
sha256 = "12f5zzyq2w56g95nni65hc0g5p7154033y2f3qmjvd016szn5qnn";
|
||||
};
|
||||
|
||||
patchFlags = [ "-p0" ];
|
||||
patches = [
|
||||
# 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 /usr/include and friends.
|
||||
./impure-dirs.patch
|
||||
./pselect.patch
|
||||
# Fix support for glibc 2.27's glob, inspired by http://www.linuxfromscratch.org/lfs/view/8.2/chapter05/make.html
|
||||
./glibc-2.27-glob.patch
|
||||
];
|
||||
|
||||
nativeBuildInputs = stdenv.lib.optionals guileSupport [ pkgconfig ];
|
||||
buildInputs = stdenv.lib.optionals guileSupport [ guile ];
|
||||
|
||||
configureFlags = stdenv.lib.optional guileSupport "--with-guile"
|
||||
|
||||
# Make uses this test to decide whether it should keep track of
|
||||
# subseconds. Apple made this possible with APFS and macOS 10.13.
|
||||
# However, we still support macOS 10.11 and 10.12. Binaries built
|
||||
# in Nixpkgs will be unable to use futimens to set mtime less than
|
||||
# a second. So, tell Make to ignore nanoseconds in mtime here by
|
||||
# overriding the autoconf test for the struct.
|
||||
# See https://github.com/NixOS/nixpkgs/issues/51221 for discussion.
|
||||
++ stdenv.lib.optional stdenv.isDarwin "ac_cv_struct_st_mtim_nsec=no";
|
||||
|
||||
outputs = [ "out" "man" "info" ];
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
homepage = "https://www.gnu.org/software/make/";
|
||||
description = "A tool to control the generation of non-source files from sources";
|
||||
license = licenses.gpl3Plus;
|
||||
|
||||
longDescription = ''
|
||||
Make is a tool which controls the generation of executables and
|
||||
other non-source files of a program from the program's source files.
|
||||
|
||||
Make gets its knowledge of how to build your program from a file
|
||||
called the makefile, which lists each of the non-source files and
|
||||
how to compute it from other files. When you write a program, you
|
||||
should write a makefile for it, so that it is possible to use Make
|
||||
to build and install the program.
|
||||
'';
|
||||
|
||||
platforms = platforms.all;
|
||||
maintainers = [ maintainers.vrthra ];
|
||||
};
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
diff -Naur glob/glob.c glob/glob.c
|
||||
--- glob/glob.c 2013-10-20 13:14:38.000000000 -0400
|
||||
+++ glob/glob.c 2018-03-16 14:32:38.483496170 -0400
|
||||
@@ -208,28 +208,9 @@
|
||||
#endif /* __GNU_LIBRARY__ || __DJGPP__ */
|
||||
|
||||
|
||||
-#if !defined __alloca && !defined __GNU_LIBRARY__
|
||||
-
|
||||
-# ifdef __GNUC__
|
||||
-# undef alloca
|
||||
-# define alloca(n) __builtin_alloca (n)
|
||||
-# else /* Not GCC. */
|
||||
-# ifdef HAVE_ALLOCA_H
|
||||
# include <alloca.h>
|
||||
-# else /* Not HAVE_ALLOCA_H. */
|
||||
-# ifndef _AIX
|
||||
-# ifdef WINDOWS32
|
||||
-# include <malloc.h>
|
||||
-# else
|
||||
-extern char *alloca ();
|
||||
-# endif /* WINDOWS32 */
|
||||
-# endif /* Not _AIX. */
|
||||
-# endif /* sparc or HAVE_ALLOCA_H. */
|
||||
-# endif /* GCC. */
|
||||
-
|
||||
# define __alloca alloca
|
||||
|
||||
-#endif
|
||||
|
||||
#ifndef __GNU_LIBRARY__
|
||||
# define __stat stat
|
|
@ -0,0 +1,34 @@
|
|||
diff -rc read.c read.c
|
||||
*** read.c 2006-03-17 15:24:20.000000000 +0100
|
||||
--- read.c 2007-05-24 17:16:31.000000000 +0200
|
||||
***************
|
||||
*** 99,107 ****
|
||||
--- 99,109 ----
|
||||
#endif
|
||||
INCLUDEDIR,
|
||||
#ifndef _AMIGA
|
||||
+ #if 0
|
||||
"/usr/gnu/include",
|
||||
"/usr/local/include",
|
||||
"/usr/include",
|
||||
+ #endif
|
||||
#endif
|
||||
0
|
||||
};
|
||||
diff -rc reremake.c
|
||||
*** remake.c 2006-03-20 03:36:37.000000000 +0100
|
||||
--- remake.c 2007-05-24 17:06:54.000000000 +0200
|
||||
***************
|
||||
*** 1452,1460 ****
|
||||
--- 1452,1462 ----
|
||||
static char *dirs[] =
|
||||
{
|
||||
#ifndef _AMIGA
|
||||
+ #if 0
|
||||
"/lib",
|
||||
"/usr/lib",
|
||||
#endif
|
||||
+ #endif
|
||||
#if defined(WINDOWS32) && !defined(LIBDIR)
|
||||
/*
|
||||
* This is completely up to the user at product install time. Just define
|
170
pkgs/development/tools/build-managers/gnumake/4.2/pselect.patch
Normal file
170
pkgs/development/tools/build-managers/gnumake/4.2/pselect.patch
Normal file
|
@ -0,0 +1,170 @@
|
|||
From b552b05251980f693c729e251f93f5225b400714 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Smith <psmith@gnu.org>
|
||||
Date: Sat, 3 Jun 2017 16:20:51 -0400
|
||||
Subject: [SV 51159] Use a non-blocking read with pselect to avoid hangs.
|
||||
|
||||
* posixos.c (set_blocking): Set blocking on a file descriptor.
|
||||
(jobserver_setup): Set non-blocking on the jobserver read side.
|
||||
(jobserver_parse_auth): Ditto.
|
||||
(jobserver_acquire_all): Set blocking to avoid a busy-wait loop.
|
||||
(jobserver_acquire): If the non-blocking read() returns without
|
||||
taking a token then try again.
|
||||
---
|
||||
posixos.c | 97 ++++++++++++++++++++++++++++++++++++++++++++++-----------------
|
||||
1 file changed, 71 insertions(+), 26 deletions(-)
|
||||
|
||||
diff --git posixos.c posixos.c
|
||||
index e642d7f..dbafa51 100644
|
||||
--- posixos.c
|
||||
+++ posixos.c
|
||||
@@ -62,6 +62,24 @@ make_job_rfd (void)
|
||||
#endif
|
||||
}
|
||||
|
||||
+static void
|
||||
+set_blocking (int fd, int blocking)
|
||||
+{
|
||||
+ // If we're not using pselect() don't change the blocking
|
||||
+#ifdef HAVE_PSELECT
|
||||
+ int flags;
|
||||
+ EINTRLOOP (flags, fcntl (fd, F_GETFL));
|
||||
+ if (flags >= 0)
|
||||
+ {
|
||||
+ int r;
|
||||
+ flags = blocking ? (flags & ~O_NONBLOCK) : (flags | O_NONBLOCK);
|
||||
+ EINTRLOOP (r, fcntl (fd, F_SETFL, flags));
|
||||
+ if (r < 0)
|
||||
+ pfatal_with_name ("fcntl(O_NONBLOCK)");
|
||||
+ }
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
unsigned int
|
||||
jobserver_setup (int slots)
|
||||
{
|
||||
@@ -86,6 +104,9 @@ jobserver_setup (int slots)
|
||||
pfatal_with_name (_("init jobserver pipe"));
|
||||
}
|
||||
|
||||
+ /* When using pselect() we want the read to be non-blocking. */
|
||||
+ set_blocking (job_fds[0], 0);
|
||||
+
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -121,6 +142,9 @@ jobserver_parse_auth (const char *auth)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+ /* When using pselect() we want the read to be non-blocking. */
|
||||
+ set_blocking (job_fds[0], 0);
|
||||
+
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -169,7 +193,10 @@ jobserver_acquire_all (void)
|
||||
{
|
||||
unsigned int tokens = 0;
|
||||
|
||||
- /* Close the write side, so the read() won't hang. */
|
||||
+ /* Use blocking reads to wait for all outstanding jobs. */
|
||||
+ set_blocking (job_fds[0], 1);
|
||||
+
|
||||
+ /* Close the write side, so the read() won't hang forever. */
|
||||
close (job_fds[1]);
|
||||
job_fds[1] = -1;
|
||||
|
||||
@@ -236,18 +263,12 @@ jobserver_pre_acquire (void)
|
||||
unsigned int
|
||||
jobserver_acquire (int timeout)
|
||||
{
|
||||
- sigset_t empty;
|
||||
- fd_set readfds;
|
||||
struct timespec spec;
|
||||
struct timespec *specp = NULL;
|
||||
- int r;
|
||||
- char intake;
|
||||
+ sigset_t empty;
|
||||
|
||||
sigemptyset (&empty);
|
||||
|
||||
- FD_ZERO (&readfds);
|
||||
- FD_SET (job_fds[0], &readfds);
|
||||
-
|
||||
if (timeout)
|
||||
{
|
||||
/* Alarm after one second (is this too granular?) */
|
||||
@@ -256,28 +277,52 @@ jobserver_acquire (int timeout)
|
||||
specp = &spec;
|
||||
}
|
||||
|
||||
- r = pselect (job_fds[0]+1, &readfds, NULL, NULL, specp, &empty);
|
||||
-
|
||||
- if (r == -1)
|
||||
+ while (1)
|
||||
{
|
||||
- /* Better be SIGCHLD. */
|
||||
- if (errno != EINTR)
|
||||
- pfatal_with_name (_("pselect jobs pipe"));
|
||||
- return 0;
|
||||
- }
|
||||
+ fd_set readfds;
|
||||
+ int r;
|
||||
+ char intake;
|
||||
|
||||
- if (r == 0)
|
||||
- /* Timeout. */
|
||||
- return 0;
|
||||
+ FD_ZERO (&readfds);
|
||||
+ FD_SET (job_fds[0], &readfds);
|
||||
|
||||
- /* The read FD is ready: read it! */
|
||||
- EINTRLOOP (r, read (job_fds[0], &intake, 1));
|
||||
- if (r < 0)
|
||||
- pfatal_with_name (_("read jobs pipe"));
|
||||
+ r = pselect (job_fds[0]+1, &readfds, NULL, NULL, specp, &empty);
|
||||
+ if (r < 0)
|
||||
+ switch (errno)
|
||||
+ {
|
||||
+ case EINTR:
|
||||
+ /* SIGCHLD will show up as an EINTR. */
|
||||
+ return 0;
|
||||
+
|
||||
+ case EBADF:
|
||||
+ /* Someone closed the jobs pipe.
|
||||
+ That shouldn't happen but if it does we're done. */
|
||||
+ O (fatal, NILF, _("job server shut down"));
|
||||
|
||||
- /* What does it mean if read() returns 0? It shouldn't happen because only
|
||||
- the master make can reap all the tokens and close the write side...?? */
|
||||
- return r > 0;
|
||||
+ default:
|
||||
+ pfatal_with_name (_("pselect jobs pipe"));
|
||||
+ }
|
||||
+
|
||||
+ if (r == 0)
|
||||
+ /* Timeout. */
|
||||
+ return 0;
|
||||
+
|
||||
+ /* The read FD is ready: read it! This is non-blocking. */
|
||||
+ EINTRLOOP (r, read (job_fds[0], &intake, 1));
|
||||
+
|
||||
+ if (r < 0)
|
||||
+ {
|
||||
+ /* Someone sniped our token! Try again. */
|
||||
+ if (errno == EAGAIN)
|
||||
+ continue;
|
||||
+
|
||||
+ pfatal_with_name (_("read jobs pipe"));
|
||||
+ }
|
||||
+
|
||||
+ /* read() should never return 0: only the master make can reap all the
|
||||
+ tokens and close the write side...?? */
|
||||
+ return r > 0;
|
||||
+ }
|
||||
}
|
||||
|
||||
#else
|
||||
--
|
||||
cgit v1.0-41-gc330
|
||||
|
|
@ -10566,6 +10566,7 @@ in
|
|||
m4 = gnum4;
|
||||
|
||||
gnumake = callPackage ../development/tools/build-managers/gnumake { };
|
||||
gnumake42 = callPackage ../development/tools/build-managers/gnumake/4.2 { };
|
||||
|
||||
gnustep = recurseIntoAttrs (callPackage ../desktops/gnustep {});
|
||||
|
||||
|
|
Loading…
Reference in a new issue