Skip to content

Commit 339b089

Browse files
authored
udpate docs (#4348)
1 parent ea60601 commit 339b089

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

‎examples/cross_build/toolchain_packages.rst‎

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Let's check the recipe and go through the most relevant parts:
5252
5353
import os
5454
from conan import ConanFile
55-
from conan.tools.files import get, copy, download
55+
from conan.tools.files import get, copy, save
5656
from conan.errors import ConanInvalidConfiguration
5757
from conan.tools.scm import Version
5858
@@ -85,22 +85,27 @@ Let's check the recipe and go through the most relevant parts:
8585
valid_archs = self._archs32() + self._archs64()
8686
if self.settings_target.os != "Linux" or self.settings_target.arch not in valid_archs:
8787
raise ConanInvalidConfiguration(f"This toolchain only supports building for Linux-{valid_archs.join(',')}. "
88-
f"{self.settings_target.os}-{self.settings_target.arch} is not supported.")
88+
f"{self.settings_target.os}-{self.settings_target.arch} is not supported.")
8989
9090
if self.settings_target.compiler != "gcc":
9191
raise ConanInvalidConfiguration(f"The compiler is set to '{self.settings_target.compiler}', but this "
9292
"toolchain only supports building with gcc.")
9393
9494
if Version(self.settings_target.compiler.version) >= Version("14") or Version(self.settings_target.compiler.version) < Version("13"):
9595
raise ConanInvalidConfiguration(f"Invalid gcc version '{self.settings_target.compiler.version}'. "
96-
"Only 13.X versions are supported for the compiler.")
96+
"Only 13.X versions are supported for the compiler.")
9797
9898
def source(self):
99-
download(self, "https://developer.arm.com/GetEula?Id=37988a7c-c40e-4b78-9fd1-62c20b507aa8", "LICENSE", verify=False)
99+
# The ARM toolchain is distributed under GPL-3.0-only license
100+
# Reference: https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads
101+
save(self, "LICENSE", "ARM GNU Toolchain\n"
102+
"License: GNU General Public License v3.0 (GPL-3.0-only)\n"
103+
"https://www.gnu.org/licenses/gpl-3.0.html\n\n"
104+
"EULA: https://developer.arm.com/GetEula?Id=37988a7c-c40e-4b78-9fd1-62c20b507aa8\n")
100105
101106
def build(self):
102107
toolchain, sha = self._get_toolchain(self.settings_target.arch)
103-
get(self, f"https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-x86_64-{toolchain}.tar.xz",
108+
get(self, f"https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-x86_64-{toolchain}.tar.xz",
104109
sha256=sha, strip_root=True)
105110
106111
def package_id(self):
@@ -260,24 +265,30 @@ Downloading the binaries for the toolchain and packaging it
260265
"12fcdf13a7430655229b20438a49e8566e26551ba08759922cdaf4695b0d4e23")
261266
262267
def source(self):
263-
download(self, "https://developer.arm.com/GetEula?Id=37988a7c-c40e-4b78-9fd1-62c20b507aa8", "LICENSE", verify=False)
268+
# The ARM toolchain is distributed under GPL-3.0-only license
269+
# Reference: https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads
270+
save(self, "LICENSE", "ARM GNU Toolchain\n"
271+
"License: GNU General Public License v3.0 (GPL-3.0-only)\n"
272+
"https://www.gnu.org/licenses/gpl-3.0.html\n\n"
273+
"EULA: https://developer.arm.com/GetEula?Id=37988a7c-c40e-4b78-9fd1-62c20b507aa8\n")
264274
265275
def build(self):
266276
toolchain, sha = self._get_toolchain(self.settings_target.arch)
267-
get(self, f"https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-x86_64-{toolchain}.tar.xz",
277+
get(self, f"https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-x86_64-{toolchain}.tar.xz",
268278
sha256=sha, strip_root=True)
269279
270280
def package(self):
271281
toolchain, _ = self._get_toolchain(self.settings_target.arch)
272282
dirs_to_copy = [toolchain, "bin", "include", "lib", "libexec"]
273283
for dir_name in dirs_to_copy:
274284
copy(self, pattern=f"{dir_name}/*", src=self.build_folder, dst=self.package_folder, keep_path=True)
275-
copy(self, "LICENSE", src=self.build_folder, dst=os.path.join(self.package_folder, "licenses"), keep_path=False)
285+
copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"), keep_path=False)
276286
277287
...
278288
279-
The `source()` method is used to download the recipe license, as it's found on the ARM
280-
toolchains' download page. However, this is the only action performed there. The actual
289+
The `source()` method is used to download or reference the recipe license. In
290+
this case, we reference the ARM toolchain's GPL-3.0 license and EULA. However,
291+
this is the only action performed there. The actual
281292
toolchain binaries are fetched in the `build()` method. This approach is necessary because
282293
the toolchain package is designed to support both 32-bit and 64-bit architectures,
283294
requiring us to download two distinct sets of toolchain binaries. Which binary the package

0 commit comments

Comments
 (0)