-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overriding find_program on the command line #13096
Comments
@eli-schwartz I think I wanted this before for Valgrind, maybe. |
@ryandesign You can do what we do in our zstd packaging: # This replaces the no-find-valgrind patch once bugfix lands in a meson
# release + we can BDEPEND on it (https://github.com/mesonbuild/meson/pull/11372)
cat >> ${native_file} <<-EOF || die
[binaries]
valgrind='valgrind-falseified'
EOF
meson setup ... --native-file "${native_file}" |
A machine file can easily specify the exact command to use. Specifying this on the command line is not currently possible (but has been discussed). |
Ports can append key=value pairs to meson.native.binaries to override the results of find_program. See: https://trac.macports.org/ticket/63356 See: mesonbuild/meson#13096
Thanks. It's less convenient to have to write these options to a separate file than to specify them on the command line directly, but it works—for |
Scratch that… the meson.build file said: python = import('python').find_installation('python3') so I assumed what I would have to add to the machine file was: [binaries]
python3='/opt/local/bin/python3.12' That didn't work. What did work however was: [binaries]
python='/opt/local/bin/python3.12' |
I've now convinced myself by looking through the python module's meson/mesonbuild/modules/python.py Line 493 in 9e3b3db
However searching through the meson codebase for other instances of meson/mesonbuild/modules/python3.py Line 60 in 9e3b3db
So to override a particular build system's python choice, it sounds like I have to read the meson.build file to discover whether it is using the python or python3 module. All of this information on how to override a meson.build file's program choices would be useful to have in the documentation. The "How do I do X in Meson?" document seems to be a mix of information targeted at meson.build authors and users building software that uses a meson.build file. It might be useful to separate it clearly into two sections for those two different audiences. The section aimed at users should not assume any prior knowledge of meson or python—most users just want to build a piece of software, not understand its build system. |
The python3 module is deprecated, so I wouldn't worry about what it's doing. I'm not sure that there's even anyone using it anymore, or has been for some time. |
I think in the past couple of years I have seen maybe two projects that used it, and both were only using it because they started using it before the "python" module replaced it. |
Ports can append key=value pairs to meson.native.binaries to override the results of find_program. See: https://trac.macports.org/ticket/63356 See: mesonbuild/meson#13096
I wish to build someone else's software that uses meson. In their meson.build file they have written:
I do not want meson to search for a program called
m4
. Instead, I want to inform meson which program it should use for this purpose (specifically/opt/local/bin/gm4
). I don't want to patch the meson.build file. If this were an autoconf-generated configure script, it would be a simple matter of specifying an argument likeac_cv_prog_M4=/opt/local/bin/gm4
on the command line when I run./configure
. What's the meson equivalent?I have read How do I do X in Meson? and the documentation for find_program() and meson.override_find_program() and I haven't found anything that seems applicable to this.
The text was updated successfully, but these errors were encountered: