Skip to content

Commit

Permalink
class/cargo: Handle case when host and target has same arch
Browse files Browse the repository at this point in the history
When we have same architecture for the host and target, we need to
properly handle the native and target case as Rust cannot differentiate
both.

Fixes: #70.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
  • Loading branch information
otavio committed Aug 20, 2020
1 parent 6f03f63 commit 2c460c0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions classes/cargo.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,18 @@ CARGO_BUILD_FLAGS = "\
"

create_cargo_config() {
echo > ${CARGO_HOME}/config
echo "[target.${RUST_BUILD}]" >> ${CARGO_HOME}/config
echo "linker = '${WRAPPER_DIR}/linker-native-wrapper.sh'" >> ${CARGO_HOME}/config

if [ "${RUST_BUILD}" != "${RUST_TARGET}" ]; then
echo > ${CARGO_HOME}/config
echo "[target.${RUST_BUILD}]" >> ${CARGO_HOME}/config
echo "linker = '${WRAPPER_DIR}/linker-native-wrapper.sh'" >> ${CARGO_HOME}/config

echo >> ${CARGO_HOME}/config
echo "[target.${RUST_TARGET}]" >> ${CARGO_HOME}/config
echo "linker = '${WRAPPER_DIR}/linker-wrapper.sh'" >> ${CARGO_HOME}/config
else
echo > ${CARGO_HOME}/config
echo "[target.${RUST_TARGET}]" >> ${CARGO_HOME}/config
echo "linker = '${WRAPPER_DIR}/linker-wrapper.sh'" >> ${CARGO_HOME}/config
fi

echo >> ${CARGO_HOME}/config
Expand Down

0 comments on commit 2c460c0

Please sign in to comment.