summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-08-05 12:01:32 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-08-08 15:44:20 +0100
commitb2ffb96705e9d7bcf268f879c756727e32fb7c88 (patch)
treee83f191a541a0f9c595dcd29472b749da0f0234e /meta/classes
parentae3950ec5a424fb81776a5b556a5669119f305ef (diff)
downloadpoky-b2ffb96705e9d7bcf268f879c756727e32fb7c88.tar.gz
rust-common: Rework wrappers to handle musl
For musl we need to be able to add a library to the end of the linker commandline. Rework the wrapper code to be able to do this through a new variable. (From OE-Core rev: dfff5a176765c0e8b212bf31081f80e79025fd1b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/rust-common.bbclass22
1 files changed, 14 insertions, 8 deletions
diff --git a/meta/classes/rust-common.bbclass b/meta/classes/rust-common.bbclass
index b79a829462..1bce7761ab 100644
--- a/meta/classes/rust-common.bbclass
+++ b/meta/classes/rust-common.bbclass
@@ -141,13 +141,18 @@ RUST_TARGET_AR = "${WRAPPER_DIR}/target-rust-ar"
141create_wrapper () { 141create_wrapper () {
142 file="$1" 142 file="$1"
143 shift 143 shift
144 extras="$1"
145 shift
144 146
145 cat <<- EOF > "${file}" 147 cat <<- EOF > "${file}"
146 #!/usr/bin/env python3 148 #!/usr/bin/env python3
147 import os, sys 149 import os, sys
148 orig_binary = "$@" 150 orig_binary = "$@"
151 extras = "${extras}"
149 binary = orig_binary.split()[0] 152 binary = orig_binary.split()[0]
150 args = orig_binary.split() + sys.argv[1:] 153 args = orig_binary.split() + sys.argv[1:]
154 if extras:
155 args.append(extras)
151 os.execvp(binary, args) 156 os.execvp(binary, args)
152 EOF 157 EOF
153 chmod +x "${file}" 158 chmod +x "${file}"
@@ -157,6 +162,7 @@ WRAPPER_TARGET_CC = "${CC}"
157WRAPPER_TARGET_CXX = "${CXX}" 162WRAPPER_TARGET_CXX = "${CXX}"
158WRAPPER_TARGET_CCLD = "${CCLD}" 163WRAPPER_TARGET_CCLD = "${CCLD}"
159WRAPPER_TARGET_LDFLAGS = "${LDFLAGS}" 164WRAPPER_TARGET_LDFLAGS = "${LDFLAGS}"
165WRAPPER_TARGET_EXTRALD = ""
160WRAPPER_TARGET_AR = "${AR}" 166WRAPPER_TARGET_AR = "${AR}"
161 167
162# compiler is used by gcc-rs 168# compiler is used by gcc-rs
@@ -166,22 +172,22 @@ do_rust_create_wrappers () {
166 mkdir -p "${WRAPPER_DIR}" 172 mkdir -p "${WRAPPER_DIR}"
167 173
168 # Yocto Build / Rust Host C compiler 174 # Yocto Build / Rust Host C compiler
169 create_wrapper "${RUST_BUILD_CC}" "${BUILD_CC}" 175 create_wrapper "${RUST_BUILD_CC}" "" "${BUILD_CC}"
170 # Yocto Build / Rust Host C++ compiler 176 # Yocto Build / Rust Host C++ compiler
171 create_wrapper "${RUST_BUILD_CXX}" "${BUILD_CXX}" 177 create_wrapper "${RUST_BUILD_CXX}" "" "${BUILD_CXX}"
172 # Yocto Build / Rust Host linker 178 # Yocto Build / Rust Host linker
173 create_wrapper "${RUST_BUILD_CCLD}" "${BUILD_CCLD}" "${BUILD_LDFLAGS}" 179 create_wrapper "${RUST_BUILD_CCLD}" "" "${BUILD_CCLD}" "${BUILD_LDFLAGS}"
174 # Yocto Build / Rust Host archiver 180 # Yocto Build / Rust Host archiver
175 create_wrapper "${RUST_BUILD_AR}" "${BUILD_AR}" 181 create_wrapper "${RUST_BUILD_AR}" "" "${BUILD_AR}"
176 182
177 # Yocto Target / Rust Target C compiler 183 # Yocto Target / Rust Target C compiler
178 create_wrapper "${RUST_TARGET_CC}" "${WRAPPER_TARGET_CC}" "${WRAPPER_TARGET_LDFLAGS}" 184 create_wrapper "${RUST_TARGET_CC}" "${WRAPPER_TARGET_EXTRALD}" "${WRAPPER_TARGET_CC}" "${WRAPPER_TARGET_LDFLAGS}"
179 # Yocto Target / Rust Target C++ compiler 185 # Yocto Target / Rust Target C++ compiler
180 create_wrapper "${RUST_TARGET_CXX}" "${WRAPPER_TARGET_CXX}" "${CXXFLAGS}" 186 create_wrapper "${RUST_TARGET_CXX}" "${WRAPPER_TARGET_EXTRALD}" "${WRAPPER_TARGET_CXX}" "${CXXFLAGS}"
181 # Yocto Target / Rust Target linker 187 # Yocto Target / Rust Target linker
182 create_wrapper "${RUST_TARGET_CCLD}" "${WRAPPER_TARGET_CCLD}" "${WRAPPER_TARGET_LDFLAGS}" 188 create_wrapper "${RUST_TARGET_CCLD}" "${WRAPPER_TARGET_EXTRALD}" "${WRAPPER_TARGET_CCLD}" "${WRAPPER_TARGET_LDFLAGS}"
183 # Yocto Target / Rust Target archiver 189 # Yocto Target / Rust Target archiver
184 create_wrapper "${RUST_TARGET_AR}" "${WRAPPER_TARGET_AR}" 190 create_wrapper "${RUST_TARGET_AR}" "" "${WRAPPER_TARGET_AR}"
185 191
186} 192}
187 193