diff --git a/recipes-devtools/cargo/cargo.inc b/recipes-devtools/cargo/cargo.inc index 5f02965..d37d787 100644 --- a/recipes-devtools/cargo/cargo.inc +++ b/recipes-devtools/cargo/cargo.inc @@ -12,7 +12,7 @@ LIC_FILES_CHKSUM = " \ " S = "${RUSTSRC}/src/tools/cargo" -CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/src/vendor" +CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor" inherit cargo @@ -29,7 +29,7 @@ do_compile_prepend () { do_install () { install -d "${D}${bindir}" - install -m 755 "${RUSTSRC}/src/target/${CARGO_TARGET_SUBDIR}/cargo" "${D}${bindir}" + install -m 755 "${RUSTSRC}/target/${CARGO_TARGET_SUBDIR}/cargo" "${D}${bindir}" } # Needed for pkg-config to be used diff --git a/recipes-devtools/cargo/cargo_1.31.1.bb b/recipes-devtools/cargo/cargo_1.31.1.bb index dd050a8..88fbe87 100644 --- a/recipes-devtools/cargo/cargo_1.31.1.bb +++ b/recipes-devtools/cargo/cargo_1.31.1.bb @@ -1,3 +1,10 @@ require recipes-devtools/rust/rust-source-${PV}.inc require recipes-devtools/rust/rust-snapshot-${PV}.inc require cargo.inc + +# From 1.32.0, the vendor and target directory has moved. +CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/src/vendor" +do_install () { + install -d "${D}${bindir}" + install -m 755 "${RUSTSRC}/src/target/${CARGO_TARGET_SUBDIR}/cargo" "${D}${bindir}" +} diff --git a/recipes-devtools/cargo/cargo_1.32.0.bb b/recipes-devtools/cargo/cargo_1.32.0.bb new file mode 100644 index 0000000..dd050a8 --- /dev/null +++ b/recipes-devtools/cargo/cargo_1.32.0.bb @@ -0,0 +1,3 @@ +require recipes-devtools/rust/rust-source-${PV}.inc +require recipes-devtools/rust/rust-snapshot-${PV}.inc +require cargo.inc diff --git a/recipes-devtools/rust/libstd-rs_1.32.0.bb b/recipes-devtools/rust/libstd-rs_1.32.0.bb new file mode 100644 index 0000000..ffedf43 --- /dev/null +++ b/recipes-devtools/rust/libstd-rs_1.32.0.bb @@ -0,0 +1,8 @@ +require rust-source-${PV}.inc +require libstd-rs.inc + +LIC_FILES_CHKSUM = "file://../../COPYRIGHT;md5=66ddc8ecd998476b7cd5732e8c3a6c1d" + +CARGO_FEATURES ?= "panic-unwind backtrace" + +CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor" diff --git a/recipes-devtools/rust/rust-cross_1.32.0.bb b/recipes-devtools/rust/rust-cross_1.32.0.bb new file mode 100644 index 0000000..bb92b99 --- /dev/null +++ b/recipes-devtools/rust/rust-cross_1.32.0.bb @@ -0,0 +1,3 @@ +require rust-cross.inc +require rust-source-${PV}.inc + diff --git a/recipes-devtools/rust/rust-llvm_1.32.0.bb b/recipes-devtools/rust/rust-llvm_1.32.0.bb new file mode 100644 index 0000000..9a14a42 --- /dev/null +++ b/recipes-devtools/rust/rust-llvm_1.32.0.bb @@ -0,0 +1,16 @@ +require rust-source-${PV}.inc +require rust-llvm.inc + +LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=c520ed40e11887bb1d24d86f7f5b1f05" + +do_install_prepend () { + # the install does a sed on this without installing the file + # we don't need it for anything + mkdir -p "${D}/usr/share/llvm/cmake" + touch "${D}/usr/share/llvm/cmake/LLVMExports-noconfig.cmake" +} + +do_install_append () { + # we don't need any of this stuff to build Rust + rm -rf "${D}/usr/lib/cmake" +} diff --git a/recipes-devtools/rust/rust-snapshot-1.32.0.inc b/recipes-devtools/rust/rust-snapshot-1.32.0.inc new file mode 100644 index 0000000..84eaf4f --- /dev/null +++ b/recipes-devtools/rust/rust-snapshot-1.32.0.inc @@ -0,0 +1,24 @@ +## This is information on the rust-snapshot (binary) used to build our current release. +## snapshot info is taken from rust/src/stage0.txt +## TODO: find a way to add additional SRC_URIs based on the contents of an +## earlier SRC_URI. +RS_VERSION = "1.31.1" + +RUST_STD_SNAPSHOT = "rust-std-${RS_VERSION}-${BUILD_ARCH}-unknown-linux-gnu" +RUSTC_SNAPSHOT = "rustc-${RS_VERSION}-${BUILD_ARCH}-unknown-linux-gnu" +CARGO_VERSION = "0.32.0" +CARGO_SNAPSHOT = "cargo-${CARGO_VERSION}-${BUILD_ARCH}-unknown-linux-gnu" + +SRC_URI += " \ + https://static.rust-lang.org/dist/${RUST_STD_SNAPSHOT}.tar.gz;name=rust-std-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \ + https://static.rust-lang.org/dist/${RUSTC_SNAPSHOT}.tar.gz;name=rustc-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \ + https://static.rust-lang.org/dist/${CARGO_SNAPSHOT}.tar.gz;name=cargo-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \ + " + +# TODO: Add hashes for other architecture toolchains as well. Make a script? +SRC_URI[rustc-snapshot-x86_64.md5sum] = "83f3f130e9a1c7e855a0c1eed8ac3508" +SRC_URI[rustc-snapshot-x86_64.sha256sum] = "77d47ce7e27a146e4301f11befd43f3fc5ac195ace0dfc07ac8154f130b057ea" +SRC_URI[rust-std-snapshot-x86_64.md5sum] = "3115e11612a882713978279635116881" +SRC_URI[rust-std-snapshot-x86_64.sha256sum] = "699664b3a64959a2d75e486e19e7cc9934cbcbf2c57a977dd2a2b33cff367da1" +SRC_URI[cargo-snapshot-x86_64.md5sum] = "9ae6d258781870591450ea33d3b1bed9" +SRC_URI[cargo-snapshot-x86_64.sha256sum] = "b3d3dc57182fb173ecf367f7884dceb855a096d9b9b32eba994e3359ddc68cd4" diff --git a/recipes-devtools/rust/rust-source-1.32.0.inc b/recipes-devtools/rust/rust-source-1.32.0.inc new file mode 100644 index 0000000..01853b4 --- /dev/null +++ b/recipes-devtools/rust/rust-source-1.32.0.inc @@ -0,0 +1,11 @@ +SRC_URI += "https://static.rust-lang.org/dist/rustc-${PV}-src.tar.gz;name=rust" + +SRC_URI[rust.md5sum] = "366f049777e00d0d6f15d25895485efb" +SRC_URI[rust.sha256sum] = "4c594c7712a0e7e8eae6526c464bf6ea1d82f77b4f61717c3fc28fb27ba2224a" + +# later versions of rust change the directory that they unextract to +RUSTSRC = "${WORKDIR}/rustc-${PV}-src" +# set this as our default +S = "${RUSTSRC}" + +LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=66ddc8ecd998476b7cd5732e8c3a6c1d" diff --git a/recipes-devtools/rust/rust.inc b/recipes-devtools/rust/rust.inc index ea2e11a..93eaea9 100644 --- a/recipes-devtools/rust/rust.inc +++ b/recipes-devtools/rust/rust.inc @@ -374,6 +374,7 @@ do_rust_setup_snapshot[dirs] += "${WORKDIR}/rust-snapshot" python do_configure() { import json + from distutils.version import LooseVersion try: import configparser except ImportError: @@ -412,9 +413,8 @@ python do_configure() { config.set("rust", "rpath", e(True)) config.set("rust", "channel", e("stable")) - # Don't use jemalloc as it doesn't work for many targets. - # https://github.com/rust-lang/rust/pull/37392 - config.set("rust", "use-jemalloc", e(False)) + if LooseVersion(d.getVar("PV")) < LooseVersion("1.32.0"): + config.set("rust", "use-jemalloc", e(False)) # Whether or not to optimize the compiler and standard library config.set("rust", "optimize", e(True)) diff --git a/recipes-devtools/rust/rust_1.32.0.bb b/recipes-devtools/rust/rust_1.32.0.bb new file mode 100644 index 0000000..c7f9f4f --- /dev/null +++ b/recipes-devtools/rust/rust_1.32.0.bb @@ -0,0 +1,12 @@ +require rust.inc +require rust-source-${PV}.inc +require rust-snapshot-${PV}.inc + +DEPENDS += "rust-llvm (=${PV})" + +# Otherwise we'll depend on what we provide +INHIBIT_DEFAULT_RUST_DEPS_class-native = "1" +# We don't need to depend on gcc-native because yocto assumes it exists +PROVIDES_class-native = "virtual/${TARGET_PREFIX}rust" + +BBCLASSEXTEND = "native"