meson.build has code to set the module_dir variable to
${libdir}/xorg/modules if the module_dir option string is empty.
However, this has several problems:

1. The variable is only used for an unused @moduledir@ substitution in
   the man page. The rule for xorg-server.pc uses option('module_dir')
   directly instead.
2. The 'module_dir' option has a default value of 'xorg/modules' so the
   above rule doesn't do anything by default.
3. The xorg-server.pc rule uses ${exec_prefix}/option('module_dir'), so
   the effect of #2 is that the default moduledir is different between
   autoconf and meson. E.g. if ${prefix} is /X, then you get

     autoconf: moduledir=/X/lib/xorg/modules
     meson:    moduledir=/X/xorg/modules

Fix this by using the module_dir variable when generating xorg-server.pc, and by
using join_paths() to assign module_dir unconditionally.

v2: Keep the 'xorg/modules' default path, but use join_paths() unconditionally 
(Thierry Reding)

Signed-off-by: Aaron Plattner <aplatt...@nvidia.com>
---
 meson.build       | 9 +++------
 meson_options.txt | 2 +-
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/meson.build b/meson.build
index 6571d08ebd38..59f19d5127fc 100644
--- a/meson.build
+++ b/meson.build
@@ -269,10 +269,7 @@ if log_dir == ''
     log_dir = join_paths(get_option('prefix'), get_option('localstatedir'), 
'log')
 endif
 
-module_dir = get_option('module_dir')
-if module_dir == ''
-    module_dir = join_paths(get_option('libdir'), 'xorg/modules')
-endif
+module_dir = join_paths(get_option('libdir'), get_option('module_dir'))
 
 if glamor_option == 'auto'
     build_glamor = build_xorg or build_xwayland
@@ -534,7 +531,7 @@ manpage_config.set('XKB_DFLT_LAYOUT', 
get_option('xkb_default_layout'))
 manpage_config.set('XKB_DFLT_VARIANT', get_option('xkb_default_variant'))
 manpage_config.set('XKB_DFLT_OPTIONS', get_option('xkb_default_options'))
 manpage_config.set('bundle_id_prefix', '...')
-manpage_config.set('modulepath', join_paths(get_option('prefix'), module_dir))
+manpage_config.set('modulepath', module_dir)
 # wtf doesn't this work
 # manpage_config.set('suid_wrapper_dir', join_paths(get_option('prefix'), 
libexecdir))
 manpage_config.set('suid_wrapper_dir', join_paths(get_option('prefix'), 
'libexec'))
@@ -619,7 +616,7 @@ if build_xorg
     sdkconfig.set('libdir', join_paths('${exec_prefix}', get_option('libdir')))
     sdkconfig.set('includedir', join_paths('${prefix}', 
get_option('includedir')))
     sdkconfig.set('datarootdir', join_paths('${prefix}', 
get_option('datadir')))
-    sdkconfig.set('moduledir', join_paths('${exec_prefix}', 
get_option('module_dir')))
+    sdkconfig.set('moduledir', join_paths('${exec_prefix}', module_dir))
     sdkconfig.set('sdkdir', join_paths('${prefix}', get_option('includedir'), 
'xorg'))
     sdkconfig.set('sysconfigdir', join_paths('${datarootdir}', 
'X11/xorg.conf.d'))
 
diff --git a/meson_options.txt b/meson_options.txt
index a296838a15ea..86fca4668441 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -22,7 +22,7 @@ option('builder_string', type: 'string', description: 
'Additional builder string
 
 option('log_dir', type: 'string')
 option('module_dir', type: 'string', value: 'xorg/modules',
-       description: 'X.Org modules directory')
+       description: 'X.Org modules directory (absolute or relative to the 
directory specified by the libdir option)')
 option('default_font_path', type: 'string')
 
 option('glx', type: 'boolean', value: true)
-- 
2.17.0

_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to