On 24 January 2018 at 19:12, Dylan Baker <dy...@pnwbakers.com> wrote: > Quoting Emil Velikov (2018-01-24 11:00:04) >> On 24 January 2018 at 18:19, Dylan Baker <dy...@pnwbakers.com> wrote: >> > Quoting Emil Velikov (2018-01-24 03:53:35) >> >> On 24 January 2018 at 10:39, Marc Dietrich <marvi...@gmx.de> wrote: >> >> > Hi Dylan, >> >> > >> >> > Am Dienstag, 23. Januar 2018, 19:28:08 CET schrieb Dylan Baker: >> >> >> Fixes: d1992255bb29 ("meson: Add build Intel "anv" vulkan driver") >> >> >> Reported-by: Marc Dietrich <marvi...@gmx.de> >> >> >> Signed-off-by: Dylan Baker <dylan.c.ba...@intel.com> >> >> >> --- >> >> >> src/util/meson.build | 8 ++++++-- >> >> >> 1 file changed, 6 insertions(+), 2 deletions(-) >> >> >> >> >> >> diff --git a/src/util/meson.build b/src/util/meson.build >> >> >> index fa591c92e56..b23dba3a985 100644 >> >> >> --- a/src/util/meson.build >> >> >> +++ b/src/util/meson.build >> >> >> @@ -112,8 +112,12 @@ libxmlconfig = static_library( >> >> >> files_xmlconfig, >> >> >> include_directories : inc_common, >> >> >> dependencies : [dep_expat, dep_m], >> >> >> - c_args : [c_msvc_compat_args, c_vis_args, >> >> >> - '-DSYSCONFDIR="@0@"'.format(get_option('sysconfdir'))], >> >> >> + c_args : [ >> >> >> + c_msvc_compat_args, c_vis_args, >> >> >> + '-DSYSCONFDIR="@0@"'.format( >> >> >> + join_paths(get_option('prefix'), get_option('sysconfdir')) >> >> >> + ), >> >> >> + ], >> >> >> build_by_default : false, >> >> >> ) >> >> > >> >> > this won't work as the prefix is often set to /usr, which results in >> >> > sysconfdir to be /usr/etc. As this is a special case, and "/etc" is the >> >> > default meson sysconfdir, we could just test for "prefix=/usr" and set >> >> > sysconfdir to prefix/sysconfdir if it is not. >> >> > >> >> > This works for me, but dosn't look meson-stylish: >> >> > >> >> > diff --git a/src/util/meson.build b/src/util/meson.build >> >> > index fa591c92e5..6294e188f2 100644 >> >> > --- a/src/util/meson.build >> >> > +++ b/src/util/meson.build >> >> > @@ -83,8 +83,6 @@ files_mesa_util = files( >> >> > 'u_vector.h', >> >> > ) >> >> > >> >> > -install_data('drirc', install_dir : get_option('sysconfdir')) >> >> > - >> >> > files_xmlconfig = files( >> >> > 'xmlconfig.c', >> >> > 'xmlconfig.h', >> >> > @@ -107,13 +105,23 @@ libmesa_util = static_library( >> >> > build_by_default : false >> >> > ) >> >> > >> >> > +if get_option('prefix') != '/usr' >> >> > + sysconfarg = join_paths(get_option('prefix'), >> >> > get_option('sysconfdir')) >> >> > +else >> >> > + sysconfarg = '/' + get_option('sysconfdir') >> >> > +endif >> >> > + >> >> Tweaking sysconfdir based on the value of prefix doesn't sound >> >> right.It's the build system to know and manage those. >> >> By default everything should be installed only in prefix - that's what >> >> cmake, autotools and others do. I think meson should say consistent do >> >> the same. >> >> >> >> The reason being is that you don't want to overwrite existing [system] >> >> files, unless explicitly asked for. In this case by setting >> >> sysconfigdir to /etc. >> >> >> >> Obviously sysconfdir/sysconfigdir is one example here, but the rule >> >> applies throughout. >> >> Emil >> > >> > Emil, >> > >> > Ken and I talked about this, I think the right thing to do is something >> > like: >> > sysdir = get_option('sysconfdir') >> > if not sysdir.startswith('/') >> > sysdir = join_paths(get_option('prefix'), sysdir) >> > endif >> > >> > So that if someone sets --sysconfdir=/etc and --prefix=/usr they get what >> > they >> > want (libs in /usr/lib and drirc in /etc), but if say a BSD sets >> > --syconfdir=etc >> > --prefux=/usr/local they get what they (libs in /usr/local/libs and drirc >> > in >> > /usr/local/etc) >> > >> > Does that seem right to you? >> > >> if it were for my personal use, I'll just hack things around ;-) >> >> It would be nice is meson complies with the existing standard. >> You can tweak the CI to prevent breakage, but for many others - their >> system files will be overwritten. >> >> Feel free to proceed as you wish, I'm just sharing something that >> looks quite buggy. >> -Emil > > Jon pointed out that join_paths('/usr', '/etc') will return '/etc' (since > '/etc') is absolute. Which means > join_paths(get_option('prefix'), get_option('sysconfidir')), will do the right > thing in both cases. > > Just to be clear, the default for meson is --prefix=/usr/local > --sysconfdir=etc, > so no one's files are going to be overwritten by default. > The manpage [1] + 0.44 [2] announcement says a slightly different thing. Or perhaps I'm misreading it?
I do agree with the Meson devs though, that having sysconfig, localstate and sharedstate under prefix is strange. And I did mention why that is the case in the broad sense. Not what happens in particular corner-case. Either way, patch is in and we can revisit if there's some problems. Thanks Emil [1] http://mesonbuild.com/Reference-manual.html#get_option [2] http://mesonbuild.com/Release-notes-for-0-44-0.html#prefixdependent-defaults-for-sysconfdir-localstatedir-and-sharedstatedir _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev