diff options
author | Aaron Plattner <aplattner@nvidia.com> | 2008-02-13 10:20:38 -0800 |
---|---|---|
committer | Aaron Plattner <aplattner@nvidia.com> | 2008-02-13 10:20:38 -0800 |
commit | 914ebf772762511c27b5876267c1c06db824bff1 (patch) | |
tree | bde2f663751bf9b2042b6466f5dc50fbb11e4514 | |
parent | 88b6ac2ff1093c46b5b8ffa05856dc1157402861 (diff) |
1.0-87741.0-8774
-rw-r--r-- | DRIVER_VERSION | 2 | ||||
-rw-r--r-- | command-list.c | 100 | ||||
-rw-r--r-- | files.c | 561 | ||||
-rw-r--r-- | files.h | 1 | ||||
-rw-r--r-- | install-from-cwd.c | 16 | ||||
-rw-r--r-- | kernel.c | 6 | ||||
-rw-r--r-- | log.c | 45 | ||||
-rw-r--r-- | misc.c | 136 | ||||
-rw-r--r-- | misc.h | 3 | ||||
-rw-r--r-- | nvidia-installer.c | 35 | ||||
-rw-r--r-- | nvidia-installer.h | 108 | ||||
-rw-r--r-- | option_table.h | 97 |
12 files changed, 820 insertions, 290 deletions
diff --git a/DRIVER_VERSION b/DRIVER_VERSION index 16d966c..33dcb97 100644 --- a/DRIVER_VERSION +++ b/DRIVER_VERSION @@ -1 +1 @@ -1.0-8762 +1.0-8774 diff --git a/command-list.c b/command-list.c index aef045e..f8412a1 100644 --- a/command-list.c +++ b/command-list.c @@ -99,65 +99,71 @@ CommandList *build_command_list(Options *op, Package *p) l = (FileList *) nvalloc(sizeof(FileList)); c = (CommandList *) nvalloc(sizeof(CommandList)); - /* find any possible conflicting libraries */ + /* find any possibly conflicting libraries and/or modules */ if (!op->kernel_module_only) { - - if (!is_symbolic_link_to(DEFAULT_XFREE86_INSTALLATION_PREFIX, - DEFAULT_OPENGL_INSTALLATION_PREFIX) - && !is_symbolic_link_to(DEFAULT_XFREE86_INSTALLATION_PREFIX, - op->opengl_prefix)) { - find_conflicting_xfree86_libraries - (op, DEFAULT_XFREE86_INSTALLATION_PREFIX, l); - } - - if (strcmp(DEFAULT_XFREE86_INSTALLATION_PREFIX, - op->xfree86_prefix) != 0) { - if (!is_symbolic_link_to(op->xfree86_prefix, - DEFAULT_OPENGL_INSTALLATION_PREFIX) - && !is_symbolic_link_to(op->xfree86_prefix, op->opengl_prefix)) - find_conflicting_xfree86_libraries(op, op->xfree86_prefix, l); - } - /* - * Note that searching op->x_module_path may produce - * duplicates of conflicting files we found above; this is OK - * because condense_file_list() will remove any duplicates. + * Note that searching the various paths may produce duplicate + * entries for conflicting files; this is OK because we will take + * care of these duplicates in condense_file_list(). */ - + + ui_status_begin(op, "Searching for conflicting X files:", "Searching"); + + ui_status_update(op, 0.16f, DEFAULT_X_PREFIX); + find_conflicting_xfree86_libraries(op, DEFAULT_X_PREFIX, l); + ui_status_update(op, 0.32f, XORG7_DEFAULT_X_PREFIX); + find_conflicting_xfree86_libraries(op, XORG7_DEFAULT_X_PREFIX, l); + ui_status_update(op, 0.48f, op->x_prefix); + find_conflicting_xfree86_libraries(op, op->x_prefix, l); + + ui_status_update(op, 0.64f, op->x_module_path); find_conflicting_xfree86_libraries_fullpath(op, op->x_module_path, l); - - find_conflicting_opengl_libraries - (op, DEFAULT_OPENGL_INSTALLATION_PREFIX, l); - - if (strcmp(DEFAULT_OPENGL_INSTALLATION_PREFIX, op->opengl_prefix) != 0) - find_conflicting_opengl_libraries(op, op->opengl_prefix, l); + ui_status_update(op, 0.80f, op->x_library_path); + find_conflicting_xfree86_libraries_fullpath(op, op->x_library_path, l); + + ui_status_end(op, "done."); + + ui_status_begin(op, "Searching for conflicting OpenGL files:", "Searching"); + + ui_status_update(op, 0.20f, DEFAULT_X_PREFIX); + find_conflicting_opengl_libraries(op, DEFAULT_X_PREFIX, l); + ui_status_update(op, 0.40f, op->x_prefix); + find_conflicting_opengl_libraries(op, op->x_prefix, l); + ui_status_update(op, 0.60f, DEFAULT_OPENGL_PREFIX); + find_conflicting_opengl_libraries(op, DEFAULT_OPENGL_PREFIX, l); + ui_status_update(op, 0.80f, op->opengl_prefix); + find_conflicting_opengl_libraries(op, op->opengl_prefix, l); + + ui_status_end(op, "done."); #if defined(NV_X86_64) - if (op->compat32_prefix != NULL) { - char *prefix = nvstrcat(op->compat32_prefix, - DEFAULT_OPENGL_INSTALLATION_PREFIX, NULL); + if (op->compat32_chroot != NULL) { + char *prefix; + + ui_status_begin(op, "Searching for conflicting compat32 files:", "Searching"); + + prefix = nvstrcat(op->compat32_chroot, DEFAULT_X_PREFIX, NULL); + ui_status_update(op, 0.20f, prefix); find_conflicting_opengl_libraries(op, prefix, l); nvfree(prefix); - if (strcmp(DEFAULT_OPENGL_INSTALLATION_PREFIX, - op->opengl_prefix) != 0) { - prefix = nvstrcat(op->compat32_prefix, op->opengl_prefix, NULL); - find_conflicting_opengl_libraries(op, prefix, l); - nvfree(prefix); - } + prefix = nvstrcat(op->compat32_chroot, op->x_prefix, NULL); + ui_status_update(op, 0.40f, prefix); + find_conflicting_opengl_libraries(op, prefix, l); + nvfree(prefix); - prefix = nvstrcat(op->compat32_prefix, - DEFAULT_XFREE86_INSTALLATION_PREFIX, NULL); + prefix = nvstrcat(op->compat32_chroot, DEFAULT_OPENGL_PREFIX, NULL); + ui_status_update(op, 0.60f, prefix); find_conflicting_opengl_libraries(op, prefix, l); nvfree(prefix); - if (strcmp(DEFAULT_XFREE86_INSTALLATION_PREFIX, - op->xfree86_prefix) != 0) { - prefix = nvstrcat(op->compat32_prefix, op->xfree86_prefix, NULL); - find_conflicting_opengl_libraries(op, prefix, l); - nvfree(prefix); - } + prefix = nvstrcat(op->compat32_chroot, op->compat32_prefix, NULL); + ui_status_update(op, 0.80f, prefix); + find_conflicting_opengl_libraries(op, prefix, l); + nvfree(prefix); + + ui_status_end(op, "done."); } #endif /* NV_X86_64 */ } @@ -220,7 +226,8 @@ CommandList *build_command_list(Options *op, Package *p) } if (op->selinux_enabled && - (p->entries[i].flags & FILE_TYPE_SHARED_LIB)) { + ((p->entries[i].flags & FILE_TYPE_SHARED_LIB) || + (p->entries[i].flags & FILE_TYPE_XMODULE_SHARED_LIB))) { tmp = nvstrcat(op->utils[CHCON], " -t shlib_t ", p->entries[i].dst, NULL); add_command(c, RUN_CMD, tmp); @@ -465,6 +472,7 @@ static ConflictingFileInfo __xfree86_libs[] = { { "libglx.", 7 /* strlen("libglx.") */ }, { "libXvMCNVIDIA", 13 /* strlen("libXvMCNVIDIA") */ }, { "libnvidia-cfg.", 14 /* strlen("libnvidia-cfg.") */ }, + { "nvidia_drv.", 11 /* strlen("nvidia_drv.") */ }, { NULL, 0 } }; @@ -48,7 +48,9 @@ #include "precompiled.h" -static int get_x_module_path(Options *op); +static char *get_xdg_data_dir(void); +static int get_x_library_path(Options *op); +static int get_x_module_path(Options *op); /* @@ -482,66 +484,14 @@ void select_tls_class(Options *op, Package *p) int set_destinations(Options *op, Package *p) { - char *prefix, *path, *name, *s; + char *name, *s; + char *prefix, *dir, *path; char *xdg_data_dir; int i; s = NULL; for (i = 0; i < p->num_entries; i++) { -#if defined(NV_X86_64) - if (p->entries[i].flags & FILE_TYPE_HAVE_PATH) { - if ((op->distro == DEBIAN || op->distro == UBUNTU) && - (s = strstr(p->entries[i].path, "lib64"))) { - /* - * XXX Debian GNU/Linux for Linux/x86-64 doesn't follow - * the "lib64" convention used by other distributors. - * The 64-bit libraries are installed in ../lib. Ubuntu - * Linux inherited this layout. - */ - - /* - * The default 64-bit destination path is ../lib64. - * Get the length of the string following "lib64", then - * move this remainder over the "64". - */ - int j, len = strlen(s+5); - for (j = 0; j <= len; j++) s[j+3] = s[j+5]; - - } else if (((op->distro == UBUNTU) || - (op->distro == GENTOO)) && - (p->entries[i].flags & FILE_CLASS_COMPAT32) && - (s = strstr(p->entries[i].path, "lib"))) { - /* - * XXX Ubuntu for Linux/x86-64 doesn't follow the "lib" - * convention used by other distributors; the 32-bit - * libraries are installed in ../lib32, instead. Patch - * up the destination path accordingly. - * - * Sadly, the same thing is also true for Gentoo Linux. - */ - - /* - * The default 32-bit destination path is ../lib. - * If this entry's path ends with "lib", go ahead and - * replace it with ../lib32, else replace the "lib" - * in the path with "lib32". - */ - if (*(s+3) == '\0') { - path = p->entries[i].path; - p->entries[i].path = nvstrcat(path, "32", NULL); - free(path); - } else if ((s+4) != NULL) { - *(s+3) = '\0'; - path = p->entries[i].path; - p->entries[i].path = nvstrcat(path, "32/", s+4, NULL); - free(path); - } else - p->entries[i].dst = NULL; - } - } -#endif /* NV_X86_64 */ - switch (p->entries[i].flags & FILE_TYPE_MASK) { case FILE_TYPE_KERNEL_MODULE_CMD: @@ -554,39 +504,59 @@ int set_destinations(Options *op, Package *p) case FILE_TYPE_OPENGL_LIB: case FILE_TYPE_OPENGL_SYMLINK: - prefix = op->opengl_prefix; - path = p->entries[i].path; + if (p->entries[i].flags & FILE_CLASS_COMPAT32) { + prefix = op->compat32_prefix; + dir = op->compat32_libdir; + } else { + prefix = op->opengl_prefix; + dir = op->opengl_libdir; + } + path = ""; break; case FILE_TYPE_XLIB_SHARED_LIB: case FILE_TYPE_XLIB_STATIC_LIB: case FILE_TYPE_XLIB_SYMLINK: - prefix = op->xfree86_prefix; - path = p->entries[i].path; + prefix = op->x_library_path; + dir = path = ""; break; case FILE_TYPE_XMODULE_SHARED_LIB: case FILE_TYPE_XMODULE_STATIC_LIB: case FILE_TYPE_XMODULE_SYMLINK: prefix = op->x_module_path; + dir = ""; path = p->entries[i].path; break; case FILE_TYPE_TLS_LIB: case FILE_TYPE_TLS_SYMLINK: - prefix = op->opengl_prefix; + if (p->entries[i].flags & FILE_CLASS_COMPAT32) { + prefix = op->compat32_prefix; + dir = op->compat32_libdir; + } else { + prefix = op->opengl_prefix; + dir = op->opengl_libdir; + } path = p->entries[i].path; break; case FILE_TYPE_UTILITY_LIB: case FILE_TYPE_UTILITY_SYMLINK: prefix = op->utility_prefix; - path = p->entries[i].path; + dir = op->utility_libdir; + path = ""; break; case FILE_TYPE_LIBGL_LA: - prefix = op->opengl_prefix; - path = p->entries[i].path; + if (p->entries[i].flags & FILE_CLASS_COMPAT32) { + prefix = op->compat32_prefix; + dir = op->compat32_libdir; + } else { + prefix = op->opengl_prefix; + dir = op->opengl_libdir; + } + path = ""; break; /* @@ -598,40 +568,44 @@ int set_destinations(Options *op, Package *p) case FILE_TYPE_OPENGL_HEADER: prefix = op->opengl_prefix; - path = OPENGL_HEADER_DST_PATH; - break; - - case FILE_TYPE_DOCUMENTATION: - prefix = op->opengl_prefix; + dir = op->opengl_incdir; path = p->entries[i].path; break; case FILE_TYPE_INSTALLER_BINARY: - prefix = op->installer_prefix; - path = INSTALLER_BINARY_DST_PATH; + prefix = op->utility_prefix; + dir = op->utility_bindir; + path = ""; break; + case FILE_TYPE_DOCUMENTATION: + prefix = op->documentation_prefix; + dir = op->documentation_docdir; + path = p->entries[i].path; + break; + + case FILE_TYPE_MANPAGE: + prefix = op->documentation_prefix; + dir = op->documentation_mandir; + path = p->entries[i].path; + break; + case FILE_TYPE_UTILITY_BINARY: prefix = op->utility_prefix; - path = UTILITY_BINARY_DST_PATH; + dir = op->utility_bindir; + path = ""; break; case FILE_TYPE_DOT_DESKTOP: - /* - * If XDG_DATA_DIRS is set, then derive the installation path - * from the first entry; complies with: - * http://www.freedesktop.org/Standards/basedir-spec - */ - xdg_data_dir = getenv("XDG_DATA_DIRS"); - if (xdg_data_dir) xdg_data_dir = nvstrdup(strtok(xdg_data_dir, ":")); - - if (xdg_data_dir != NULL) { + xdg_data_dir = get_xdg_data_dir(); + if (xdg_data_dir) { prefix = xdg_data_dir; - path = nvstrdup("applications"); + dir = nvstrdup("applications"); } else { - prefix = op->opengl_prefix; - path = DOT_DESKTOP_DST_PATH; + prefix = op->utility_prefix; + dir = op->dot_desktopdir; } + path = ""; break; case FILE_TYPE_KERNEL_MODULE: @@ -653,14 +627,20 @@ int set_destinations(Options *op, Package *p) p->entries[i].dst = NULL; continue; } + + if ((prefix == NULL) || (dir == NULL) || (path == NULL)) { + p->entries[i].dst = NULL; + continue; + } name = p->entries[i].name; - p->entries[i].dst = nvstrcat(prefix, "/", path, "/", name, NULL); + p->entries[i].dst = nvstrcat(prefix, "/", dir, "/", path, "/", name, NULL); + collapse_multiple_slashes(p->entries[i].dst); #if defined(NV_X86_64) if ((p->entries[i].flags & FILE_CLASS_COMPAT32) && - (op->compat32_prefix != NULL)) { + (op->compat32_chroot != NULL)) { /* * prepend an additional prefix; this is currently only @@ -669,7 +649,7 @@ int set_destinations(Options *op, Package *p) */ char *dst = p->entries[i].dst; - p->entries[i].dst = nvstrcat(op->compat32_prefix, dst, NULL); + p->entries[i].dst = nvstrcat(op->compat32_chroot, dst, NULL); nvfree(dst); } @@ -755,29 +735,43 @@ int get_prefixes (Options *op) char *ret; if (op->expert) { - ret = ui_get_input(op, op->xfree86_prefix, + ret = ui_get_input(op, op->x_prefix, "X installation prefix (only under " "rare circumstances should this be changed " "from the default)"); if (ret && ret[0]) { - op->xfree86_prefix = ret; - if (!confirm_path(op, op->xfree86_prefix)) return FALSE; + op->x_prefix = ret; + if (!confirm_path(op, op->x_prefix)) return FALSE; } } - remove_trailing_slashes(op->xfree86_prefix); - ui_expert(op, "X installation prefix is: '%s'", op->xfree86_prefix); + remove_trailing_slashes(op->x_prefix); + ui_expert(op, "X installation prefix is: '%s'", op->x_prefix); /* - * assign the X module path; this must be done after - * op->xfree86_prefix is assigned + * assign the X module and library paths; this must be done + * after the default prefixes/paths are assigned. */ - if (!get_x_module_path(op)) { + if (!get_x_library_path(op) || !get_x_module_path(op)) { return FALSE; } if (op->expert) { + ret = ui_get_input(op, op->x_library_path, + "X library installation path (only under " + "rare circumstances should this be changed " + "from the default)"); + if (ret && ret[0]) { + op->x_library_path = ret; + if (!confirm_path(op, op->x_library_path)) return FALSE; + } + } + + remove_trailing_slashes(op->x_library_path); + ui_expert(op, "X library installation path is: '%s'", op->x_library_path); + + if (op->expert) { ret = ui_get_input(op, op->x_module_path, "X module installation path (only under " "rare circumstances should this be changed " @@ -805,10 +799,57 @@ int get_prefixes (Options *op) remove_trailing_slashes(op->opengl_prefix); ui_expert(op, "OpenGL installation prefix is: '%s'", op->opengl_prefix); + + if (op->expert) { + ret = ui_get_input(op, op->documentation_prefix, + "Documentation installation prefix (only under " + "rare circumstances should this be changed " + "from the default)"); + if (ret && ret[0]) { + op->documentation_prefix = ret; + if (!confirm_path(op, op->documentation_prefix)) return FALSE; + } + } + + remove_trailing_slashes(op->documentation_prefix); + ui_expert(op, "Documentation installation prefix is: '%s'", op->documentation_prefix); + + + if (op->expert) { + ret = ui_get_input(op, op->utility_prefix, + "Utility installation prefix (only under " + "rare circumstances should this be changed " + "from the default)"); + if (ret && ret[0]) { + op->utility_prefix = ret; + if (!confirm_path(op, op->utility_prefix)) return FALSE; + } + } + + remove_trailing_slashes(op->utility_prefix); + ui_expert(op, "Utility installation prefix is: '%s'", op->utility_prefix); + #if defined(NV_X86_64) if (op->expert) { + ret = ui_get_input(op, op->compat32_chroot, + "Compat32 installation chroot (only under " + "rare circumstances should this be " + "changed from the default)"); + if (ret && ret[0]) { + op->compat32_chroot = ret; + if (!confirm_path(op, op->compat32_chroot)) return FALSE; + } + } + + remove_trailing_slashes(op->compat32_chroot); + ui_expert(op, "Compat32 installation chroot is: '%s'", + op->compat32_chroot); + + if (op->expert) { ret = ui_get_input(op, op->compat32_prefix, - "Compat32 installation prefix"); + "Compat32 installation prefix (only under " + "rare circumstances should this be " + "changed from the default)"); if (ret && ret[0]) { op->compat32_prefix = ret; if (!confirm_path(op, op->compat32_prefix)) return FALSE; @@ -820,19 +861,6 @@ int get_prefixes (Options *op) op->compat32_prefix); #endif /* NV_X86_64 */ - if (op->expert) { - ret = ui_get_input(op, op->installer_prefix, - "Installer installation prefix"); - if (ret && ret[0]) { - op->installer_prefix = ret; - if (!confirm_path(op, op->installer_prefix)) return FALSE; - } - } - - remove_trailing_slashes(op->installer_prefix); - ui_expert(op, "Installer installation prefix is: '%s'", - op->installer_prefix); - return TRUE; } /* get_prefixes() */ @@ -1707,8 +1735,13 @@ void process_libGL_la_files(Options *op, Package *p) for (i = 0; i < package_num_entries; i++) { if ((p->entries[i].flags & FILE_TYPE_LIBGL_LA)) { - replacements[0] = nvstrcat(op->opengl_prefix, - "/", p->entries[i].path, NULL); + if (p->entries[i].flags & FILE_CLASS_COMPAT32) { + replacements[0] = nvstrcat(op->compat32_prefix, + "/", op->compat32_libdir, NULL); + } else { + replacements[0] = nvstrcat(op->opengl_prefix, + "/", op->opengl_libdir, NULL); + } /* invalidate the template file */ @@ -1751,7 +1784,7 @@ void process_libGL_la_files(Options *op, Package *p) /* * process_dot_desktop_files() - for any .desktop files in the * package, copy them to a temporary file, replacing __UTILS_PATH__ - * and __LIBGL_PATH__ as appropriate. Then, add the new file to + * and __PIXMAP_PATH__ as appropriate. Then, add the new file to * the package list. */ @@ -1760,24 +1793,35 @@ void process_dot_desktop_files(Options *op, Package *p) int i, n; char *tmpfile; - char *tokens[3] = { "__UTILS_PATH__", "__DOCS_PATH__", NULL }; + char *tokens[3] = { "__UTILS_PATH__", "__PIXMAP_PATH__", NULL }; char *replacements[3] = { NULL, NULL, NULL }; int package_num_entries = p->num_entries; + replacements[0] = nvstrcat(op->utility_prefix, + "/", op->utility_bindir, NULL); + + remove_trailing_slashes(replacements[0]); + collapse_multiple_slashes(replacements[0]); + for (i = 0; i < package_num_entries; i++) { if ((p->entries[i].flags & FILE_TYPE_DOT_DESKTOP)) { - replacements[0] = nvstrcat(op->utility_prefix, - "/", UTILITY_BINARY_DST_PATH, NULL); - replacements[1] = nvstrcat(op->opengl_prefix, - "/", DOCUMENTATION_DST_PATH, NULL); - /* invalidate the template file */ p->entries[i].flags &= ~FILE_TYPE_MASK; p->entries[i].dst = NULL; + nvfree(replacements[1]); + + replacements[1] = nvstrcat(op->documentation_prefix, + "/", op->documentation_docdir, + "/", p->entries[i].path, + NULL); + + remove_trailing_slashes(replacements[1]); + collapse_multiple_slashes(replacements[1]); + tmpfile = process_template_file(op, &p->entries[i], tokens, replacements); if (tmpfile != NULL) { @@ -1799,11 +1843,12 @@ void process_dot_desktop_files(Options *op, Package *p) p->num_entries++; } - - nvfree(replacements[0]); - nvfree(replacements[1]); } } + + nvfree(replacements[0]); + nvfree(replacements[1]); + } /* process_dot_desktop_files() */ @@ -1832,16 +1877,197 @@ int set_security_context(Options *op, const char *filename) } /* set_security_context() */ +/* + * get_default_prefixes_and_paths() - assign the default prefixes and + * paths depending on the architecture, distribution and the Xorg + * version installed on the system. + */ + +void get_default_prefixes_and_paths(Options *op) +{ + char *default_libdir; + +#if defined(NV_X86_64) + if ((op->distro == DEBIAN) || + (op->distro == UBUNTU)) { + default_libdir = DEBIAN_DEFAULT_64BIT_LIBDIR; + } else { + default_libdir = DEFAULT_64BIT_LIBDIR; + } +#else + default_libdir = DEFAULT_LIBDIR; +#endif + + if (!op->opengl_prefix) + op->opengl_prefix = DEFAULT_OPENGL_PREFIX; + if (!op->opengl_libdir) + op->opengl_libdir = default_libdir; + if (!op->opengl_incdir) + op->opengl_incdir = DEFAULT_INCDIR; + + if (!op->x_prefix) { + if (op->modular_xorg) { + op->x_prefix = XORG7_DEFAULT_X_PREFIX; + } else { + op->x_prefix = DEFAULT_X_PREFIX; + } + } + if (!op->x_libdir) + op->x_libdir = default_libdir; + if (!op->x_moddir) { + if (op->modular_xorg) { + op->x_moddir = XORG7_DEFAULT_X_MODULEDIR ; + } else { + op->x_moddir = DEFAULT_X_MODULEDIR; + } + } + +#if defined(NV_X86_64) + if (op->distro == DEBIAN && !op->compat32_chroot) + op->compat32_chroot = DEBIAN_DEFAULT_COMPAT32_CHROOT; + + if (!op->compat32_prefix) + op->compat32_prefix = DEFAULT_OPENGL_PREFIX; + + if (!op->compat32_libdir) { + if ((op->distro == UBUNTU) || + (op->distro == GENTOO)) { + op->compat32_libdir = UBUNTU_DEFAULT_COMPAT32_LIBDIR; + } else { + op->compat32_libdir = DEFAULT_LIBDIR; + } + } +#endif + + if (!op->utility_prefix) + op->utility_prefix = DEFAULT_UTILITY_PREFIX; + if (!op->utility_libdir) + op->utility_libdir = default_libdir; + if (!op->utility_bindir) + op->utility_bindir = DEFAULT_BINDIR; + + if (!op->dot_desktopdir) + op->dot_desktopdir = DEFAULT_DOT_DESKTOPDIR; + + if (!op->documentation_prefix) + op->documentation_prefix = DEFAULT_DOCUMENTATION_PREFIX; + if (!op->documentation_docdir) + op->documentation_docdir = DEFAULT_DOCDIR; + if (!op->documentation_mandir) + op->documentation_mandir = DEFAULT_MANDIR; + +} /* get_default_prefixes_and_paths() */ + + +/* + * get_xdg_data_dir() - determine if the XDG_DATA_DIRS environment + * variable is set; if set and not empty, return the first path + * in the list, else return NULL. + */ + +static char *get_xdg_data_dir(void) +{ + /* + * If XDG_DATA_DIRS is set, then derive the installation path + * from the first entry; complies with: + * http://www.freedesktop.org/Standards/basedir-spec + */ + char *xdg_data_dir = getenv("XDG_DATA_DIRS"); + if ((xdg_data_dir != NULL) && strlen(xdg_data_dir)) + return nvstrdup(strtok(xdg_data_dir, ":")); + return NULL; +} + /* - * get_x_module_path() - assign op->x_module_path if it is not already - * set + * get_x_library_path() - assign op->x_library_path if it is not + * already set. + */ + +static int get_x_library_path(Options *op) +{ + char *cmd, *dir = NULL; + int ret; + + /* + * if the path was already specified (i.e.: by a command + * line option), then we are done. + */ + + if (op->x_library_path != NULL) + return TRUE; + + if (!op->utils[PKG_CONFIG]) { + if (op->modular_xorg) { + ui_warn(op, "You appear to be using a modular Xorg " + "release, but nvidia-installer could not find the " + "`pkg-config` utility required to determine the " + "correct X library installation path. Please " + "install the `pkg-config` utility and the Xorg " + "SDK/development package for your distribution."); + } + } else { + /* ask pkg-config */ + + cmd = nvstrcat(op->utils[PKG_CONFIG], + " --variable=libdir xorg-server", NULL); + + ret = run_command(op, cmd, &dir, FALSE, 0, TRUE); + nvfree(cmd); + + if ((ret != 0) || (dir == NULL)) { + if (op->modular_xorg) { + ui_warn(op, "You appear to be using a modular Xorg " + "release, but nvidia-installer was unable to " + "determine the correct X library " + "installation path with the `pkg-config` " + "utility. Please install the Xorg SDK/" + "development package for your distribution."); + } + } else { + if (!directory_exists(op, dir) && + op->modular_xorg) { + ui_warn(op, "You appear to be using a modular Xorg " + "release, but the X library installation " + "path reported by `pkg-config " + "--variable=libdir xorg-server` does " + "not exist. Please check your Xorg installation."); + } else { + op->x_library_path = dir; + return TRUE; + } + } + + nvfree(dir); + } + + /* build the X library path */ + + op->x_library_path = nvstrcat(op->x_prefix, "/", op->x_libdir, NULL); + + remove_trailing_slashes(op->x_library_path); + collapse_multiple_slashes(op->x_library_path); + + if (op->modular_xorg) { + ui_warn(op, "nvidia-installer was unable to determine the " + "correct X library installation path and will " + "install the NVIDIA X libraries to '%s'.", + op->x_library_path); + } + + return TRUE; + +} /* get_x_library_path() */ + + +/* + * get_x_module_path() - assign op->x_module_path if it is not + * already set. */ static int get_x_module_path(Options *op) { - char *dir = NULL; - char *lib; + char *cmd, *dir = NULL; int ret; /* @@ -1853,40 +2079,69 @@ static int get_x_module_path(Options *op) return TRUE; } - /* ask pkg-config */ + if (!op->utils[PKG_CONFIG]) { + if (op->modular_xorg) { + ui_warn(op, "You appear to be using a modular Xorg " + "release, but nvidia-installer could not find the " + "`pkg-config` utility required to determine the " + "correct X module installation path. Please " + "install the `pkg-config` utility and the Xorg " + "SDK/development package for your distribution."); + } + } else { + /* ask pkg-config */ - ret = run_command(op, "pkg-config --variable=moduledir xorg-server", - &dir, FALSE, 0, TRUE); - - if ((ret == 0) && directory_exists(op, dir)) { - op->x_module_path = dir; - return TRUE; + cmd = nvstrcat(op->utils[PKG_CONFIG], + " --variable=moduledir xorg-server", + NULL); + + ret = run_command(op, cmd, &dir, FALSE, 0, TRUE); + nvfree(cmd); + + if ((ret != 0) || (dir == NULL)) { + if (op->modular_xorg) { + ui_warn(op, "You appear to be using a modular Xorg " + "release, but nvidia-installer was unable to " + "determine the correct X module " + "installation path with the `pkg-config` " + "utility. Please install the Xorg SDK/" + "development package for your distribution."); + } + } else { + if (!directory_exists(op, dir) && + op->modular_xorg) { + ui_warn(op, "You appear to be using a modular Xorg " + "release, but the X module installation " + "path reported by `pkg-config " + "--variable=moduledir xorg-server` does " + "not exist. Please check your Xorg installation."); + } else { + op->x_module_path = dir; + return TRUE; + } + } + + nvfree(dir); } - - nvfree(dir); - - /* build the X module path from the xfree86_prefix */ - - /* - * XXX kludge to determine the correct 'lib' vs 'lib64' path; - * normally, on 64-bit distributions, the X modules get installed - * in "<xprefix>/lib64/modules". However, on Debian, Ubuntu, or - * any 32-bit distribution, we use "<xprefix>/lib/modules" - */ -#if defined(NV_X86_64) - if ((op->distro == DEBIAN || op->distro == UBUNTU)) { - lib = "lib"; - } else { - lib = "lib64"; + /* build the X module path */ + + op->x_module_path = + nvstrcat(op->x_library_path, "/", op->x_moddir, NULL); + + remove_trailing_slashes(op->x_module_path); + collapse_multiple_slashes(op->x_module_path); + + if (op->modular_xorg) { + ui_warn(op, "nvidia-installer was unable to determine the " + "correct X module installation path and will " + "install the NVIDIA X driver components to '%s'. " + "If X fails to find the NVIDIA X driver module, " + "please correct any `pkg-config` problems warned " + "about earlier and reinstall the driver.", + op->x_module_path); } -#else - lib = "lib"; -#endif - op->x_module_path = nvstrcat(op->xfree86_prefix, - "/", lib, "/modules", NULL); - return TRUE; } /* get_x_module_path() */ @@ -62,5 +62,6 @@ char *process_template_file(Options *op, PackageEntry *pe, void process_libGL_la_files(Options *op, Package *p); void process_dot_desktop_files(Options *op, Package *p); int set_security_context(Options *op, const char *filename); +void get_default_prefixes_and_paths(Options *op); #endif /* __NVIDIA_INSTALLER_FILES_H__ */ diff --git a/install-from-cwd.c b/install-from-cwd.c index 995637d..fc62058 100644 --- a/install-from-cwd.c +++ b/install-from-cwd.c @@ -344,6 +344,13 @@ static int install_kernel_module(Options *op, Package *p) } else { /* + * make sure the required development tools are present on + * this system before attempting to verify the compiler and + * trying to build a custom kernel interface. + */ + if (!check_development_tools(op, p)) return FALSE; + + /* * make sure that the selected or default system compiler * is compatible with the target kernel; the user may choose * to override the check. @@ -351,13 +358,6 @@ static int install_kernel_module(Options *op, Package *p) if (!check_cc_version(op, p)) return FALSE; /* - * make sure the required development tools are present on - * this system before attempting to verify the compiler and - * trying to build a custom kernel interface. - */ - if (!check_development_tools(op)) return FALSE; - - /* * we do not have a prebuilt kernel interface; thus we'll need * to compile the kernel interface, so determine where the * kernel source files are. @@ -635,6 +635,8 @@ static Package *parse_manifest (Options *op) p->entries[n].flags |= FILE_TYPE_UTILITY_LIB; else if (strcmp(flag, "DOCUMENTATION") == 0) p->entries[n].flags |= FILE_TYPE_DOCUMENTATION; + else if (strcmp(flag, "MANPAGE") == 0) + p->entries[n].flags |= FILE_TYPE_MANPAGE; else if (strcmp(flag, "OPENGL_SYMLINK") == 0) p->entries[n].flags |= FILE_TYPE_OPENGL_SYMLINK; else if (strcmp(flag, "XLIB_SYMLINK") == 0) @@ -1503,12 +1503,12 @@ int check_cc_version(Options *op, Package *p) CC = getenv("CC"); if (!CC) CC = "cc"; - ui_log(op, "Performing CC test with CC=\"%s\".", CC); + ui_log(op, "Performing CC version check with CC=\"%s\".", CC); cmd = nvstrcat("sh ", p->kernel_module_build_directory, "/conftest.sh ", CC, " ", CC, " ", "DUMMY_SOURCE DUMMY_OUTPUT ", - "cc_sanity_check just_msg", NULL); + "cc_version_check just_msg", NULL); ret = run_command(op, cmd, &result, FALSE, 0, TRUE); @@ -1516,7 +1516,7 @@ int check_cc_version(Options *op, Package *p) if (ret == 0) return TRUE; - ret = ui_yes_no(op, TRUE, "gcc-version-check failed:\n\n%s\n\n" + ret = ui_yes_no(op, TRUE, "The CC version check failed:\n\n%s\n\n" "If you know what you are doing and want to " "ignore the gcc version check, select \"No\" to " "continue installation. Otherwise, select \"Yes\" to " @@ -58,6 +58,17 @@ static FILE *log_file_stream; __tls_str; \ }) +#define SELINUXSTR(x) ({ \ + const char *__selinux_str = NULL; \ + switch (x) { \ + case SELINUX_FORCE_YES: __selinux_str = "yes"; break; \ + case SELINUX_FORCE_NO: __selinux_str = "no"; break; \ + case SELINUX_DEFAULT: __selinux_str = "default"; break; \ + default: __selinux_str = "(not specified)"; \ + } \ + __selinux_str; \ +}) + /* * log_init() - if logging is enabled, initialize the log file; if * initializing the log file fails, print an error to stderr and @@ -102,11 +113,11 @@ void log_init(Options *op) BOOLSTR(op->uninstall)); log_printf(op, TRUE, NULL, " driver info : %s", BOOLSTR(op->driver_info)); - log_printf(op, TRUE, NULL, " no precompiled interface: %s", - BOOLSTR(op->no_precompiled_interface)); + log_printf(op, TRUE, NULL, " precompiled interfaces : %s", + BOOLSTR(!op->no_precompiled_interface)); log_printf(op, TRUE, NULL, " no ncurses color : %s", BOOLSTR(op->no_ncurses_color)); - log_printf(op, TRUE, NULL, " query latest driver ver : %s", + log_printf(op, TRUE, NULL, " query latest version : %s", BOOLSTR(op->latest)); log_printf(op, TRUE, NULL, " OpenGL header files : %s", BOOLSTR(op->opengl_headers)); @@ -114,6 +125,8 @@ void log_init(Options *op) BOOLSTR(op->no_questions)); log_printf(op, TRUE, NULL, " silent : %s", BOOLSTR(op->silent)); + log_printf(op, TRUE, NULL, " no recursion : %s", + BOOLSTR(op->no_recursion)); log_printf(op, TRUE, NULL, " no backup : %s", BOOLSTR(op->no_backup)); log_printf(op, TRUE, NULL, " kernel module only : %s", @@ -130,20 +143,40 @@ void log_init(Options *op) BOOLSTR(op->no_abi_note)); log_printf(op, TRUE, NULL, " no RPMs : %s", BOOLSTR(op->no_rpms)); + log_printf(op, TRUE, NULL, " no kernel module : %s", + BOOLSTR(op->no_kernel_module)); + log_printf(op, TRUE, NULL, " force SELinux : %s", + SELINUXSTR(op->selinux_option)); log_printf(op, TRUE, NULL, " force tls : %s", TLSSTR(op->which_tls)); +#if defined(NV_X86_64) log_printf(op, TRUE, NULL, " force compat32 tls : %s", TLSSTR(op->which_tls_compat32)); +#endif log_printf(op, TRUE, NULL, " X install prefix : %s", - STRSTR(op->xfree86_prefix)); + STRSTR(op->x_prefix)); + log_printf(op, TRUE, NULL, " X library install path : %s", + STRSTR(op->x_library_path)); + log_printf(op, TRUE, NULL, " X module install path : %s", + STRSTR(op->x_module_path)); log_printf(op, TRUE, NULL, " OpenGL install prefix : %s", STRSTR(op->opengl_prefix)); + log_printf(op, TRUE, NULL, " OpenGL install libdir : %s", + STRSTR(op->opengl_libdir)); +#if defined(NV_X86_64) + log_printf(op, TRUE, NULL, " compat32 install chroot : %s", + STRSTR(op->compat32_chroot)); log_printf(op, TRUE, NULL, " compat32 install prefix : %s", STRSTR(op->compat32_prefix)); - log_printf(op, TRUE, NULL, " installer install prefix: %s", - STRSTR(op->installer_prefix)); + log_printf(op, TRUE, NULL, " compat32 install libdir : %s", + STRSTR(op->compat32_libdir)); +#endif log_printf(op, TRUE, NULL, " utility install prefix : %s", STRSTR(op->utility_prefix)); + log_printf(op, TRUE, NULL, " utility install libdir : %s", + STRSTR(op->utility_libdir)); + log_printf(op, TRUE, NULL, " doc install prefix : %s", + STRSTR(op->documentation_prefix)); log_printf(op, TRUE, NULL, " kernel name : %s", STRSTR(op->kernel_name)); log_printf(op, TRUE, NULL, " kernel include path : %s", @@ -683,7 +683,7 @@ int read_text_file(const char *filename, char **buf) * XXX requiring ld may cause problems */ -#define EXTRA_PATH "/bin:/usr/bin:/sbin:/usr/sbin" +#define EXTRA_PATH "/bin:/usr/bin:/sbin:/usr/sbin:/usr/X11R6/bin:/usr/bin/X11" int find_system_utils(Options *op) { @@ -703,7 +703,9 @@ int find_system_utils(Options *op) const struct { const char *util, *package; } optional_utils[] = { { "chcon", "selinux" }, { "selinuxenabled", "selinux" }, - { "getenforce", "selinux" } + { "getenforce", "selinux" }, + { "pkg-config", "pkg-config" }, + { "X", "xserver" } }; int i, j; @@ -885,7 +887,7 @@ int check_proc_modprobe_path(Options *op) * to build custom kernel interfaces are available. */ -int check_development_tools(Options *op) +int check_development_tools(Options *op, Package *p) { #define MAX_TOOLS 2 const struct { char *tool, *package; } needed_tools[] = { @@ -893,12 +895,23 @@ int check_development_tools(Options *op) { "make", "make" } }; - int i; - char *tool; + int i, ret; + char *tool, *cmd, *CC, *result; + + CC = getenv("CC"); ui_expert(op, "Checking development tools:"); - for (i = 0; i < MAX_TOOLS; i++) { + /* + * Check if the required toolchain components are installed on + * the system. Note that we skip the check for `cc` if the + * user specified the CC environment variable; we do this because + * `cc` may not be present in the path, nor the compiler named + * in $CC, but the installation may still succeed. $CC is sanity + * checked below. + */ + + for (i = (CC != NULL) ? 1 : 0; i < MAX_TOOLS; i++) { tool = find_system_util(needed_tools[i].tool); if (!tool) { ui_error(op, "Unable to find the development tool `%s` in " @@ -916,7 +929,7 @@ int check_development_tools(Options *op) /* * Check if the libc development headers are installed; we need - * these to build the gcc version check utility. + * these to build the CC version check utility. */ if (access("/usr/include/stdio.h", F_OK) == -1) { ui_error(op, "You do not appear to have libc header files " @@ -925,7 +938,26 @@ int check_development_tools(Options *op) return FALSE; } - return TRUE; + if (!CC) CC = "cc"; + + ui_log(op, "Performing CC sanity check with CC=\"%s\".", CC); + + cmd = nvstrcat("sh ", p->kernel_module_build_directory, + "/conftest.sh ", CC, " ", CC, " ", + "DUMMY_SOURCE DUMMY_OUTPUT ", + "cc_sanity_check just_msg", NULL); + + ret = run_command(op, cmd, &result, FALSE, 0, TRUE); + + nvfree(cmd); + + if (ret == 0) return TRUE; + + ui_error(op, "The CC sanity check failed:\n\n%s\n", result); + + nvfree(result); + + return FALSE; } /* check_development_tools() */ @@ -1157,17 +1189,17 @@ void should_install_compat32_files(Options *op, Package *p) "Install NVIDIA's 32-bit compatibility OpenGL " "libraries?"); - if (install_compat32_files && op->compat32_prefix && - access(op->compat32_prefix, F_OK) < 0) { + if (install_compat32_files && (op->compat32_chroot != NULL) && + access(op->compat32_chroot, F_OK) < 0) { install_compat32_files = ui_yes_no(op, FALSE, "The NVIDIA 32-bit compatibility OpenGL libraries are " - "to be installed relative to the prefix '%s'; however, " - "this directory does not exit. Please consult your " - "distribution's documentation to confirm the correct " - "installation prefix for 32-bit compatiblity libraries." - "\n\nDo you wish to install the 32-bit NVIDIA OpenGL " - "compatibility libraries anyway?", - op->compat32_prefix); + "to be installed relative to the top-level prefix (chroot) " + "'%s'; however, this directory does not exist. Please " + "consult your distribution's documentation to confirm the " + "correct top-level installation prefix for 32-bit " + "compatiblity libraries.\n\nDo you wish to install the " + "32-bit NVIDIA OpenGL compatibility libraries anyway?", + op->compat32_chroot); } if (!install_compat32_files) { @@ -1877,6 +1909,76 @@ Distribution get_distribution(Options *op) } /* get_distribution() */ +/* + * check_for_modular_xorg() - run the X binary with the '-version' + * command line option and extract the version in an attempt to + * determine if it's part of a modular Xorg release. If the version + * can't be determined, we assume it's not. + */ + +#define OLD_VERSION_FORMAT "(protocol Version %d, revision %d, vendor release %d)" +#define NEW_VERSION_FORMAT "X Protocol Version %d, Revision %d, Release %d." + +int check_for_modular_xorg(Options *op) +{ + char *cmd = NULL, *ptr, *data = NULL; + int modular_xorg = FALSE; + int dummy, release; + + if (!op->utils[XSERVER]) + goto done; + + cmd = nvstrcat(op->utils[XSERVER], " -version", NULL); + + if (run_command(op, cmd, &data, FALSE, 0, TRUE) || + (data == NULL)) { + goto done; + } + + /* + * Check if this is an XFree86 release that identifies + * itself as such in the version string. + */ + if (strstr(data, "XFree86 Version")) + goto done; + + /* + * Check if this looks like an XFree86 release older + * than XFree86 4.3.0. + */ + if ((ptr = strstr(data, "(protocol Version")) != NULL && + sscanf(ptr, OLD_VERSION_FORMAT, &dummy, &dummy, &release) == 3) { + goto done; + } + + /* + * Check if this looks like an XFree86 release between + * XFree86 4.2 and 4.5, or an Xorg release. + */ + + if ((ptr = strstr(data, "X Protocol Version")) != NULL && + sscanf(ptr, NEW_VERSION_FORMAT, &dummy, &dummy, &release) == 3) { + modular_xorg = (release >= 7); + goto done; + } + + /* + * If all else fails, check if this is an Xorg release + * that identifies itself as such. + */ + if ((ptr = strstr(data, "X Window System Version")) && + sscanf(ptr, "X Window System Version %d.", &release) == 1) { + modular_xorg = (release >= 7); + } + +done: + nvfree(data); + nvfree(cmd); + + return modular_xorg; + +} /* check_for_modular_xorg() */ + /* * check_for_running_x() - running any X server (even with a @@ -102,7 +102,7 @@ int find_system_utils(Options *op); int find_module_utils(Options *op); int check_selinux(Options *op); int check_proc_modprobe_path(Options *op); -int check_development_tools(Options *op); +int check_development_tools(Options *op, Package *p); int nvid_version (const char *str, int *major, int *minor, int *patch); int continue_after_error(Options *op, const char *fmt, ...); int do_install(Options *op, Package *p, CommandList *c); @@ -116,6 +116,7 @@ void collapse_multiple_slashes(char *s); int is_symbolic_link_to(const char *path, const char *dest); Distribution get_distribution(Options *op); int check_for_running_x(Options *op); +int check_for_modular_xorg(Options *op); int check_for_nvidia_graphics_devices(Options *op, Package *p); int run_nvidia_xconfig(Options *op); diff --git a/nvidia-installer.c b/nvidia-installer.c index 236d40c..1458242 100644 --- a/nvidia-installer.c +++ b/nvidia-installer.c @@ -235,9 +235,6 @@ Options *parse_commandline(int argc, char *argv[]) /* statically initialized strings */ - op->xfree86_prefix = DEFAULT_XFREE86_INSTALLATION_PREFIX; - op->opengl_prefix = DEFAULT_OPENGL_INSTALLATION_PREFIX; - op->utility_prefix = DEFAULT_UTILITY_INSTALLATION_PREFIX; op->proc_mount_point = DEFAULT_PROC_MOUNT_POINT; op->log_file_name = DEFAULT_LOG_FILE_NAME; op->ftp_site = DEFAULT_FTP_SITE; @@ -245,11 +242,6 @@ Options *parse_commandline(int argc, char *argv[]) op->tmpdir = get_tmpdir(op); op->distro = get_distribution(op); -#if defined(NV_X86_64) - if (op->distro == DEBIAN) - op->compat32_prefix = DEBIAN_COMPAT32_INSTALLATION_PREFIX; -#endif - op->logging = TRUE; /* log by default */ op->opengl_headers = TRUE; /* We now install our GL headers by default */ op->run_nvidia_xconfig = FALSE; @@ -302,17 +294,31 @@ Options *parse_commandline(int argc, char *argv[]) case XFREE86_PREFIX_OPTION: case X_PREFIX_OPTION: - op->xfree86_prefix = optarg; break; + op->x_prefix = optarg; break; + case X_LIBRARY_PATH_OPTION: + op->x_library_path = optarg; break; case X_MODULE_PATH_OPTION: op->x_module_path = optarg; break; case OPENGL_PREFIX_OPTION: op->opengl_prefix = optarg; break; + case OPENGL_LIBDIR_OPTION: + op->opengl_libdir = optarg; break; +#if defined(NV_X86_64) + case COMPAT32_CHROOT_OPTION: + op->compat32_chroot = optarg; break; case COMPAT32_PREFIX_OPTION: op->compat32_prefix = optarg; break; + case COMPAT32_LIBDIR_OPTION: + op->compat32_libdir = optarg; break; +#endif + case DOCUMENTATION_PREFIX_OPTION: + op->documentation_prefix = optarg; break; case INSTALLER_PREFIX_OPTION: op->installer_prefix = optarg; break; case UTILITY_PREFIX_OPTION: op->utility_prefix = optarg; break; + case UTILITY_LIBDIR_OPTION: + op->utility_libdir = optarg; break; case KERNEL_SOURCE_PATH_OPTION: op->kernel_source_path = optarg; break; case KERNEL_OUTPUT_PATH_OPTION: @@ -348,6 +354,7 @@ Options *parse_commandline(int argc, char *argv[]) exit(1); } break; +#if defined(NV_X86_64) case FORCE_TLS_COMPAT32_OPTION: if (strcasecmp(optarg, "new") == 0) op->which_tls_compat32 = FORCE_NEW_TLS; @@ -362,6 +369,7 @@ Options *parse_commandline(int argc, char *argv[]) exit(1); } break; +#endif case SANITY_OPTION: op->sanity = TRUE; break; @@ -513,7 +521,16 @@ int main(int argc, char *argv[]) if (!find_system_utils(op)) goto done; if (!find_module_utils(op)) goto done; if (!check_selinux(op)) goto done; + + /* check if we need to worry about modular Xorg */ + + op->modular_xorg = + check_for_modular_xorg(op); + /* get the default installation prefixes/paths */ + + get_default_prefixes_and_paths(op); + /* get the latest available driver version */ if (op->latest) { diff --git a/nvidia-installer.h b/nvidia-installer.h index dfa4e91..350e641 100644 --- a/nvidia-installer.h +++ b/nvidia-installer.h @@ -53,6 +53,8 @@ typedef enum { CHCON = MAX_SYSTEM_UTILS, SELINUX_ENABLED, GETENFORCE, + PKG_CONFIG, + XSERVER, MAX_SYSTEM_OPTIONAL_UTILS } SystemOptionalUtils; @@ -133,12 +135,32 @@ typedef struct __options { int selinux_enabled; int sigwinch_workaround; - char *xfree86_prefix; - char *x_module_path; char *opengl_prefix; + char *opengl_libdir; + char *opengl_incdir; + + char *x_prefix; + char *x_libdir; + char *x_moddir; + char *x_module_path; + char *x_library_path; + + char *compat32_chroot; char *compat32_prefix; - char *installer_prefix; + char *compat32_libdir; + char *utility_prefix; + char *utility_libdir; + char *utility_bindir; + char *installer_prefix; + + char *dot_desktopdir; + + char *documentation_prefix; + char *documentation_docdir; + char *documentation_mandir; + + int modular_xorg; char *kernel_source_path; char *kernel_output_path; @@ -279,6 +301,7 @@ typedef struct { #define FILE_TYPE_XMODULE_STATIC_LIB 0x00040000 #define FILE_TYPE_XMODULE_SHARED_LIB 0x00080000 #define FILE_TYPE_XMODULE_SYMLINK 0x00100000 +#define FILE_TYPE_MANPAGE 0x00200000 /* file class: this is used to distinguish OpenGL libraries */ @@ -300,6 +323,7 @@ typedef struct { FILE_TYPE_TLS_LIB | \ FILE_TYPE_UTILITY_LIB | \ FILE_TYPE_DOCUMENTATION | \ + FILE_TYPE_MANPAGE | \ FILE_TYPE_OPENGL_HEADER | \ FILE_TYPE_KERNEL_MODULE | \ FILE_TYPE_INSTALLER_BINARY | \ @@ -308,17 +332,13 @@ typedef struct { FILE_TYPE_XMODULE_LIB | \ FILE_TYPE_DOT_DESKTOP) -#define FILE_TYPE_HAVE_PATH (FILE_TYPE_OPENGL_LIB | \ - FILE_TYPE_OPENGL_SYMLINK | \ - FILE_TYPE_LIBGL_LA | \ - FILE_TYPE_XLIB_LIB | \ - FILE_TYPE_XLIB_SYMLINK | \ +#define FILE_TYPE_HAVE_PATH (FILE_TYPE_XMODULE_LIB | \ + FILE_TYPE_XMODULE_SYMLINK | \ + FILE_TYPE_MANPAGE | \ + FILE_TYPE_OPENGL_HEADER | \ FILE_TYPE_TLS_LIB | \ FILE_TYPE_TLS_SYMLINK | \ - FILE_TYPE_UTILITY_LIB | \ - FILE_TYPE_UTILITY_SYMLINK | \ - FILE_TYPE_XMODULE_LIB | \ - FILE_TYPE_XMODULE_SYMLINK | \ + FILE_TYPE_DOT_DESKTOP | \ FILE_TYPE_DOCUMENTATION) #define FILE_TYPE_HAVE_ARCH (FILE_TYPE_OPENGL_LIB | \ @@ -360,23 +380,65 @@ typedef struct { #define PRECOMPILED_KERNEL_INTERFACE_FILENAME "precompiled-nv-linux.o" -#define DEFAULT_XFREE86_INSTALLATION_PREFIX "/usr/X11R6" -#define DEFAULT_OPENGL_INSTALLATION_PREFIX "/usr" -#define DEFAULT_INSTALLER_INSTALLATION_PREFIX "/usr" -#define DEFAULT_UTILITY_INSTALLATION_PREFIX "/usr" -#define DEBIAN_COMPAT32_INSTALLATION_PREFIX "/emul/ia32-linux" + +/* + * These are the default installation prefixes and the default + * paths relative to the prefixes. Some of the defaults are + * overriden on some distributions or when the new modular Xorg + * is detected, all prefixes/paths can be overriden from the + * command line. + */ +#define DEFAULT_OPENGL_PREFIX "/usr" +#define DEFAULT_X_PREFIX "/usr/X11R6" +#define DEFAULT_UTILITY_PREFIX "/usr" +#define DEFAULT_DOCUMENTATION_PREFIX "/usr" + +#define DEFAULT_LIBDIR "lib" +#define DEFAULT_64BIT_LIBDIR "lib64" +#define DEFAULT_BINDIR "bin" +#define DEFAULT_INCDIR "include" +#define DEFAULT_X_MODULEDIR "modules" +#define DEFAULT_DOT_DESKTOPDIR "share/applications" +#define DEFAULT_DOCDIR "share/doc" +#define DEFAULT_MANDIR "share/man" + +/* + * As of Xorg 7.x, X components need not be installed relative + * to a special top-level directory, they can be integrated + * more tightly with the rest of the system. The system must be + * queried for the installation paths, but in the event that + * this fails, the fallbacks below are chosen. + */ +#define XORG7_DEFAULT_X_PREFIX "/usr" +#define XORG7_DEFAULT_X_MODULEDIR "xorg/modules" + +/* + * Debian GNU/Linux for x86-64 installs 32-bit compatibility + * libraries relative to a chroot-like top-level directory; the + * prefix below is prepended to the full paths. + */ +#define DEBIAN_DEFAULT_COMPAT32_CHROOT "/emul/ia32-linux" + +/* + * Debian GNU/Linux and Ubuntu do not follow the lib64 library + * path naming convention used by other distributors. 64-bit + * libraries are placed under ../lib. + */ +#define DEBIAN_DEFAULT_64BIT_LIBDIR "lib" + +/* + * Ubuntu GNU/Linux and Gentoo Linux do not follow the "lib" + * library path naming convention used for 32-bit compatibility + * libraries by other distributors. These libraries are + * placed under ../lib32. + */ +#define UBUNTU_DEFAULT_COMPAT32_LIBDIR "lib32" #define DEFAULT_PROC_MOUNT_POINT "/proc" #define DEFAULT_FTP_SITE "ftp://download.nvidia.com" -#define OPENGL_HEADER_DST_PATH "include/GL" -#define INSTALLER_BINARY_DST_PATH "bin" -#define UTILITY_BINARY_DST_PATH "bin" -#define DOCUMENTATION_DST_PATH "share/doc/NVIDIA_GLX-1.0" -#define DOT_DESKTOP_DST_PATH "share/applications" - #define LICENSE_FILE "LICENSE" #define DEFAULT_LOG_FILE_NAME "/var/log/nvidia-installer.log" diff --git a/option_table.h b/option_table.h index d0eec91..684239b 100644 --- a/option_table.h +++ b/option_table.h @@ -13,6 +13,7 @@ typedef struct { enum { XFREE86_PREFIX_OPTION = 1, OPENGL_PREFIX_OPTION, + OPENGL_LIBDIR_OPTION, KERNEL_INCLUDE_PATH_OPTION, KERNEL_INSTALL_PATH_OPTION, UNINSTALL_OPTION, @@ -27,6 +28,7 @@ enum { SANITY_OPTION, ADVANCED_OPTIONS_ARGS_ONLY_OPTION, UTILITY_PREFIX_OPTION, + UTILITY_LIBDIR_OPTION, ADD_THIS_KERNEL_OPTION, RPM_FILE_LIST_OPTION, NO_RUNLEVEL_CHECK_OPTION, @@ -38,11 +40,15 @@ enum { KERNEL_OUTPUT_PATH_OPTION, NO_RECURSION_OPTION, FORCE_TLS_COMPAT32_OPTION, + COMPAT32_CHROOT_OPTION, COMPAT32_PREFIX_OPTION, + COMPAT32_LIBDIR_OPTION, UPDATE_OPTION, FORCE_SELINUX_OPTION, NO_SIGWINCH_WORKAROUND_OPTION, X_MODULE_PATH_OPTION, + DOCUMENTATION_PREFIX_OPTION, + X_LIBRARY_PATH_OPTION, NO_KERNEL_MODULE_OPTION }; @@ -109,9 +115,10 @@ static const NVOption __options[] = { { "x-prefix", X_PREFIX_OPTION, NVOPT_HAS_ARGUMENT, "The prefix under which the X components of the " - "NVIDIA driver will be installed; the default is: '" - DEFAULT_XFREE86_INSTALLATION_PREFIX - "'. Only under rare circumstances should this option be used." }, + "NVIDIA driver will be installed; the default is '" DEFAULT_X_PREFIX + "' unless nvidia-installer detects that Xorg >= 7.0 is installed, " + "in which case the default is '" XORG7_DEFAULT_X_PREFIX "'. Only " + "under rare circumstances should this option be used." }, { "xfree86-prefix", XFREE86_PREFIX_OPTION, NVOPT_HAS_ARGUMENT, "This is a deprecated synonym for --x-prefix." }, @@ -120,37 +127,80 @@ static const NVOption __options[] = { "The path under which the NVIDIA X server modules will be installed. " "If `pkg-config --variable=moduledir xorg-server` is successful and " "returns a directory that exists, then that is the default; otherwise, " - "this value defaults to the X prefix (which defaults to '" - DEFAULT_XFREE86_INSTALLATION_PREFIX "', but can be overridden with the " - "'--x-prefix' option) plus \"lib/modules\"." }, + "this value defaults to the X library path (see the '--x-library-path' " + "option) plus '" DEFAULT_X_MODULEDIR "' or '" XORG7_DEFAULT_X_MODULEDIR + "' if nvidia-installer detects that Xorg >= 7.0 is installed." }, + + { "x-library-path", X_LIBRARY_PATH_OPTION, NVOPT_HAS_ARGUMENT, + "The path under which the NVIDIA X libraries will be installed. " + "If `pkg-config --variable=libdir xorg-server` is successful and " + "returns a directory that exists, then that is the default; otherwise, " + "this value defaults to the X prefix (see the '--x-prefix' option) " + "plus '" DEFAULT_LIBDIR "' on 32bit systems, and '" + DEFAULT_64BIT_LIBDIR "' or '" DEFAULT_LIBDIR "' on 64bit systems, " + "depending on the installed Linux distribution." }, { "opengl-prefix", OPENGL_PREFIX_OPTION, NVOPT_HAS_ARGUMENT, "The prefix under which the OpenGL components of the " - "NVIDIA driver will be installed; the default is: '" - DEFAULT_OPENGL_INSTALLATION_PREFIX + "NVIDIA driver will be installed; the default is: '" DEFAULT_OPENGL_PREFIX "'. Only under rare circumstances should this option be used. " "The Linux OpenGL ABI (http://oss.sgi.com/projects/ogl-sample/ABI/) " "mandates this default value." }, + { "opengl-libdir", OPENGL_LIBDIR_OPTION, NVOPT_HAS_ARGUMENT, + "The path relative to the OpenGL library installation prefix under " + "which the NVIDIA OpenGL components will be installed. The " + "default is '" DEFAULT_LIBDIR "' on 32bit systems, and '" + DEFAULT_64BIT_LIBDIR "' or '" DEFAULT_LIBDIR "' on 64bit systems, " + "depending on the installed Linux distribution. Only under very rare " + "circumstances should this option be used." }, + #if defined(NV_X86_64) + { "compat32-chroot", COMPAT32_CHROOT_OPTION, NVOPT_HAS_ARGUMENT, + "The top-level prefix (chroot) relative to which the 32bit " + "compatibility OpenGL libraries will be installed on Linux/x86-64 " + "systems; this option is unset by default, the 32bit OpenGL " + "library installation prefix (see below) and the 32bit library " + "path alone determine the target location. Only under very rare " + "circumstances should this option be used." }, + { "compat32-prefix", COMPAT32_PREFIX_OPTION, NVOPT_HAS_ARGUMENT, - "The path relative to which the 32bit compatibility " - "libraries will be installed on x86-64 systems; this option " - "is unset by default, the OpenGL prefix alone determines " - "the target location. Only under very rare circumstances " - "should this option need to be used." }, + "The prefix under which the 32bit compatibility OpenGL components " + "of the NVIDIA driver will be installed; the default is: '" + DEFAULT_OPENGL_PREFIX "'. Only under rare circumstances should " + "this option be used." }, + + { "compat32-libdir", COMPAT32_LIBDIR_OPTION, NVOPT_HAS_ARGUMENT, + "The path relative to the 32bit compatibility prefix under which the " + "32bit compatibility OpenGL components of the NVIDIA driver will " + "be installed. The default is '" DEFAULT_LIBDIR "' or '" + UBUNTU_DEFAULT_COMPAT32_LIBDIR "', depending on the installed Linux " + "distribution. Only under very rare circumstances should this " + "option be used." }, #endif /* NV_X86_64 */ { "installer-prefix", INSTALLER_PREFIX_OPTION, NVOPT_HAS_ARGUMENT, "The prefix under which the installer binary will be " - "installed; the default is: '" DEFAULT_INSTALLER_INSTALLATION_PREFIX - "'. Note: use the \"--utility-prefix\" option instead." }, + "installed; the default is: '" DEFAULT_UTILITY_PREFIX "'. Note: please " + "use the '--utility-prefix' option instead." }, { "utility-prefix", UTILITY_PREFIX_OPTION, NVOPT_HAS_ARGUMENT, - "The prefix under which the various NVIDIA utilities " - "(nvidia-installer, nvidia-settings, nvidia-xconfig, " - "nvidia-bug-report.sh) will be installed; the default is: '" - DEFAULT_UTILITY_INSTALLATION_PREFIX "'." }, + "The prefix under which the NVIDIA utilities (nvidia-installer, " + "nvidia-settings, nvidia-xconfig, nvidia-bug-report.sh) and the NVIDIA " + "utility libraries will be installed; the default is: '" + DEFAULT_UTILITY_PREFIX "'." }, + + { "utility-libdir", UTILITY_LIBDIR_OPTION, NVOPT_HAS_ARGUMENT, + "The path relative to the utility installation prefix under which the " + "NVIDIA utility libraries will be installed. The default is '" + DEFAULT_LIBDIR "' on 32bit systems, and '" DEFAULT_64BIT_LIBDIR + "' or '" DEFAULT_LIBDIR "' on 64bit " "systems, depending on the " + "installed Linux distribution." }, + + { "documentation-prefix", DOCUMENTATION_PREFIX_OPTION, NVOPT_HAS_ARGUMENT, + "The prefix under which the documentation files for the NVIDIA " + "driver will be installed. The default is: '" + DEFAULT_DOCUMENTATION_PREFIX "'." }, { "kernel-include-path", KERNEL_INCLUDE_PATH_OPTION, NVOPT_HAS_ARGUMENT, "The directory containing the kernel include files that " @@ -236,11 +286,10 @@ static const NVOption __options[] = { "different thread local storage (TLS) mechanisms: 'classic tls' " "which is used on systems with glibc 2.2 or older, and 'new tls' " "which is used on systems with tls-enabled glibc 2.3 or newer. " - "The nvidia-installer will select the OpenGL " - "libraries appropriate for your system; however, you may use " - "this option to force the installer to install one library " - "type or another. Valid values for [FORCE-TLS] are 'new' and " - "'classic'." }, + "nvidia-installer will select the OpenGL libraries appropriate " + "for your system; however, you may use this option to force the " + "installer to install one library type or another. Valid values " + "for [FORCE-TLS] are 'new' and 'classic'." }, #if defined(NV_X86_64) { "force-tls-compat32", FORCE_TLS_COMPAT32_OPTION, NVOPT_HAS_ARGUMENT, |