diff options
-rw-r--r-- | DRIVER_VERSION | 2 | ||||
-rw-r--r-- | command-list.c | 12 | ||||
-rw-r--r-- | dist-files.mk | 95 | ||||
-rw-r--r-- | files.c | 9 | ||||
-rw-r--r-- | install-from-cwd.c | 14 | ||||
-rw-r--r-- | kernel.c | 4 | ||||
-rw-r--r-- | makefile.nvmk | 170 | ||||
-rw-r--r-- | misc.c | 8 | ||||
-rw-r--r-- | misc.h | 2 | ||||
-rw-r--r-- | nvidia-installer.c | 11 | ||||
-rw-r--r-- | nvidia-installer.h | 100 | ||||
-rw-r--r-- | public.mk | 278 |
12 files changed, 641 insertions, 64 deletions
diff --git a/DRIVER_VERSION b/DRIVER_VERSION index b989d8e..5549128 100644 --- a/DRIVER_VERSION +++ b/DRIVER_VERSION @@ -1 +1 @@ -177.82 +180.06 diff --git a/command-list.c b/command-list.c index d98b2e0..23bb6c0 100644 --- a/command-list.c +++ b/command-list.c @@ -65,7 +65,7 @@ static void find_conflicting_kernel_modules(Options *op, Package *p, FileList *l); -static void find_existing_files(Package *p, FileList *l, unsigned int); +static void find_existing_files(Package *p, FileList *l, uint64_t); static void condense_file_list(Package *p, FileList *l); @@ -95,7 +95,7 @@ CommandList *build_command_list(Options *op, Package *p) FileList *l; CommandList *c; int i, cmd; - unsigned int installable_files; + uint64_t installable_files; char *tmp; installable_files = get_installable_file_mask(op); @@ -216,8 +216,7 @@ CommandList *build_command_list(Options *op, Package *p) for (i = 0; i < p->num_entries; i++) { if (op->selinux_enabled && (op->utils[EXECSTACK] != NULL) && - ((p->entries[i].flags & FILE_TYPE_SHARED_LIB) || - (p->entries[i].flags & FILE_TYPE_XMODULE_SHARED_LIB))) { + (p->entries[i].flags & FILE_TYPE_SHARED_LIB)) { tmp = nvstrcat(op->utils[EXECSTACK], " -c ", p->entries[i].file, NULL); add_command(c, RUN_CMD, tmp); @@ -243,8 +242,7 @@ 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_XMODULE_SHARED_LIB))) { + (p->entries[i].flags & FILE_TYPE_SHARED_LIB)) { tmp = nvstrcat(op->utils[CHCON], " -t ", op->selinux_chcon_type, " ", p->entries[i].dst, NULL); add_command(c, RUN_CMD, tmp); @@ -642,7 +640,7 @@ static void find_conflicting_kernel_modules(Options *op, * FileList. */ -static void find_existing_files(Package *p, FileList *l, unsigned int flag) +static void find_existing_files(Package *p, FileList *l, uint64_t flag) { int i; struct stat stat_buf; diff --git a/dist-files.mk b/dist-files.mk new file mode 100644 index 0000000..8e9a2d2 --- /dev/null +++ b/dist-files.mk @@ -0,0 +1,95 @@ +# +# nvidia-installer: A tool for installing NVIDIA software packages on +# Unix and Linux systems. +# +# Copyright (C) 2008 NVIDIA Corporation. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of Version 2 of the GNU General Public +# License as published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See Version 2 +# of the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the: +# +# Free Software Foundation, Inc. +# 59 Temple Place - Suite 330 +# Boston, MA 02111-1307, USA +# + +############################################################################## +# define the list of files that should be distributed in the +# nvidia-installer tarball; this is used by the NVIDIA driver build +# when packaging the tarball, and by the nvidia-installer makefile when +# building nvidia-installer. +# +# Defines SRC and DIST_FILES +############################################################################## + +SRC := backup.c +SRC += command-list.c +SRC += crc.c +SRC += files.c +SRC += format.c +SRC += install-from-cwd.c +SRC += kernel.c +SRC += log.c +SRC += misc.c +SRC += nvidia-installer.c +SRC += precompiled.c +SRC += snarf-ftp.c +SRC += snarf-http.c +SRC += snarf.c +SRC += stream-ui.c +SRC += update.c +SRC += user-interface.c +SRC += sanity.c + +DIST_FILES := $(SRC) + +DIST_FILES += backup.h +DIST_FILES += command-list.h +DIST_FILES += crc.h +DIST_FILES += files.h +DIST_FILES += format.h +DIST_FILES += kernel.h +DIST_FILES += misc.h +DIST_FILES += nvidia-installer-ui.h +DIST_FILES += nvidia-installer.h +DIST_FILES += option_table.h +DIST_FILES += precompiled.h +DIST_FILES += sanity.h +DIST_FILES += snarf-internal.h +DIST_FILES += snarf.h +DIST_FILES += update.h +DIST_FILES += user-interface.h + +DIST_FILES += COPYING +DIST_FILES += README +DIST_FILES += dist-files.mk + +DIST_FILES += rtld_test_Linux-x86 +DIST_FILES += rtld_test_Linux-x86_64 + +DIST_FILES += tls_test_Linux-ia64 +DIST_FILES += tls_test_Linux-x86 +DIST_FILES += tls_test_Linux-x86_64 + +DIST_FILES += tls_test_dso_Linux-ia64.so +DIST_FILES += tls_test_dso_Linux-x86.so +DIST_FILES += tls_test_dso_Linux-x86_64.so + +DIST_FILES += tls_test.c +DIST_FILES += tls_test_dso.c +DIST_FILES += rtld_test.c + +DIST_FILES += nvidia-installer.1.m4 +DIST_FILES += gen-manpage-opts.c + +DIST_FILES += gen-ui-array.c +DIST_FILES += ncurses-ui.c +DIST_FILES += mkprecompiled.c @@ -503,6 +503,8 @@ int set_destinations(Options *op, Package *p) case FILE_TYPE_OPENGL_LIB: case FILE_TYPE_OPENGL_SYMLINK: + case FILE_TYPE_VDPAU_LIB: + case FILE_TYPE_VDPAU_SYMLINK: if (p->entries[i].flags & FILE_CLASS_COMPAT32) { prefix = op->compat32_prefix; dir = op->compat32_libdir; @@ -553,7 +555,7 @@ int set_destinations(Options *op, Package *p) break; case FILE_TYPE_UTILITY_LIB: - case FILE_TYPE_UTILITY_SYMLINK: + case FILE_TYPE_UTILITY_LIB_SYMLINK: prefix = op->utility_prefix; dir = op->utility_libdir; path = ""; @@ -579,6 +581,7 @@ int set_destinations(Options *op, Package *p) case FILE_TYPE_OPENGL_HEADER: case FILE_TYPE_CUDA_HEADER: + case FILE_TYPE_VDPAU_HEADER: prefix = op->opengl_prefix; dir = op->opengl_incdir; path = p->entries[i].path; @@ -603,6 +606,7 @@ int set_destinations(Options *op, Package *p) break; case FILE_TYPE_UTILITY_BINARY: + case FILE_TYPE_UTILITY_BIN_SYMLINK: prefix = op->utility_prefix; dir = op->utility_bindir; path = ""; @@ -922,10 +926,9 @@ int add_kernel_module_to_package(Options *op, Package *p) void remove_non_kernel_module_files_from_package(Options *op, Package *p) { int i; - unsigned int flags; for (i = 0; i < p->num_entries; i++) { - flags = p->entries[i].flags & FILE_TYPE_MASK; + uint64_t flags = p->entries[i].flags & FILE_TYPE_MASK; if ((flags != FILE_TYPE_KERNEL_MODULE) && (flags != FILE_TYPE_KERNEL_MODULE_CMD)) p->entries[i].flags &= ~FILE_TYPE_MASK; diff --git a/install-from-cwd.c b/install-from-cwd.c index c5ff042..0f7a35e 100644 --- a/install-from-cwd.c +++ b/install-from-cwd.c @@ -684,12 +684,14 @@ static Package *parse_manifest (Options *op) p->entries[n].flags |= FILE_TYPE_XLIB_SYMLINK; else if (strcmp(flag, "TLS_SYMLINK") == 0) p->entries[n].flags |= FILE_TYPE_TLS_SYMLINK; - else if (strcmp(flag, "UTILITY_SYMLINK") == 0) - p->entries[n].flags |= FILE_TYPE_UTILITY_SYMLINK; + else if (strcmp(flag, "UTILITY_LIB_SYMLINK") == 0) + p->entries[n].flags |= FILE_TYPE_UTILITY_LIB_SYMLINK; else if (strcmp(flag, "INSTALLER_BINARY") == 0) p->entries[n].flags |= FILE_TYPE_INSTALLER_BINARY; else if (strcmp(flag, "UTILITY_BINARY") == 0) p->entries[n].flags |= FILE_TYPE_UTILITY_BINARY; + else if (strcmp(flag, "UTILITY_BIN_SYMLINK") == 0) + p->entries[n].flags |= FILE_TYPE_UTILITY_BIN_SYMLINK; else if (strcmp(flag, "DOT_DESKTOP") == 0) p->entries[n].flags |= FILE_TYPE_DOT_DESKTOP; else if (strcmp(flag, "XMODULE_SHARED_LIB") == 0) @@ -698,6 +700,12 @@ static Package *parse_manifest (Options *op) p->entries[n].flags |= FILE_TYPE_XMODULE_SYMLINK; else if (strcmp(flag, "XMODULE_NEWSYM") == 0) p->entries[n].flags |= FILE_TYPE_XMODULE_NEWSYM; + else if (strcmp(flag, "VDPAU_HEADER") == 0) + p->entries[n].flags |= FILE_TYPE_VDPAU_HEADER; + else if (strcmp(flag, "VDPAU_LIB") == 0) + p->entries[n].flags |= FILE_TYPE_VDPAU_LIB; + else if (strcmp(flag, "VDPAU_SYMLINK") == 0) + p->entries[n].flags |= FILE_TYPE_VDPAU_SYMLINK; else { nvfree(flag); goto invalid_manifest_file; @@ -829,7 +837,7 @@ void add_package_entry(Package *p, char *name, char *target, char *dst, - unsigned int flags, + uint64_t flags, mode_t mode) { int n; @@ -738,7 +738,9 @@ int test_kernel_module(Options *op, Package *p) "from the one used to build the target kernel, or " "if a driver such as rivafb/nvidiafb is present and " "prevents the NVIDIA kernel module from obtaining " - "ownership of the NVIDIA graphics device(s).\n\n" + "ownership of the NVIDIA graphics device(s), or " + "NVIDIA GPU installed in this system is not supported " + "by this NVIDIA Linux graphics driver release.\n\n" "Please see the log entries 'Kernel module load " "error' and 'Kernel messages' at the end of the file " "'%s' for more information.", diff --git a/makefile.nvmk b/makefile.nvmk new file mode 100644 index 0000000..9b844b0 --- /dev/null +++ b/makefile.nvmk @@ -0,0 +1,170 @@ +############################################################################## +# drivers/setup/linux/nvidia-installer/makefile.nvmk +############################################################################## + +include $(NV_SOURCE)/drivers/common/build/nvCommon.nvmk + + +############################################################################## +# export the appropriate variables from nvmake to the gmake that we're +# going to invoke +############################################################################## + +$(eval $(EXPORT_VARIABLES_TO_PUBLIC_MAKEFILE)) + +_ncurses_dir = $(NV_TOOLS)/unix/targets/$(NV_TARGET_OS)-$(NV_TARGET_ARCH)/ncurses-5.5 + +NCURSES_INCLUDE_DIR = $(_ncurses_dir)/include +NCURSES_LIB_DIR = $(_ncurses_dir)/lib + +export NCURSES_CFLAGS = -I$(NCURSES_INCLUDE_DIR) +export NCURSES_LDFLAGS = -L$(NCURSES_LIB_DIR) + +_pci_dir = $(NV_TOOLS)/unix/targets/$(NV_TARGET_OS)-$(NV_TARGET_ARCH)/pciutils-2.2.1 + +PCI_INCLUDE_DIR = $(_pci_dir)/include +PCI_LIB_DIR = $(_pci_dir)/lib + +export PCI_CFLAGS = -I$(PCI_INCLUDE_DIR) +export PCI_LDFLAGS = -L$(PCI_LIB_DIR) + +export OUTPUTDIR + +export NV_AUTO_DEPEND +export NV_VERBOSE + +# for utils.mk +NV_MAKE_ARGS = -I $(NV_SOURCE)/drivers/setup/linux/common + + +############################################################################## +# check that all the directories that we exported above actually +# exist; trigger a warning if any of them don't exist +############################################################################## + +_extra_dirs += $(NCURSES_INCLUDE_DIR) +_extra_dirs += $(NCURSES_LIB_DIR) +_extra_dirs += $(PCI_INCLUDE_DIR) +_extra_dirs += $(PCI_LIB_DIR) + +build :: $(_extra_dirs) + +$(sort $(_extra_dirs)) : + @$(ECHO) WARNING: nvidia-installer extra directory does not exist: $@ + + +############################################################################## +# generate the legacy GPU header file +############################################################################## + +_nv_common_inc = $(NV_SOURCE)/drivers/common/inc +_nv_sdk_inc = $(NV_SOURCE)/sdk/nvidia/inc + +NV_NAME_H = $(_nv_common_inc)/nv_name.h +NV_CHIPFLAGS_H = $(_nv_common_inc)/nvChipFlags.h +NV_CHIPUTILS_H = $(_nv_common_inc)/nvChipUtils.h +NV_MISC_H = $(_nv_sdk_inc)/nvmisc.h + +NV_LEGACY_H = $(OUTPUTDIR)/nvLegacy.h + +NV_LEGACY_GENERATOR = $(OUTPUTDIR)/nvLegacyGenerator + +NV_LEGACY_GENERATOR_HEADER_DEPS = \ + $(NV_NAME_H) $(NV_CHIPFLAGS_H) $(NV_CHIPUTILS_H) $(NV_MISC_H) + +NV_LEGACY_GENERATOR_INCLUDE_CFLAGS = \ + $(addprefix -I,$(sort $(dir $(NV_LEGACY_GENERATOR_HEADER_DEPS)))) + +$(NV_LEGACY_GENERATOR): ../nvLegacy.c $(NV_LEGACY_GENERATOR_HEADER_DEPS) + $(call quiet_cmd,HOST_CC) $< -o $@ \ + $(NV_LEGACY_GENERATOR_INCLUDE_CFLAGS) $(HOST_LDFLAGS) $(HOST_BIN_LDFLAGS) + +$(NV_LEGACY_H): $(NV_LEGACY_GENERATOR) + ./$(NV_LEGACY_GENERATOR) > $@ + +OTHER_FILES_TO_REMOVE += $(NV_LEGACY_H) $(NV_LEGACY_GENERATOR) + + +############################################################################## +# define how to package the nvidia-installer source tarball +############################################################################## + +.PHONY: dist + +# include the list of nvidia-installer source files; defines DIST_FILES +include dist-files.mk + +NVIDIA_INSTALLER_DISTDIR_NO_OUTPUTDIR = nvidia-installer-$(NV_VERSION_STRING) +NVIDIA_INSTALLER_DISTDIR = $(OUTPUTDIR)/$(NVIDIA_INSTALLER_DISTDIR_NO_OUTPUTDIR) +NVIDIA_INSTALLER_TARBALL_NO_OUTPUTDIR = $(NVIDIA_INSTALLER_DISTDIR_NO_OUTPUTDIR).tar.bz2 +NVIDIA_INSTALLER_TARBALL = $(NVIDIA_INSTALLER_DISTDIR).tar.bz2 + +ifeq ($(NV_VERBOSE),1) + _tar_verbose_arg = -v +else + _tar_verbose_arg = +endif + +# define rules to copy files from the source tree to +# $(NVIDIA_INSTALLER_DISTDIR) + +$(eval $(call ADD_FILE_TO_TARBALL_RULE, \ + public.mk, \ + $(NVIDIA_INSTALLER_DISTDIR)/Makefile, \ + $(NVIDIA_INSTALLER_TARBALL))) + +$(eval $(call ADD_FILE_TO_TARBALL_RULE, \ + $(OUTPUTDIR)/version.mk, \ + $(NVIDIA_INSTALLER_DISTDIR)/version.mk, \ + $(NVIDIA_INSTALLER_TARBALL))) + +$(eval $(call ADD_FILE_TO_TARBALL_RULE, \ + $(NV_SOURCE)/drivers/setup/linux/common/utils.mk, \ + $(NVIDIA_INSTALLER_DISTDIR)/utils.mk, \ + $(NVIDIA_INSTALLER_TARBALL))) + +$(eval $(call ADD_FILE_TO_TARBALL_RULE, \ + $(NV_LEGACY_H), \ + $(NVIDIA_INSTALLER_DISTDIR)/$(notdir $(NV_LEGACY_H)), \ + $(NVIDIA_INSTALLER_TARBALL))) + +$(foreach src, $(DIST_FILES), \ + $(eval $(call ADD_FILE_TO_TARBALL_RULE, \ + $(src), \ + $(NVIDIA_INSTALLER_DISTDIR)/$(src), \ + $(NVIDIA_INSTALLER_TARBALL)))) + +$(NVIDIA_INSTALLER_TARBALL): + @$(ECHO) "Generating $(OUTPUTDIR)/$(NVIDIA_INSTALLER_TARBALL)" + $(RM) $(OUTPUTDIR)/tar-file-list.txt + for i in $(patsubst $(OUTPUTDIR)/%,%,$(TARBALL_FILE_LIST_$@)); do \ + $(ECHO) $${i} >> $(OUTPUTDIR)/tar-file-list.txt; \ + done + cd $(OUTPUTDIR) && \ + PATH=/bin $(TAR) -c -j $(_tar_verbose_arg) -f \ + $(NVIDIA_INSTALLER_TARBALL_NO_OUTPUTDIR) \ + --files-from=tar-file-list.txt + $(RM) $(OUTPUTDIR)/tar-file-list.txt + +dist: $(NVIDIA_INSTALLER_TARBALL) + +OTHER_FILES_TO_REMOVE += $(NVIDIA_INSTALLER_DISTDIR) +OTHER_FILES_TO_REMOVE += $(NVIDIA_INSTALLER_TARBALL) + + +############################################################################## +# to actually build nvidia-settings, hand off control to the public makefile +############################################################################## + +$(eval $(DEFINE_VERSION_MK_RULE)) + +build:: $(OUTPUTDIR)/version.mk $(NV_LEGACY_H) + $(MAKE) $(NV_MAKE_ARGS) -f public.mk $@ + + +############################################################################## +# define the compiler and include the common rules +############################################################################## + +include $(NV_SOURCE)/drivers/common/build/gcc-4.1.1as2.nvmk +include $(NV_SOURCE)/drivers/common/build/nvCommonRules.nvmk @@ -1356,8 +1356,8 @@ void check_installed_files_from_package(Options *op, Package *p) { int i, ret = TRUE; float percent; - unsigned int installable_files; - + uint64_t installable_files; + ui_status_begin(op, "Running post-install sanity check:", "Checking"); installable_files = get_installable_file_mask(op); @@ -1499,9 +1499,9 @@ static int check_file(Options *op, const char *filename, * should be considered installable. */ -unsigned int get_installable_file_mask(Options *op) +uint64_t get_installable_file_mask(Options *op) { - unsigned int installable_files = FILE_TYPE_INSTALLABLE_FILE; + uint64_t installable_files = FILE_TYPE_INSTALLABLE_FILE; if (!op->opengl_headers) installable_files &= ~FILE_TYPE_OPENGL_HEADER; return installable_files; @@ -109,7 +109,7 @@ int do_install(Options *op, Package *p, CommandList *c); void should_install_opengl_headers(Options *op, Package *p); void should_install_compat32_files(Options *op, Package *p); void check_installed_files_from_package(Options *op, Package *p); -unsigned int get_installable_file_mask(Options *op); +uint64_t get_installable_file_mask(Options *op); int tls_test(Options *op, int compat_32_libs); int check_runtime_configuration(Options *op, Package *p); void collapse_multiple_slashes(char *s); diff --git a/nvidia-installer.c b/nvidia-installer.c index 69059b3..714361d 100644 --- a/nvidia-installer.c +++ b/nvidia-installer.c @@ -32,6 +32,7 @@ #include <limits.h> #include <string.h> #include <ctype.h> +#include <libgen.h> #include <sys/types.h> #include <sys/stat.h> @@ -201,6 +202,7 @@ Options *parse_commandline(int argc, char *argv[]) { Options *op; int c, option_index = 0; + char *program_name; const int num_opts = sizeof(__options) / sizeof(__options[0]) - 1; /* Allocate space for the long options. */ @@ -481,6 +483,15 @@ Options *parse_commandline(int argc, char *argv[]) op->installer_prefix = op->utility_prefix; } + /* + * if the installer was invoked as "nvidia-uninstall", perform an + * uninstallation. + */ + program_name = strdup(argv[0]); + if (strcmp(basename(program_name), "nvidia-uninstall") == 0) + op->uninstall = TRUE; + free(program_name); + return (op); } /* parse_commandline() */ diff --git a/nvidia-installer.h b/nvidia-installer.h index 509e441..ecdf2d4 100644 --- a/nvidia-installer.h +++ b/nvidia-installer.h @@ -29,6 +29,7 @@ #define __NVIDIA_INSTALLER_H__ #include <sys/types.h> +#include <stdint.h> /* @@ -92,9 +93,9 @@ typedef enum { } Distribution; -typedef unsigned int uint32; -typedef unsigned short uint16; -typedef unsigned char uint8; +typedef uint32_t uint32; +typedef uint16_t uint16; +typedef uint8_t uint8; @@ -226,8 +227,8 @@ typedef struct __package_entry { * field is assigned by the set_destinations() * function. */ - - unsigned int flags; + + uint64_t flags; mode_t mode; ino_t inode; @@ -292,43 +293,47 @@ typedef struct { /* file types */ -#define FILE_TYPE_MASK 0x01ffffff - -#define FILE_TYPE_KERNEL_MODULE_SRC 0x00000001 -#define FILE_TYPE_KERNEL_MODULE_CMD 0x00000002 -#define FILE_TYPE_OPENGL_HEADER 0x00000004 -#define FILE_TYPE_OPENGL_LIB 0x00000008 -#define FILE_TYPE_XLIB_STATIC_LIB 0x00000010 -#define FILE_TYPE_XLIB_SHARED_LIB 0x00000020 -#define FILE_TYPE_DOCUMENTATION 0x00000040 -#define FILE_TYPE_OPENGL_SYMLINK 0x00000080 -#define FILE_TYPE_XLIB_SYMLINK 0x00000100 -#define FILE_TYPE_KERNEL_MODULE 0x00000200 -#define FILE_TYPE_INSTALLER_BINARY 0x00000400 -#define FILE_TYPE_UTILITY_BINARY 0x00000800 -#define FILE_TYPE_LIBGL_LA 0x00001000 -#define FILE_TYPE_TLS_LIB 0x00002000 -#define FILE_TYPE_TLS_SYMLINK 0x00004000 -#define FILE_TYPE_UTILITY_LIB 0x00008000 -#define FILE_TYPE_DOT_DESKTOP 0x00010000 -#define FILE_TYPE_UTILITY_SYMLINK 0x00020000 -#define FILE_TYPE_XMODULE_SHARED_LIB 0x00040000 -#define FILE_TYPE_XMODULE_SYMLINK 0x00080000 +#define FILE_TYPE_MASK 0x00000000ffffffffULL + +#define FILE_TYPE_KERNEL_MODULE_SRC 0x0000000000000001ULL +#define FILE_TYPE_KERNEL_MODULE_CMD 0x0000000000000002ULL +#define FILE_TYPE_OPENGL_HEADER 0x0000000000000004ULL +#define FILE_TYPE_OPENGL_LIB 0x0000000000000008ULL +#define FILE_TYPE_XLIB_STATIC_LIB 0x0000000000000010ULL +#define FILE_TYPE_XLIB_SHARED_LIB 0x0000000000000020ULL +#define FILE_TYPE_DOCUMENTATION 0x0000000000000040ULL +#define FILE_TYPE_OPENGL_SYMLINK 0x0000000000000080ULL +#define FILE_TYPE_XLIB_SYMLINK 0x0000000000000100ULL +#define FILE_TYPE_KERNEL_MODULE 0x0000000000000200ULL +#define FILE_TYPE_INSTALLER_BINARY 0x0000000000000400ULL +#define FILE_TYPE_UTILITY_BINARY 0x0000000000000800ULL +#define FILE_TYPE_LIBGL_LA 0x0000000000001000ULL +#define FILE_TYPE_TLS_LIB 0x0000000000002000ULL +#define FILE_TYPE_TLS_SYMLINK 0x0000000000004000ULL +#define FILE_TYPE_UTILITY_LIB 0x0000000000008000ULL +#define FILE_TYPE_DOT_DESKTOP 0x0000000000010000ULL +#define FILE_TYPE_UTILITY_LIB_SYMLINK 0x0000000000020000ULL +#define FILE_TYPE_XMODULE_SHARED_LIB 0x0000000000040000ULL +#define FILE_TYPE_XMODULE_SYMLINK 0x0000000000080000ULL /* Create a symlink only if the file doesn't exist */ -#define FILE_TYPE_XMODULE_NEWSYM 0x00100000 -#define FILE_TYPE_MANPAGE 0x00200000 -#define FILE_TYPE_CUDA_HEADER 0x00400000 -#define FILE_TYPE_CUDA_LIB 0x00800000 -#define FILE_TYPE_CUDA_SYMLINK 0x01000000 +#define FILE_TYPE_XMODULE_NEWSYM 0x0000000000100000ULL +#define FILE_TYPE_MANPAGE 0x0000000000200000ULL +#define FILE_TYPE_CUDA_HEADER 0x0000000000400000ULL +#define FILE_TYPE_CUDA_LIB 0x0000000000800000ULL +#define FILE_TYPE_CUDA_SYMLINK 0x0000000001000000ULL +#define FILE_TYPE_VDPAU_LIB 0x0000000002000000ULL +#define FILE_TYPE_VDPAU_SYMLINK 0x0000000004000000ULL +#define FILE_TYPE_VDPAU_HEADER 0x0000000008000000ULL +#define FILE_TYPE_UTILITY_BIN_SYMLINK 0x0000000010000000ULL /* file class: this is used to distinguish OpenGL libraries */ -#define FILE_CLASS_MASK 0xfe000000 +#define FILE_CLASS_MASK 0xf000000000000000ULL -#define FILE_CLASS_NEW_TLS 0x02000000 -#define FILE_CLASS_CLASSIC_TLS 0x04000000 -#define FILE_CLASS_NATIVE 0x08000000 -#define FILE_CLASS_COMPAT32 0x10000000 +#define FILE_CLASS_NEW_TLS 0x1000000000000000ULL +#define FILE_CLASS_CLASSIC_TLS 0x2000000000000000ULL +#define FILE_CLASS_NATIVE 0x4000000000000000ULL +#define FILE_CLASS_COMPAT32 0x8000000000000000ULL #define FILE_TYPE_XLIB_LIB (FILE_TYPE_XLIB_STATIC_LIB | \ FILE_TYPE_XLIB_SHARED_LIB) @@ -349,7 +354,9 @@ typedef struct { FILE_TYPE_UTILITY_BINARY | \ FILE_TYPE_LIBGL_LA | \ FILE_TYPE_XMODULE_LIB | \ - FILE_TYPE_DOT_DESKTOP) + FILE_TYPE_DOT_DESKTOP | \ + FILE_TYPE_VDPAU_LIB | \ + FILE_TYPE_VDPAU_HEADER) #define FILE_TYPE_HAVE_PATH (FILE_TYPE_XMODULE_LIB | \ FILE_TYPE_XMODULE_SYMLINK | \ @@ -360,7 +367,8 @@ typedef struct { FILE_TYPE_TLS_LIB | \ FILE_TYPE_TLS_SYMLINK | \ FILE_TYPE_DOT_DESKTOP | \ - FILE_TYPE_DOCUMENTATION) + FILE_TYPE_DOCUMENTATION | \ + FILE_TYPE_VDPAU_HEADER) #define FILE_TYPE_HAVE_ARCH (FILE_TYPE_OPENGL_LIB | \ FILE_TYPE_CUDA_LIB | \ @@ -368,7 +376,9 @@ typedef struct { FILE_TYPE_CUDA_SYMLINK | \ FILE_TYPE_LIBGL_LA | \ FILE_TYPE_TLS_LIB | \ - FILE_TYPE_TLS_SYMLINK) + FILE_TYPE_TLS_SYMLINK | \ + FILE_TYPE_VDPAU_SYMLINK | \ + FILE_TYPE_VDPAU_LIB) #define FILE_TYPE_HAVE_CLASS (FILE_TYPE_TLS_LIB | \ FILE_TYPE_TLS_SYMLINK) @@ -378,7 +388,9 @@ typedef struct { FILE_TYPE_XLIB_SYMLINK | \ FILE_TYPE_TLS_SYMLINK | \ FILE_TYPE_XMODULE_SYMLINK | \ - FILE_TYPE_UTILITY_SYMLINK) + FILE_TYPE_UTILITY_LIB_SYMLINK| \ + FILE_TYPE_UTILITY_BIN_SYMLINK| \ + FILE_TYPE_VDPAU_SYMLINK) #define FILE_TYPE_NEWSYM (FILE_TYPE_XMODULE_NEWSYM) @@ -393,7 +405,8 @@ typedef struct { FILE_TYPE_XLIB_SHARED_LIB | \ FILE_TYPE_TLS_LIB | \ FILE_TYPE_XMODULE_SHARED_LIB | \ - FILE_TYPE_UTILITY_LIB) + FILE_TYPE_UTILITY_LIB | \ + FILE_TYPE_VDPAU_LIB) #define TLS_LIB_TYPE_FORCED 0x0001 #define TLS_LIB_NEW_TLS 0x0002 @@ -419,7 +432,6 @@ typedef struct { * command line. */ #define DEFAULT_OPENGL_PREFIX "/usr" -#define DEFAULT_CUDA_PREFEIX "/usr" #define DEFAULT_X_PREFIX "/usr/X11R6" #define DEFAULT_UTILITY_PREFIX "/usr" #define DEFAULT_DOCUMENTATION_PREFIX "/usr" @@ -503,7 +515,7 @@ void add_package_entry(Package *p, char *name, char *target, char *dst, - unsigned int flags, + uint64_t flags, mode_t mode); /* XXX */ diff --git a/public.mk b/public.mk new file mode 100644 index 0000000..fee02e3 --- /dev/null +++ b/public.mk @@ -0,0 +1,278 @@ +# +# nvidia-installer: A tool for installing NVIDIA software packages on +# Unix and Linux systems. +# +# Copyright (C) 2008 NVIDIA Corporation +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the: +# +# Free Software Foundation, Inc. +# 59 Temple Place - Suite 330 +# Boston, MA 02111-1307, USA +# +# +# Makefile +# + + +############################################################################## +# include common variables and functions +############################################################################## + +include utils.mk + + +############################################################################## +# The calling Makefile may export any of the following variables; we +# assign default values if they are not exported by the caller +############################################################################## + + +NCURSES_CFLAGS ?= +NCURSES_LDFLAGS ?= +PCI_CFLAGS ?= +PCI_LDFLAGS ?= + + +############################################################################## +# assign variables +############################################################################## + +NVIDIA_INSTALLER = $(OUTPUTDIR)/nvidia-installer +MKPRECOMPILED = $(OUTPUTDIR)/mkprecompiled + +NVIDIA_INSTALLER_PROGRAM_NAME = "nvidia-installer" + +NVIDIA_INSTALLER_VERSION := $(NVIDIA_VERSION) + +NCURSES_UI_C = ncurses-ui.c +NCURSES_UI_SO = $(OUTPUTDIR)/nvidia-installer-ncurses-ui.so +NCURSES_UI_SO_C = $(OUTPUTDIR)/g_$(notdir $(NCURSES_UI_SO:.so=.c)) + +TLS_TEST_C = $(OUTPUTDIR)/g_tls_test.c +TLS_TEST_DSO_C = $(OUTPUTDIR)/g_tls_test_dso.c +TLS_TEST = tls_test_$(TARGET_OS)-$(TARGET_ARCH) +TLS_TEST_DSO_SO = tls_test_dso_$(TARGET_OS)-$(TARGET_ARCH).so + +TLS_TEST_32_C = $(OUTPUTDIR)/g_tls_test_32.c +TLS_TEST_DSO_32_C = $(OUTPUTDIR)/g_tls_test_dso_32.c +TLS_TEST_32 = tls_test_$(TARGET_OS)-x86 +TLS_TEST_DSO_SO_32 = tls_test_dso_$(TARGET_OS)-x86.so + +RTLD_TEST_C = $(OUTPUTDIR)/g_rtld_test.c +RTLD_TEST = rtld_test_$(TARGET_OS)-$(TARGET_ARCH) + +RTLD_TEST_32_C = $(OUTPUTDIR)/g_rtld_test_32.c +RTLD_TEST_32 = rtld_test_$(TARGET_OS)-x86 + +GEN_UI_ARRAY = $(OUTPUTDIR)/gen-ui-array +CONFIG_H = $(OUTPUTDIR)/config.h + +MANPAGE = $(OUTPUTDIR)/nvidia-installer.1 +GEN_MANPAGE_OPTS = $(OUTPUTDIR)/gen-manpage-opts +OPTIONS_1_INC = $(OUTPUTDIR)/options.1.inc + +# Setup some architecture specific build options +ifeq ($(TARGET_OS)-$(TARGET_ARCH), Linux-x86_64) + TLS_MODEL = initial-exec + PIC = -fPIC + CFLAGS += -DNV_X86_64 + # Only Linux-x86_64 needs the tls_test_32 files + COMPAT_32_SRC = $(TLS_TEST_32_C) $(TLS_TEST_DSO_32_C) \ + $(RTLD_TEST_32_C) +else + # So far all other platforms use local-exec + TLS_MODEL = local-exec + PIC = + # Non-Linux-x86_64 platforms do not include the tls_test_32 files + COMPAT_32_SRC = +endif + +# include the list of source files; defines SRC +include dist-files.mk + +INSTALLER_SRC = $(SRC) $(NCURSES_UI_SO_C) $(TLS_TEST_C) $(TLS_TEST_DSO_C) \ + $(RTLD_TEST_C) $(COMPAT_32_SRC) $(STAMP_C) + +INSTALLER_OBJS = $(call BUILD_OBJECT_LIST,$(INSTALLER_SRC)) + +CFLAGS += -I. -imacros $(CONFIG_H) -I $(OUTPUTDIR) +HOST_CFLAGS += -I. -imacros $(CONFIG_H) -I $(OUTPUTDIR) +LDFLAGS += -L. -ldl + +MKPRECOMPILED_SRC = crc.c mkprecompiled.c +MKPRECOMPILED_OBJS = $(call BUILD_OBJECT_LIST,$(MKPRECOMPILED_SRC)) + +ALL_SRC = $(sort $(INSTALLER_SRC) $(NCURSES_UI_C) $(MKPRECOMPILED_SRC)) + +# define a quiet rule for GEN-UI-ARRAY +quiet_GEN_UI_ARRAY = GEN-UI-ARRAY $@ + + +############################################################################## +# build rules +############################################################################## + +.PNONY: all install NVIDIA_INSTALLER_install MKPRECOMPILED_install \ + MANPAGE_install clean clobber + +all: $(NVIDIA_INSTALLER) $(MKPRECOMPILED) $(MANPAGE) + +install: NVIDIA_INSTALLER_install MKPRECOMPILED_install MANPAGE_install + +NVIDIA_INSTALLER_install: $(NVIDIA_INSTALLER) + $(MKDIR) $(bindir) + $(INSTALL) $(INSTALL_BIN_ARGS) $< $(bindir)/$(notdir $<) + +MKPRECOMPILED_install: $(MKPRECOMPILED) + $(MKDIR) $(bindir) + $(INSTALL) $(INSTALL_BIN_ARGS) $< $(bindir)/$(notdir $<) + +MANPAGE_install: $(MANPAGE) + $(MKDIR) $(mandir) + $(INSTALL) $(INSTALL_DOC_ARGS) $< $(mandir)/$(notdir $<) + gzip -9f $(mandir)/$(notdir $(MANPAGE)) + +$(MKPRECOMPILED): $(MKPRECOMPILED_OBJS) + $(call quiet_cmd,LINK) -o $@ \ + $(MKPRECOMPILED_OBJS) $(CFLAGS) $(LDFLAGS) $(BIN_LDFLAGS) && \ + $(STRIP) $@ + +$(NVIDIA_INSTALLER): $(INSTALLER_OBJS) + $(call quiet_cmd,LINK) -o $@ $(INSTALLER_OBJS) $(CFLAGS) $(LDFLAGS) \ + -Bstatic $(PCI_LDFLAGS) -lpci -Bdynamic $(BIN_LDFLAGS) && \ + $(STRIP) $@ + +$(GEN_UI_ARRAY): gen-ui-array.c $(CONFIG_H) + $(call quiet_cmd,HOST_CC) -o $@ $< $(HOST_CFLAGS) $(HOST_LDFLAGS) \ + $(HOST_BIN_LDFLAGS) + +$(NCURSES_UI_SO): $(call BUILD_OBJECT_LIST,ncurses-ui.c) + $(call quiet_cmd,LINK) -o $@ -shared $< \ + $(NCURSES_LDFLAGS) -lncurses \ + $(CFLAGS) $(LDFLAGS) $(BIN_LDFLAGS) + +$(NCURSES_UI_SO_C): $(GEN_UI_ARRAY) $(NCURSES_UI_SO) + $(call quiet_cmd,GEN_UI_ARRAY) $(NCURSES_UI_SO) ncurses_ui_array > $@ + +$(TLS_TEST_C): $(GEN_UI_ARRAY) $(TLS_TEST) + $(call quiet_cmd,GEN_UI_ARRAY) $(TLS_TEST) tls_test_array > $@ + +$(TLS_TEST_DSO_C): $(GEN_UI_ARRAY) $(TLS_TEST_DSO_SO) + $(call quiet_cmd,GEN_UI_ARRAY) \ + $(TLS_TEST_DSO_SO) tls_test_dso_array > $@ + +$(TLS_TEST_32_C): $(GEN_UI_ARRAY) $(TLS_TEST_32) + $(call quiet_cmd,GEN_UI_ARRAY) $(TLS_TEST_32) tls_test_array_32 > $@ + +$(TLS_TEST_DSO_32_C): $(GEN_UI_ARRAY) $(TLS_TEST_DSO_SO_32) + $(call quiet_cmd,GEN_UI_ARRAY) \ + $(TLS_TEST_DSO_SO_32) tls_test_dso_array_32 > $@ + +$(RTLD_TEST_C): $(GEN_UI_ARRAY) $(RTLD_TEST) + $(call quiet_cmd,GEN_UI_ARRAY) $(RTLD_TEST) rtld_test_array > $@ + +$(RTLD_TEST_32_C): $(GEN_UI_ARRAY) $(RTLD_TEST_32) + $(call quiet_cmd,GEN_UI_ARRAY) $(RTLD_TEST_32) rtld_test_array_32 > $@ + +# misc.c includes pci.h +$(call BUILD_OBJECT_LIST,misc.c): CFLAGS += $(PCI_CFLAGS) + +# ncurses-ui.c includes ncurses.h +$(call BUILD_OBJECT_LIST,ncurses-ui.c): CFLAGS += $(NCURSES_CFLAGS) -fPIC + +# define the rule to build each object file +$(foreach src,$(ALL_SRC),$(eval $(call DEFINE_OBJECT_RULE,CC,$(src)))) + +# define the rule to generate $(STAMP_C) +$(eval $(call DEFINE_STAMP_C_RULE, $(INSTALLER_OBJS), $(NVIDIA_INSTALLER_PROGRAM_NAME))) + +$(CONFIG_H): $(bootstrap) + @ $(RM) -f $@ + @ $(ECHO) "#define INSTALLER_OS \"$(TARGET_OS)\"" >> $@ + @ $(ECHO) "#define INSTALLER_ARCH \"$(TARGET_ARCH)\"" >> $@ + @ $(ECHO) -n "#define NVIDIA_INSTALLER_VERSION " >> $@ + @ $(ECHO) "\"$(NVIDIA_INSTALLER_VERSION)\"" >> $@ + @ $(ECHO) -n "#define PROGRAM_NAME " >> $@ + @ $(ECHO) "\"$(NVIDIA_INSTALLER_PROGRAM_NAME)\"" >> $@ + +$(INSTALLER_OBJS): $(CONFIG_H) + +clean clobber: + rm -rf $(OUTPUTDIR) + + +############################################################################## +# rule to rebuild tls_test and tls_test_dso; a precompiled tls_test +# and tls_test_dso is distributed with nvidia_installer because they +# require a recent toolchain to build. +############################################################################## + +rebuild_tls_test: tls_test.c + gcc -Wall -O2 -fomit-frame-pointer -o $(TLS_TEST) -ldl $< + strip $(TLS_TEST) + +rebuild_tls_test_dso: tls_test_dso.c + gcc -Wall -O2 $(PIC) -fomit-frame-pointer -c $< \ + -ftls-model=$(TLS_MODEL) + gcc -o $(TLS_TEST_DSO_SO) -shared tls_test_dso.o + strip $(TLS_TEST_DSO_SO) + +# dummy rule to override implicit rule that builds tls_test from +# tls_test.c + +tls_test: tls_test.c + touch $@ + +# rule to rebuild rtld_test; a precompiled rtld_test is distributed with +# nvidia-installer to simplify x86-64 builds. + +rebuild_rtld_test: rtld_test.c + gcc -Wall -O2 -fomit-frame-pointer -o $(RTLD_TEST) -lGL $< + strip $(RTLD_TEST) + +# dummy rule to override implicit rule that builds dls_test from +# rtld_test.c + +rtld_test: rtld_test.c + touch $@ + + +############################################################################## +# Documentation +############################################################################## + +AUTO_TEXT = ".\\\" WARNING: THIS FILE IS AUTO-GENERATED! Edit $< instead." + +doc: $(MANPAGE) + +$(eval $(call DEFINE_OBJECT_RULE,HOST_CC,gen-manpage-opts.c)) + +$(GEN_MANPAGE_OPTS): $(call BUILD_OBJECT_LIST,gen-manpage-opts.c) + $(call quiet_cmd,HOST_LINK) $< -o $@ \ + $(HOST_CFLAGS) $(HOST_LDFLAGS) $(HOST_BIN_LDFLAGS) + +$(OPTIONS_1_INC): $(GEN_MANPAGE_OPTS) + @./$< > $@ + +$(MANPAGE): nvidia-installer.1.m4 $(OPTIONS_1_INC) + $(call quiet_cmd,M4) \ + -D__HEADER__=$(AUTO_TEXT) \ + -D__VERSION__=$(NVIDIA_INSTALLER_VERSION) \ + -D__TARGET_OS__="$(TARGET_OS)" \ + -D__TARGET_ARCH__="$(TARGET_ARCH)" \ + -D__DRIVER_VERSION__="$(NVIDIA_VERSION)" \ + -D__OUTPUTDIR__=$(OUTPUTDIR) \ + -I $(OUTPUTDIR) \ + $< > $@ |