Gentoo Archives: gentoo-commits

From: Mike Gilbert <floppym@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: www-client/chromium/, www-client/chromium/files/toolchain/
Date: Mon, 19 Jun 2017 05:01:16
Message-Id: 1497848465.2dd4eba091de610ed6621df0b20daedc7c5c44c2.floppym@gentoo
1 commit: 2dd4eba091de610ed6621df0b20daedc7c5c44c2
2 Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jun 19 04:57:51 2017 +0000
4 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
5 CommitDate: Mon Jun 19 05:01:05 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2dd4eba0
7
8 www-client/chromium: wire-up cross-compile support
9
10 Cross-compiling still does not work, but this gets us closer.
11
12 - Build GN with the host (CBUILD) compiler, skip rebuild after bootstrap.
13 - Add a toolchain definition for the host (CBUILD) compiler.
14 - Set the host_toolchain option.
15 - Set the target_cpu option based on the target arch (CHOST).
16
17 The host_toolchain option is also set for native builds. This makes
18 clang work without setting clang_base_path.
19
20 Package-Manager: Portage-2.3.6_p7, Repoman-2.3.2_p75
21
22 www-client/chromium/chromium-61.0.3128.3.ebuild | 47 +++++++++++++++++--------
23 www-client/chromium/files/toolchain/BUILD.gn | 18 ++++++++++
24 2 files changed, 50 insertions(+), 15 deletions(-)
25
26 diff --git a/www-client/chromium/chromium-61.0.3128.3.ebuild b/www-client/chromium/chromium-61.0.3128.3.ebuild
27 index 22c6f5f671b..09e3875b0b4 100644
28 --- a/www-client/chromium/chromium-61.0.3128.3.ebuild
29 +++ b/www-client/chromium/chromium-61.0.3128.3.ebuild
30 @@ -333,6 +333,22 @@ src_prepare() {
31 build/linux/unbundle/remove_bundled_libraries.py "${keeplibs[@]}" --do-remove || die
32 }
33
34 +bootstrap_gn() {
35 + if tc-is-cross-compiler; then
36 + local -x AR=${BUILD_AR}
37 + local -x CC=${BUILD_CC}
38 + local -x CXX=${BUILD_CXX}
39 + local -x NM=${BUILD_NM}
40 + local -x CFLAGS=${BUILD_CFLAGS}
41 + local -x CXXFLAGS=${BUILD_CXXFLAGS}
42 + local -x LDFLAGS=${BUILD_LDFLAGS}
43 + fi
44 + einfo "Building GN..."
45 + set -- tools/gn/bootstrap/bootstrap.py -s -v --no-clean
46 + echo "$@"
47 + "$@" || die
48 +}
49 +
50 src_configure() {
51 local myconf_gn=""
52
53 @@ -398,7 +414,6 @@ src_configure() {
54
55 if tc-is-clang; then
56 myconf_gn+=" is_clang=true clang_use_chrome_plugins=false"
57 - myconf_gn+=" clang_base_path=\"$(realpath $(dirname `which clang`)/..)\""
58 else
59 myconf_gn+=" is_clang=false"
60 fi
61 @@ -425,16 +440,16 @@ src_configure() {
62
63 local myarch="$(tc-arch)"
64 if [[ $myarch = amd64 ]] ; then
65 - target_arch=x64
66 + myconf_gn+=" target_cpu=\"x64\""
67 ffmpeg_target_arch=x64
68 elif [[ $myarch = x86 ]] ; then
69 - target_arch=ia32
70 + myconf_gn+=" target_cpu=\"x86\""
71 ffmpeg_target_arch=ia32
72 elif [[ $myarch = arm64 ]] ; then
73 - target_arch=arm64
74 + myconf_gn+=" target_cpu=\"arm64\""
75 ffmpeg_target_arch=arm64
76 elif [[ $myarch = arm ]] ; then
77 - target_arch=arm
78 + myconf_gn+=" target_cpu=\"arm\""
79 ffmpeg_target_arch=$(usex neon arm-neon arm)
80 else
81 die "Failed to determine target arch, got '$myarch'."
82 @@ -467,20 +482,19 @@ src_configure() {
83 # Make sure the build system will use the right tools, bug #340795.
84 tc-export AR CC CXX NM
85
86 - # https://bugs.gentoo.org/588596
87 - append-cxxflags $(test-flags-CXX -fno-delete-null-pointer-checks)
88 -
89 # Define a custom toolchain for GN
90 myconf_gn+=" custom_toolchain=\"${FILESDIR}/toolchain:default\""
91
92 - # Tools for building programs to be executed on the build system, bug #410883.
93 if tc-is-cross-compiler; then
94 - export AR_host=$(tc-getBUILD_AR)
95 - export CC_host=$(tc-getBUILD_CC)
96 - export CXX_host=$(tc-getBUILD_CXX)
97 - export NM_host=$(tc-getBUILD_NM)
98 + tc-export BUILD_{AR,CC,CXX,NM}
99 + myconf_gn+=" host_toolchain=\"${FILESDIR}/toolchain:host\""
100 + else
101 + myconf_gn+=" host_toolchain=\"${FILESDIR}/toolchain:default\""
102 fi
103
104 + # https://bugs.gentoo.org/588596
105 + append-cxxflags $(test-flags-CXX -fno-delete-null-pointer-checks)
106 +
107 # Bug 491582.
108 export TMPDIR="${WORKDIR}/temp"
109 mkdir -p -m 755 "${TMPDIR}" || die
110 @@ -505,9 +519,12 @@ src_configure() {
111
112 touch chrome/test/data/webui/i18n_process_css_test.html || die
113
114 + bootstrap_gn
115 +
116 einfo "Configuring Chromium..."
117 - tools/gn/bootstrap/bootstrap.py -v --no-clean --gn-gen-args "${myconf_gn}" || die
118 - out/Release/gn gen --args="${myconf_gn}" out/Release || die
119 + set -- out/Release/gn gen --args="${myconf_gn}" out/Release
120 + echo "$@"
121 + "$@" || die
122 }
123
124 src_compile() {
125
126 diff --git a/www-client/chromium/files/toolchain/BUILD.gn b/www-client/chromium/files/toolchain/BUILD.gn
127 index 78f7b57e3be..f88d3afdcfd 100644
128 --- a/www-client/chromium/files/toolchain/BUILD.gn
129 +++ b/www-client/chromium/files/toolchain/BUILD.gn
130 @@ -17,3 +17,21 @@ gcc_toolchain("default") {
131 current_os = current_os
132 }
133 }
134 +
135 +gcc_toolchain("host") {
136 + cc = getenv("BUILD_CC")
137 + cxx = getenv("BUILD_CXX")
138 + ar = getenv("BUILD_AR")
139 + nm = getenv("BUILD_NM")
140 + ld = cxx
141 +
142 + extra_cflags = getenv("BUILD_CFLAGS")
143 + extra_cppflags = getenv("BUILD_CPPFLAGS")
144 + extra_cxxflags = getenv("BUILD_CXXFLAGS")
145 + extra_ldflags = getenv("BUILD_LDFLAGS")
146 +
147 + toolchain_args = {
148 + current_cpu = current_cpu
149 + current_os = current_os
150 + }
151 +}