mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-12 06:06:53 -05:00
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.
This commit is contained in:
parent
1dec7fa83d
commit
4796b5d6d1
4 changed files with 130 additions and 3 deletions
|
@ -243,6 +243,9 @@ (define* (cross-gcc target
|
|||
(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")
|
||||
|
|
|
@ -598,7 +598,7 @@ (define-public gcc-11
|
|||
|
||||
;; 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 @@ (define-public gcc-objc-10
|
|||
(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 @@ (define-public gcc-objc++-10
|
|||
(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."
|
||||
|
|
|
@ -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 */
|
73
gnu/packages/patches/gcc-cross-gxx-include-dir.patch
Normal file
73
gnu/packages/patches/gcc-cross-gxx-include-dir.patch
Normal file
|
@ -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
|
Loading…
Reference in a new issue