diff options
Diffstat (limited to 'meta/recipes-devtools/rust/rust-cross-canadian.inc')
-rw-r--r-- | meta/recipes-devtools/rust/rust-cross-canadian.inc | 65 |
1 files changed, 10 insertions, 55 deletions
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 | ||