1 |
commit: ad34d5e17e56a4a446402185cd67d7b920edf28f |
2 |
Author: Palmer Dabbelt <palmer <AT> dabbelt <DOT> com> |
3 |
AuthorDate: Tue Apr 3 20:10:41 2018 +0000 |
4 |
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Apr 3 20:21:18 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ad34d5e1 |
7 |
|
8 |
sys-libs/glibc: Add support for building RISC-V headers |
9 |
|
10 |
The RISC-V GCC port defines some extra preprocessor macros that glibc |
11 |
uses to determine which RISC-V target is being compiled for. Since |
12 |
crossdev doesn't use a RISC-V compiler to build the headers, this blows |
13 |
up. These checks don't matter for building the headers because they're |
14 |
the same on all RISC-V targets, so we just hack up the glibc build to |
15 |
elide the check. |
16 |
|
17 |
sys-libs/glibc/glibc-2.27-r1.ebuild | 17 +++++++++++++++++ |
18 |
1 file changed, 17 insertions(+) |
19 |
|
20 |
diff --git a/sys-libs/glibc/glibc-2.27-r1.ebuild b/sys-libs/glibc/glibc-2.27-r1.ebuild |
21 |
index b281c00fac3..588eebae7f2 100644 |
22 |
--- a/sys-libs/glibc/glibc-2.27-r1.ebuild |
23 |
+++ b/sys-libs/glibc/glibc-2.27-r1.ebuild |
24 |
@@ -762,6 +762,23 @@ src_prepare() { |
25 |
sed -i '/CPPFLAGS=.*-mabi/s|.*|:|' ports/sysdeps/mips/preconfigure || die |
26 |
find ports/sysdeps/mips/ -name Makefile -exec sed -i '/^CC.*-mabi=/s:-mabi=.*:-D_MIPS_SZPTR=32:' {} + |
27 |
fi |
28 |
+ if [[ -e sysdeps/riscv/preconfigure ]] ; then |
29 |
+ # RISC-V interrogates the compiler to determine which target to |
30 |
+ # build. If building the headers then we don't strictly need a |
31 |
+ # RISC-V compiler, so the built-in definitions that are provided |
32 |
+ # along with all RISC-V compiler might not exist. This causes |
33 |
+ # glibc's RISC-V preconfigure script to blow up. Since we're just |
34 |
+ # building the headers any value will actually work here, so just |
35 |
+ # pick the standard one (rv64g/lp64d) to make the build scripts |
36 |
+ # happy for now -- the headers are all the same anyway so it |
37 |
+ # doesn't matter. |
38 |
+ sed -i 's/^ xlen=.*/ xlen=64/g' sysdeps/riscv/preconfigure || die |
39 |
+ sed -i 's/^ flen=.*/ flen=64/g' sysdeps/riscv/preconfigure || die |
40 |
+ sed -i 's/^ float_abi=.*/ float_abi=double/g' sysdeps/riscv/preconfigure || die |
41 |
+ sed -i 's/^ atomic=.*/ atomic=__riscv_atomic/g' sysdeps/riscv/preconfigure || die |
42 |
+ sed -i 's/^libc_cv_riscv_float_abi=no/libc_cv_riscv_float_abi=d/g' sysdeps/unix/sysv/linux/riscv/configure.ac || die |
43 |
+ sed -i 's/^libc_cv_riscv_float_abi=no/libc_cv_riscv_float_abi=d/g' sysdeps/unix/sysv/linux/riscv/configure || die |
44 |
+ fi |
45 |
fi |
46 |
|
47 |
default |