summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/rust
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-08-05 13:49:47 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-08-08 15:44:20 +0100
commit0a01b5ab973ed6351fb485950adaf888f27f990d (patch)
tree6e4d9cc22dac411503f463a5b58cb47e2fea9fb3 /meta/recipes-devtools/rust
parent1b7b5c37598b4475075b4e526277e5eb63d2a77c (diff)
downloadpoky-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/rust')
-rw-r--r--meta/recipes-devtools/rust/rust-cross-canadian-common.inc49
-rw-r--r--meta/recipes-devtools/rust/rust-cross-canadian.inc65
-rw-r--r--meta/recipes-devtools/rust/rust-cross-canadian_1.62.0.bb8
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
2RUST_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-config"
3
4require rust.inc
5
6DEPENDS += "rust-llvm (=${PV})"
7
8inherit cross-canadian
9
10DEPENDS += " \
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.
21EXCLUDE_FROM_SHLIBS_${RUSTLIB_TARGET_PN} = "1"
22
23DEBUG_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
28RUST_TARGETGENS = "BUILD HOST TARGET"
29
30INHIBIT_DEFAULT_RUST_DEPS = "1"
31
32export WRAPPER_TARGET_CC = "${CCACHE}${TARGET_PREFIX}gcc --sysroot=${STAGING_DIR_TARGET} ${TARGET_CC_ARCH} ${SECURITY_NOPIE_CFLAGS}"
33export WRAPPER_TARGET_CXX = "${CCACHE}${TARGET_PREFIX}g++ --sysroot=${STAGING_DIR_TARGET} ${TARGET_CC_ARCH} ${SECURITY_NOPIE_CFLAGS}"
34export WRAPPER_TARGET_CCLD = "${TARGET_PREFIX}gcc --sysroot=${STAGING_DIR_TARGET} ${TARGET_CC_ARCH} ${SECURITY_NOPIE_CFLAGS}"
35export WRAPPER_TARGET_LDFLAGS = "${TARGET_LDFLAGS}"
36export WRAPPER_TARGET_AR = "${TARGET_PREFIX}ar"
37
38python 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
43INSANE_SKIP:${RUSTLIB_TARGET_PN} = "file-rdeps arch ldflags"
44SKIP_FILEDEPS:${RUSTLIB_TARGET_PN} = "1"
45
46INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
47INHIBIT_PACKAGE_STRIP = "1"
48INHIBIT_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
2require rust-cross-canadian-common.inc
3
4RUSTLIB_TARGET_PN = "rust-cross-canadian-rustlib-target-${TRANSLATED_TARGET_ARCH}"
5RUSTLIB_HOST_PN = "rust-cross-canadian-rustlib-host-${TRANSLATED_TARGET_ARCH}"
6RUSTLIB_SRC_PN = "rust-cross-canadian-src"
7RUSTLIB_PKGS = "${RUSTLIB_SRC_PN} ${RUSTLIB_TARGET_PN} ${RUSTLIB_HOST_PN}"
8PN = "rust-cross-canadian-${TRANSLATED_TARGET_ARCH}" 1PN = "rust-cross-canadian-${TRANSLATED_TARGET_ARCH}"
9 2
10PACKAGES = "${RUSTLIB_PKGS} ${PN}" 3inherit rust-target-config
11RDEPENDS:${PN} += "${RUSTLIB_PKGS}" 4inherit rust-common
12 5
13# The default behaviour of x.py changed in 1.47+ so now we need to 6LICENSE = "MIT"
14# explicitly ask for the stage 2 compiler to be assembled. 7
15do_compile () { 8MODIFYTOS = "0"
16 rust_runx build --stage 2
17}
18 9
19create_sdk_wrapper () { 10create_sdk_wrapper () {
20 file="$1" 11 file="$1"
@@ -30,39 +21,14 @@ create_sdk_wrapper () {
30 21
31do_install () { 22do_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
103PKG_SYS_LIBDIR = "${SDKPATHNATIVE}/usr/lib" 69FILES:${PN} += "${base_prefix}/environment-setup.d"
104PKG_SYS_BINDIR = "${SDKPATHNATIVE}/usr/bin"
105PKG_RUSTLIB_DIR = "${PKG_SYS_LIBDIR}/${TARGET_SYS}/rustlib"
106FILES:${PN} = "${PKG_SYS_LIBDIR}/*.so ${PKG_SYS_BINDIR} ${base_prefix}/environment-setup.d"
107FILES:${RUSTLIB_TARGET_PN} = "${PKG_RUSTLIB_DIR}/${TARGET_SYS} ${PKG_RUSTLIB_DIR}/${TARGET_SYS}.json"
108FILES:${RUSTLIB_HOST_PN} = "${PKG_RUSTLIB_DIR}/${BUILD_ARCH}-unknown-linux-gnu"
109FILES:${RUSTLIB_SRC_PN} = "${PKG_RUSTLIB_DIR}/src"
110
111SUMMARY:${RUSTLIB_TARGET_PN} = "Rust cross canadian libaries for ${TARGET_SYS}"
112SUMMARY:${RUSTLIB_HOST_PN} = "Rust cross canadian libaries for ${HOST_SYS}"
113SUMMARY:${RUSTLIB_SRC_PN} = "Rust standard library sources for cross canadian toolchain"
114SUMMARY:${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 @@
1require rust-cross-canadian.inc 1inherit cross-canadian
2require rust-source.inc 2require rust-cross-canadian.inc \ No newline at end of file
3require rust-snapshot.inc
4
5FILESEXTRAPATHS:prepend := "${THISDIR}/rust:"
6