Skip to content

Commit

Permalink
gnumake: recreate patch set and move to patches directory
Browse files Browse the repository at this point in the history
  • Loading branch information
tie committed Aug 18, 2024
1 parent 3f648e2 commit 5fec234
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 32 deletions.
23 changes: 12 additions & 11 deletions pkgs/development/tools/build-managers/gnumake/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,18 @@ stdenv.mkDerivation rec {
sha256 = "sha256-3Rb7HWe/q3mnL16DkHNcSePo5wtJRaFasfgd23hlj7M=";
};

# to update apply these patches with `git am *.patch` to https://git.savannah.gnu.org/git/make.git
patches = [
# See patch message.
./make-cxx.patch
# Replaces /bin/sh with sh, see patch file for reasoning
./0001-No-impure-bin-sh.patch
# 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.
./0002-remove-impure-dirs.patch
];
# To update patches:
# $ version=4.4.1
# $ git clone https://git.savannah.gnu.org/git/make.git
# $ cd make && git checkout -b nixpkgs $version
# $ git am --directory=../patches
# $ # make changes, resolve conflicts, etc.
# $ git format-patch --output-directory ../patches --diff-algorithm=histogram $version
#
# TODO: stdenv’s setup.sh should be aware of patch directories. It’s very
# convenient to keep them in a separate directory but we can defer listing the
# directory until derivation realization to avoid unnecessary Nix evaluations.
patches = lib.filesystem.listFilesRecursive ./patches;

nativeBuildInputs = [ autoreconfHook pkg-config ];
buildInputs = lib.optionals guileEnabled [ guile ];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From e00a5257a6ca5fedbf68b09eee7df3502971a057 Mon Sep 17 00:00:00 2001
From b69e3740e68afaec97b9957d40b9c135db87eaab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
Date: Sat, 24 Apr 2021 10:11:40 +0200
Subject: [PATCH 1/2] No impure bin sh
Subject: [PATCH 1/3] No impure bin sh

default_shell is used to populuate default shell used to execute jobs.
Unless SHELL is set to a different value this would be /bin/sh.
Expand All @@ -18,10 +18,10 @@ hard-coded has some advantages:
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/job.c b/src/job.c
index ae1f18b..6b4ddb3 100644
index ea885614..8a9bd8e0 100644
--- a/src/job.c
+++ b/src/job.c
@@ -77,7 +77,7 @@ char * vms_strsignal (int status);
@@ -76,7 +76,7 @@ char * vms_strsignal (int status);

#else

Expand All @@ -31,5 +31,5 @@ index ae1f18b..6b4ddb3 100644

#endif
--
2.31.1
2.44.1

Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
From 795d63d3c8b5c0dbb7e544954f75507b371b7228 Mon Sep 17 00:00:00 2001
From 2db52008be2e2d504889f4f19318c2ba5a2a4797 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
Date: Sat, 24 Apr 2021 10:20:16 +0200
Subject: [PATCH 2/2] remove impure dirs
Subject: [PATCH 2/3] Remove impure dirs

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.
---
src/read.c | 3 ---
src/remake.c | 2 --
2 files changed, 5 deletions(-)

diff --git a/src/read.c b/src/read.c
index fa197fb..defacfb 100644
index b0fc1e1f..d6b41c17 100644
--- a/src/read.c
+++ b/src/read.c
@@ -109,9 +109,6 @@ static const char *default_include_directories[] =
#endif
@@ -111,9 +111,6 @@ static const char *default_include_directories[] =
INCLUDEDIR,
#endif
#ifndef _AMIGA
- "/usr/gnu/include",
- "/usr/local/include",
Expand All @@ -23,10 +27,10 @@ index fa197fb..defacfb 100644
0
};
diff --git a/src/remake.c b/src/remake.c
index fb237c5..94bff7d 100644
index fe67ab28..1b76560c 100644
--- a/src/remake.c
+++ b/src/remake.c
@@ -1601,8 +1601,6 @@ library_search (const char *lib, FILE_TIMESTAMP *mtime_ptr)
@@ -1690,8 +1690,6 @@ library_search (const char *lib, FILE_TIMESTAMP *mtime_ptr)
static const char *dirs[] =
{
#ifndef _AMIGA
Expand All @@ -36,5 +40,5 @@ index fb237c5..94bff7d 100644
#if defined(WINDOWS32) && !defined(LIBDIR)
/*
--
2.31.1
2.44.1

Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
Do not search for a C++ compiler and set MAKE_CXX.
From 3317b3a78666e6073c63f62a322176e3dc680461 Mon Sep 17 00:00:00 2001
From: Ivan Trubach <mr.trubach@icloud.com>
Date: Sat, 17 Aug 2024 22:35:03 +0300
Subject: [PATCH 3/3] Do not search for a C++ compiler and set MAKE_CXX
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Removes unnecessary reference to C++ compiler if CXX is set to an
absolute path. If CXX is not an absolute path, we avoid defaulting CXX
Expand All @@ -19,18 +25,28 @@ In stdenv, CXX environment variable is always defined and overrides the
default value.

References:
• https://savannah.gnu.org/bugs/?63668
• https://git.savannah.gnu.org/cgit/make.git/commit/?id=ffa28f3914ff402b3915f75e4fed86ac6fb1449d
• https://savannah.gnu.org/bugs/?63668
• https://git.savannah.gnu.org/cgit/make.git/commit/?id=ffa28f3914ff402b3915f75e4fed86ac6fb1449d
---
configure.ac | 2 --
src/default.c | 19 ++++++-------------
2 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/configure.ac b/configure.ac
index cd785754..41a65307 100644
--- a/configure.ac
+++ b/configure.ac
@@ -37,6 +37,4 @@ AM_INIT_AUTOMAKE([1.16.1 foreign -Werror -Wall])
@@ -37,8 +37,6 @@ AM_INIT_AUTOMAKE([1.16.1 foreign -Werror -Wall])
# Checks for programs.
AC_USE_SYSTEM_EXTENSIONS
AC_PROG_CC
-AC_PROG_CXX
-AC_DEFINE_UNQUOTED(MAKE_CXX, ["$CXX"], [Default C++ compiler.])


# Configure gnulib
gl_EARLY
diff --git a/src/default.c b/src/default.c
index e396269b..78ba402f 100644
--- a/src/default.c
+++ b/src/default.c
@@ -528,22 +528,15 @@ static const char *default_variables[] =
Expand All @@ -45,8 +61,7 @@ References:
#else
"CC", "cc",
"OBJC", "cc",
+ "CXX", "c++",
#endif
-#endif
-#ifdef MAKE_CXX
- "CXX", MAKE_CXX,
-#else
Expand All @@ -59,6 +74,10 @@ References:
-# else
- "CXX", "g++",
-# endif
-#endif
+ "CXX", "c++",
#endif
/* This expands to $(CO) $(COFLAGS) $< $@ if $@ does not exist,
and to the empty string if $@ does exist. */
--
2.44.1

0 comments on commit 5fec234

Please sign in to comment.