* [Buildroot] [PATCH] package/environment-setup: new package
@ 2020-04-18 10:31 Angelo Compagnucci
2020-04-18 12:45 ` Yann E. MORIN
0 siblings, 1 reply; 7+ messages in thread
From: Angelo Compagnucci @ 2020-04-18 10:31 UTC (permalink / raw)
To: buildroot
Install an helper script to setup a build environment
based on buildroot. It's useful when you export an sdk
and want to use buildroot to build an external project.
Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
---
docs/manual/using-buildroot-toolchain.txt | 7 +++++
package/Config.in | 1 +
package/environment-setup/Config.in | 6 ++++
.../environment-setup/environment-setup.mk | 28 +++++++++++++++++++
4 files changed, 42 insertions(+)
create mode 100644 package/environment-setup/Config.in
create mode 100644 package/environment-setup/environment-setup.mk
diff --git a/docs/manual/using-buildroot-toolchain.txt b/docs/manual/using-buildroot-toolchain.txt
index 0c0c35fced..15096cfec8 100644
--- a/docs/manual/using-buildroot-toolchain.txt
+++ b/docs/manual/using-buildroot-toolchain.txt
@@ -27,6 +27,13 @@ Upon extracting the SDK tarball, the user must run the script
+relocate-sdk.sh+ (located at the top directory of the SDK), to make
sure all paths are updated with the new location.
+For your convenience, by selecting the package BR2_PACKAGE_ENVIRONMENT_SETUP,
+you can have a +setup-environment.sh+ script installed in +output/host/+.
+This script can be sourced with +. environment-setup.sh+ to launch
+the buildroot shell. Inside this shell, you will find an environment already
+set up with the correct PATH, the complete list of +target configure+
+variables and some useful commands like the +configure+ alias.
+
Alternatively, if you just want to prepare the SDK without generating
the tarball (e.g. because you will just be moving the +host+ directory,
or will be generating the tarball on your own), Buildroot also allows
diff --git a/package/Config.in b/package/Config.in
index ccf54f2417..eff51d7451 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1949,6 +1949,7 @@ menu "Miscellaneous"
source "package/collectl/Config.in"
source "package/domoticz/Config.in"
source "package/empty/Config.in"
+ source "package/environment-setup/Config.in"
source "package/gnuradio/Config.in"
source "package/googlefontdirectory/Config.in"
source "package/gqrx/Config.in"
diff --git a/package/environment-setup/Config.in b/package/environment-setup/Config.in
new file mode 100644
index 0000000000..f0fcc7d0f8
--- /dev/null
+++ b/package/environment-setup/Config.in
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_ENVIRONMENT_SETUP
+ bool "Environment setup"
+ help
+ Install an helper script to setup a build environment
+ based on buildroot. It's useful when you export an sdk
+ and want to use buildroot to build an external project
diff --git a/package/environment-setup/environment-setup.mk b/package/environment-setup/environment-setup.mk
new file mode 100644
index 0000000000..840ee2a1a0
--- /dev/null
+++ b/package/environment-setup/environment-setup.mk
@@ -0,0 +1,28 @@
+################################################################################
+#
+# environment-setup
+#
+################################################################################
+
+ENVIRONMENT_SETUP_FILE = $(HOST_DIR)/environment-setup.sh
+ENVIRONMENT_SETUP_SED_EXP = --expression='s+$(HOST_DIR)+\$$SDK_PATH+g'
+
+define ENVIRONMENT_SETUP_INSTALL_TARGET_CMDS
+ cp package/environment-setup/environment-setup.sh $(ENVIRONMENT_SETUP_FILE)
+ for var in $(TARGET_CONFIGURE_OPTS); do \
+ echo export \"$$var\" | sed $(ENVIRONMENT_SETUP_SED_EXP) >> $(ENVIRONMENT_SETUP_FILE); \
+ done
+ echo export \"CROSS_COMPILE=$(TARGET_CROSS)\" | sed $(ENVIRONMENT_SETUP_SED_EXP) >> $(ENVIRONMENT_SETUP_FILE)
+ echo export \"CONFIGURE_FLAGS=--target=$(GNU_TARGET_NAME) \
+ --host=$(GNU_TARGET_NAME) \
+ --build=$(GNU_HOST_NAME) \
+ --prefix=/usr \
+ --exec-prefix=/usr \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --program-prefix=\" >> $(ENVIRONMENT_SETUP_FILE)
+ echo "PS1=\"\[\e[32m\]buildroot-$(BR2_VERSION)\[\e[m\]:\[\e[34m\]\w\[\e[m\]\$$ \"" >> $(ENVIRONMENT_SETUP_FILE)
+ echo alias "configure=\"./configure \$${CONFIGURE_FLAGS}\"" >> $(ENVIRONMENT_SETUP_FILE)
+endef
+
+$(eval $(generic-package))
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH] package/environment-setup: new package
2020-04-18 10:31 [Buildroot] [PATCH] package/environment-setup: new package Angelo Compagnucci
@ 2020-04-18 12:45 ` Yann E. MORIN
2020-04-18 12:54 ` Thomas Petazzoni
2020-04-18 13:26 ` Angelo Compagnucci
0 siblings, 2 replies; 7+ messages in thread
From: Yann E. MORIN @ 2020-04-18 12:45 UTC (permalink / raw)
To: buildroot
Angelo, All,
On 2020-04-18 12:31 +0200, Angelo Compagnucci spake thusly:
> Install an helper script to setup a build environment
> based on buildroot. It's useful when you export an sdk
> and want to use buildroot to build an external project.
>
> Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
> ---
> docs/manual/using-buildroot-toolchain.txt | 7 +++++
> package/Config.in | 1 +
> package/environment-setup/Config.in | 6 ++++
> .../environment-setup/environment-setup.mk | 28 +++++++++++++++++++
> 4 files changed, 42 insertions(+)
> create mode 100644 package/environment-setup/Config.in
> create mode 100644 package/environment-setup/environment-setup.mk
>
> diff --git a/docs/manual/using-buildroot-toolchain.txt b/docs/manual/using-buildroot-toolchain.txt
> index 0c0c35fced..15096cfec8 100644
> --- a/docs/manual/using-buildroot-toolchain.txt
> +++ b/docs/manual/using-buildroot-toolchain.txt
> @@ -27,6 +27,13 @@ Upon extracting the SDK tarball, the user must run the script
> +relocate-sdk.sh+ (located at the top directory of the SDK), to make
> sure all paths are updated with the new location.
>
> +For your convenience, by selecting the package BR2_PACKAGE_ENVIRONMENT_SETUP,
> +you can have a +setup-environment.sh+ script installed in +output/host/+.
> +This script can be sourced with +. environment-setup.sh+ to launch
> +the buildroot shell. Inside this shell, you will find an environment already
> +set up with the correct PATH, the complete list of +target configure+
> +variables and some useful commands like the +configure+ alias.
I don't think this should warrant a blurb in the manual. Otherwise, you
would have to add the same for the meson cross-compilation file that we
provide. And the ones for cmake as well...
Also. I don't like it being a package. There is no reason for that.
Instead, install it like we do the similar other cross-compilaiton
helpers, with the package that actually provides the tools:
- the mexon's cross-compilation file is installed by host-meson
- the cmake's toolchainfile.cmake and Buildroot.cmake files are
installed by the cmake infra (yeah, that's not so nice...)
So, since this script is geared towards autotools, I guess host-autoconf
should bear the burden of installing that file.
> diff --git a/package/environment-setup/Config.in b/package/environment-setup/Config.in
> new file mode 100644
> index 0000000000..f0fcc7d0f8
> --- /dev/null
> +++ b/package/environment-setup/Config.in
> @@ -0,0 +1,6 @@
> +config BR2_PACKAGE_ENVIRONMENT_SETUP
> + bool "Environment setup"
> + help
> + Install an helper script to setup a build environment
> + based on buildroot. It's useful when you export an sdk
> + and want to use buildroot to build an external project
> diff --git a/package/environment-setup/environment-setup.mk b/package/environment-setup/environment-setup.mk
> new file mode 100644
> index 0000000000..840ee2a1a0
> --- /dev/null
> +++ b/package/environment-setup/environment-setup.mk
> @@ -0,0 +1,28 @@
> +################################################################################
> +#
> +# environment-setup
> +#
> +################################################################################
> +
> +ENVIRONMENT_SETUP_FILE = $(HOST_DIR)/environment-setup.sh
Don't install that at the root of the host dir, that's ugly.
> +ENVIRONMENT_SETUP_SED_EXP = --expression='s+$(HOST_DIR)+\$$SDK_PATH+g'
> +
> +define ENVIRONMENT_SETUP_INSTALL_TARGET_CMDS
> + cp package/environment-setup/environment-setup.sh $(ENVIRONMENT_SETUP_FILE)
package/environment-setup/environment-setup.sh is missing in your patch.
Also, I don't think it should spawn a shell. Instead, it should be a
file that has to be sourced:
. /path/to/sdk-dir/usr/share/buildroot/autoconf-env
> + for var in $(TARGET_CONFIGURE_OPTS); do \
No-no: there are variables which values have spaces in them; that's not
going to work very well for those...
> + echo export \"$$var\" | sed $(ENVIRONMENT_SETUP_SED_EXP) >> $(ENVIRONMENT_SETUP_FILE); \
Why don't you just do (export can export multiple variables_:
printf 'export %s\n' '$(TARGET_CONFIGURE_OPTS)' >>$(ENVIRONMENT_SETUP_FILE)
(use printf, not echo).
> + done
> + echo export \"CROSS_COMPILE=$(TARGET_CROSS)\" | sed $(ENVIRONMENT_SETUP_SED_EXP) >> $(ENVIRONMENT_SETUP_FILE)
Is CROSS_COMPILE really a variable used by autotools?
Yeah, kernel... But this file should be only autotools, like the ones
we have for meson and cmake.
> + echo export \"CONFIGURE_FLAGS=--target=$(GNU_TARGET_NAME) \
> + --host=$(GNU_TARGET_NAME) \
> + --build=$(GNU_HOST_NAME) \
> + --prefix=/usr \
> + --exec-prefix=/usr \
> + --sysconfdir=/etc \
> + --localstatedir=/var \
> + --program-prefix=\" >> $(ENVIRONMENT_SETUP_FILE)
> + echo "PS1=\"\[\e[32m\]buildroot-$(BR2_VERSION)\[\e[m\]:\[\e[34m\]\w\[\e[m\]\$$ \"" >> $(ENVIRONMENT_SETUP_FILE)
Do not ever play with the PS1 of users: they all have their prompt very
well crafted over the years! ;-] And this is absolutely not usefull for
the purpose of that script.
Regards,
Yann E. MORIN.
> + echo alias "configure=\"./configure \$${CONFIGURE_FLAGS}\"" >> $(ENVIRONMENT_SETUP_FILE)
> +endef
> +
> +$(eval $(generic-package))
> --
> 2.17.1
>
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH] package/environment-setup: new package
2020-04-18 12:45 ` Yann E. MORIN
@ 2020-04-18 12:54 ` Thomas Petazzoni
2020-04-18 13:26 ` Angelo Compagnucci
1 sibling, 0 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2020-04-18 12:54 UTC (permalink / raw)
To: buildroot
On Sat, 18 Apr 2020 14:45:25 +0200
"Yann E. MORIN" <yann.morin.1998@free.fr> wrote:
> > +For your convenience, by selecting the package BR2_PACKAGE_ENVIRONMENT_SETUP,
> > +you can have a +setup-environment.sh+ script installed in +output/host/+.
> > +This script can be sourced with +. environment-setup.sh+ to launch
> > +the buildroot shell. Inside this shell, you will find an environment already
> > +set up with the correct PATH, the complete list of +target configure+
> > +variables and some useful commands like the +configure+ alias.
>
> I don't think this should warrant a blurb in the manual. Otherwise, you
> would have to add the same for the meson cross-compilation file that we
> provide. And the ones for cmake as well...
I actually think the meson cross-compilation, the cmake toolchain file
and al. should be documented in the manual. I'm not sure where exactly.
In fact we should probably a section "Application development" in
Buildroot, where we cover how to manually build stuff against the
Buildroot toolchain, how to use the SDK, how to use the local site
method or <pkg>_OVERRIDE_SRCDIR, etc.
Besides that aspect, I agree with Yann's review.
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH] package/environment-setup: new package
2020-04-18 12:45 ` Yann E. MORIN
2020-04-18 12:54 ` Thomas Petazzoni
@ 2020-04-18 13:26 ` Angelo Compagnucci
1 sibling, 0 replies; 7+ messages in thread
From: Angelo Compagnucci @ 2020-04-18 13:26 UTC (permalink / raw)
To: buildroot
Il giorno sab 18 apr 2020 alle ore 14:45 Yann E. MORIN <
yann.morin.1998@free.fr> ha scritto:
> Angelo, All,
>
> On 2020-04-18 12:31 +0200, Angelo Compagnucci spake thusly:
> > Install an helper script to setup a build environment
> > based on buildroot. It's useful when you export an sdk
> > and want to use buildroot to build an external project.
> >
> > Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
> > ---
> > docs/manual/using-buildroot-toolchain.txt | 7 +++++
> > package/Config.in | 1 +
> > package/environment-setup/Config.in | 6 ++++
> > .../environment-setup/environment-setup.mk | 28 +++++++++++++++++++
> > 4 files changed, 42 insertions(+)
> > create mode 100644 package/environment-setup/Config.in
> > create mode 100644 package/environment-setup/environment-setup.mk
> >
> > diff --git a/docs/manual/using-buildroot-toolchain.txt
> b/docs/manual/using-buildroot-toolchain.txt
> > index 0c0c35fced..15096cfec8 100644
> > --- a/docs/manual/using-buildroot-toolchain.txt
> > +++ b/docs/manual/using-buildroot-toolchain.txt
> > @@ -27,6 +27,13 @@ Upon extracting the SDK tarball, the user must run
> the script
> > +relocate-sdk.sh+ (located at the top directory of the SDK), to make
> > sure all paths are updated with the new location.
> >
> > +For your convenience, by selecting the package
> BR2_PACKAGE_ENVIRONMENT_SETUP,
> > +you can have a +setup-environment.sh+ script installed in
> +output/host/+.
> > +This script can be sourced with +. environment-setup.sh+ to launch
> > +the buildroot shell. Inside this shell, you will find an environment
> already
> > +set up with the correct PATH, the complete list of +target configure+
> > +variables and some useful commands like the +configure+ alias.
>
> I don't think this should warrant a blurb in the manual. Otherwise, you
> would have to add the same for the meson cross-compilation file that we
> provide. And the ones for cmake as well...
>
> Also. I don't like it being a package. There is no reason for that.
> Instead, install it like we do the similar other cross-compilaiton
> helpers, with the package that actually provides the tools:
>
> - the mexon's cross-compilation file is installed by host-meson
>
> - the cmake's toolchainfile.cmake and Buildroot.cmake files are
> installed by the cmake infra (yeah, that's not so nice...)
>
> So, since this script is geared towards autotools, I guess host-autoconf
> should bear the burden of installing that file.
>
Why do you think it's geared toward autotools? By having path properly
configured, it's pretty universal, for example I can do a qmake well sure
the qmake from buildroot is used, or cmake.
> > diff --git a/package/environment-setup/Config.in
> b/package/environment-setup/Config.in
> > new file mode 100644
> > index 0000000000..f0fcc7d0f8
> > --- /dev/null
> > +++ b/package/environment-setup/Config.in
> > @@ -0,0 +1,6 @@
> > +config BR2_PACKAGE_ENVIRONMENT_SETUP
> > + bool "Environment setup"
> > + help
> > + Install an helper script to setup a build environment
> > + based on buildroot. It's useful when you export an sdk
> > + and want to use buildroot to build an external project
> > diff --git a/package/environment-setup/environment-setup.mk
> b/package/environment-setup/environment-setup.mk
> > new file mode 100644
> > index 0000000000..840ee2a1a0
> > --- /dev/null
> > +++ b/package/environment-setup/environment-setup.mk
> > @@ -0,0 +1,28 @@
> >
> +################################################################################
> > +#
> > +# environment-setup
> > +#
> >
> +################################################################################
> > +
> > +ENVIRONMENT_SETUP_FILE = $(HOST_DIR)/environment-setup.sh
>
> Don't install that at the root of the host dir, that's ugly.
>
Why? This is common for other build systems like Yocto. This script is
intended to mimic that.
> > +ENVIRONMENT_SETUP_SED_EXP = --expression='s+$(HOST_DIR)+\$$SDK_PATH+g'
> > +
> > +define ENVIRONMENT_SETUP_INSTALL_TARGET_CMDS
> > + cp package/environment-setup/environment-setup.sh
> $(ENVIRONMENT_SETUP_FILE)
>
> package/environment-setup/environment-setup.sh is missing in your patch.
>
Ops.
> Also, I don't think it should spawn a shell. Instead, it should be a
> file that has to be sourced:
>
> . /path/to/sdk-dir/usr/share/buildroot/autoconf-env
>
Well, if you intend to remove the .sh extension, no problem
>
> > + for var in $(TARGET_CONFIGURE_OPTS); do \
>
> No-no: there are variables which values have spaces in them; that's not
> going to work very well for those...
>
> > + echo export \"$$var\" | sed $(ENVIRONMENT_SETUP_SED_EXP)
> >> $(ENVIRONMENT_SETUP_FILE); \
>
> Why don't you just do (export can export multiple variables_:
>
> printf 'export %s\n' '$(TARGET_CONFIGURE_OPTS)'
> >>$(ENVIRONMENT_SETUP_FILE)
>
> (use printf, not echo).
>
I will try
> > + done
> > + echo export \"CROSS_COMPILE=$(TARGET_CROSS)\" | sed
> $(ENVIRONMENT_SETUP_SED_EXP) >> $(ENVIRONMENT_SETUP_FILE)
>
> Is CROSS_COMPILE really a variable used by autotools?
>
No, but it is very useful in the contest of compiling other software.
> Yeah, kernel... But this file should be only autotools, like the ones
> we have for meson and cmake.
>
> > + echo export \"CONFIGURE_FLAGS=--target=$(GNU_TARGET_NAME) \
> > + --host=$(GNU_TARGET_NAME) \
> > + --build=$(GNU_HOST_NAME) \
> > + --prefix=/usr \
> > + --exec-prefix=/usr \
> > + --sysconfdir=/etc \
> > + --localstatedir=/var \
> > + --program-prefix=\" >> $(ENVIRONMENT_SETUP_FILE)
> > + echo
> "PS1=\"\[\e[32m\]buildroot-$(BR2_VERSION)\[\e[m\]:\[\e[34m\]\w\[\e[m\]\$$
> \"" >> $(ENVIRONMENT_SETUP_FILE)
>
> Do not ever play with the PS1 of users: they all have their prompt very
> well crafted over the years! ;-] And this is absolutely not usefull for
> the purpose of that script.
>
> Regards,
> Yann E. MORIN.
>
> > + echo alias "configure=\"./configure \$${CONFIGURE_FLAGS}\"" >>
> $(ENVIRONMENT_SETUP_FILE)
> > +endef
> > +
> > +$(eval $(generic-package))
> > --
> > 2.17.1
> >
> > _______________________________________________
> > buildroot mailing list
> > buildroot at busybox.net
> > http://lists.busybox.net/mailman/listinfo/buildroot
>
> --
>
> .-----------------.--------------------.------------------.--------------------.
> | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics'
> conspiracy: |
> | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___
> |
> | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is
> no |
> | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v
> conspiracy. |
>
> '------------------------------^-------^------------------^--------------------'
>
--
Profile: http://it.linkedin.com/in/compagnucciangelo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20200418/dbda1f42/attachment.html>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH] package/environment-setup: new package
@ 2020-10-27 14:01 Matt Weber
2020-10-27 15:56 ` Angelo Compagnucci
2020-11-03 21:45 ` Thomas Petazzoni
0 siblings, 2 replies; 7+ messages in thread
From: Matt Weber @ 2020-10-27 14:01 UTC (permalink / raw)
To: buildroot
From: Angelo Compagnucci <angelo.compagnucci@gmail.com>
Install an helper script to setup a build environment based on buildroot.
It's useful when a developer wants to use a buildroot generated sdk to
build an external project.
Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
Tested-by: Michael Trimarchi <michael@amarulasolutions.com>
Tested-by: Adam Duskett <aduskett@gmail.com>
Signed-off-by: Maury Anderson <maury.anderson@collins.com>
Signed-off-by: Matt Weber <matthew.weber@rockwellcollins.com>
---
Reviving a patch from this series.
http://patchwork.ozlabs.org/project/buildroot/patch/1588085161-28104-1-git-send-email-angelo at amarulasolutions.com/
Changes v6 -> new v1
(Maury)
- Adjusted host tool naming in menuconfig to be prefixed with "host "
---
docs/manual/using-buildroot-toolchain.txt | 8 +++++
package/Config.in.host | 1 +
package/environment-setup/Config.in.host | 6 ++++
package/environment-setup/environment-setup | 16 +++++++++
.../environment-setup/environment-setup.mk | 34 +++++++++++++++++++
5 files changed, 65 insertions(+)
create mode 100644 package/environment-setup/Config.in.host
create mode 100644 package/environment-setup/environment-setup
create mode 100644 package/environment-setup/environment-setup.mk
diff --git a/docs/manual/using-buildroot-toolchain.txt b/docs/manual/using-buildroot-toolchain.txt
index 0c0c35fced..98dae6cdcc 100644
--- a/docs/manual/using-buildroot-toolchain.txt
+++ b/docs/manual/using-buildroot-toolchain.txt
@@ -27,6 +27,14 @@ Upon extracting the SDK tarball, the user must run the script
+relocate-sdk.sh+ (located at the top directory of the SDK), to make
sure all paths are updated with the new location.
+For your convenience, by selecting the host package
+BR2_PACKAGE_HOST_ENVIRONMENT_SETUP, you can have a +setup-environment+ script
+installed in +output/host/+.
+This script can be sourced with +. your/sdk/path/environment-setup+ to launch
+the buildroot shell. Inside this shell, you will find an environment already
+set up with the correct PATH and the complete list of +target configure
+options+.
+
Alternatively, if you just want to prepare the SDK without generating
the tarball (e.g. because you will just be moving the +host+ directory,
or will be generating the tarball on your own), Buildroot also allows
diff --git a/package/Config.in.host b/package/Config.in.host
index 546f1c226d..c69c756f3a 100644
--- a/package/Config.in.host
+++ b/package/Config.in.host
@@ -19,6 +19,7 @@ menu "Host utilities"
source "package/dtc/Config.in.host"
source "package/e2fsprogs/Config.in.host"
source "package/e2tools/Config.in.host"
+ source "package/environment-setup/Config.in.host"
source "package/erofs-utils/Config.in.host"
source "package/eudev/Config.in.host"
source "package/exfatprogs/Config.in.host"
diff --git a/package/environment-setup/Config.in.host b/package/environment-setup/Config.in.host
new file mode 100644
index 0000000000..d3604525a5
--- /dev/null
+++ b/package/environment-setup/Config.in.host
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_HOST_ENVIRONMENT_SETUP
+ bool "host environment setup"
+ help
+ Install an helper script to setup a build environment
+ based on buildroot. It's useful when you export an sdk
+ and want to use buildroot to build an external project
diff --git a/package/environment-setup/environment-setup b/package/environment-setup/environment-setup
new file mode 100644
index 0000000000..b48f1979d6
--- /dev/null
+++ b/package/environment-setup/environment-setup
@@ -0,0 +1,16 @@
+cat <<'EOF'
+ _ _ _ _ _
+| |__ _ _(_) | __| |_ __ ___ ___ | |_
+| '_ \| | | | | |/ _` | '__/ _ \ / _ \| __|
+| |_) | |_| | | | (_| | | | (_) | (_) | |_
+|_.__/ \__,_|_|_|\__,_|_| \___/ \___/ \__| shell
+
+ Making embedded Linux easy!
+
+Some tips:
+* PATH is now pointing to the HOST_DIR path
+* Target configure options are already exported
+* To configure do "./configure $CONFIGURE_FLAGS"
+
+EOF
+SDK_PATH=$(dirname $(realpath "${BASH_SOURCE[0]}"))
diff --git a/package/environment-setup/environment-setup.mk b/package/environment-setup/environment-setup.mk
new file mode 100644
index 0000000000..6d2396f8f1
--- /dev/null
+++ b/package/environment-setup/environment-setup.mk
@@ -0,0 +1,34 @@
+################################################################################
+#
+# environment-setup
+#
+################################################################################
+
+ENVIRONMENT_SETUP_FILE = $(HOST_DIR)/environment-setup
+ENVIRONMENT_SETUP_HOST_DIR_SED_EXP = 's+$(HOST_DIR)+\$$SDK_PATH+g'
+ENVIRONMENT_SETUP_HOST_BIN_DIR_SED_EXP = 's+$(HOST_DIR)/bin/++g'
+
+define HOST_ENVIRONMENT_SETUP_INSTALL_CMDS
+ cp package/environment-setup/environment-setup $(ENVIRONMENT_SETUP_FILE)
+ for var in $(TARGET_CONFIGURE_OPTS); do \
+ printf "export \"$$var\"\n" >> $(ENVIRONMENT_SETUP_FILE); \
+ done
+ printf "export \"CROSS_COMPILE=$(TARGET_CROSS)\"\n" >> $(ENVIRONMENT_SETUP_FILE)
+ printf "export \"CONFIGURE_FLAGS=--target=$(GNU_TARGET_NAME) \
+ --host=$(GNU_TARGET_NAME) \
+ --build=$(GNU_HOST_NAME) \
+ --prefix=/usr \
+ --exec-prefix=/usr \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --program-prefix=\"\n" >> $(ENVIRONMENT_SETUP_FILE)
+ $(SED) $(ENVIRONMENT_SETUP_HOST_BIN_DIR_SED_EXP) \
+ -e $(ENVIRONMENT_SETUP_HOST_DIR_SED_EXP) \
+ -e '/^export "PATH=/c\' \
+ $(ENVIRONMENT_SETUP_FILE)
+ printf "export \"PATH=\$$SDK_PATH/bin:\$$SDK_PATH/sbin:\$$PATH\"\n" \
+ >> $(ENVIRONMENT_SETUP_FILE)
+
+endef
+
+$(eval $(host-generic-package))
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH] package/environment-setup: new package
2020-10-27 14:01 Matt Weber
@ 2020-10-27 15:56 ` Angelo Compagnucci
2020-11-03 21:45 ` Thomas Petazzoni
1 sibling, 0 replies; 7+ messages in thread
From: Angelo Compagnucci @ 2020-10-27 15:56 UTC (permalink / raw)
To: buildroot
Hi Matt!
On Tue, Oct 27, 2020 at 3:01 PM Matt Weber
<matthew.weber@rockwellcollins.com> wrote:
>
> From: Angelo Compagnucci <angelo.compagnucci@gmail.com>
>
> Install an helper script to setup a build environment based on buildroot.
> It's useful when a developer wants to use a buildroot generated sdk to
> build an external project.
>
> Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
> Tested-by: Michael Trimarchi <michael@amarulasolutions.com>
> Tested-by: Adam Duskett <aduskett@gmail.com>
> Signed-off-by: Maury Anderson <maury.anderson@collins.com>
> Signed-off-by: Matt Weber <matthew.weber@rockwellcollins.com>
> ---
>
> Reviving a patch from this series.
> http://patchwork.ozlabs.org/project/buildroot/patch/1588085161-28104-1-git-send-email-angelo at amarulasolutions.com/
Thanks for the fix, but the maintainers are not interested in this
patch series and it will never be merged.
>
> Changes v6 -> new v1
> (Maury)
> - Adjusted host tool naming in menuconfig to be prefixed with "host "
> ---
> docs/manual/using-buildroot-toolchain.txt | 8 +++++
> package/Config.in.host | 1 +
> package/environment-setup/Config.in.host | 6 ++++
> package/environment-setup/environment-setup | 16 +++++++++
> .../environment-setup/environment-setup.mk | 34 +++++++++++++++++++
> 5 files changed, 65 insertions(+)
> create mode 100644 package/environment-setup/Config.in.host
> create mode 100644 package/environment-setup/environment-setup
> create mode 100644 package/environment-setup/environment-setup.mk
>
> diff --git a/docs/manual/using-buildroot-toolchain.txt b/docs/manual/using-buildroot-toolchain.txt
> index 0c0c35fced..98dae6cdcc 100644
> --- a/docs/manual/using-buildroot-toolchain.txt
> +++ b/docs/manual/using-buildroot-toolchain.txt
> @@ -27,6 +27,14 @@ Upon extracting the SDK tarball, the user must run the script
> +relocate-sdk.sh+ (located at the top directory of the SDK), to make
> sure all paths are updated with the new location.
>
> +For your convenience, by selecting the host package
> +BR2_PACKAGE_HOST_ENVIRONMENT_SETUP, you can have a +setup-environment+ script
> +installed in +output/host/+.
> +This script can be sourced with +. your/sdk/path/environment-setup+ to launch
> +the buildroot shell. Inside this shell, you will find an environment already
> +set up with the correct PATH and the complete list of +target configure
> +options+.
> +
> Alternatively, if you just want to prepare the SDK without generating
> the tarball (e.g. because you will just be moving the +host+ directory,
> or will be generating the tarball on your own), Buildroot also allows
> diff --git a/package/Config.in.host b/package/Config.in.host
> index 546f1c226d..c69c756f3a 100644
> --- a/package/Config.in.host
> +++ b/package/Config.in.host
> @@ -19,6 +19,7 @@ menu "Host utilities"
> source "package/dtc/Config.in.host"
> source "package/e2fsprogs/Config.in.host"
> source "package/e2tools/Config.in.host"
> + source "package/environment-setup/Config.in.host"
> source "package/erofs-utils/Config.in.host"
> source "package/eudev/Config.in.host"
> source "package/exfatprogs/Config.in.host"
> diff --git a/package/environment-setup/Config.in.host b/package/environment-setup/Config.in.host
> new file mode 100644
> index 0000000000..d3604525a5
> --- /dev/null
> +++ b/package/environment-setup/Config.in.host
> @@ -0,0 +1,6 @@
> +config BR2_PACKAGE_HOST_ENVIRONMENT_SETUP
> + bool "host environment setup"
> + help
> + Install an helper script to setup a build environment
> + based on buildroot. It's useful when you export an sdk
> + and want to use buildroot to build an external project
> diff --git a/package/environment-setup/environment-setup b/package/environment-setup/environment-setup
> new file mode 100644
> index 0000000000..b48f1979d6
> --- /dev/null
> +++ b/package/environment-setup/environment-setup
> @@ -0,0 +1,16 @@
> +cat <<'EOF'
> + _ _ _ _ _
> +| |__ _ _(_) | __| |_ __ ___ ___ | |_
> +| '_ \| | | | | |/ _` | '__/ _ \ / _ \| __|
> +| |_) | |_| | | | (_| | | | (_) | (_) | |_
> +|_.__/ \__,_|_|_|\__,_|_| \___/ \___/ \__| shell
> +
> + Making embedded Linux easy!
> +
> +Some tips:
> +* PATH is now pointing to the HOST_DIR path
> +* Target configure options are already exported
> +* To configure do "./configure $CONFIGURE_FLAGS"
> +
> +EOF
> +SDK_PATH=$(dirname $(realpath "${BASH_SOURCE[0]}"))
> diff --git a/package/environment-setup/environment-setup.mk b/package/environment-setup/environment-setup.mk
> new file mode 100644
> index 0000000000..6d2396f8f1
> --- /dev/null
> +++ b/package/environment-setup/environment-setup.mk
> @@ -0,0 +1,34 @@
> +################################################################################
> +#
> +# environment-setup
> +#
> +################################################################################
> +
> +ENVIRONMENT_SETUP_FILE = $(HOST_DIR)/environment-setup
> +ENVIRONMENT_SETUP_HOST_DIR_SED_EXP = 's+$(HOST_DIR)+\$$SDK_PATH+g'
> +ENVIRONMENT_SETUP_HOST_BIN_DIR_SED_EXP = 's+$(HOST_DIR)/bin/++g'
> +
> +define HOST_ENVIRONMENT_SETUP_INSTALL_CMDS
> + cp package/environment-setup/environment-setup $(ENVIRONMENT_SETUP_FILE)
> + for var in $(TARGET_CONFIGURE_OPTS); do \
> + printf "export \"$$var\"\n" >> $(ENVIRONMENT_SETUP_FILE); \
> + done
> + printf "export \"CROSS_COMPILE=$(TARGET_CROSS)\"\n" >> $(ENVIRONMENT_SETUP_FILE)
> + printf "export \"CONFIGURE_FLAGS=--target=$(GNU_TARGET_NAME) \
> + --host=$(GNU_TARGET_NAME) \
> + --build=$(GNU_HOST_NAME) \
> + --prefix=/usr \
> + --exec-prefix=/usr \
> + --sysconfdir=/etc \
> + --localstatedir=/var \
> + --program-prefix=\"\n" >> $(ENVIRONMENT_SETUP_FILE)
> + $(SED) $(ENVIRONMENT_SETUP_HOST_BIN_DIR_SED_EXP) \
> + -e $(ENVIRONMENT_SETUP_HOST_DIR_SED_EXP) \
> + -e '/^export "PATH=/c\' \
> + $(ENVIRONMENT_SETUP_FILE)
> + printf "export \"PATH=\$$SDK_PATH/bin:\$$SDK_PATH/sbin:\$$PATH\"\n" \
> + >> $(ENVIRONMENT_SETUP_FILE)
> +
> +endef
> +
> +$(eval $(host-generic-package))
> --
> 2.17.1
>
--
Angelo Compagnucci
Amarula Solutions SRL
Embedded Linux Developer
Via Le Canevare 30 31100 Treviso IT
T. +390422435310
M. +393479922139
[`as] https://www.amarulasolutions.com|
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH] package/environment-setup: new package
2020-10-27 14:01 Matt Weber
2020-10-27 15:56 ` Angelo Compagnucci
@ 2020-11-03 21:45 ` Thomas Petazzoni
1 sibling, 0 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2020-11-03 21:45 UTC (permalink / raw)
To: buildroot
Hello,
On Tue, 27 Oct 2020 09:01:40 -0500
Matt Weber <matthew.weber@rockwellcollins.com> wrote:
> From: Angelo Compagnucci <angelo.compagnucci@gmail.com>
>
> Install an helper script to setup a build environment based on buildroot.
> It's useful when a developer wants to use a buildroot generated sdk to
> build an external project.
>
> Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
> Tested-by: Michael Trimarchi <michael@amarulasolutions.com>
> Tested-by: Adam Duskett <aduskett@gmail.com>
> Signed-off-by: Maury Anderson <maury.anderson@collins.com>
> Signed-off-by: Matt Weber <matthew.weber@rockwellcollins.com>
> ---
I've applied to master, with a number of small changes. The main is
probably getting rid of the "buildroot shell" terminology. There's no
such thing as a "buildroot shell". There's a script that exports a
number of environment variables and aliases in your current shell.
Thanks!
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-11-03 21:45 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-18 10:31 [Buildroot] [PATCH] package/environment-setup: new package Angelo Compagnucci
2020-04-18 12:45 ` Yann E. MORIN
2020-04-18 12:54 ` Thomas Petazzoni
2020-04-18 13:26 ` Angelo Compagnucci
-- strict thread matches above, loose matches on Subject: below --
2020-10-27 14:01 Matt Weber
2020-10-27 15:56 ` Angelo Compagnucci
2020-11-03 21:45 ` Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox