How to determine modular paths?

Andy Ritger aritger at nvidia.com
Fri Nov 17 19:15:53 PST 2006


Thanks, Kevin and Stefan.

If the command-line argument route is preferrable, that's fine with me.
The particular mechanism for querying the modular paths doesn't matter
to me, as long as there is a mechanism that is reliably present.

Aaron Plattner was kind enough to code up two commandline options,
"-showDefaultModulePath" and "-showDefaultLibPath", as functional
equivalents to using pkg-config to query moduledir and libdir,
respectively.  See attached.

Please let me know if there are any objections to that approach.

Thanks,
- Andy


On Thu, 16 Nov 2006, Kevin E Martin wrote:

> On Thu, Nov 16, 2006 at 09:20:28AM -0800, Andy Ritger wrote:
>> What is the proper way for a 3rd party X driver installation tool to
>> know the correct path for installation?
>>
>> In this thread:
>>
>>     http://lists.freedesktop.org/archives/xorg/2005-December/011369.html
>>
>> it was suggested to use `pkg-config --variable=moduledir xorg-server`,
>> which seems reasonable to me.  The NVIDIA installation utility runs
>> these commands:
>>
>>     pkg-config --variable=moduledir xorg-server
>>     pkg-config --variable=libdir xorg-server
>>
>> to find the paths for X driver installation and X library installation
>> (like libXvMC).
>>
>> However, in many modular installations, the pkg-config command does
>> not work because the .pc file is not installed along with the X server,
>> but rather with the devel package which many users do not have installed.
>
> That is correct.  The .pc files are only installed with the devel or sdk
> packages.  They are used at build-time, not install-time.
>
>> Are the above pkg-config commands the correct way for 3rd party
>> installation tools to determine the paths where the related files should
>> be installed?
>
> No, I don't think so.  The better way to do this (as discussed in the
> thread quoted above) is to either:
>
> - add a command-line argument to the Xorg server to display the default
>   paths (and potentially other information that could be queried), or
> - simply add it to the output of the -version (e.g., with the -verbose
>   option).
>
> These should be easy to implement, and I feel are much better solution.
>
> Thanks,
> Kevin
>
-------------- next part --------------
From d39d4501d4bce1da30ac96553f15e98642aeb497 Mon Sep 17 00:00:00 2001
From: Aaron Plattner <aplattner at nvidia.com>
Date: Fri, 17 Nov 2006 16:04:55 -0800
Subject: [PATCH] Add a -showDefaultModulePath option.

As discussed on the mailing list, people would rather have an X command-line
option to print the module path so installers can know where to put modules,
rather than the installers using `pkg-config --variable=moduledir xorg-server`,
since some distros choose not to install xorg-server.pc.
---
 hw/xfree86/common/xf86Init.c    |   13 +++++++++++++
 hw/xfree86/doc/man/Xorg.man.pre |    3 +++
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 33351f2..5106acf 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -100,6 +100,7 @@ #endif
 
 static void xf86PrintBanner(void);
 static void xf86PrintMarkers(void);
+static void xf86PrintDefaultModulePath(void);
 static void xf86RunVtInit(void);
 
 #ifdef __UNIXOS2__
@@ -1376,6 +1377,11 @@ #endif
     xf86PrintBanner();
     exit(0);
   }
+  if (!strcmp(argv[i],"-showDefaultModulePath"))
+  {
+    xf86PrintDefaultModulePath();
+    exit(0);
+  }
   /* Notice the -fp flag, but allow it to pass to the dix layer */
   if (!strcmp(argv[i], "-fp"))
   {
@@ -1625,6 +1631,7 @@ #endif
   ErrorF("-ignoreABI             make module ABI mismatches non-fatal\n");
   ErrorF("-isolateDevice bus_id  restrict device resets to bus_id (PCI only)\n");
   ErrorF("-version               show the server version\n");
+  ErrorF("-showDefaultModulePath show the server default module path\n");
   /* OS-specific usage */
   xf86UseMsg();
   ErrorF("\n");
@@ -1748,6 +1755,12 @@ xf86PrintMarkers()
 }
 
 static void
+xf86PrintDefaultModulePath(void)
+{
+  ErrorF("%s\n", DEFAULT_MODULE_PATH);
+}
+
+static void
 xf86RunVtInit(void)
 {
     int i;
diff --git a/hw/xfree86/doc/man/Xorg.man.pre b/hw/xfree86/doc/man/Xorg.man.pre
index b7fa990..be57bab 100644
--- a/hw/xfree86/doc/man/Xorg.man.pre
+++ b/hw/xfree86/doc/man/Xorg.man.pre
@@ -426,6 +426,9 @@ Print out the server version, patchlevel
 system/platform it was built on, and whether it includes module loader
 support.
 .TP 8
+.B \-showDefualtModulePath
+Print out the default module path the server was compiled with.
+.TP 8
 .BI \-config " file"
 Read the server configuration from
 .IR file .
-- 
1.4.2.4

-------------- next part --------------
From 0c56581479b381ee3dd358fa2da25a3e2e7311fa Mon Sep 17 00:00:00 2001
From: Aaron Plattner <aplattner at nvidia.com>
Date: Fri, 17 Nov 2006 18:33:58 -0800
Subject: [PATCH] Add a -showDefaultLibPath option.

A corollary to the previous change, this option prints $libdir.
---
 configure.ac                    |    1 +
 hw/xfree86/common/xf86Init.c    |   13 +++++++++++++
 hw/xfree86/doc/man/Xorg.man.pre |    3 +++
 include/xorg-config.h.in        |    3 +++
 4 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index 2108db4..590ab2a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1383,6 +1383,7 @@ dnl has it in libc), or if libdl is need
 	AC_DEFINE_DIR(__XCONFIGFILE__, XF86CONFIGFILE, [Name of configuration file])
 	AC_DEFINE_DIR(XF86CONFIGFILE, XF86CONFIGFILE, [Name of configuration file])
 	AC_DEFINE_DIR(DEFAULT_MODULE_PATH, moduledir, [Default module search path])
+	AC_DEFINE_DIR(DEFAULT_LIBRARY_PATH, libdir, [Default library install path])
 	AC_DEFINE_DIR(DEFAULT_LOGPREFIX, LOGPREFIX, [Default log location])
 	AC_DEFINE_UNQUOTED(__VENDORDWEBSUPPORT__, ["$VENDOR_WEB"], [Vendor web address for support])
 
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 5106acf..ff878d5 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -101,6 +101,7 @@ #endif
 static void xf86PrintBanner(void);
 static void xf86PrintMarkers(void);
 static void xf86PrintDefaultModulePath(void);
+static void xf86PrintDefaultLibraryPath(void);
 static void xf86RunVtInit(void);
 
 #ifdef __UNIXOS2__
@@ -1382,6 +1383,11 @@ #endif
     xf86PrintDefaultModulePath();
     exit(0);
   }
+  if (!strcmp(argv[i],"-showDefaultLibPath"))
+  {
+    xf86PrintDefaultLibraryPath();
+    exit(0);
+  }
   /* Notice the -fp flag, but allow it to pass to the dix layer */
   if (!strcmp(argv[i], "-fp"))
   {
@@ -1632,6 +1638,7 @@ #endif
   ErrorF("-isolateDevice bus_id  restrict device resets to bus_id (PCI only)\n");
   ErrorF("-version               show the server version\n");
   ErrorF("-showDefaultModulePath show the server default module path\n");
+  ErrorF("-showDefaultLibPath    show the server default library path\n");
   /* OS-specific usage */
   xf86UseMsg();
   ErrorF("\n");
@@ -1761,6 +1768,12 @@ xf86PrintDefaultModulePath(void)
 }
 
 static void
+xf86PrintDefaultLibraryPath(void)
+{
+  ErrorF("%s\n", DEFAULT_LIBRARY_PATH);
+}
+
+static void
 xf86RunVtInit(void)
 {
     int i;
diff --git a/hw/xfree86/doc/man/Xorg.man.pre b/hw/xfree86/doc/man/Xorg.man.pre
index 5803100..8f497f3 100644
--- a/hw/xfree86/doc/man/Xorg.man.pre
+++ b/hw/xfree86/doc/man/Xorg.man.pre
@@ -429,6 +429,9 @@ support.
 .B \-showDefaultModulePath
 Print out the default module path the server was compiled with.
 .TP 8
+.B \-showDefaultLibraryPath
+Print out the path libraries should be installed to.
+.TP 8
 .BI \-config " file"
 Read the server configuration from
 .IR file .
diff --git a/include/xorg-config.h.in b/include/xorg-config.h.in
index 4a64522..b9643a2 100644
--- a/include/xorg-config.h.in
+++ b/include/xorg-config.h.in
@@ -45,6 +45,9 @@ #undef __XCONFIGFILE__
 /* Path to loadable modules. */
 #undef DEFAULT_MODULE_PATH
 
+/* Path to installed libraries. */
+#undef DEFAULT_LIBRARY_PATH
+
 /* Path to server log file. */
 #undef DEFAULT_LOGPREFIX
 
-- 
1.4.2.4



More information about the xorg mailing list