mesonbuild / meson

The Meson Build System
http://mesonbuild.com
Apache License 2.0
5.66k stars 1.64k forks source link

find_program() not very useful if many binary names and paths are possible #4033

Closed csaavedra closed 6 years ago

csaavedra commented 6 years ago

Say you want to find apache with find_program(). Apache binaries in different distros can have many names, httpd, httpd2, apache, apache2. Meson so far can cover this. The problem arises when the apache binary can be installed in different locations, that are not in the PATH, like /usr/sbin, or /sbin.

The documentations states that one can simply prepend the path where the program might be found. But with the example above, we have 4 different binary names and three different possibilities. So that's a lot of clutter, would look something like this.

find_program('httpd', 'httpd2', 'apache', 'apache2', 
    '/sbin/httpd', '/sbin/httpd2', '/sbin/apache', '/sbin/apache2',
    '/usr/sbin/httpd', '/usr/sbin/httpd2', '/usr/sbin/apache', '/usr/sbin/apache2')

Add one more path or possible name and this grows.. Obviously this is just an example.

It would be useful if paths and binary names were two different arrays and meson would go through them without having to do it manually. Something like


find_program(names : ['httpd', httpd2, 'apache', 'apache2'],
             additional_paths : ['/sbin', '/usr/sbin'])
nirbheek commented 6 years ago

Duplicate of https://github.com/mesonbuild/meson/issues/1576

nirbheek commented 6 years ago

Further discussion is on https://github.com/mesonbuild/meson/issues/1576. Looks like a good idea to implement this.