Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 793050 - meson.eclass: support a native configuration function
Summary: meson.eclass: support a native configuration function
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Mike Gilbert
URL:
Whiteboard:
Keywords:
Depends on: 794181
Blocks:
  Show dependency tree
 
Reported: 2021-05-30 15:20 UTC by David Michael
Modified: 2021-06-04 16:40 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Michael 2021-05-30 15:20:47 UTC
The meson eclass should have an equivalent of econf_build to support projects that build their own tools to execute natively but don't understand cross-compilation.

The meson_src_configure function is huge but only requires a few tweaks to provide this functionality.  Maybe it could be converted to an internal function that takes an argument to select native configuration, so meson_src_configure and meson_build could both just call that?

Here is a prototype edit to demonstrate:
  - Set the new function name
  - Drop the cross file
  - Pick a different build directory
  - Copy --build.pkg-config-path to --pkg-config-path

For correctness, this also requires an EAPI change to support "get_libdir -b" as in bug #762454, but it can use BUILD_PKG_CONFIG_PATH to work around it.

--- eclass/meson.eclass
+++ eclass/meson.eclass
@@ -379,6 +379,13 @@
 	) || die
 }
 
+eval "$(declare -f meson_src_configure | sed '
+s/meson_src_configure/meson_build/g
+s/.*cross_file/: # &/
+s,BUILD_DIR=.*,local BUILD_DIR="${WORKDIR}/${P}-native",
+/build.pkg/{s/[^ ]*-pkg[^ ]* *[^ ]*//;s/\([^ ]*\)build.\(pkg[^ ]* [^ ]*\)/& \1\2/;}
+')"
+
 # @FUNCTION: meson_src_compile
 # @USAGE: [extra ninja arguments]
 # @DESCRIPTION: