diff options
author | Aaron Plattner <aplattner@nvidia.com> | 2014-11-13 08:51:31 -0800 |
---|---|---|
committer | Aaron Plattner <aplattner@nvidia.com> | 2014-11-13 08:51:31 -0800 |
commit | e086acf7e6425022750a4b9f502516e5654be422 (patch) | |
tree | 64dfbac103c807e76cc15101a0ca0ab5b72d0cd5 | |
parent | 8d2e6576974ad1425c7020483150b88a8748a66f (diff) |
346.16346.16
-rw-r--r-- | XF86Config-parser/Generate.c | 18 | ||||
-rw-r--r-- | common-utils/common-utils.c | 98 | ||||
-rw-r--r-- | common-utils/common-utils.h | 5 | ||||
-rw-r--r-- | common-utils/nvgetopt.c | 16 | ||||
-rw-r--r-- | nvidia-xconfig.h | 2 | ||||
-rw-r--r-- | util.c | 17 | ||||
-rw-r--r-- | utils.mk | 90 | ||||
-rw-r--r-- | version.mk | 2 |
8 files changed, 192 insertions, 56 deletions
diff --git a/XF86Config-parser/Generate.c b/XF86Config-parser/Generate.c index cdd7054..9e1db27 100644 --- a/XF86Config-parser/Generate.c +++ b/XF86Config-parser/Generate.c @@ -1313,13 +1313,10 @@ static char *xconfigGetDefaultProjectRoot(void) * get_xserver_information() - parse the versionString (from `X * -version`) and assign relevant information that we infer from the X * server version. - * - * Note: this implementation should be shared with nvidia-installer */ static int get_xserver_information(const char *versionString, int *isXorg, - int *isModular, int *autoloadsGLX, int *supportsExtensionSection, int *xineramaPlusCompositeWorks) @@ -1334,7 +1331,6 @@ static int get_xserver_information(const char *versionString, if (strstr(versionString, "XFree86 Version")) { *isXorg = FALSE; - *isModular = FALSE; *autoloadsGLX = FALSE; *supportsExtensionSection = FALSE; *xineramaPlusCompositeWorks = FALSE; @@ -1365,17 +1361,6 @@ static int get_xserver_information(const char *versionString, if (!found) return FALSE; /* - * isModular: X.Org X11R6.x X servers are monolithic, all others - * are modular - */ - - if (major == 6) { - *isModular = FALSE; - } else { - *isModular = TRUE; - } - - /* * supportsExtensionSection: support for the "Extension" xorg.conf * section was added between X.Org 6.7 and 6.8. To account for * the X server version wrap, it is easier to check for X servers @@ -1443,7 +1428,7 @@ void xconfigGetXServerInUse(GenerateOptions *gop) FILE *stream = NULL; int xserver = -1; int isXorg; - int dummy, len, found; + int len, found; char *cmd, *ptr, *ret; gop->supports_extension_section = FALSE; @@ -1476,7 +1461,6 @@ void xconfigGetXServerInUse(GenerateOptions *gop) found = get_xserver_information(buf, &isXorg, - &dummy, /* isModular */ &gop->autoloads_glx, &gop->supports_extension_section, &gop->xinerama_plus_composite_works); diff --git a/common-utils/common-utils.c b/common-utils/common-utils.c index f581f0d..81fd7ed 100644 --- a/common-utils/common-utils.c +++ b/common-utils/common-utils.c @@ -522,6 +522,68 @@ char *nv_basename(const char *path) } +/* + * nv_mkdir_recursive() - make a directory and all parent directories as needed. + * dir_list is an optional arguments that if not empty, will be set to a string + * containing a newline separated list of all directories created. + */ +int nv_mkdir_recursive(const char *path, const mode_t mode, + char **error_str, char **dir_list) +{ + char *c, *tmp, ch, *list; + int success = FALSE; + + if (!path || !path[0]) { + return FALSE; + } + + tmp = nvstrdup(path); + remove_trailing_slashes(tmp); + + list = NULL; + + c = tmp; + do { + c++; + if ((*c == '/') || (*c == '\0')) { + ch = *c; + *c = '\0'; + if (!directory_exists(tmp)) { + char *tmplist; + if (mkdir(tmp, mode) != 0) { + *error_str = + nvasprintf("Failure creating directory '%s' : (%s)", + tmp, strerror(errno)); + goto done; + } + /* Prepend the created directory path to a running list */ + if (dir_list) { + tmplist = list; + list = nvstrcat(tmp, "\n", tmplist, NULL); + free(tmplist); + } + } + *c = ch; + } + } while (*c); + + /* Log any created directories */ + if (dir_list && list) { + *dir_list = list; + } + + success = TRUE; + + done: + + if (!dir_list) { + free(list); + } + free(tmp); + return success; +} + + /****************************************************************************/ /* string helper functions */ /****************************************************************************/ @@ -611,3 +673,39 @@ char *nv_trim_char_strict(char *string, char trim) { return NULL; } +/* + * directory_exists() - test whether the given directory exists + */ + +int directory_exists(const char *dir) +{ + struct stat stat_buf; + + if ((stat (dir, &stat_buf) == -1) || (!S_ISDIR(stat_buf.st_mode))) { + return FALSE; + } else { + return TRUE; + } +} + +/* + * remove_trailing_slashes() - begin at the end of the given string, + * and overwrite slashes with NULL as long as we find slashes. + */ + +void remove_trailing_slashes(char *string) +{ + int len; + + if (string == NULL) { + return; + } + + len = strlen(string); + + while (string[len-1] == '/') { + string[--len] = '\0'; + } + +} + diff --git a/common-utils/common-utils.h b/common-utils/common-utils.h index 3db71b6..709ff02 100644 --- a/common-utils/common-utils.h +++ b/common-utils/common-utils.h @@ -62,10 +62,15 @@ int nv_get_file_length(const char *filename); void nv_set_file_length(const char *filename, int fd, int len); void *nv_mmap(const char *filename, size_t len, int prot, int flags, int fd); char *nv_basename(const char *path); +int nv_mkdir_recursive(const char *path, const mode_t mode, + char **error_str, char **log_str); char *nv_trim_space(char *string); char *nv_trim_char(char *string, char trim); char *nv_trim_char_strict(char *string, char trim); +void remove_trailing_slashes(char *string); + +int directory_exists(const char *dir); #if defined(__GNUC__) # define NV_INLINE __inline__ diff --git a/common-utils/nvgetopt.c b/common-utils/nvgetopt.c index 1c6c9b8..aaebd78 100644 --- a/common-utils/nvgetopt.c +++ b/common-utils/nvgetopt.c @@ -42,6 +42,7 @@ int nvgetopt(int argc, int ret = 0; int negate = NVGETOPT_FALSE; int disable = NVGETOPT_FALSE; + int double_dash = NVGETOPT_FALSE; const NVGetoptOption *o = NULL; static int argv_index = 0; @@ -65,6 +66,7 @@ int nvgetopt(int argc, if ((arg[0] == '-') && (arg[1] == '-')) { name = arg + 2; + double_dash = NVGETOPT_TRUE; } else if (arg[0] == '-') { name = arg + 1; } else { @@ -80,16 +82,26 @@ int nvgetopt(int argc, c = name; while (*c) { - if (*c == '=') { argument = c + 1; *c = '\0'; break; } + if (*c == '=') { + argument = c + 1; + *c = '\0'; + break; + } c++; } /* + * if there is no character after '--' then stop processing options. * if the string is terminated after one character, interpret it * as a short option. Otherwise, interpret it as a long option. */ - if (name[1] == '\0') { /* short option */ + if (name[0] == '\0') { + if (double_dash && argument == NULL) { /* option list terminator */ + ret = -1; + goto done; + } + } else if (name[1] == '\0') { /* short option */ for (i = 0; options[i].name; i++) { if (options[i].val == name[0]) { o = &options[i]; diff --git a/nvidia-xconfig.h b/nvidia-xconfig.h index 85ae21e..2c7fbd1 100644 --- a/nvidia-xconfig.h +++ b/nvidia-xconfig.h @@ -198,8 +198,6 @@ typedef struct { int copy_file(const char *srcfile, const char *dstfile, mode_t mode); -int directory_exists(const char *dir); - /* make_usable.c */ int update_modules(XConfigPtr config); @@ -128,23 +128,6 @@ int copy_file(const char *srcfile, const char *dstfile, mode_t mode) /* - * directory_exists() - - */ - -int directory_exists(const char *dir) -{ - struct stat stat_buf; - - if ((stat (dir, &stat_buf) == -1) || (!S_ISDIR(stat_buf.st_mode))) { - return FALSE; - } else { - return TRUE; - } -} /* directory_exists() */ - - - -/* * xconfigPrint() - this is the one entry point that a user of the * XF86Config-Parser library must provide. */ @@ -55,6 +55,7 @@ endif INSTALL ?= install INSTALL_BIN_ARGS ?= -m 755 +INSTALL_LIB_ARGS ?= -m 644 INSTALL_DOC_ARGS ?= -m 644 M4 ?= m4 @@ -98,6 +99,26 @@ ifndef TARGET_ARCH TARGET_ARCH := $(subst i686,x86,$(TARGET_ARCH)) endif +ifeq ($(TARGET_ARCH),x86) + CFLAGS += -DNV_X86 -DNV_ARCH_BITS=32 +endif + +ifeq ($(TARGET_ARCH),x86_64) + CFLAGS += -DNV_X86_64 -DNV_ARCH_BITS=64 +endif + +ifeq ($(TARGET_ARCH),armv7l) + CFLAGS += -DNV_ARMV7 -DNV_ARCH_BITS=32 +endif + +ifeq ($(TARGET_ARCH),aarch64) + CFLAGS += -DNV_AARCH64 -DNV_ARCH_BITS=64 +endif + +ifeq ($(TARGET_ARCH),ppc64le) + CFLAGS += -DNV_PPC64LE -DNV_ARCH_BITS=64 +endif + ifeq ($(TARGET_OS),Linux) LIBDL_LIBS = -ldl else @@ -113,6 +134,14 @@ ifeq ($(TARGET_ARCH),armv7l) endif TARGET_ARCH_ABI ?= +ifeq ($(TARGET_ARCH_ABI),gnueabi) + CFLAGS += -DNV_GNUEABI +endif + +ifeq ($(TARGET_ARCH_ABI),gnueabihf) + CFLAGS += -DNV_GNUEABIHF +endif + OUTPUTDIR ?= _out/$(TARGET_OS)_$(TARGET_ARCH) OUTPUTDIR_ABSOLUTE ?= $(CURDIR)/$(OUTPUTDIR) @@ -143,6 +172,7 @@ endif PREFIX ?= /usr/local BINDIR = $(DESTDIR)$(PREFIX)/bin +LIBDIR = $(DESTDIR)$(PREFIX)/lib MANDIR = $(DESTDIR)$(PREFIX)/share/man/man1 @@ -230,7 +260,7 @@ NV_MODULE_LOGGING_NAME ?= ifeq ($(NV_VERBOSE),0) quiet_cmd = @$(PRINTF) \ - " $(if $(NV_MODULE_LOGGING_NAME),[ %-17.17s ],%s) $(quiet_$(1))\n" \ + " $(if $(NV_MODULE_LOGGING_NAME),[ %-17.17s ],%s) $(quiet_$(1))\n" \ "$(NV_MODULE_LOGGING_NAME)" && $($(1)) else quiet_cmd = $($(1)) @@ -262,32 +292,49 @@ quiet_STRIP_CMD = $(call define_quiet_cmd,STRIP ,$@) ############################################################################## # function to generate a list of object files from their corresponding -# source files; example usage: +# source files using the specified path. The _WITH_DIR variant takes an +# output path as the second argument while the BUILD_OBJECT_LIST defaults +# to using the value of OUTPUTDIR as the output path. example usage: # -# OBJS = $(call BUILD_OBJECT_LIST,$(SRC)) +# OBJS = $(call BUILD_OBJECT_LIST_WITH_DIR,$(SRC),$(DIR)) ############################################################################## +BUILD_OBJECT_LIST_WITH_DIR = \ + $(addprefix $(2)/,$(notdir $(addsuffix .o,$(basename $(1))))) + BUILD_OBJECT_LIST = \ - $(addprefix $(OUTPUTDIR)/,$(notdir $(addsuffix .o,$(basename $(1))))) + $(call BUILD_OBJECT_LIST_WITH_DIR,$(1),$(OUTPUTDIR)) ############################################################################## # function to generate a list of dependency files from their -# corresponding source files; example usage: +# corresponding source files using the specified path. The _WITH_DIR +# variant takes an output path as the second argument while the +# BUILD_DEPENDENCY_LIST default to using the value of OUTPUTDIR as the +# output path. example usage: # -# DEPS = $(call BUILD_DEPENDENCY_LIST,$(SRC)) +# DEPS = $(call BUILD_DEPENDENCY_LIST_WITH_DIR,$(SRC),$(DIR)) ############################################################################## +BUILD_DEPENDENCY_LIST_WITH_DIR = \ + $(addprefix $(2)/,$(notdir $(addsuffix .d,$(basename $(1))))) + BUILD_DEPENDENCY_LIST = \ - $(addprefix $(OUTPUTDIR)/,$(notdir $(addsuffix .d,$(basename $(1))))) + $(call BUILD_DEPENDENCY_LIST_WITH_DIR,$(1),$(OUTPUTDIR)) ############################################################################## # functions to define a rule to build an object file; the first -# argument whether the rule is for the target or host platform ("HOST" -# or "TARGET"), the second argument is the source file to compile, and -# the third argument (_WITH_OBJECT_NAME-only) is the object filename -# to produce. Example usage: +# argument for all functions is whether the rule is for the target or +# host platform ("HOST" or "TARGET"), the second argument for all +# functions is the source file to compile. +# +# The _WITH_OBJECT_NAME and _WITH_DIR function name suffixes describe +# the third and possibly fourth arguments based on order. The +# _WITH_OBJECT_NAME argument is the object filename to produce while +# the _WITH_DIR argument is the destination path for the object file. +# +# Example usage: # # $(eval $(call DEFINE_OBJECT_RULE,TARGET,foo.c)) # @@ -299,26 +346,35 @@ BUILD_DEPENDENCY_LIST = \ # from the source file name (this is normally what you want). ############################################################################## -define DEFINE_OBJECT_RULE_WITH_OBJECT_NAME +define DEFINE_OBJECT_RULE_WITH_OBJECT_NAME_WITH_DIR $(3): $(2) - @$(MKDIR) $(OUTPUTDIR) + @$(MKDIR) $(4) $$(call quiet_cmd,$(call host_target_cc,$(1))) \ $$($(call host_target_cflags,$(1))) -c $$< -o $$@ \ $(call AUTO_DEP_CMD,$(1),$(2),$(3)) - -include $$(call BUILD_DEPENDENCY_LIST,$(3)) + -include $$(call BUILD_DEPENDENCY_LIST_WITH_DIR,$(3),$(4)) # declare empty rule for generating dependency file; we generate the # dependency files implicitly when compiling the source file (see # AUTO_DEP_CMD above), so we don't want gmake to spend time searching # for an explicit rule to generate the dependency file - $$(call BUILD_DEPENDENCY_LIST,$(3)): ; + $$(call BUILD_DEPENDENCY_LIST_WITH_DIR,$(3),$(4)): ; + +endef + +define DEFINE_OBJECT_RULE_WITH_OBJECT_NAME + $$(eval $$(call DEFINE_OBJECT_RULE_WITH_OBJECT_NAME_WITH_DIR,$(1),$(2),\ + $(3),$(OUTPUTDIR))) +endef +define DEFINE_OBJECT_RULE_WITH_DIR + $$(eval $$(call DEFINE_OBJECT_RULE_WITH_OBJECT_NAME_WITH_DIR,$(1),$(2),\ + $$(call BUILD_OBJECT_LIST_WITH_DIR,$(2),$(3)),$(3))) endef define DEFINE_OBJECT_RULE - $$(eval $$(call DEFINE_OBJECT_RULE_WITH_OBJECT_NAME,$(1),$(2),\ - $$(call BUILD_OBJECT_LIST,$(2)))) + $$(eval $$(call DEFINE_OBJECT_RULE_WITH_DIR,$(1),$(2),$(OUTPUTDIR))) endef @@ -1 +1 @@ -NVIDIA_VERSION = 343.22 +NVIDIA_VERSION = 346.16 |