Skip to content

Commit 2e26a51

Browse files
committed
Allow native builds
1 parent be15e81 commit 2e26a51

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

classes/cargo_bin.bbclass

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ inherit rust_bin-common
33
# Many crates rely on pkg-config to find native versions of their libraries for
44
# linking - do the simple thing and make it generally available.
55
DEPENDS:append = "\
6-
cargo-bin-cross-${TARGET_ARCH} \
6+
${@ "cargo-bin-cross-${TARGET_ARCH}" if d.getVar('TARGET_ARCH') != "${BUILD_ARCH}" else "cargo-bin-native" } \
77
pkgconfig-native \
88
"
99

@@ -98,6 +98,8 @@ cargo_bin_do_compile() {
9898
export TARGET_CXX="${WRAPPER_DIR}/cxx-wrapper.sh"
9999
export CC="${WRAPPER_DIR}/cc-native-wrapper.sh"
100100
export CXX="${WRAPPER_DIR}/cxx-native-wrapper.sh"
101+
export TARGET_LD="${WRAPPER_DIR}/linker-wrapper.sh"
102+
export LD="${WRAPPER_DIR}/linker-native-wrapper.sh"
101103
export PKG_CONFIG_ALLOW_CROSS="1"
102104
export LDFLAGS=""
103105
export RUSTFLAGS="${RUSTFLAGS}"

recipes-devtools/rust/cargo-bin-cross.inc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ inherit rust_bin-common
88

99
PN = "cargo-bin-cross-${TARGET_ARCH}"
1010

11+
PROVIDES += "cargo-bin-native"
12+
1113
CARGO_HOST_TARGET = "${@rust_target(d, 'HOST')}"
1214

1315
SYSROOT_DIRS_NATIVE += "${prefix}"

recipes-devtools/rust/rust-bin-cross.inc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ SECTION = "devel"
66
inherit cross
77
inherit rust_bin-common
88

9+
PN:class-native = "rust-bin-native-${BUILD_ARCH}"
10+
911
# Required to link binaries
10-
DEPENDS += "gcc-cross-${TARGET_ARCH}"
12+
DEPENDS += "${@ "gcc-cross-${TARGET_ARCH}" if d.getVar('TARGET_ARCH') == "X86_64" else "" }"
1113

1214
PN = "rust-bin-cross-${TARGET_ARCH}"
1315

0 commit comments

Comments
 (0)