diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-08-05 13:49:47 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-08-08 15:44:20 +0100 |
commit | 0a01b5ab973ed6351fb485950adaf888f27f990d (patch) | |
tree | 6e4d9cc22dac411503f463a5b58cb47e2fea9fb3 /meta/recipes-devtools | |
parent | 1b7b5c37598b4475075b4e526277e5eb63d2a77c (diff) | |
download | poky-0a01b5ab973ed6351fb485950adaf888f27f990d.tar.gz |
rust-cross-canadian: Simplify and fix
Since a copy of rust can target any target and doesn't need to be target
specific, we can simplify rust-cross-canadian to simply contain the json
configuration and envirionment setup scripts.
(From OE-Core rev: 6ec18de9d6f49bccff72f2665821dbd732b69b48)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools')
3 files changed, 12 insertions, 110 deletions
diff --git a/meta/recipes-devtools/rust/rust-cross-canadian-common.inc b/meta/recipes-devtools/rust/rust-cross-canadian-common.inc deleted file mode 100644 index 34020ff6ff..0000000000 --- a/meta/recipes-devtools/rust/rust-cross-canadian-common.inc +++ /dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | |||
2 | RUST_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-config" | ||
3 | |||
4 | require rust.inc | ||
5 | |||
6 | DEPENDS += "rust-llvm (=${PV})" | ||
7 | |||
8 | inherit cross-canadian | ||
9 | |||
10 | DEPENDS += " \ | ||
11 | virtual/${HOST_PREFIX}gcc-crosssdk \ | ||
12 | virtual/nativesdk-libc rust-llvm-native \ | ||
13 | virtual/${TARGET_PREFIX}compilerlibs \ | ||
14 | virtual/nativesdk-${HOST_PREFIX}compilerlibs \ | ||
15 | gcc-cross-${TARGET_ARCH} \ | ||
16 | " | ||
17 | |||
18 | # The host tools are likely not to be able to do the necessary operation on | ||
19 | # the target architecturea. Alternatively one could check compatibility | ||
20 | # between host/target. | ||
21 | EXCLUDE_FROM_SHLIBS_${RUSTLIB_TARGET_PN} = "1" | ||
22 | |||
23 | DEBUG_PREFIX_MAP = "-fdebug-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \ | ||
24 | -fdebug-prefix-map=${STAGING_DIR_HOST}= \ | ||
25 | -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \ | ||
26 | " | ||
27 | |||
28 | RUST_TARGETGENS = "BUILD HOST TARGET" | ||
29 | |||
30 | INHIBIT_DEFAULT_RUST_DEPS = "1" | ||
31 | |||
32 | export WRAPPER_TARGET_CC = "${CCACHE}${TARGET_PREFIX}gcc --sysroot=${STAGING_DIR_TARGET} ${TARGET_CC_ARCH} ${SECURITY_NOPIE_CFLAGS}" | ||
33 | export WRAPPER_TARGET_CXX = "${CCACHE}${TARGET_PREFIX}g++ --sysroot=${STAGING_DIR_TARGET} ${TARGET_CC_ARCH} ${SECURITY_NOPIE_CFLAGS}" | ||
34 | export WRAPPER_TARGET_CCLD = "${TARGET_PREFIX}gcc --sysroot=${STAGING_DIR_TARGET} ${TARGET_CC_ARCH} ${SECURITY_NOPIE_CFLAGS}" | ||
35 | export WRAPPER_TARGET_LDFLAGS = "${TARGET_LDFLAGS}" | ||
36 | export WRAPPER_TARGET_AR = "${TARGET_PREFIX}ar" | ||
37 | |||
38 | python do_configure:prepend() { | ||
39 | targets = [d.getVar("TARGET_SYS", True), "{}-unknown-linux-gnu".format(d.getVar("HOST_ARCH", True))] | ||
40 | hosts = ["{}-unknown-linux-gnu".format(d.getVar("HOST_ARCH", True))] | ||
41 | } | ||
42 | |||
43 | INSANE_SKIP:${RUSTLIB_TARGET_PN} = "file-rdeps arch ldflags" | ||
44 | SKIP_FILEDEPS:${RUSTLIB_TARGET_PN} = "1" | ||
45 | |||
46 | INHIBIT_PACKAGE_DEBUG_SPLIT = "1" | ||
47 | INHIBIT_PACKAGE_STRIP = "1" | ||
48 | INHIBIT_SYSROOT_STRIP = "1" | ||
49 | |||
diff --git a/meta/recipes-devtools/rust/rust-cross-canadian.inc b/meta/recipes-devtools/rust/rust-cross-canadian.inc index 677bd8842c..2b09661542 100644 --- a/meta/recipes-devtools/rust/rust-cross-canadian.inc +++ b/meta/recipes-devtools/rust/rust-cross-canadian.inc | |||
@@ -1,20 +1,11 @@ | |||
1 | |||
2 | require rust-cross-canadian-common.inc | ||
3 | |||
4 | RUSTLIB_TARGET_PN = "rust-cross-canadian-rustlib-target-${TRANSLATED_TARGET_ARCH}" | ||
5 | RUSTLIB_HOST_PN = "rust-cross-canadian-rustlib-host-${TRANSLATED_TARGET_ARCH}" | ||
6 | RUSTLIB_SRC_PN = "rust-cross-canadian-src" | ||
7 | RUSTLIB_PKGS = "${RUSTLIB_SRC_PN} ${RUSTLIB_TARGET_PN} ${RUSTLIB_HOST_PN}" | ||
8 | PN = "rust-cross-canadian-${TRANSLATED_TARGET_ARCH}" | 1 | PN = "rust-cross-canadian-${TRANSLATED_TARGET_ARCH}" |
9 | 2 | ||
10 | PACKAGES = "${RUSTLIB_PKGS} ${PN}" | 3 | inherit rust-target-config |
11 | RDEPENDS:${PN} += "${RUSTLIB_PKGS}" | 4 | inherit rust-common |
12 | 5 | ||
13 | # The default behaviour of x.py changed in 1.47+ so now we need to | 6 | LICENSE = "MIT" |
14 | # explicitly ask for the stage 2 compiler to be assembled. | 7 | |
15 | do_compile () { | 8 | MODIFYTOS = "0" |
16 | rust_runx build --stage 2 | ||
17 | } | ||
18 | 9 | ||
19 | create_sdk_wrapper () { | 10 | create_sdk_wrapper () { |
20 | file="$1" | 11 | file="$1" |
@@ -30,39 +21,14 @@ create_sdk_wrapper () { | |||
30 | 21 | ||
31 | do_install () { | 22 | do_install () { |
32 | # Rust requires /usr/lib to contain the libs. | 23 | # Rust requires /usr/lib to contain the libs. |
33 | # Similar story is with /usr/bin ruquiring `lib` to be at the same level. | ||
34 | # The required structure is retained for simplicity. | 24 | # The required structure is retained for simplicity. |
35 | SYS_LIBDIR=$(dirname ${D}${libdir}) | 25 | SYS_LIBDIR=$(dirname ${D}${libdir}) |
36 | SYS_BINDIR=$(dirname ${D}${bindir}) | 26 | SYS_BINDIR=$(dirname ${D}${bindir}) |
37 | RUSTLIB_DIR=${SYS_LIBDIR}/${TARGET_SYS}/rustlib | 27 | RUSTLIB_DIR=${SYS_LIBDIR}/${TARGET_SYS}/rustlib |
38 | 28 | ||
39 | install -d "${SYS_BINDIR}" | 29 | install -d ${RUSTLIB_DIR} |
40 | cp build/${SNAPSHOT_BUILD_SYS}/stage2/bin/* ${SYS_BINDIR} | 30 | install -m 0644 "${RUST_TARGETS_DIR}/${RUST_HOST_SYS}.json" "${RUSTLIB_DIR}" |
41 | for i in ${SYS_BINDIR}/*; do | 31 | install -m 0644 "${RUST_TARGETS_DIR}/${RUST_TARGET_SYS}.json" "${RUSTLIB_DIR}" |
42 | chrpath -r "\$ORIGIN/../lib" ${i} | ||
43 | done | ||
44 | |||
45 | install -d "${D}${libdir}" | ||
46 | cp -pRd build/${SNAPSHOT_BUILD_SYS}/stage2/lib/${TARGET_SYS}/*.so ${SYS_LIBDIR} | ||
47 | cp -pRd build/${SNAPSHOT_BUILD_SYS}/stage2/lib/${TARGET_SYS}/rustlib ${RUSTLIB_DIR} | ||
48 | |||
49 | for i in ${SYS_LIBDIR}/*.so; do | ||
50 | chrpath -r "\$ORIGIN/../lib" ${i} | ||
51 | done | ||
52 | for i in ${RUSTLIB_DIR}/*/lib/*.so; do | ||
53 | chrpath -d ${i} | ||
54 | done | ||
55 | |||
56 | install -m 0644 "${WORKDIR}/targets/${TARGET_SYS}.json" "${RUSTLIB_DIR}" | ||
57 | |||
58 | SRC_DIR=${RUSTLIB_DIR}/src/rust | ||
59 | install -d ${SRC_DIR}/src/llvm-project | ||
60 | cp -R --no-dereference build/${SNAPSHOT_BUILD_SYS}/stage2/lib/rustlib/src/rust/src/llvm-project/libunwind ${SRC_DIR}/src/llvm-project | ||
61 | cp -R --no-dereference build/${SNAPSHOT_BUILD_SYS}/stage2/lib/rustlib/src/rust/library ${SRC_DIR} | ||
62 | cp --no-dereference build/${SNAPSHOT_BUILD_SYS}/stage2/lib/rustlib/src/rust/Cargo.lock ${SRC_DIR} | ||
63 | # Remove executable bit from any files so then SDK doesn't try to relocate. | ||
64 | chmod -R -x+X ${SRC_DIR} | ||
65 | |||
66 | 32 | ||
67 | # Uses SDK's CC as linker so linked binaries works out of box. | 33 | # Uses SDK's CC as linker so linked binaries works out of box. |
68 | install -d ${SYS_BINDIR} | 34 | install -d ${SYS_BINDIR} |
@@ -73,7 +39,7 @@ do_install () { | |||
73 | ENV_SETUP_SH="${ENV_SETUP_DIR}/rust.sh" | 39 | ENV_SETUP_SH="${ENV_SETUP_DIR}/rust.sh" |
74 | 40 | ||
75 | cat <<- EOF > "${ENV_SETUP_SH}" | 41 | cat <<- EOF > "${ENV_SETUP_SH}" |
76 | export RUSTFLAGS="--sysroot=\$OECORE_NATIVE_SYSROOT/usr -C link-arg=--sysroot=\$OECORE_TARGET_SYSROOT -L\$OECORE_NATIVE_SYSROOT/usr/lib/${TARGET_SYS}/rustlib/${TARGET_SYS}/lib" | 42 | export RUSTFLAGS="--sysroot=\$OECORE_TARGET_SYSROOT/usr -C link-arg=--sysroot=\$OECORE_TARGET_SYSROOT" |
77 | export RUST_TARGET_PATH="\$OECORE_NATIVE_SYSROOT/usr/lib/${TARGET_SYS}/rustlib" | 43 | export RUST_TARGET_PATH="\$OECORE_NATIVE_SYSROOT/usr/lib/${TARGET_SYS}/rustlib" |
78 | EOF | 44 | EOF |
79 | 45 | ||
@@ -100,16 +66,5 @@ do_install () { | |||
100 | EOF | 66 | EOF |
101 | } | 67 | } |
102 | 68 | ||
103 | PKG_SYS_LIBDIR = "${SDKPATHNATIVE}/usr/lib" | 69 | FILES:${PN} += "${base_prefix}/environment-setup.d" |
104 | PKG_SYS_BINDIR = "${SDKPATHNATIVE}/usr/bin" | ||
105 | PKG_RUSTLIB_DIR = "${PKG_SYS_LIBDIR}/${TARGET_SYS}/rustlib" | ||
106 | FILES:${PN} = "${PKG_SYS_LIBDIR}/*.so ${PKG_SYS_BINDIR} ${base_prefix}/environment-setup.d" | ||
107 | FILES:${RUSTLIB_TARGET_PN} = "${PKG_RUSTLIB_DIR}/${TARGET_SYS} ${PKG_RUSTLIB_DIR}/${TARGET_SYS}.json" | ||
108 | FILES:${RUSTLIB_HOST_PN} = "${PKG_RUSTLIB_DIR}/${BUILD_ARCH}-unknown-linux-gnu" | ||
109 | FILES:${RUSTLIB_SRC_PN} = "${PKG_RUSTLIB_DIR}/src" | ||
110 | |||
111 | SUMMARY:${RUSTLIB_TARGET_PN} = "Rust cross canadian libaries for ${TARGET_SYS}" | ||
112 | SUMMARY:${RUSTLIB_HOST_PN} = "Rust cross canadian libaries for ${HOST_SYS}" | ||
113 | SUMMARY:${RUSTLIB_SRC_PN} = "Rust standard library sources for cross canadian toolchain" | ||
114 | SUMMARY:${PN} = "Rust crost canadian compiler" | ||
115 | 70 | ||
diff --git a/meta/recipes-devtools/rust/rust-cross-canadian_1.62.0.bb b/meta/recipes-devtools/rust/rust-cross-canadian_1.62.0.bb index 766912c019..55865238ab 100644 --- a/meta/recipes-devtools/rust/rust-cross-canadian_1.62.0.bb +++ b/meta/recipes-devtools/rust/rust-cross-canadian_1.62.0.bb | |||
@@ -1,6 +1,2 @@ | |||
1 | require rust-cross-canadian.inc | 1 | inherit cross-canadian |
2 | require rust-source.inc | 2 | require rust-cross-canadian.inc \ No newline at end of file |
3 | require rust-snapshot.inc | ||
4 | |||
5 | FILESEXTRAPATHS:prepend := "${THISDIR}/rust:" | ||
6 | |||