Andrew Geissler | d159c7f | 2021-09-02 21:05:58 -0500 | [diff] [blame] | 1 | SUMMARY ?= "Cargo, a package manager for Rust." |
| 2 | HOMEPAGE = "https://crates.io" |
| 3 | LICENSE = "MIT | Apache-2.0" |
| 4 | SECTION = "devel" |
| 5 | |
| 6 | DEPENDS = "openssl zlib curl ca-certificates libssh2" |
| 7 | |
| 8 | LIC_FILES_CHKSUM = " \ |
| 9 | file://LICENSE-MIT;md5=b377b220f43d747efdec40d69fcaa69d \ |
| 10 | file://LICENSE-APACHE;md5=71b224ca933f0676e26d5c2e2271331c \ |
| 11 | file://LICENSE-THIRD-PARTY;md5=f257ad009884cb88a3a87d6920e7180a \ |
| 12 | " |
| 13 | |
| 14 | |
| 15 | S = "${RUSTSRC}/src/tools/cargo" |
| 16 | CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor" |
| 17 | EXCLUDE_FROM_WORLD = "1" |
| 18 | |
Andrew Geissler | 5199d83 | 2021-09-24 16:47:35 -0500 | [diff] [blame] | 19 | inherit cargo pkgconfig |
Andrew Geissler | d159c7f | 2021-09-02 21:05:58 -0500 | [diff] [blame] | 20 | |
| 21 | do_cargo_setup_snapshot () { |
| 22 | ${WORKDIR}/rust-snapshot-components/${CARGO_SNAPSHOT}/install.sh --prefix="${WORKDIR}/${CARGO_SNAPSHOT}" --disable-ldconfig |
| 23 | # Need to use uninative's loader if enabled/present since the library paths |
| 24 | # are used internally by rust and result in symbol mismatches if we don't |
| 25 | if [ ! -z "${UNINATIVE_LOADER}" -a -e "${UNINATIVE_LOADER}" ]; then |
| 26 | patchelf-uninative ${WORKDIR}/${CARGO_SNAPSHOT}/bin/cargo --set-interpreter ${UNINATIVE_LOADER} |
| 27 | fi |
| 28 | } |
| 29 | |
| 30 | addtask cargo_setup_snapshot after do_unpack before do_configure |
| 31 | do_cargo_setup_snapshot[dirs] += "${WORKDIR}/${CARGO_SNAPSHOT}" |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 32 | do_cargo_setup_snapshot[vardepsexclude] += "UNINATIVE_LOADER" |
| 33 | |
Andrew Geissler | d159c7f | 2021-09-02 21:05:58 -0500 | [diff] [blame] | 34 | |
| 35 | do_compile:prepend () { |
| 36 | export RUSTC_BOOTSTRAP="1" |
| 37 | } |
| 38 | |
| 39 | do_install () { |
| 40 | install -d "${D}${bindir}" |
| 41 | install -m 755 "${B}/target/${CARGO_TARGET_SUBDIR}/cargo" "${D}${bindir}" |
| 42 | } |
| 43 | |
| 44 | # Disabled due to incompatibility with libgit2 0.28.x (https://github.com/rust-lang/git2-rs/issues/458, https://bugs.gentoo.org/707746#c1) |
| 45 | # as shipped by Yocto Dunfell. |
| 46 | # According to https://github.com/rust-lang/git2-rs/issues/458#issuecomment-522567539, there are no compatibility guarantees between |
| 47 | # libgit2-sys and arbitrary system libgit2 versions, so better keep this turned off. |
| 48 | #export LIBGIT2_SYS_USE_PKG_CONFIG = "1" |
| 49 | |
| 50 | # Needed for pkg-config to be used |
| 51 | export LIBSSH2_SYS_USE_PKG_CONFIG = "1" |
| 52 | |
| 53 | # When building cargo-native we don't have cargo-native to use and depend on, |
| 54 | # so we must use the locally set up snapshot to bootstrap the build. |
| 55 | BASEDEPENDS:remove:class-native = "cargo-native" |
| 56 | CARGO:class-native = "${WORKDIR}/${CARGO_SNAPSHOT}/bin/cargo" |