diff options
| author | Alex Kiernan <alex.kiernan@gmail.com> | 2022-12-28 15:23:27 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-12-28 23:59:56 +0000 |
| commit | 510ecb586f50d4b701cd079e8900e016e37eb79e (patch) | |
| tree | b6c03bc8098714b535783d98637d27c10d9e15a4 /meta | |
| parent | f045d37015410ca391728cf29b4e306642b26247 (diff) | |
| download | poky-510ecb586f50d4b701cd079e8900e016e37eb79e.tar.gz | |
rust: Merge .inc into .bb
(From OE-Core rev: a09bcc7db13a7308f523d985332e96461b8feeec)
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
| -rw-r--r-- | meta/recipes-devtools/rust/rust-target.inc | 10 | ||||
| -rw-r--r-- | meta/recipes-devtools/rust/rust.inc | 223 | ||||
| -rw-r--r-- | meta/recipes-devtools/rust/rust_1.66.0.bb | 218 |
3 files changed, 217 insertions, 234 deletions
diff --git a/meta/recipes-devtools/rust/rust-target.inc b/meta/recipes-devtools/rust/rust-target.inc deleted file mode 100644 index dce2b47517..0000000000 --- a/meta/recipes-devtools/rust/rust-target.inc +++ /dev/null | |||
| @@ -1,10 +0,0 @@ | |||
| 1 | require rust.inc | ||
| 2 | |||
| 3 | DEPENDS += "rust-llvm (=${PV})" | ||
| 4 | |||
| 5 | # Otherwise we'll depend on what we provide | ||
| 6 | INHIBIT_DEFAULT_RUST_DEPS:class-native = "1" | ||
| 7 | # We don't need to depend on gcc-native because yocto assumes it exists | ||
| 8 | PROVIDES:class-native = "virtual/${TARGET_PREFIX}rust" | ||
| 9 | |||
| 10 | BBCLASSEXTEND = "native nativesdk" | ||
diff --git a/meta/recipes-devtools/rust/rust.inc b/meta/recipes-devtools/rust/rust.inc deleted file mode 100644 index f58aa46444..0000000000 --- a/meta/recipes-devtools/rust/rust.inc +++ /dev/null | |||
| @@ -1,223 +0,0 @@ | |||
| 1 | SUMMARY = "Rust compiler and runtime libaries" | ||
| 2 | HOMEPAGE = "http://www.rust-lang.org" | ||
| 3 | SECTION = "devel" | ||
| 4 | LICENSE = "(MIT | Apache-2.0) & Unicode-TOU" | ||
| 5 | LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=92289ed52a60b63ab715612ad2915603" | ||
| 6 | |||
| 7 | inherit rust | ||
| 8 | inherit cargo_common | ||
| 9 | |||
| 10 | DEPENDS += "file-native python3-native" | ||
| 11 | DEPENDS:append:class-native = " rust-llvm-native" | ||
| 12 | DEPENDS:append:class-nativesdk = " nativesdk-rust-llvm" | ||
| 13 | |||
| 14 | S = "${RUSTSRC}" | ||
| 15 | |||
| 16 | # Use at your own risk, accepted values are stable, beta and nightly | ||
| 17 | RUST_CHANNEL ?= "stable" | ||
| 18 | PV .= "${@bb.utils.contains('RUST_CHANNEL', 'stable', '', '-${RUST_CHANNEL}', d)}" | ||
| 19 | |||
| 20 | export FORCE_CRATE_HASH="${BB_TASKHASH}" | ||
| 21 | |||
| 22 | RUST_ALTERNATE_EXE_PATH ?= "${STAGING_LIBDIR}/llvm-rust/bin/llvm-config" | ||
| 23 | RUST_ALTERNATE_EXE_PATH_NATIVE = "${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-config" | ||
| 24 | |||
| 25 | # We don't want to use bitbakes vendoring because the rust sources do their | ||
| 26 | # own vendoring. | ||
| 27 | CARGO_DISABLE_BITBAKE_VENDORING = "1" | ||
| 28 | |||
| 29 | # We can't use RUST_BUILD_SYS here because that may be "musl" if | ||
| 30 | # TCLIBC="musl". Snapshots are always -unknown-linux-gnu | ||
| 31 | setup_cargo_environment () { | ||
| 32 | # The first step is to build bootstrap and some early stage tools, | ||
| 33 | # these are build for the same target as the snapshot, e.g. | ||
| 34 | # x86_64-unknown-linux-gnu. | ||
| 35 | # Later stages are build for the native target (i.e. target.x86_64-linux) | ||
| 36 | cargo_common_do_configure | ||
| 37 | } | ||
| 38 | |||
| 39 | inherit rust-target-config | ||
| 40 | |||
| 41 | do_rust_setup_snapshot () { | ||
| 42 | for installer in "${WORKDIR}/rust-snapshot-components/"*"/install.sh"; do | ||
| 43 | "${installer}" --prefix="${WORKDIR}/rust-snapshot" --disable-ldconfig | ||
| 44 | done | ||
| 45 | |||
| 46 | # Some versions of rust (e.g. 1.18.0) tries to find cargo in stage0/bin/cargo | ||
| 47 | # and fail without it there. | ||
| 48 | mkdir -p ${RUSTSRC}/build/${BUILD_SYS} | ||
| 49 | ln -sf ${WORKDIR}/rust-snapshot/ ${RUSTSRC}/build/${BUILD_SYS}/stage0 | ||
| 50 | |||
| 51 | # Need to use uninative's loader if enabled/present since the library paths | ||
| 52 | # are used internally by rust and result in symbol mismatches if we don't | ||
| 53 | if [ ! -z "${UNINATIVE_LOADER}" -a -e "${UNINATIVE_LOADER}" ]; then | ||
| 54 | for bin in cargo rustc rustdoc; do | ||
| 55 | patchelf-uninative ${WORKDIR}/rust-snapshot/bin/$bin --set-interpreter ${UNINATIVE_LOADER} | ||
| 56 | done | ||
| 57 | fi | ||
| 58 | } | ||
| 59 | addtask rust_setup_snapshot after do_unpack before do_configure | ||
| 60 | do_rust_setup_snapshot[dirs] += "${WORKDIR}/rust-snapshot" | ||
| 61 | do_rust_setup_snapshot[vardepsexclude] += "UNINATIVE_LOADER" | ||
| 62 | |||
| 63 | python do_configure() { | ||
| 64 | import json | ||
| 65 | try: | ||
| 66 | import configparser | ||
| 67 | except ImportError: | ||
| 68 | import ConfigParser as configparser | ||
| 69 | |||
| 70 | # toml is rather similar to standard ini like format except it likes values | ||
| 71 | # that look more JSON like. So for our purposes simply escaping all values | ||
| 72 | # as JSON seem to work fine. | ||
| 73 | |||
| 74 | e = lambda s: json.dumps(s) | ||
| 75 | |||
| 76 | config = configparser.RawConfigParser() | ||
| 77 | |||
| 78 | # [target.ARCH-poky-linux] | ||
| 79 | host_section = "target.{}".format(d.getVar('RUST_HOST_SYS', True)) | ||
| 80 | config.add_section(host_section) | ||
| 81 | |||
| 82 | llvm_config_target = d.expand("${RUST_ALTERNATE_EXE_PATH}") | ||
| 83 | llvm_config_build = d.expand("${RUST_ALTERNATE_EXE_PATH_NATIVE}") | ||
| 84 | config.set(host_section, "llvm-config", e(llvm_config_target)) | ||
| 85 | |||
| 86 | config.set(host_section, "cxx", e(d.expand("${RUST_TARGET_CXX}"))) | ||
| 87 | config.set(host_section, "cc", e(d.expand("${RUST_TARGET_CC}"))) | ||
| 88 | config.set(host_section, "linker", e(d.expand("${RUST_TARGET_CCLD}"))) | ||
| 89 | if "musl" in host_section: | ||
| 90 | config.set(host_section, "musl-root", e(d.expand("${STAGING_DIR_HOST}${exec_prefix}"))) | ||
| 91 | |||
| 92 | # If we don't do this rust-native will compile it's own llvm for BUILD. | ||
| 93 | # [target.${BUILD_ARCH}-unknown-linux-gnu] | ||
| 94 | build_section = "target.{}".format(d.getVar('RUST_BUILD_SYS', True)) | ||
| 95 | if build_section != host_section: | ||
| 96 | config.add_section(build_section) | ||
| 97 | |||
| 98 | config.set(build_section, "llvm-config", e(llvm_config_build)) | ||
| 99 | |||
| 100 | config.set(build_section, "cxx", e(d.expand("${RUST_BUILD_CXX}"))) | ||
| 101 | config.set(build_section, "cc", e(d.expand("${RUST_BUILD_CC}"))) | ||
| 102 | config.set(build_section, "linker", e(d.expand("${RUST_BUILD_CCLD}"))) | ||
| 103 | |||
| 104 | target_section = "target.{}".format(d.getVar('RUST_TARGET_SYS', True)) | ||
| 105 | if target_section != host_section and target_section != build_section: | ||
| 106 | config.add_section(target_section) | ||
| 107 | |||
| 108 | config.set(target_section, "llvm-config", e(llvm_config_target)) | ||
| 109 | |||
| 110 | config.set(target_section, "cxx", e(d.expand("${RUST_TARGET_CXX}"))) | ||
| 111 | config.set(target_section, "cc", e(d.expand("${RUST_TARGET_CC}"))) | ||
| 112 | config.set(target_section, "linker", e(d.expand("${RUST_TARGET_CCLD}"))) | ||
| 113 | |||
| 114 | # [llvm] | ||
| 115 | config.add_section("llvm") | ||
| 116 | config.set("llvm", "static-libstdcpp", e(False)) | ||
| 117 | if "llvm" in (d.getVar('TC_CXX_RUNTIME') or ""): | ||
| 118 | config.set("llvm", "use-libcxx", e(True)) | ||
| 119 | |||
| 120 | # [rust] | ||
| 121 | config.add_section("rust") | ||
| 122 | config.set("rust", "rpath", e(True)) | ||
| 123 | config.set("rust", "channel", e(d.expand("${RUST_CHANNEL}"))) | ||
| 124 | |||
| 125 | # Whether or not to optimize the compiler and standard library | ||
| 126 | config.set("rust", "optimize", e(True)) | ||
| 127 | |||
| 128 | # Emits extraneous output from tests to ensure that failures of the test | ||
| 129 | # harness are debuggable just from logfiles | ||
| 130 | config.set("rust", "verbose-tests", e(True)) | ||
| 131 | |||
| 132 | # [build] | ||
| 133 | config.add_section("build") | ||
| 134 | config.set("build", "submodules", e(False)) | ||
| 135 | config.set("build", "docs", e(False)) | ||
| 136 | |||
| 137 | rustc = d.expand("${WORKDIR}/rust-snapshot/bin/rustc") | ||
| 138 | config.set("build", "rustc", e(rustc)) | ||
| 139 | |||
| 140 | # Support for the profiler runtime to generate e.g. coverage report, | ||
| 141 | # PGO etc. | ||
| 142 | config.set("build", "profiler", e(True)) | ||
| 143 | |||
| 144 | cargo = d.expand("${WORKDIR}/rust-snapshot/bin/cargo") | ||
| 145 | config.set("build", "cargo", e(cargo)) | ||
| 146 | |||
| 147 | config.set("build", "vendor", e(True)) | ||
| 148 | |||
| 149 | if not "targets" in locals(): | ||
| 150 | targets = [d.getVar("RUST_TARGET_SYS", True)] | ||
| 151 | config.set("build", "target", e(targets)) | ||
| 152 | |||
| 153 | if not "hosts" in locals(): | ||
| 154 | hosts = [d.getVar("RUST_HOST_SYS", True)] | ||
| 155 | config.set("build", "host", e(hosts)) | ||
| 156 | |||
| 157 | # We can't use BUILD_SYS since that is something the rust snapshot knows | ||
| 158 | # nothing about when trying to build some stage0 tools (like fabricate) | ||
| 159 | config.set("build", "build", e(d.getVar("RUST_BUILD_SYS", True))) | ||
| 160 | |||
| 161 | # [install] | ||
| 162 | config.add_section("install") | ||
| 163 | # ./x.py install doesn't have any notion of "destdir" | ||
| 164 | # but we can prepend ${D} to all the directories instead | ||
| 165 | config.set("install", "prefix", e(d.getVar("D", True) + d.getVar("prefix", True))) | ||
| 166 | config.set("install", "bindir", e(d.getVar("D", True) + d.getVar("bindir", True))) | ||
| 167 | config.set("install", "libdir", e(d.getVar("D", True) + d.getVar("libdir", True))) | ||
| 168 | config.set("install", "datadir", e(d.getVar("D", True) + d.getVar("datadir", True))) | ||
| 169 | config.set("install", "mandir", e(d.getVar("D", True) + d.getVar("mandir", True))) | ||
| 170 | |||
| 171 | with open("config.toml", "w") as f: | ||
| 172 | f.write('changelog-seen = 2\n\n') | ||
| 173 | config.write(f) | ||
| 174 | |||
| 175 | # set up ${WORKDIR}/cargo_home | ||
| 176 | bb.build.exec_func("setup_cargo_environment", d) | ||
| 177 | } | ||
| 178 | |||
| 179 | |||
| 180 | rust_runx () { | ||
| 181 | echo "COMPILE ${PN}" "$@" | ||
| 182 | |||
| 183 | # CFLAGS, LDFLAGS, CXXFLAGS, CPPFLAGS are used by rust's build for a | ||
| 184 | # wide range of targets (not just TARGET). Yocto's settings for them will | ||
| 185 | # be inappropriate, avoid using. | ||
| 186 | unset CFLAGS | ||
| 187 | unset LDFLAGS | ||
| 188 | unset CXXFLAGS | ||
| 189 | unset CPPFLAGS | ||
| 190 | |||
| 191 | export RUSTFLAGS="${RUST_DEBUG_REMAP}" | ||
| 192 | |||
| 193 | # Copy the natively built llvm-config into the target so we can run it. Horrible, | ||
| 194 | # but works! | ||
| 195 | if [ ${RUST_ALTERNATE_EXE_PATH_NATIVE} != ${RUST_ALTERNATE_EXE_PATH} ]; then | ||
| 196 | mkdir -p `dirname ${RUST_ALTERNATE_EXE_PATH}` | ||
| 197 | cp ${RUST_ALTERNATE_EXE_PATH_NATIVE} ${RUST_ALTERNATE_EXE_PATH} | ||
| 198 | chrpath -d ${RUST_ALTERNATE_EXE_PATH} | ||
| 199 | fi | ||
| 200 | |||
| 201 | oe_cargo_fix_env | ||
| 202 | |||
| 203 | python3 src/bootstrap/bootstrap.py ${@oe.utils.parallel_make_argument(d, '-j %d')} "$@" --verbose | ||
| 204 | } | ||
| 205 | rust_runx[vardepsexclude] += "PARALLEL_MAKE" | ||
| 206 | |||
| 207 | do_compile () { | ||
| 208 | rust_runx build | ||
| 209 | } | ||
| 210 | |||
| 211 | rust_do_install () { | ||
| 212 | mkdir -p ${D}${bindir} | ||
| 213 | cp build/${RUST_HOST_SYS}/stage2/bin/* ${D}${bindir} | ||
| 214 | |||
| 215 | mkdir -p ${D}${libdir}/rustlib | ||
| 216 | cp -pRd build/${RUST_HOST_SYS}/stage2/lib/* ${D}${libdir} | ||
| 217 | # Remove absolute symlink so bitbake doesn't complain | ||
| 218 | rm -f ${D}${libdir}/rustlib/src/rust | ||
| 219 | } | ||
| 220 | |||
| 221 | do_install () { | ||
| 222 | rust_do_install | ||
| 223 | } | ||
diff --git a/meta/recipes-devtools/rust/rust_1.66.0.bb b/meta/recipes-devtools/rust/rust_1.66.0.bb index b39f772c5f..5192ec2ee1 100644 --- a/meta/recipes-devtools/rust/rust_1.66.0.bb +++ b/meta/recipes-devtools/rust/rust_1.66.0.bb | |||
| @@ -1,4 +1,215 @@ | |||
| 1 | require rust-target.inc | 1 | SUMMARY = "Rust compiler and runtime libaries" |
| 2 | HOMEPAGE = "http://www.rust-lang.org" | ||
| 3 | SECTION = "devel" | ||
| 4 | LICENSE = "(MIT | Apache-2.0) & Unicode-TOU" | ||
| 5 | LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=92289ed52a60b63ab715612ad2915603" | ||
| 6 | |||
| 7 | inherit rust | ||
| 8 | inherit cargo_common | ||
| 9 | |||
| 10 | DEPENDS += "file-native python3-native" | ||
| 11 | DEPENDS:append:class-native = " rust-llvm-native" | ||
| 12 | DEPENDS:append:class-nativesdk = " nativesdk-rust-llvm" | ||
| 13 | |||
| 14 | DEPENDS += "rust-llvm (=${PV})" | ||
| 15 | |||
| 16 | # Otherwise we'll depend on what we provide | ||
| 17 | INHIBIT_DEFAULT_RUST_DEPS:class-native = "1" | ||
| 18 | # We don't need to depend on gcc-native because yocto assumes it exists | ||
| 19 | PROVIDES:class-native = "virtual/${TARGET_PREFIX}rust" | ||
| 20 | |||
| 21 | S = "${RUSTSRC}" | ||
| 22 | |||
| 23 | # Use at your own risk, accepted values are stable, beta and nightly | ||
| 24 | RUST_CHANNEL ?= "stable" | ||
| 25 | PV .= "${@bb.utils.contains('RUST_CHANNEL', 'stable', '', '-${RUST_CHANNEL}', d)}" | ||
| 26 | |||
| 27 | export FORCE_CRATE_HASH="${BB_TASKHASH}" | ||
| 28 | |||
| 29 | RUST_ALTERNATE_EXE_PATH ?= "${STAGING_LIBDIR}/llvm-rust/bin/llvm-config" | ||
| 30 | RUST_ALTERNATE_EXE_PATH_NATIVE = "${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-config" | ||
| 31 | |||
| 32 | # We don't want to use bitbakes vendoring because the rust sources do their | ||
| 33 | # own vendoring. | ||
| 34 | CARGO_DISABLE_BITBAKE_VENDORING = "1" | ||
| 35 | |||
| 36 | # We can't use RUST_BUILD_SYS here because that may be "musl" if | ||
| 37 | # TCLIBC="musl". Snapshots are always -unknown-linux-gnu | ||
| 38 | setup_cargo_environment () { | ||
| 39 | # The first step is to build bootstrap and some early stage tools, | ||
| 40 | # these are build for the same target as the snapshot, e.g. | ||
| 41 | # x86_64-unknown-linux-gnu. | ||
| 42 | # Later stages are build for the native target (i.e. target.x86_64-linux) | ||
| 43 | cargo_common_do_configure | ||
| 44 | } | ||
| 45 | |||
| 46 | inherit rust-target-config | ||
| 47 | |||
| 48 | do_rust_setup_snapshot () { | ||
| 49 | for installer in "${WORKDIR}/rust-snapshot-components/"*"/install.sh"; do | ||
| 50 | "${installer}" --prefix="${WORKDIR}/rust-snapshot" --disable-ldconfig | ||
| 51 | done | ||
| 52 | |||
| 53 | # Some versions of rust (e.g. 1.18.0) tries to find cargo in stage0/bin/cargo | ||
| 54 | # and fail without it there. | ||
| 55 | mkdir -p ${RUSTSRC}/build/${BUILD_SYS} | ||
| 56 | ln -sf ${WORKDIR}/rust-snapshot/ ${RUSTSRC}/build/${BUILD_SYS}/stage0 | ||
| 57 | |||
| 58 | # Need to use uninative's loader if enabled/present since the library paths | ||
| 59 | # are used internally by rust and result in symbol mismatches if we don't | ||
| 60 | if [ ! -z "${UNINATIVE_LOADER}" -a -e "${UNINATIVE_LOADER}" ]; then | ||
| 61 | for bin in cargo rustc rustdoc; do | ||
| 62 | patchelf-uninative ${WORKDIR}/rust-snapshot/bin/$bin --set-interpreter ${UNINATIVE_LOADER} | ||
| 63 | done | ||
| 64 | fi | ||
| 65 | } | ||
| 66 | addtask rust_setup_snapshot after do_unpack before do_configure | ||
| 67 | do_rust_setup_snapshot[dirs] += "${WORKDIR}/rust-snapshot" | ||
| 68 | do_rust_setup_snapshot[vardepsexclude] += "UNINATIVE_LOADER" | ||
| 69 | |||
| 70 | python do_configure() { | ||
| 71 | import json | ||
| 72 | try: | ||
| 73 | import configparser | ||
| 74 | except ImportError: | ||
| 75 | import ConfigParser as configparser | ||
| 76 | |||
| 77 | # toml is rather similar to standard ini like format except it likes values | ||
| 78 | # that look more JSON like. So for our purposes simply escaping all values | ||
| 79 | # as JSON seem to work fine. | ||
| 80 | |||
| 81 | e = lambda s: json.dumps(s) | ||
| 82 | |||
| 83 | config = configparser.RawConfigParser() | ||
| 84 | |||
| 85 | # [target.ARCH-poky-linux] | ||
| 86 | host_section = "target.{}".format(d.getVar('RUST_HOST_SYS', True)) | ||
| 87 | config.add_section(host_section) | ||
| 88 | |||
| 89 | llvm_config_target = d.expand("${RUST_ALTERNATE_EXE_PATH}") | ||
| 90 | llvm_config_build = d.expand("${RUST_ALTERNATE_EXE_PATH_NATIVE}") | ||
| 91 | config.set(host_section, "llvm-config", e(llvm_config_target)) | ||
| 92 | |||
| 93 | config.set(host_section, "cxx", e(d.expand("${RUST_TARGET_CXX}"))) | ||
| 94 | config.set(host_section, "cc", e(d.expand("${RUST_TARGET_CC}"))) | ||
| 95 | config.set(host_section, "linker", e(d.expand("${RUST_TARGET_CCLD}"))) | ||
| 96 | if "musl" in host_section: | ||
| 97 | config.set(host_section, "musl-root", e(d.expand("${STAGING_DIR_HOST}${exec_prefix}"))) | ||
| 98 | |||
| 99 | # If we don't do this rust-native will compile it's own llvm for BUILD. | ||
| 100 | # [target.${BUILD_ARCH}-unknown-linux-gnu] | ||
| 101 | build_section = "target.{}".format(d.getVar('RUST_BUILD_SYS', True)) | ||
| 102 | if build_section != host_section: | ||
| 103 | config.add_section(build_section) | ||
| 104 | |||
| 105 | config.set(build_section, "llvm-config", e(llvm_config_build)) | ||
| 106 | |||
| 107 | config.set(build_section, "cxx", e(d.expand("${RUST_BUILD_CXX}"))) | ||
| 108 | config.set(build_section, "cc", e(d.expand("${RUST_BUILD_CC}"))) | ||
| 109 | config.set(build_section, "linker", e(d.expand("${RUST_BUILD_CCLD}"))) | ||
| 110 | |||
| 111 | target_section = "target.{}".format(d.getVar('RUST_TARGET_SYS', True)) | ||
| 112 | if target_section != host_section and target_section != build_section: | ||
| 113 | config.add_section(target_section) | ||
| 114 | |||
| 115 | config.set(target_section, "llvm-config", e(llvm_config_target)) | ||
| 116 | |||
| 117 | config.set(target_section, "cxx", e(d.expand("${RUST_TARGET_CXX}"))) | ||
| 118 | config.set(target_section, "cc", e(d.expand("${RUST_TARGET_CC}"))) | ||
| 119 | config.set(target_section, "linker", e(d.expand("${RUST_TARGET_CCLD}"))) | ||
| 120 | |||
| 121 | # [llvm] | ||
| 122 | config.add_section("llvm") | ||
| 123 | config.set("llvm", "static-libstdcpp", e(False)) | ||
| 124 | if "llvm" in (d.getVar('TC_CXX_RUNTIME') or ""): | ||
| 125 | config.set("llvm", "use-libcxx", e(True)) | ||
| 126 | |||
| 127 | # [rust] | ||
| 128 | config.add_section("rust") | ||
| 129 | config.set("rust", "rpath", e(True)) | ||
| 130 | config.set("rust", "channel", e(d.expand("${RUST_CHANNEL}"))) | ||
| 131 | |||
| 132 | # Whether or not to optimize the compiler and standard library | ||
| 133 | config.set("rust", "optimize", e(True)) | ||
| 134 | |||
| 135 | # Emits extraneous output from tests to ensure that failures of the test | ||
| 136 | # harness are debuggable just from logfiles | ||
| 137 | config.set("rust", "verbose-tests", e(True)) | ||
| 138 | |||
| 139 | # [build] | ||
| 140 | config.add_section("build") | ||
| 141 | config.set("build", "submodules", e(False)) | ||
| 142 | config.set("build", "docs", e(False)) | ||
| 143 | |||
| 144 | rustc = d.expand("${WORKDIR}/rust-snapshot/bin/rustc") | ||
| 145 | config.set("build", "rustc", e(rustc)) | ||
| 146 | |||
| 147 | # Support for the profiler runtime to generate e.g. coverage report, | ||
| 148 | # PGO etc. | ||
| 149 | config.set("build", "profiler", e(True)) | ||
| 150 | |||
| 151 | cargo = d.expand("${WORKDIR}/rust-snapshot/bin/cargo") | ||
| 152 | config.set("build", "cargo", e(cargo)) | ||
| 153 | |||
| 154 | config.set("build", "vendor", e(True)) | ||
| 155 | |||
| 156 | if not "targets" in locals(): | ||
| 157 | targets = [d.getVar("RUST_TARGET_SYS", True)] | ||
| 158 | config.set("build", "target", e(targets)) | ||
| 159 | |||
| 160 | if not "hosts" in locals(): | ||
| 161 | hosts = [d.getVar("RUST_HOST_SYS", True)] | ||
| 162 | config.set("build", "host", e(hosts)) | ||
| 163 | |||
| 164 | # We can't use BUILD_SYS since that is something the rust snapshot knows | ||
| 165 | # nothing about when trying to build some stage0 tools (like fabricate) | ||
| 166 | config.set("build", "build", e(d.getVar("RUST_BUILD_SYS", True))) | ||
| 167 | |||
| 168 | # [install] | ||
| 169 | config.add_section("install") | ||
| 170 | # ./x.py install doesn't have any notion of "destdir" | ||
| 171 | # but we can prepend ${D} to all the directories instead | ||
| 172 | config.set("install", "prefix", e(d.getVar("D", True) + d.getVar("prefix", True))) | ||
| 173 | config.set("install", "bindir", e(d.getVar("D", True) + d.getVar("bindir", True))) | ||
| 174 | config.set("install", "libdir", e(d.getVar("D", True) + d.getVar("libdir", True))) | ||
| 175 | config.set("install", "datadir", e(d.getVar("D", True) + d.getVar("datadir", True))) | ||
| 176 | config.set("install", "mandir", e(d.getVar("D", True) + d.getVar("mandir", True))) | ||
| 177 | |||
| 178 | with open("config.toml", "w") as f: | ||
| 179 | f.write('changelog-seen = 2\n\n') | ||
| 180 | config.write(f) | ||
| 181 | |||
| 182 | # set up ${WORKDIR}/cargo_home | ||
| 183 | bb.build.exec_func("setup_cargo_environment", d) | ||
| 184 | } | ||
| 185 | |||
| 186 | rust_runx () { | ||
| 187 | echo "COMPILE ${PN}" "$@" | ||
| 188 | |||
| 189 | # CFLAGS, LDFLAGS, CXXFLAGS, CPPFLAGS are used by rust's build for a | ||
| 190 | # wide range of targets (not just TARGET). Yocto's settings for them will | ||
| 191 | # be inappropriate, avoid using. | ||
| 192 | unset CFLAGS | ||
| 193 | unset LDFLAGS | ||
| 194 | unset CXXFLAGS | ||
| 195 | unset CPPFLAGS | ||
| 196 | |||
| 197 | export RUSTFLAGS="${RUST_DEBUG_REMAP}" | ||
| 198 | |||
| 199 | # Copy the natively built llvm-config into the target so we can run it. Horrible, | ||
| 200 | # but works! | ||
| 201 | if [ ${RUST_ALTERNATE_EXE_PATH_NATIVE} != ${RUST_ALTERNATE_EXE_PATH} ]; then | ||
| 202 | mkdir -p `dirname ${RUST_ALTERNATE_EXE_PATH}` | ||
| 203 | cp ${RUST_ALTERNATE_EXE_PATH_NATIVE} ${RUST_ALTERNATE_EXE_PATH} | ||
| 204 | chrpath -d ${RUST_ALTERNATE_EXE_PATH} | ||
| 205 | fi | ||
| 206 | |||
| 207 | oe_cargo_fix_env | ||
| 208 | |||
| 209 | python3 src/bootstrap/bootstrap.py ${@oe.utils.parallel_make_argument(d, '-j %d')} "$@" --verbose | ||
| 210 | } | ||
| 211 | rust_runx[vardepsexclude] += "PARALLEL_MAKE" | ||
| 212 | |||
| 2 | require rust-source.inc | 213 | require rust-source.inc |
| 3 | require rust-snapshot.inc | 214 | require rust-snapshot.inc |
| 4 | 215 | ||
| @@ -35,6 +246,10 @@ RDEPENDS:${PN}-tools-rustfmt = "${PN}" | |||
| 35 | SUMMARY:${PN}-tools-clippy = "A collection of lints to catch common mistakes and improve your Rust code" | 246 | SUMMARY:${PN}-tools-clippy = "A collection of lints to catch common mistakes and improve your Rust code" |
| 36 | SUMMARY:${PN}-tools-rustfmt = "A tool for formatting Rust code according to style guidelines" | 247 | SUMMARY:${PN}-tools-rustfmt = "A tool for formatting Rust code according to style guidelines" |
| 37 | 248 | ||
| 249 | do_install () { | ||
| 250 | rust_do_install | ||
| 251 | } | ||
| 252 | |||
| 38 | rust_do_install() { | 253 | rust_do_install() { |
| 39 | rust_runx install | 254 | rust_runx install |
| 40 | } | 255 | } |
| @@ -87,3 +302,4 @@ RUSTLIB_DEP:class-nativesdk = "" | |||
| 87 | # musl builds include libunwind.a | 302 | # musl builds include libunwind.a |
| 88 | INSANE_SKIP:${PN} = "staticdev" | 303 | INSANE_SKIP:${PN} = "staticdev" |
| 89 | 304 | ||
| 305 | BBCLASSEXTEND = "native nativesdk" | ||
