@@ -71,6 +71,14 @@ $(2)_DOWNLOAD_DEPENDENCIES += host-rustc
$(2)_DOWNLOAD_POST_PROCESS = cargo
$(2)_DL_ENV += CARGO_HOME=$$(HOST_DIR)/share/cargo
+# If building in a sub directory, use that to find the Cargo.toml, unless
+# the package already provided its location.
+ifneq ($$($(2)_SUBDIR),)
+ifneq ($$(filter BR_CARGO_MANIFEST_PATH=%,$$($(2)_DL_ENV)))
+$(2)_DL_ENV += BR_CARGO_MANIFEST_PATH=$$($(2)_SUBDIR)/Cargo.toml
+endif
+endif
+
# Due to vendoring, it is pretty likely that not all licenses are
# listed in <pkg>_LICENSE.
$(2)_LICENSE += , vendored dependencies licenses probably not listed
@@ -97,7 +105,7 @@ $(2)_LICENSE += , vendored dependencies licenses probably not listed
ifndef $(2)_BUILD_CMDS
ifeq ($(4),target)
define $(2)_BUILD_CMDS
- cd $$(@D) && \
+ cd $$($$(PKG)_SRCDIR) && \
$$(TARGET_MAKE_ENV) \
$$(TARGET_CONFIGURE_OPTS) \
$$(PKG_CARGO_ENV) \
@@ -111,7 +119,7 @@ define $(2)_BUILD_CMDS
endef
else # ifeq ($(4),target)
define $(2)_BUILD_CMDS
- cd $$(@D) && \
+ cd $$($$(PKG)_SRCDIR) && \
$$(HOST_MAKE_ENV) \
RUSTFLAGS="$$(addprefix -C link-args=,$$(HOST_LDFLAGS))" \
$$(HOST_CONFIGURE_OPTS) \
@@ -133,7 +141,7 @@ endif # ifndef $(2)_BUILD_CMDS
#
ifndef $(2)_INSTALL_TARGET_CMDS
define $(2)_INSTALL_TARGET_CMDS
- cd $$(@D) && \
+ cd $$($$(PKG)_SRCDIR) && \
$$(TARGET_MAKE_ENV) \
$$(TARGET_CONFIGURE_OPTS) \
$$(PKG_CARGO_ENV) \
@@ -152,7 +160,7 @@ endif
ifndef $(2)_INSTALL_CMDS
define $(2)_INSTALL_CMDS
- cd $$(@D) && \
+ cd $$($$(PKG)_SRCDIR) && \
$$(HOST_MAKE_ENV) \
RUSTFLAGS="$$(addprefix -C link-args=,$$(HOST_LDFLAGS))" \
$$(HOST_CONFIGURE_OPTS) \