summaryrefslogtreecommitdiff
path: root/gnu/packages
diff options
context:
space:
mode:
authorMarius Bakke <marius@gnu.org>2021-05-01 22:42:27 +0200
committerMarius Bakke <marius@gnu.org>2021-06-13 01:00:46 +0200
commit4796b5d6d18dcc0f1b6c8e134977ebdb575c5741 (patch)
tree7f07f488beeb7044590deb4feee787bf848e91d9 /gnu/packages
parent1dec7fa83d4e89f98bc887211b1cfb78aa74f98d (diff)
gnu: GCC: Switch to GCC 10.
* gnu/packages/patches/gcc-cross-gxx-include-dir.patch: New file. * gnu/packages/patches/gcc-10-cross-environment-variables.patch: New file. * gnu/packages/gcc.scm (gcc): Point to GCC-10. (gcc-objc): Point to GCC-OBJC-10. (gcc-objc++): Point to GCC-OBJC++-10. * gnu/packages/cross-base.scm (cross-gcc)[source](patches): Apply the new patches.
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/cross-base.scm3
-rw-r--r--gnu/packages/gcc.scm6
-rw-r--r--gnu/packages/patches/gcc-10-cross-environment-variables.patch51
-rw-r--r--gnu/packages/patches/gcc-cross-gxx-include-dir.patch73
4 files changed, 130 insertions, 3 deletions
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 9487ac9238..926b00ccdf 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -243,6 +243,9 @@ target that libc."
(append
(origin-patches (package-source xgcc))
(append (cond
+ ((version>=? (package-version xgcc) "10.0")
+ (search-patches "gcc-10-cross-environment-variables.patch"
+ "gcc-cross-gxx-include-dir.patch"))
((version>=? (package-version xgcc) "8.0")
(search-patches "gcc-8-cross-environment-variables.patch"))
((version>=? (package-version xgcc) "6.0")
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index e202b41715..5d114dca87 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -598,7 +598,7 @@ It also includes runtime support libraries for these languages.")))
;; Note: When changing the default gcc version, update
;; the gcc-toolchain-* definitions.
-(define-public gcc gcc-8)
+(define-public gcc gcc-10)
(define-public (make-libstdc++ gcc)
"Return a libstdc++ package based on GCC. The primary use case is when
@@ -838,7 +838,7 @@ provides the GNU compiler for the Go programming language."))
(custom-gcc gcc-10 "gcc-objc" '("objc")
%objc-search-paths))
-(define-public gcc-objc gcc-objc-7)
+(define-public gcc-objc gcc-objc-10)
(define %objc++-search-paths
(list (search-path-specification
@@ -880,7 +880,7 @@ provides the GNU compiler for the Go programming language."))
(custom-gcc gcc-10 "gcc-objc++" '("obj-c++")
%objc++-search-paths))
-(define-public gcc-objc++ gcc-objc++-7)
+(define-public gcc-objc++ gcc-objc++-10)
(define (make-libstdc++-doc gcc)
"Return a package with the libstdc++ documentation for GCC."
diff --git a/gnu/packages/patches/gcc-10-cross-environment-variables.patch b/gnu/packages/patches/gcc-10-cross-environment-variables.patch
new file mode 100644
index 0000000000..414198657d
--- /dev/null
+++ b/gnu/packages/patches/gcc-10-cross-environment-variables.patch
@@ -0,0 +1,51 @@
+Search path environment variables for cross-compilers. See the discussion
+at <http://gcc.gnu.org/ml/gcc/2013-02/msg00124.html>.
+
+Note: Touch 'C_INCLUDE_PATH' et al. rather than 'CPATH', as discussed
+at <http://bugs.gnu.org/22186>.
+
+diff --git a/gcc/gcc.c b/gcc/gcc.c
+--- a/gcc/gcc.c
++++ b/gcc/gcc.c
+@@ -4474,7 +4474,7 @@ process_command (unsigned int decoded_options_count,
+ }
+
+ temp = env.get (LIBRARY_PATH_ENV);
+- if (temp && *cross_compile == '0')
++ if (temp)
+ {
+ const char *startp, *endp;
+ char *nstore = (char *) alloca (strlen (temp) + 3);
+diff --git a/gcc/incpath.c b/gcc/incpath.c
+--- a/gcc/incpath.c
++++ b/gcc/incpath.c
+@@ -472,8 +472,8 @@ register_include_chains (cpp_reader *pfile, const char *sysroot,
+ int stdinc, int cxx_stdinc, int verbose)
+ {
+ static const char *const lang_env_vars[] =
+- { "C_INCLUDE_PATH", "CPLUS_INCLUDE_PATH",
+- "OBJC_INCLUDE_PATH", "OBJCPLUS_INCLUDE_PATH" };
++ { "CROSS_C_INCLUDE_PATH", "CROSS_CPLUS_INCLUDE_PATH",
++ "CROSS_OBJC_INCLUDE_PATH", "CROSS_OBJCPLUS_INCLUDE_PATH" };
+ cpp_options *cpp_opts = cpp_get_options (pfile);
+ size_t idx = (cpp_opts->objc ? 2: 0);
+
+@@ -484,7 +484,7 @@ register_include_chains (cpp_reader *pfile, const char *sysroot,
+
+ /* CPATH and language-dependent environment variables may add to the
+ include chain. */
+- add_env_var_paths ("CPATH", INC_BRACKET);
++ add_env_var_paths ("CROSS_CPATH", INC_BRACKET);
+ add_env_var_paths (lang_env_vars[idx], INC_SYSTEM);
+
+ target_c_incpath.extra_pre_includes (sysroot, iprefix, stdinc);
+diff --git a/gcc/system.h b/gcc/system.h
+--- a/gcc/system.h
++++ b/gcc/system.h
+@@ -1244,4 +1244,6 @@ void gcc_stablesort (void *, size_t, size_t,
+ of the number. */
+ #define PRsa(n) "%" #n PRIu64 "%c"
+
++#define LIBRARY_PATH_ENV "CROSS_LIBRARY_PATH"
++
+ #endif /* ! GCC_SYSTEM_H */
diff --git a/gnu/packages/patches/gcc-cross-gxx-include-dir.patch b/gnu/packages/patches/gcc-cross-gxx-include-dir.patch
new file mode 100644
index 0000000000..d6c4ffddc4
--- /dev/null
+++ b/gnu/packages/patches/gcc-cross-gxx-include-dir.patch
@@ -0,0 +1,73 @@
+This patch reverts upstream commit b4d3485e4fc1d:
+
+ https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=b4d3485e4fc1d029e620a59deb54b3f4f3f6b209
+
+Otherwise, GCC ends up searching the wrong target directory for cross-headers.
+
+diff --git a/gcc/configure b/gcc/configure
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -3689,11 +3689,6 @@ esac
+ fi
+
+
+-# If both --with-sysroot and --with-gxx-include-dir are passed, we interpolate
+-# the former in the latter and, upon success, compute gcc_gxx_include_dir as
+-# relative to the sysroot.
+-gcc_gxx_include_dir_add_sysroot=0
+-
+ # This logic must match libstdc++-v3/acinclude.m4:GLIBCXX_EXPORT_INSTALL_INFO.
+ if test x${gcc_gxx_include_dir} = x; then
+ if test x${enable_version_specific_runtime_libs} = xyes; then
+@@ -3705,10 +3700,15 @@ if test x${gcc_gxx_include_dir} = x; then
+ fi
+ gcc_gxx_include_dir="\$(libsubdir)/\$(libsubdir_to_prefix)$libstdcxx_incdir"
+ fi
+-elif test "${with_sysroot+set}" = set; then
++fi
++
++gcc_gxx_include_dir_add_sysroot=0
++if test "${with_sysroot+set}" = set; then
+ gcc_gxx_without_sysroot=`expr "${gcc_gxx_include_dir}" : "${with_sysroot}"'\(.*\)'`
+ if test "${gcc_gxx_without_sysroot}"; then
+- gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
++ if test x${with_sysroot} != x/; then
++ gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
++ fi
+ gcc_gxx_include_dir_add_sysroot=1
+ fi
+ fi
+diff --git a/gcc/configure.ac b/gcc/configure.ac
+index 715fcba0482..88136e232df 100644
+--- a/gcc/configure.ac
++++ b/gcc/configure.ac
+@@ -204,11 +204,6 @@ no) ;;
+ *) gcc_gxx_include_dir=$with_gxx_include_dir ;;
+ esac])
+
+-# If both --with-sysroot and --with-gxx-include-dir are passed, we interpolate
+-# the former in the latter and, upon success, compute gcc_gxx_include_dir as
+-# relative to the sysroot.
+-gcc_gxx_include_dir_add_sysroot=0
+-
+ # This logic must match libstdc++-v3/acinclude.m4:GLIBCXX_EXPORT_INSTALL_INFO.
+ if test x${gcc_gxx_include_dir} = x; then
+ if test x${enable_version_specific_runtime_libs} = xyes; then
+@@ -220,10 +215,15 @@ if test x${gcc_gxx_include_dir} = x; then
+ fi
+ gcc_gxx_include_dir="\$(libsubdir)/\$(libsubdir_to_prefix)$libstdcxx_incdir"
+ fi
+-elif test "${with_sysroot+set}" = set; then
++fi
++
++gcc_gxx_include_dir_add_sysroot=0
++if test "${with_sysroot+set}" = set; then
+ gcc_gxx_without_sysroot=`expr "${gcc_gxx_include_dir}" : "${with_sysroot}"'\(.*\)'`
+ if test "${gcc_gxx_without_sysroot}"; then
+- gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
++ if test x${with_sysroot} != x/; then
++ gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
++ fi
+ gcc_gxx_include_dir_add_sysroot=1
+ fi
+ fi