All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/3] package/pkg-cargo: allow packages to define download environment
       [not found] <cover.1644343524.git.yann.morin@orange.com>
@ 2022-02-08 18:05 ` yann.morin
  2022-02-08 18:05 ` [Buildroot] [PATCH 2/3] package/pkg-golang: " yann.morin
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: yann.morin @ 2022-02-08 18:05 UTC (permalink / raw)
  To: buildroot; +Cc: Yann E. MORIN, Thomas Petazzoni

From: "Yann E. MORIN" <yann.morin@orange.com>

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.

Signed-off-by: Yann E. MORIN <yann.morin@orange.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 package/pkg-cargo.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/pkg-cargo.mk b/package/pkg-cargo.mk
index e74a8358bc..66bea513e0 100644
--- a/package/pkg-cargo.mk
+++ b/package/pkg-cargo.mk
@@ -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.
-- 
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
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH 2/3] package/pkg-golang: allow packages to define download environment
       [not found] <cover.1644343524.git.yann.morin@orange.com>
  2022-02-08 18:05 ` [Buildroot] [PATCH 1/3] package/pkg-cargo: allow packages to define download environment yann.morin
@ 2022-02-08 18:05 ` yann.morin
  2022-02-08 18:05 ` [Buildroot] [PATCH 3/3] package/pkg-cargo: allow building in a sub-directory yann.morin
       [not found] ` <61674c9d53c678f60a82c5c347147c31b9a29ba6.1644343524.git.yann.morin@orange.com>
  3 siblings, 0 replies; 4+ messages in thread
From: yann.morin @ 2022-02-08 18:05 UTC (permalink / raw)
  To: buildroot; +Cc: Yann E. MORIN, Anisse Astier, Thomas Petazzoni

From: "Yann E. MORIN" <yann.morin@orange.com>

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.

Signed-off-by: Yann E. MORIN <yann.morin@orange.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Christian Stewart <christian@paral.in>
Cc: Anisse Astier <anisse@astier.eu>
---
 package/pkg-golang.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/pkg-golang.mk b/package/pkg-golang.mk
index 35bcb1673b..69eae02830 100644
--- a/package/pkg-golang.mk
+++ b/package/pkg-golang.mk
@@ -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)
-- 
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
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH 3/3] package/pkg-cargo: allow building in a sub-directory
       [not found] <cover.1644343524.git.yann.morin@orange.com>
  2022-02-08 18:05 ` [Buildroot] [PATCH 1/3] package/pkg-cargo: allow packages to define download environment yann.morin
  2022-02-08 18:05 ` [Buildroot] [PATCH 2/3] package/pkg-golang: " yann.morin
@ 2022-02-08 18:05 ` yann.morin
       [not found] ` <61674c9d53c678f60a82c5c347147c31b9a29ba6.1644343524.git.yann.morin@orange.com>
  3 siblings, 0 replies; 4+ messages in thread
From: yann.morin @ 2022-02-08 18:05 UTC (permalink / raw)
  To: buildroot; +Cc: Yann E. MORIN, Thomas Petazzoni

From: "Yann E. MORIN" <yann.morin@orange.com>

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.

Signed-off-by: Yann E. MORIN <yann.morin@orange.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 package/pkg-cargo.mk | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/package/pkg-cargo.mk b/package/pkg-cargo.mk
index 66bea513e0..68e15e066c 100644
--- a/package/pkg-cargo.mk
+++ b/package/pkg-cargo.mk
@@ -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) \
-- 
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
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Buildroot] [PATCH 3/3] package/pkg-cargo: allow building in a sub-directory
       [not found] ` <61674c9d53c678f60a82c5c347147c31b9a29ba6.1644343524.git.yann.morin@orange.com>
@ 2022-02-09  8:44   ` yann.morin
  0 siblings, 0 replies; 4+ messages in thread
From: yann.morin @ 2022-02-09  8:44 UTC (permalink / raw)
  To: buildroot; +Cc: Thomas Petazzoni

All,

On 2022-02-08 19:05 +0100, yann.morin@orange.com spake thusly:
> From: "Yann E. MORIN" <yann.morin@orange.com>
> 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.
> 
> Signed-off-by: Yann E. MORIN <yann.morin@orange.com>
> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> ---
>  package/pkg-cargo.mk | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/package/pkg-cargo.mk b/package/pkg-cargo.mk
> index 66bea513e0..68e15e066c 100644
> --- a/package/pkg-cargo.mk
> +++ b/package/pkg-cargo.mk
> @@ -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.

> +$(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) \
> -- 
> 2.25.1
> 

-- 
                                        ____________
.-----------------.--------------------:       _    :------------------.
|  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
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-02-09  8:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <cover.1644343524.git.yann.morin@orange.com>
2022-02-08 18:05 ` [Buildroot] [PATCH 1/3] package/pkg-cargo: allow packages to define download environment yann.morin
2022-02-08 18:05 ` [Buildroot] [PATCH 2/3] package/pkg-golang: " yann.morin
2022-02-08 18:05 ` [Buildroot] [PATCH 3/3] package/pkg-cargo: allow building in a sub-directory yann.morin
     [not found] ` <61674c9d53c678f60a82c5c347147c31b9a29ba6.1644343524.git.yann.morin@orange.com>
2022-02-09  8:44   ` yann.morin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.