package/pkg-cargo: allow packages to define download environment
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/3 package/pkg-cargo: allow packages to define download environment
From: "Yann E. MORIN" <[email protected]>
Currently, the cargo infrastructure forcibly sets the package _DL_ENV variable, instead of appending to it, which prevents packages from providing their own download environment variables.
We fix that by using an append-assignment.
Note: when introduced, that variable was explicitly not documented, and is supposed to only be used by packages infrastructures. However, that variable exists, and it can be (ab)used by br2-external packages (most probably to ill effects, but heh!). We anyway leave it undocumented, like _ROOTFS_PRE_CMD_HOOKS.
--- package/pkg-cargo.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
package/pkg-cargo.mk +1 -1
@@ -69,7 +69,7 @@ define inner-cargo-package $(2)_DOWNLOAD_DEPENDENCIES += host-rustc $(2)_DOWNLOAD_POST_PROCESS = cargo -$(2)_DL_ENV = CARGO_HOME=$$(HOST_DIR)/share/cargo +$(2)_DL_ENV += CARGO_HOME=$$(HOST_DIR)/share/cargo # Due to vendoring, it is pretty likely that not all licenses are # listed in <pkg>_LICENSE.
Signature · 20 lines
2.25.1 _________________________________________________________________________________________________________________________ Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration, Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci. This message and its attachments may contain confidential or privileged information that may be protected by law; they should not be distributed, used or copied without authorisation. If you have received this email in error, please notify the sender and delete this message and its attachments. As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified. Thank you. _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 2/3 package/pkg-golang: allow packages to define download environment
In reply to a message not in the archiveFrom: "Yann E. MORIN" <[email protected]>
Currently, the golang infrastructure forcibly sets the package _DL_ENV variable, instead of appending to it, which prevents packages from providing their own download environment variables.
We fix that by using an append-assignment.
Note: when introduced, that variable was explicitly not documented, and is supposed to only be used by packages infrastructures. However, that variable exists, and it can be (ab)used by br2-external packages (most probably to ill effects, but heh!). We anyway leave it undocumented, like _ROOTFS_PRE_CMD_HOOKS.
--- package/pkg-golang.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
package/pkg-golang.mk +1 -1
@@ -83,7 +83,7 @@ endef $(2)_POST_PATCH_HOOKS += $(2)_GEN_GOMOD $(2)_DOWNLOAD_POST_PROCESS = go -$(2)_DL_ENV = \ +$(2)_DL_ENV += \ $(HOST_GO_COMMON_ENV) \ GOPROXY=direct \ BR_GOMOD=$$($(2)_GOMOD)
Signature · 20 lines
2.25.1 _________________________________________________________________________________________________________________________ Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration, Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci. This message and its attachments may contain confidential or privileged information that may be protected by law; they should not be distributed, used or copied without authorisation. If you have received this email in error, please notify the sender and delete this message and its attachments. As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified. Thank you. _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 3/3 package/pkg-cargo: allow building in a sub-directory
In reply to a message not in the archiveFrom: "Yann E. MORIN" <[email protected]>
Some packages have their rust sources as a sub-directory, rather than at the root of the source tree.
Do like we do for autotools-package, and use the package's _SRCDIR rather than the top-level directory $(@D).
Additionally, in such a situation, it is more than probable that the Cargo.toml is also present in that sub-directory, so use that when vendoring the package, unless the package took extra precautions to specify an alternate location.
--- package/pkg-cargo.mk | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
package/pkg-cargo.mk +12 -4
@@ -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) \
Signature · 20 lines
2.25.1 _________________________________________________________________________________________________________________________ Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration, Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci. This message and its attachments may contain confidential or privileged information that may be protected by law; they should not be distributed, used or copied without authorisation. If you have received this email in error, please notify the sender and delete this message and its attachments. As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified. Thank you. _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
A message that is not in the archive (sent off-list or not yet received): 61674c9d53c678f60a82c5c347147c31b9a29ba6.1644343524.git.yann.morin@orange.com
Re: [Buildroot] [PATCH 3/3] package/pkg-cargo: allow building in a sub-directory
All,
On 2022-02-08 19:05 +0100, [email protected] spake thusly:
Quoted 23 lines
From: "Yann E. MORIN" <[email protected]>
Some packages have their rust sources as a sub-directory, rather than at the root of the source tree.Do like we do for autotools-package, and use the package's
_SRCDIRrather than the top-level directory $(@D).Additionally, in such a situation, it is more than probable that the Cargo.toml is also present in that sub-directory, so use that when vendoring the package, unless the package took extra precautions to specify an alternate location.
Signed-off-by Yann E. MORIN <[email protected]>Cc Thomas Petazzoni <[email protected]>--- package/pkg-cargo.mk | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)package/pkg-cargo.mk +0
-0
package/pkg-cargo.mk $(2)_DOWNLOAD_DEPENDENCIES += host-rustc · line 77
Quoted 7 lines
package/pkg-cargo.mk +4
-0@@ -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)))
------^
I forgot to git commit --amend to add the missing comma.
Sorry for the noise... :-(
Regards,
Yann E. MORIN.
Quoted 46 lines
package/pkg-cargo.mk +8
-4+$(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) \Signature · 1 line
2.25.1
Signature · 26 lines
____________ .-----------------.--------------------: _ :------------------. | Yann E. MORIN | Real-Time Embedded | __/ ) | /"\ ASCII RIBBON | | +33 534.541.179 | Software Designer | _/ - /' | \ / CAMPAIGN | | +33 638.411.245 '--------------------: (_ `--, | X AGAINST | | yann.morin (at) orange.com |_=" ,--' | / \ HTML MAIL | '--------------------------------------:______/_____:------------------' _________________________________________________________________________________________________________________________ Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration, Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci. This message and its attachments may contain confidential or privileged information that may be protected by law; they should not be distributed, used or copied without authorisation. If you have received this email in error, please notify the sender and delete this message and its attachments. As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified. Thank you. _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot