summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* meson.eclass: stop using the incomparably broken "meson compile"Eli Schwartz2024-06-061-14/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With my upstream meson hat on, I have griped about this for years any time someone mentions "meson compile" to me. I think it was badly motivated and shouldn't exist. The purpose of this command is "for symmetry" with meson setup and meson test and meson install, even though all of those are python programs first and foremost, which have ninja targets that simply call back into the meson tool but with less control. Symmetry doesn't make a whole lot of sense. The compile phase actually is implemented as a... ninja file, not a python program. Using ninja directly is: - faster, since you don't load hundreds of python modules into memory, just to fork out to ninja - easier to control, since you can directly control the ninja arguments The "meson compile" program actually, in fact, only really exists for two reasons: - meson supports multiple backends -- only when manually requested -- on operating systems other than linux. Namely, VS on Windows, and xcode on macOS. The wrapper first checks which backend has been generated, and then runs the appropriate command there. It also provides the ninja argument syntax for options that multiple backends understand, so, you can pass -v -j8 and it actually works regardless of backend (even if in fact it has to pass `-verbosity:minimal -maxCpuCount:8` to do it). - via retconning, on Windows when using the MSVC `cl.exe` meson compile started actually adding this to PATH and setting it up (because it requires sourcing a batch script in order to both add to PATH and set inscrutable mandatory environment variables) to prevent ninja utterly failing if you missed this yourself. For portage purposes, neither of these matter whatsoever. Even if portage were to ever use cl.exe on Windows (???) it could set up the environment just fine on its own, and actually using alternative backends would require extending the eclass to configure xcode/vs for tremendous slowdown in compile time, which would be silly. In exchange for all these features portage doesn't need, what do we get? meson compile unabashedly doesn't support all possible ninja arguments, and says you should instead pass the combination of --ninja-args "..." --vs-args "..." --xcode-args "..." and it will figure out which ones are relevant for *your* backend and forward it to the backend. We don't actually do that -- it would be super ugly for the common case of -v -j8. As a result, we ignore $NINJAOPTS, which ninja-utils.eclass claims we are allowed to use. Instead we manually parse out some subset of "supported" values. We *cannot* respect NINJAOPTS anyways, because... ... meson compile sucks and cannot handle it. To be more accurate: it expects --ninja-args to be formatted using `meson-format-array`, the same format that machine files use. No thank you! And we still have to move to get_NINJAOPTS, then pass it as: ``` meson compile -C "${BUILD_DIR}" --ninja-args="['-j', '8', '-k', '0', '-v', '-l', '0']" ``` instead of: ``` meson compile -C "${BUILD_DIR}" -j 8 -v -l 0 --ninja-args="['-k0']" ``` The overengineered complexity of this is immense. ninja-utils.eclass exists for an extremely good reason, provides best practices, and means we don't have to maintain an interface to a custom tool with unintuitive behavior since we get precisely the common functionality we already want, for free. Just use eninja. Fixes: - the absolute inability to use standard $NINJAOPTS to fine-tune meson-using packages, for example to keep going and collect all the build errors before aborting with a failure. - support for ${NINJA_VERBOSE} (expected to be the fallback if MESON_VERBOSE isn't set) Signed-off-by: Eli Schwartz <eschwartz93@gmail.com> Signed-off-by: Mike Gilbert <floppym@gentoo.org>
* meson.eclass: preserve exit status in phase funcsMike Gilbert2024-04-191-4/+16
| | | | | | | | | | When the functions are called with nonfatal, we need to ensure 'popd' does not clobber the exit status of the called command. Update meson_src_configure as well just for consistency. Closes: https://bugs.gentoo.org/930119 Signed-off-by: Mike Gilbert <floppym@gentoo.org>
* meson.eclass: set working directory to BUILD_DIREli Schwartz2024-04-041-3/+12
| | | | | | | | | | | | | | | | | In phases where the build directory has been configured and we are operating on it, it is better to change directories instead of passing -C options. This allows portage to know where we are, and in the case of errors it will then print: * Working directory: '/var/tmp/portage/www-client/elinks-0.16.1.1-r2/work/elinks-0.16.1.1-build' * S: '/var/tmp/portage/www-client/elinks-0.16.1.1-r2/work/elinks-0.16.1.1' instead of simply listing both as the same directory. This is much more convenient to copy/paste for the sake of entering the failed build and examining it. Signed-off-by: Eli Schwartz <eschwartz93@gmail.com> Signed-off-by: Sam James <sam@gentoo.org>
* meson.eclass: call die -n in phase helpersMike Gilbert2024-04-041-4/+4
| | | | | | | | This allows the ebuild author to treat some errors as nonfatal. Signed-off-by: Mike Gilbert <floppym@gentoo.org> Signed-off-by: Eli Schwartz <eschwartz93@gmail.com> Signed-off-by: Sam James <sam@gentoo.org>
* meson.eclass: crank the minimum meson for python 3.12 supportEli Schwartz2024-03-151-1/+1
| | | | | | | | | | | | | | | | | Contains the all-important commit: https://github.com/mesonbuild/meson/commit/3c3caf5163e2efdb2bc6a7089a7f4e0c5d058efb Which was backported from: https://github.com/mesonbuild/meson/commit/2d6c10908b3771216e7ce086af1ee4dc77e698c2 Needed in order to avoid randomly requiring dev-python/setuptools[python_targets_python3_12] when building software with meson that happens to run py.find_installation() (which cannot even be described as a dev-build/meson dependency, since meson can target pythons other than the one meson itself uses!) Signed-off-by: Eli Schwartz <eschwartz93@gmail.com> Signed-off-by: Sam James <sam@gentoo.org>
* meson.eclass: move python_export_utf8_locale to meson_src_configureSam James2024-03-081-3/+3
| | | | | | | | We don't need it in setup_meson_src_configure as distutils-r1 uses it and it'll get called twice then. Signed-off-by: Sam James <sam@gentoo.org> Signed-off-by: Michał Górny <mgorny@gentoo.org>
* meson.eclass: fix setting BUILD_DIR after the lto refactorEli Schwartz2024-03-011-2/+2
| | | | | | | | BUILD_DIR is an eclass variable and should be publicly, globally set. Closes: https://bugs.gentoo.org/925939 Signed-off-by: Eli Schwartz <eschwartz93@gmail.com> Signed-off-by: Sam James <sam@gentoo.org>
* meson.eclass: prefer -D buildtype instead of --buildtypeEli Schwartz2024-03-011-1/+1
| | | | | | | | | Because that is the logic which meson-python hardcodes, and meson needs to match calling convention. Signed-off-by: Eli Schwartz <eschwartz93@gmail.com> Closes: https://github.com/gentoo/gentoo/pull/35528 Signed-off-by: Sam James <sam@gentoo.org>
* meson.eclass: wire up LTO support directly into the meson optionsEli Schwartz2024-03-011-5/+35
| | | | | | | | | meson's builtin LTO support allows meson to introspect whether LTO is enabled and do some fancy things, such as forcing LTO off for a single target that is known to be special(ly bad) and not support LTO. Signed-off-by: Eli Schwartz <eschwartz93@gmail.com> Signed-off-by: Sam James <sam@gentoo.org>
* meson.eclass: refactor src_configure into a setter functionEli Schwartz2024-03-011-23/+32
| | | | | | | | | | | | | | | | This is necessary in order to get at the implementation of `meson setup` from other eclasses, which do not simply call meson_src_configure. The intended use case is distutils-r1, where a python build backend wraps meson and needs its arguments while calling meson on its own. This allows distutils-r1 to invoke `setup_meson_src_configure` followed by gpep517, and get access to: - the preparation which needs to be done, including setting up the environment - the array of setup arguments Signed-off-by: Eli Schwartz <eschwartz93@gmail.com> Signed-off-by: Sam James <sam@gentoo.org>
* Move {dev-util → dev-build}/mesonMichał Górny2024-01-131-1/+1
| | | | | | Signed-off-by: Michał Górny <mgorny@gentoo.org> Closes: https://github.com/gentoo/gentoo/pull/34790 Signed-off-by: Michał Górny <mgorny@gentoo.org>
* Move {dev-util → dev-build}/meson-format-arrayMichał Górny2024-01-131-1/+1
| | | | Signed-off-by: Michał Górny <mgorny@gentoo.org>
* meson.eclass: Pass -Db_lto=false globallyMichał Górny2024-01-071-1/+5
| | | | | | | | | | | | | Pass `-Db_lto=false` globally to force-disable appending `-flto` in projects that default to it. In Gentoo, users enable LTO via setting `*FLAGS` manually. If a package really needs to pass `-Db_lto=true` because the build system enables some custom logic based on it, `tc-is-lto` can be used to determine whether LTO is enabled, and then `-Db_lto=true` can be passed explicitly by the ebuild. Signed-off-by: Michał Górny <mgorny@gentoo.org>
* meson.eclass: update machine files for meson-1.3.0 deprecationSam James2023-11-271-0/+6
| | | | | | | | | | | | | See https://mesonbuild.com/Release-notes-for-1-3-0.html#machine-files-pkgconfig-field-deprecated-and-replaced-by-pkgconfig. 'pkgconfig' is deprecated as a key in machine files in favour of 'pkg-config'. We can define both 'pkgconfig' and 'pkg-config' in our generated machine files until we require >=1.3.0. Per the release notes, if we define both, no deprecation notice is emitted, so do that. Reviewed-by: Eli Schwartz <eschwartz93@gmail.com> Signed-off-by: Sam James <sam@gentoo.org>
* meson.eclass: depend on >=dev-util/meson-1.2.1Mike Gilbert2023-10-301-1/+1
| | | | | Bug: https://bugs.gentoo.org/916536 Signed-off-by: Mike Gilbert <floppym@gentoo.org>
* meson.eclass: use get_makeopts_{jobs,loadavg}Florian Schmaus2023-10-091-2/+2
| | | | | Signed-off-by: Florian Schmaus <flow@gentoo.org> Closes: https://github.com/gentoo/gentoo/pull/32385
* meson.eclass: Add MESON_VERBOSEJonas Rakebrandt2023-07-181-2/+13
| | | | | | | | This works similar to cmake.eclass's ${CMAKE_VERBOSE}. Closes: https://github.com/gentoo/gentoo/pull/28942 Signed-off-by: Jonas Rakebrandt <xarblu@protonmail.com> Signed-off-by: Matt Turner <mattst88@gentoo.org>
* meson.eclass: Change maintainer to base-system@Matt Turner2023-07-181-2/+1
| | | | | | Per floppym's request. Signed-off-by: Matt Turner <mattst88@gentoo.org>
* meson.eclass: drop dead prefix targetsSam James2023-06-101-3/+0
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* meson.eclass: Quote argument of ":" commandUlrich Müller2023-03-261-15/+15
| | | | | | This avoids globbing, see: https://www.shellcheck.net/wiki/SC2223 Signed-off-by: Ulrich Müller <ulm@gentoo.org>
* eclass: standardize prologue/epilogueDavid Seifert2023-03-171-3/+3
| | | | | Closes: https://github.com/gentoo/gentoo/pull/30061 Signed-off-by: David Seifert <soap@gentoo.org>
* meson.eclass: add "--no-rebuild" to meson install argsMike Gilbert2022-07-231-0/+1
| | | | | | | This avoids rebuilding targets with no dependency information. Closes: https://bugs.gentoo.org/857180 Signed-off-by: Mike Gilbert <floppym@gentoo.org>
* meson.eclass: depend on >=dev-util/meson-0.62.2Mike Gilbert2022-07-131-1/+1
| | | | Signed-off-by: Mike Gilbert <floppym@gentoo.org>
* meson.eclass: print error logs for failing testsDaniel Campello2022-07-131-0/+1
| | | | | | Signed-off-by: Daniel Campello <campello@chromium.org> Closes: https://github.com/gentoo/gentoo/pull/24561 Signed-off-by: Mike Gilbert <floppym@gentoo.org>
* meson.eclass: remove EAPI 6David Seifert2022-07-021-10/+3
| | | | Signed-off-by: David Seifert <soap@gentoo.org>
* meson.eclass: Support dev-util/samuraiorbea2022-05-101-1/+3
| | | | | | | | | | | samurai is a ninja-compatible build tool written in C which works with cmake, meson and other users of ninja. It is feature-complete and supports most of the same options as ninja. Signed-off-by: orbea <orbea@riseup.net> Signed-off-by: Mike Gilbert <floppym@gentoo.org>
* meson.eclass: disable werrorSam James2022-04-251-0/+4
| | | | | | | | | It's Gentoo policy to disable Werror where possible and this is a builtin Meson option, so let's use it, to save needing to add this all the time in ebuilds. Closes: https://bugs.gentoo.org/754279 Signed-off-by: Sam James <sam@gentoo.org>
* meson.eclass: disable PCHSam James2022-04-251-1/+7
| | | | | | | | | It's already masked and disabled in GCC and it causes a huge number of problems, but we need to do this to avoid automagically trying to use PCH-even-once-it's-been-disabled-in-the-compiler. Bug: https://bugs.gentoo.org/839549 Signed-off-by: Sam James <sam@gentoo.org>
* *.eclass: @ECLASS-VARIABLE renamed to @ECLASS_VARIABLEUlrich Müller2022-03-241-3/+3
| | | | | Bug: https://bugs.gentoo.org/835396 Signed-off-by: Ulrich Müller <ulm@gentoo.org>
* meson.eclass: depend on >=dev-util/meson-0.59.4Mart Raudsepp2022-03-161-1/+1
| | | | | | | | | | Many GNOME 42 packages will require meson 0.59. Raise the minimum systemwide to reduce local override needs, as we don't have older in tree anymore anyways. Acked-by: William Hubbs <williamh@gentoo.org> Acked-by: Mike Gilbert <floppym@gentoo.org> Signed-off-by: Mart Raudsepp <leio@gentoo.org>
* meson.eclass: add EMESON_BUILDTYPE variableMike Gilbert2021-10-241-1/+9
| | | | | | | | | | | | | This allows the buildtype option to be overridden or omitted. This may be necessary if an ebuild makes use of the 'debug' built-in option control project-specific debug functionality. meson emits a warning if both buildtype and debug are specified, since the former overrides the latter. See discussion in https://github.com/gentoo/gentoo/pull/22574. Signed-off-by: Mike Gilbert <floppym@gentoo.org>
* meson.eclass: depend in >=dev-util/meson-0.58.2-r1Mike Gilbert2021-09-211-1/+1
| | | | | Bug: https://bugs.gentoo.org/810655 Signed-off-by: Mike Gilbert <floppym@gentoo.org>
* meson.eclass: depend on >=dev-util/meson-0.57.0Mike Gilbert2021-08-291-1/+1
| | | | | | | Earlier versions did not support the meson install --destdir option. Closes: https://bugs.gentoo.org/811066 Signed-off-by: Mike Gilbert <floppym@gentoo.org>
* meson.eclass: introduce meson_install helper functionMike Gilbert2021-08-291-5/+12
| | | | | | This will be called from meson.eclass and meson-multilib.eclass. Signed-off-by: Mike Gilbert <floppym@gentoo.org>
* meson.eclass: several cleanupsWilliam Hubbs2021-08-261-17/+24
| | | | | | | | | | | | | | | | | | - Drop the unused emesontestargs variable. - Use the compile and install subcommands of meson instead of calling ninja. This allows for the possibility of a different back end. - Stop using the NINJAOPTS variable. - Add --num-processes to "meson test" call regardless of whether MAKEOPTS is set since the default is 1 process. - Pass --jobs 0 instead of 999 to represent infinity. - Echo commands before running them. Signed-off-by: William Hubbs <williamh@gentoo.org>
* meson.eclass: prefix MESON_DEPEND with an underscoreMike Gilbert2021-06-281-3/+3
| | | | | | Avoids a pkgcheck warning about undocumented variables. Signed-off-by: Mike Gilbert <floppym@gentoo.org>
* meson.eclass: EAPI 8 supportDavid Michael2021-06-281-16/+9
| | | | | Signed-off-by: David Michael <fedora.dm0@gmail.com> Signed-off-by: Mike Gilbert <floppym@gentoo.org>
* meson.eclass: Run einstalldocs from ${S}Matt Turner2021-06-031-0/+3
| | | | | | | | This is how cmake.eclass works, and it will allow easy use by meson-multilib.eclass. Closes: https://github.com/gentoo/gentoo/pull/20986 Signed-off-by: Matt Turner <mattst88@gentoo.org>
* meson.eclass: move compiler flags to [built-in options]Mike Gilbert2021-05-221-3/+7
| | | | | | | Resolves deprecation notices since meson 0.56.0. Closes: https://bugs.gentoo.org/738710 Signed-off-by: Mike Gilbert <floppym@gentoo.org>
* meson.eclass: include riscv bitness in cpu_familyDavid Michael2021-05-051-1/+6
| | | | | | | | | | | | This makes cpu_family identify RISC-V systems as either "riscv64" or "riscv32" to match the given tuple, or it will leave it as "riscv" when the tuple has an unknown cpu field. This fixes the expected values of cpu_family in meson projects: https://mesonbuild.com/Reference-tables.html#cpu-families Signed-off-by: David Michael <fedora.dm0@gmail.com> Signed-off-by: Mike Gilbert <floppym@gentoo.org>
* meson.eclass: define objcopyDavid Michael2021-02-151-0/+2
| | | | | | Closes: https://bugs.gentoo.org/770844 Signed-off-by: David Michael <fedora.dm0@gmail.com> Signed-off-by: Mike Gilbert <floppym@gentoo.org>
* Revert "meson.eclass: fix machine files"Mike Gilbert2021-01-121-16/+6
| | | | | | | needs_exe_wrapper and pkg_config_libdir are not built-in options. Reverts: e3cc29cc79d4e94d0144c3ebc4d8cf00d4ee2e70 Signed-off-by: Mike Gilbert <floppym@gentoo.org>
* meson.eclass: change '--host-route' to '--host-root'Mike Gilbert2021-01-111-1/+1
| | | | Signed-off-by: Mike Gilbert <floppym@gentoo.org>
* meson.eclass: fix machine filesWilliam Hubbs2021-01-111-6/+16
| | | | | | | | | Several options we were setting in the [properties] section of the machine files have been moved to the [built-in options] section in meson 0.56. Closes: https://bugs.gentoo.org/738710 Signed-off-by: William Hubbs <williamh@gentoo.org>
* meson.eclass: use meson-format-arrayMike Gilbert2020-12-281-15/+4
| | | | | Closes: https://bugs.gentoo.org/759433 Signed-off-by: Mike Gilbert <floppym@gentoo.org>
* meson.eclass: depend on >=dev-util/meson-0.54.0Mike Gilbert2020-07-041-15/+2
| | | | | | | Also remove compatibility code for earlier versions. Closes: https://bugs.gentoo.org/730650 Signed-off-by: Mike Gilbert <floppym@gentoo.org>
* meson.eclass: override 'nm' tool with tuple-prefixed oneSergei Trofimovich2020-06-131-0/+2
| | | | | | | | | | | | | | x11-libs/libdrm and media-libs/libglvnd fail to find 'nm' tool on sys-devel/binutils-config[-native-symlinks] system as: `meson.build:40:0: ERROR: Program(s) ['nm'] not found or not executable` It's caused by the code that locates the tool as: `prog_nm = find_program('nm')`. The change adds 'nm' tool along with other binutils tools. Closes: https://bugs.gentoo.org/720886 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* Revert "meson.eclass: define host_machine in the native machine file"Mike Gilbert2020-05-231-6/+0
| | | | | | | This change did not have the desired effect. Reverts: c21b75bd0b6bf77e2b51c51222b4281729bb1c01. Signed-off-by: Mike Gilbert <floppym@gentoo.org>
* meson.eclass: define host_machine in the native machine fileMike Gilbert2020-05-231-0/+6
| | | | | | | Should resolve a problem with inline assembly in media-libs/mesa for multilib builds. Signed-off-by: Mike Gilbert <floppym@gentoo.org>
* meson.eclass: add workaround for broken boost detectionMike Gilbert2020-05-101-0/+4
| | | | | Bug: https://bugs.gentoo.org/721786 Signed-off-by: Mike Gilbert <floppym@gentoo.org>