Commit graph

33 commits

Author SHA1 Message Date
Yann E. MORIN 62df914ced package/meson: fix shebang in deep build trees
The meson script includes the full path to the python interpreter. In
deep build trees, this path can be more than 128 characters long, which
is the limit for how long a shebang may be.

Notice that this has been bumped to 256 since kerel 5.1, but the issue still
persists:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6eb3c3d0a52dca337e327ae8868ca1f44a712e02

In older kernels, this limit was silently ignored, leading to potential
bugs, but newer kernels enforce that limit, and refuse to execve() the
script, returning with NOEXEC.  Since the script is +x, the shell (any
bourne shell, as well as the C shell) will conclude from that situation that
they should interpret it as a shell script, which it obviously is not.

Fix the problem by replacing the shebang with a call to /usr/bin/env
which will redirect to the correct python3 interpreter found in the
PATH.

Note however that this means our meson installation can no longer be
called from outside of the meson-package infrastructure anymore (not
that we ever supported it before, but who knows what people may have
done in their br2-external), unless one does set the PATH to include
$(HOST_DIR)/bin/ earlier than a system-provided python3 would be found.

Fixes: #12331 #12461

Reported-by: Jean-pierre Cartal <jpcartal@free.fr>
Reported-by: Matthias Weißer <m.weisser.m@gmail.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2020-02-03 12:08:48 +01:00
James Hilliard 6e2a0ddb77 package/meson: bump to version 0.53.1
Removed patch that is now upstream.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2020-02-01 22:51:38 +01:00
James Hilliard 9b63f630e2 package/meson: bump to version 0.52.1
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-12-18 23:23:24 +01:00
Thomas De Schampheleire ccc9e05990 package/meson: install cross-compilation.conf during toolchain install
package/meson installs a cross-compilation.conf file in
$(HOST_DIR)/etc/meson, via TARGET_FINALIZE_HOOKS.

package/pkg-cmake.mk installs a toolchainfile.cmake in
$(HOST_DIR)/share/buildroot, via TOOLCHAIN_POST_INSTALL_STAGING_HOOKS.

Both files have a similar concept, they describe some flags/paths needed for
compilation using respective build systems. One difference is that the meson
file is added for external compilation, from the SDK, while the cmake file
is used internally in Buildroot.

The 'problem' of using TARGET_FINALIZE_HOOKS for the meson file, is that it
installs a 'host' file from target-finalize, which is conceptually incorrect
since not just TARGET_DIR but also HOST_DIR is "regenerated" on a subsequent
'make' when everything was already built (i.e. only target-finalize is run).

This can easily be fixed, by using the same hook as cmake uses, i.e.
TOOLCHAIN_POST_INSTALL_STAGING_HOOKS.

Note that actually even for cmake, TOOLCHAIN_POST_INSTALL_STAGING_HOOKS is
not the best hook to install a host file. A better hook would have been
TOOLCHAIN_POST_INSTALL_HOOKS, but this triggers only for 'host' packages,
and 'toolchain' is treated as a 'target' package.

Also, the hook (and therefore also the definition of
PKG_MESON_INSTALL_CROSS_CONF) is moved to pkg-meson.mk, again to make it
more similar to how it's done for cmake. Otherwise check-package
complains that the meson package is setting variables that don't start
with MESON_.

Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2019-10-27 14:34:25 +01:00
Matt Weber f1cb8ca218 package/meson: force ext static libs when BR2_STATIC_LIBS
This patch adds a case in the library pattern logic to prefer static
libraries when the Meson Core option for "default_library" is set to
solely static.

The existing library search order makes sense for cases of shared and
shared / static mixed. However if using a prebuilt cross-toolchain,
they usually provide both a static and shared version of sysroot
libraries. This presents a problem in a complete static build where
there won't be shared libraries at runtime and during build time there
are failures like "ld: attempted static link of dynamic object".

Bug:
https://github.com/mesonbuild/meson/issues/6108

Fixes:
http://autobuild.buildroot.net/results/db1740b4777f436324218c52bc7b08e5c21b667d/
http://autobuild.buildroot.net/results/c17/c17bbb12d9deadd64a441b36e324cfbbe8aba5be/

Cc: Arnout Vandecappelle <arnout@mind.be>
Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-10-26 19:02:00 +02:00
Bernd Kuhls dbfedd709e package/meson: import lzma only when needed
Fixes
http://autobuild.buildroot.net/results/49d/49d89e419edc34ec77129d748ac573f89dfddbae/
and many, many, many more.

Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
[Arnout: extend patch commit message]
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2019-10-19 20:39:16 +02:00
James Hilliard 4c27fee9f7 package/meson: bump to version 0.52.0
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-10-16 21:56:19 +02:00
Bernd Kuhls f6a21f38d5 package/meson: bump version to 0.51.2
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-09-28 23:17:30 +02:00
Adam Duskett 4d87f5a74c package/meson: bump version to 0.51.1
Signed-off-by: Adam Duskett <Aduskett@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-07-14 15:07:32 +02:00
Peter Seiderer 74e574c8a6 infra/pkg-meson: allow packages to pass custom compiler/linker flags
Meson does not allow to pass CFLAGS/LDFLAGS/CXXFLAGS via the environment
or via command-line arguments or options (instead, those flags from the
environment are passed to the host compiler, which is seldom what we
need). The only way to pas those flags is via the cross-compilation.conf
file.

Add LIBFOO_CFLAGS, LIBFOO_LDFLAGS and LIBFOO_CXXFLAGS variables to allow
packages to provide their own flags, possibly overriding the generic
ones entirely, as we allow for other infras. Those per-package flags will
then be used to generate the per-package cross-compilation.conf.

This means that the meson infra is the first and only infra for which
FOO_CFLAGS, FOO_LDFLAGS, and FOO_CXXFLAGS are meaningful, while for the
other infras, they are just variables private to the package itself.
Instead of naming those variables after the meson infra (e.g.
FOO_MESON_CFLAGS), we name them with a generic name, as maybe, just
maybe, we could also change the other infras to also recognise those
variables.

Just like for the HOST_MESON_SED_CFLAGS etc., we need to add auxiliary
variables to do convert the shell-formatted argument list into the
JSON-formatted list that meson expects. We can't use a pure-make
construct because the CFLAGS can contain quoting that needs to be
expanded by the shell. Similarly, we need a condition on the strip'ed
variable to avoid passing empty arguments.

To mimic this feature for packages that are built from the SDK, we also
install a templatised version of cross-compilation.conf, with three new
placeholders for custom flags. If a user wants to build a package that
needs custom flags, they can use that template to generate a per-package
cross-compilation.conf.

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Adam Duskett <aduskett@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Tested-by: Peter Seiderer <ps.report@gmx.net>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2019-07-01 09:51:16 +02:00
Yann E. MORIN e9de6d9e0a package/meson: fix empty arguments in cross-compilation.conf
When TARGET_CFLAGS (or _LDFLAGS or _CXXFLAGS) are empty, but were
constructed by appending other variables, like:

    TARGET_CFLAGS = $(SOMETHING) $(SOMETHING_ELSE)

and both variables are empty, then $(TARGET_CFLAGS) is _not_ the
null-string; it's value is a string made of a single space.

This means that the construct:

    $(if $(TARGET_CFLAGS),true,false)

will in fact return 'true'.

In our case, it means that we will call:

    `printf '"%s", ' `

which expands to just:

    "",

which we are then happy to insert as-is in the generated
cross-compilation.conf.

Then meson, will happily call the compiler with an empty argument.

The compiler is less happy, though:

    arm-none-linux-gnueabi-gcc: error: : No such file or directory

And this is not even trivial to debug either... The only clue being that
there seems to be something missing between ': :'

We fix that testing the $(strip)ed value. We can still pass the
non-$(strip) expansion, because the shell will just do it for us, and we
are then sure there is at least one non-blank word in there.

Thanks a lot to Adam for his invaluable help debugging this!

Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Adam Duskett <aduskett@gmail.com>
Cc: Eric Le Bihan <eric.le.bihan.dev@free.fr>
Cc: Arnout Vandecappelle <arnout@mind.be>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2019-07-01 09:49:42 +02:00
James Hilliard 46106db456 package/meson: bump to version 0.51.0
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-06-17 19:39:25 +02:00
Adam Duskett 70fb5e6107 package/meson: bump to version 0.50.1
Tested against systemd and glib-networking.

Signed-off-by: Adam Duskett <Aduskett@gmail.com>
[Thomas: use the upstream-uploaded tarball and not the github macro,
which allows to have the tarball that really matches upstream's GPG
signature]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-04-24 21:48:26 +02:00
Fabrice Fontaine c37b81af64 Revert "package/meson: bump version to 0.50.0"
This reverts commit 114e9dcd28.
Indeed, there is major issue with this version because c_std is not
passed anymore when cross-compiling:
https://github.com/mesonbuild/meson/issues/5097

As a result, some meson packages (at least systemd, libmpdclient,
glib-networking) fail to build

Fixes:
 - http://autobuild.buildroot.org/results/9eae2181fb3fcfe12481e5496b7d87c0dcd109eb
 - http://autobuild.buildroot.org/results/e828c7925d9247e14d8a8694febfee8ce6c86e81
 - http://autobuild.buildroot.org/results/031aee7cf12ad882727eb2da5e953fd8813b52e2

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2019-03-20 23:06:29 +01:00
Peter Seiderer 114e9dcd28 package/meson: bump version to 0.50.0
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-03-18 22:59:03 +01:00
Peter Seiderer 05bbdb876d package/meson: bump version to 0.49.2
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-02-15 22:48:22 +01:00
Peter Seiderer 5c97f7387b package/meson: fix RPATH patch
The re-added ([1]) patch missed to remove two lines of the original
unconditional code.

[1] https://git.buildroot.net/buildroot/commit/?id=5c939246a802c0ad9704dac1505105037542a1d3

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-02-06 14:18:01 +01:00
Peter Seiderer 5d882b71a8 package/pkg-meson: support per-package directories
Currently, package/meson/meson.mk generates a single global
cross-compilation.conf file, with the path to the compiler, cflags,
ldflags, and various other details. This file is then used when
building all meson-based packages.

This causes two problems:

 - It is not compatible with per-package directories, because with
   per-package folders, we need to use a different compiler, and
   possibly CFLAGS/LDFLAGS for each package.

 - It is not possible to define per package CFLAGS. Indeed, when
   cross-compiling, meson doesn't support passing CFLAGS through the
   environment, only the CFLAGS from cross-compilation.conf are taken
   into account.

For this reason, this commit:

 - Introduces a per-package cross-compilation.conf, which is generated
   by the pkg-meson infrastructure in the "configure" step right
   before calling meson. The file is generated in $(@D)/build/, and
   because it is generated within a given package "configure" step,
   the compiler path is the one of this package.

 - Keeps the global cross-compilation.conf in $(HOST_DIR)/etc/meson/,
   for the SDK use-case of Buildroot. Since we want the final and
   global values of the compiler path, CFLAGS and LDFLAGS, generating
   this global cross-compilation.conf is moved to a
   TARGET_FINALIZE_HOOKS. If we were keeping this as a
   HOST_MESON_POST_INSTALL_HOOKS, it would contain values specific to
   the host-meson package.

For now, we don't yet support per-package CFLAGS/LDFLAGS, but having
such per-package cross-compilation.conf is a necessary preparation to
achieve this goal.

This commit has been tested by building all Buildroot packages that
use meson: json-glib, systemd, enlightenment, at-spi2-core, ncmpc,
libmpdclient and ncmpc.

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
[Thomas:
 - add extended commit log
 - in pkg-meson.mk, re-use variables defined in meson.mk to do the
   replacement of CFLAGS/LDFLAGS/CXXFLAGS
 - move the generation of the global cross-compilation.conf to a
   TARGET_FINALIZE_HOOKS
 - testing with per-package folders]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Tested-by: Peter Seiderer <ps.report@gmx.net>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2019-01-17 22:52:41 +01:00
James Hilliard 9d1c241eac package/meson: bump to version 0.49.0
This version requires host-python3-setuptools, because meson no longer
falls back to distutils for its installation if setuptools cannot be
found: setuptools *must* be available.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-01-01 11:24:14 +01:00
James Hilliard f3bacda0c0 package/meson: fix CPU familly
As explained in [0], meson recognises a certain set of CPU famillies,
whose names slightly differ from those we know them as.

If we don't pass the proper cpu_familly, meson whines:
    WARNING: Unknown CPU family 'i686', please report this at [...]

Subsequently, packages that use that to decide on what they should build
and how they should build it, fail to build. That is the case for the
upcoming systemd-boot, for example.

Fix that by using the list propvided by the meson documentation [0].

[0] https://mesonbuild.com/Reference-tables.html#cpu-families

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
[yann.morin.1998@free.fr:
  - split in its own patch
  - imnprove commit log
]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2018-12-28 11:52:58 +01:00
James Hilliard f112f2b991 package/meson: never try to run generated target binaries
As explained in [0], meson will try on its own to decide whether it can
run what it builds. If it happens that the host and target CPUs are
"compatible", that test may fail and meson may believe it can run what
it builds.

Override that test by using needs_exe_wrapper=true, and not defining an
actual exe_wrapper.

[0] https://mesonbuild.com/Cross-compilation.html

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
[yann.morin.1998@free.fr:
  - split in its own patch
  - improve commit log
]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2018-12-28 11:52:37 +01:00
Jörg Krause 55b5dfc1bf package/meson: bump to version 0.47.2
Note, that there is already a patch [1] to bump the version to 0.48.1.
However, the bump to version 0.48.x has some unresolved issues.

In the meantime, until the issue with 0.48 is resolved, bump to latest
version of the 0.47 branch.

[1] http://patchwork.ozlabs.org/patch/986260/

Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2018-11-09 22:24:37 +01:00
Eric Le Bihan 5c939246a8 meson: re-add patch for skipping RPATH fixing
The patch to skip RPATH fixing performed by Meson was removed in commit
a03f46ca6e, as the script
support/scripts/check-host-rpath was not complaining anymore.

But without it, the problem still occurs for host packages [1].

So, restore this patch to fix build of host packages with Meson.

[1] http://lists.busybox.net/pipermail/buildroot/2018-October/232956.html

Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2018-11-01 21:21:34 +01:00
Mark Corbin bd0640a213 arch: allow GCC target options to be optionally overwritten
The BR2_GCC_TARGET_* configuration variables are copied to
corresponding GCC_TARGET_* variables which may then be optionally
modified or overwritten by architecture specific makefiles.

All makefiles must use the new GCC_TARGET_* variables instead
of the BR2_GCC_TARGET_* versions.

Signed-off-by: Mark Corbin <mark.corbin@embecosm.com>
[Thomas: simplify include of arch/arch.mk]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2018-09-23 22:17:57 +02:00
Peter Seiderer a03f46ca6e meson: bump version to 0.47.1
- delete legacy patch 0001-Only-fix-RPATH-if-install_rpath-is-not-empty.patch
  (no complains from support/scripts/check-host-rpath even without the patch)

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Acked-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
Tested-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2018-08-16 13:51:46 +02:00
Eric Le Bihan 574fba15fc meson: bump version to 0.46.1
Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2018-06-09 16:41:54 +02:00
Eric Le Bihan 7a23af4773 meson: prevent RPATH stripping
By default, Meson strips RPATH from the executable it builds [1,2],
unless explicitly set via install_rpath.

This will make support/scripts/check-host-rpath fail when building the
host variant of a Meson-based package.

So add a patch to prevent RPATH from being stripped if install_rpath is
not set and notify user about it.

[1] https://github.com/mesonbuild/meson/issues/2567
[2] https://github.com/mesonbuild/meson/issues/314#issuecomment-157658562

Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2018-05-30 22:19:20 +02:00
Eric Le Bihan dacf48e9b1 meson: bump version to 0.46.0
Bump version and drop obsolete patch.

Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2018-05-01 22:51:26 +02:00
Fabrice Fontaine 8cbb08d8e5 meson: fix error when restorecon unavailable
host-meson is used by some packages such as libmpdclient.
If selinuxenabled is installed on host but restorecon is unavailable
(for an "unknwown" reason), install will crash.

Fixes:
 - http://autobuild.buildroot.net/results/d5dcdfdfab3503fdc387f99e68267972a38c417d

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2018-03-31 22:52:18 +02:00
Jörg Krause bd7b808557 meson: bump to version 0.45.0
Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2018-03-08 09:01:05 +01:00
Yann E. MORIN 443b9f3075 package/meson: fix malformed cross-compilation.conf.in
Currently, meson will set the c_link_args and the cpp_link_args to the
value of TARGET_LDFLAGS, even when it's not defined.

This creates a malformed array ["",] which will break any package
building using meson/ninja.

We fix that by using an empty replacement when the corresponding values
are empty.

Reported-by: Adam Duskett <Adamduskett@outlook.com>
Signed-off-by: Adam Duskett <Adamduskett@outlook.com>
[yann.morin.1998@free.fr: alternate implementation, suggested by Thomas]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tested-by: Adam Duskett aduskett@gmail.com
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2018-01-01 23:05:07 +01:00
Adam Duskett e416d5d9f4 meson: bump to 0.44.0
Also add a hash for the license file.

Signed-off-by: Adam Duskett <Adamduskett@outlook.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2017-12-29 23:30:52 +01:00
Eric Le Bihan 5cd8afbdfc meson: new package
This new package provides the host variant of the Meson Build System, an
open source build system meant to be both extremely fast, and as user
friendly as possible.

More precisely, Meson creates configuration files for the Ninja build
system.

Besides building Meson, it generates a configuration file
("$(HOST_DIR)/etc/meson/cross-compilation.conf") to be used when
cross-compiling a Meson-based project.

Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
Tested-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2017-12-28 23:09:37 +01:00