-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gnumake: do not use MAKE_CXX #314716
Merged
Merged
gnumake: do not use MAKE_CXX #314716
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ lib | ||
, stdenv | ||
, fetchurl | ||
, updateAutotoolsGnuConfigScriptsHook | ||
, autoreconfHook | ||
, guileSupport ? false, guile | ||
# avoid guile depend on bootstrap to prevent dependency cycles | ||
, inBootstrap ? false | ||
|
@@ -22,17 +22,20 @@ 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 = [ | ||
# 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; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook ] ++ lib.optionals guileEnabled [ pkg-config ]; | ||
nativeBuildInputs = [ autoreconfHook pkg-config ]; | ||
buildInputs = lib.optionals guileEnabled [ guile ]; | ||
|
||
configureFlags = lib.optional guileEnabled "--with-guile" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
Comment on lines
+6
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was taken from the comment in the Nix file (and I appreciate it here!) |
||
--- | ||
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", | ||
|
@@ -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 | ||
|
@@ -36,5 +40,5 @@ index fb237c5..94bff7d 100644 | |
#if defined(WINDOWS32) && !defined(LIBDIR) | ||
/* | ||
-- | ||
2.31.1 | ||
2.44.1 | ||
|
83 changes: 83 additions & 0 deletions
83
...build-managers/gnumake/patches/0003-Do-not-search-for-a-C-compiler-and-set-MAKE_CXX.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
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 | ||
to a compiler name that was used to build the package. | ||
|
||
Context: GNU Make defines default values for CC, CXX and other | ||
environment variables. For CXX, it usually defaults to g++, however, | ||
FreeBSD and OpenBSD no longer ship GCC as a system compiler (and use | ||
Clang instead). For C compiler, POSIX standardizes the name to be "cc", | ||
but there is no such standard for C++ compiler name. As a fix, GNU Make | ||
uses CXX set for build as a default (via MAKE_CXX preprocessor macro in | ||
the source code). | ||
|
||
We revert the change that added this behavior and set the default to c++ | ||
or g++ that does not depend on the build platform. | ||
|
||
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 | ||
--- | ||
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,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[] = | ||
#ifdef GCC_IS_NATIVE | ||
"CC", "gcc", | ||
"OBJC", "gcc", | ||
+# ifdef __MSDOS__ | ||
+ "CXX", "gpp", /* g++ is an invalid name on MSDOS */ | ||
+# else | ||
+ "CXX", "g++", | ||
+# endif /* __MSDOS__ */ | ||
#else | ||
"CC", "cc", | ||
"OBJC", "cc", | ||
-#endif | ||
-#ifdef MAKE_CXX | ||
- "CXX", MAKE_CXX, | ||
-#else | ||
-# ifdef GCC_IS_NATIVE | ||
-# ifdef __MSDOS__ | ||
- "CXX", "gpp", /* g++ is an invalid name on MSDOS */ | ||
-# else | ||
- "CXX", "gcc", | ||
-# endif /* __MSDOS__ */ | ||
-# else | ||
- "CXX", "g++", | ||
-# endif | ||
+ "CXX", "c++", | ||
#endif | ||
/* This expands to $(CO) $(COFLAGS) $< $@ if $@ does not exist, | ||
and to the empty string if $@ does exist. */ | ||
-- | ||
2.44.1 | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created #335579