Skip to content

Commit

Permalink
Merge pull request #178 from engineeredarts/feature/allow-native-builds
Browse files Browse the repository at this point in the history
Allow native builds
  • Loading branch information
nastevens authored May 21, 2024
2 parents be15e81 + 2e26a51 commit 14e76cf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion classes/cargo_bin.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ inherit rust_bin-common
# Many crates rely on pkg-config to find native versions of their libraries for
# linking - do the simple thing and make it generally available.
DEPENDS:append = "\
cargo-bin-cross-${TARGET_ARCH} \
${@ "cargo-bin-cross-${TARGET_ARCH}" if d.getVar('TARGET_ARCH') != "${BUILD_ARCH}" else "cargo-bin-native" } \
pkgconfig-native \
"

Expand Down Expand Up @@ -98,6 +98,8 @@ cargo_bin_do_compile() {
export TARGET_CXX="${WRAPPER_DIR}/cxx-wrapper.sh"
export CC="${WRAPPER_DIR}/cc-native-wrapper.sh"
export CXX="${WRAPPER_DIR}/cxx-native-wrapper.sh"
export TARGET_LD="${WRAPPER_DIR}/linker-wrapper.sh"
export LD="${WRAPPER_DIR}/linker-native-wrapper.sh"
export PKG_CONFIG_ALLOW_CROSS="1"
export LDFLAGS=""
export RUSTFLAGS="${RUSTFLAGS}"
Expand Down
2 changes: 2 additions & 0 deletions recipes-devtools/rust/cargo-bin-cross.inc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ inherit rust_bin-common

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

PROVIDES += "cargo-bin-native"

CARGO_HOST_TARGET = "${@rust_target(d, 'HOST')}"

SYSROOT_DIRS_NATIVE += "${prefix}"
Expand Down
4 changes: 3 additions & 1 deletion recipes-devtools/rust/rust-bin-cross.inc
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ SECTION = "devel"
inherit cross
inherit rust_bin-common

PN:class-native = "rust-bin-native-${BUILD_ARCH}"

# Required to link binaries
DEPENDS += "gcc-cross-${TARGET_ARCH}"
DEPENDS += "${@ "gcc-cross-${TARGET_ARCH}" if d.getVar('TARGET_ARCH') == "X86_64" else "" }"

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

Expand Down

0 comments on commit 14e76cf

Please sign in to comment.