diff options
author | Anthony G. Basile <blueness@gentoo.org> | 2012-11-23 18:56:16 -0500 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2012-11-23 18:56:16 -0500 |
commit | 6cb86c3a330caedc323599cb11fbed4138958271 (patch) | |
tree | 6b0f1e44d69ed1d043b23f5f64e9f7e8b9830c07 | |
parent | e5cc2b881fd1db175b0d80bcccf21ae70857a532 (diff) |
Propagation of configured installation paths to Makefile.am and .c code
This commit is a continuation of the previous one in which all the configured
paths obtained in configure.ac are propagated to the Makefile.am and .c files
via AM_CPPFLAGS of the form -DUDEV_CONF_FILE=\"$(udevconffile)\". This should
address the issue in
https://github.com/gentoo/eudev/issues/17
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
-rw-r--r-- | configure.ac | 12 | ||||
-rw-r--r-- | keymaps-force-release/Makefile.am | 4 | ||||
-rw-r--r-- | src/keymap/Makefile.am | 2 | ||||
-rw-r--r-- | src/keymap/keymap.c | 2 | ||||
-rw-r--r-- | src/libudev/Makefile.am | 2 | ||||
-rw-r--r-- | src/libudev/libudev-hwdb.c | 10 | ||||
-rw-r--r-- | src/libudev/libudev.c | 6 | ||||
-rw-r--r-- | src/udev/Makefile.am | 5 | ||||
-rw-r--r-- | src/udev/udev-event.c | 2 | ||||
-rw-r--r-- | src/udev/udev-rules.c | 4 | ||||
-rw-r--r-- | src/udev/udevadm-hwdb.c | 11 |
11 files changed, 33 insertions, 27 deletions
diff --git a/configure.ac b/configure.ac index ee6084c7f4..17b0325d10 100644 --- a/configure.ac +++ b/configure.ac @@ -145,12 +145,12 @@ AC_SUBST([udevlibexecdir], [${with_rootlibdir}/udev]) # sysconfdir paths AC_SUBST([udevconfdir],[${sysconfdir}/udev]) -AC_SUBST([udevhwdbdir],[${sysconfdir}/hwdb.d]) -AC_SUBST([udevkeymapdir],[${sysconfdir}/keymaps]) -AC_SUBST([udevkeymapforcereldir],[${sysconfdir}/keymaps/force-release]) - -# libexecdir paths -AC_SUBST([udevrulesdir],[${udevlibexecdir}/rules.d]) +AC_SUBST([udevconffile],[${udevconfdir}/udev.conf]) +AC_SUBST([udevhwdbdir],[${udevconfdir}/hwdb.d]) +AC_SUBST([udevhwdbbin],[${udevconfdir}/hwdb.bin]) +AC_SUBST([udevkeymapdir],[${udevconfdir}/keymaps]) +AC_SUBST([udevkeymapforceredir],[${udevkeymapdir}/force-release]) +AC_SUBST([udevrulesdir],[${udevconfdir}/rules.d]) # pkgconfigdir paths AC_SUBST([sharepkgconfigdir],[${datadir}/pkgconfig]) diff --git a/keymaps-force-release/Makefile.am b/keymaps-force-release/Makefile.am index 5b2bb8e29b..9f156bc126 100644 --- a/keymaps-force-release/Makefile.am +++ b/keymaps-force-release/Makefile.am @@ -1,8 +1,8 @@ ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} -udevkeymapforcereldir = @udevkeymapforcereldir@ +udevkeymapforceredir = @udevkeymapforceredir@ -dist_udevkeymapforcerel_DATA = \ +dist_udevkeymapforcere_DATA = \ dell-touchpad \ dell-xps \ hp-other \ diff --git a/src/keymap/Makefile.am b/src/keymap/Makefile.am index f21cb80aae..3e3c90f854 100644 --- a/src/keymap/Makefile.am +++ b/src/keymap/Makefile.am @@ -5,7 +5,7 @@ udevlibexecdir=@udevlibexecdir@ AM_CPPFLAGS = \ -I $(top_srcdir)/src/libudev \ -I $(top_srcdir)/src/udev \ - -DUDEVLIBEXECDIR=\"$(udevlibexecdir)\" + -DUDEV_LIBEXEC_DIR=\"$(udevlibexecdir)\" udevlibexec_PROGRAMS = \ keymap diff --git a/src/keymap/keymap.c b/src/keymap/keymap.c index 939407fd0b..b350a8cd86 100644 --- a/src/keymap/keymap.c +++ b/src/keymap/keymap.c @@ -429,7 +429,7 @@ int main(int argc, char **argv) if (f) { merge_table(fd, f); } else { - snprintf(keymap_path, sizeof(keymap_path), UDEVLIBEXECDIR "/keymaps/%s", filearg); + snprintf(keymap_path, sizeof(keymap_path), UDEV_LIBEXEC_DIR "/keymaps/%s", filearg); f = fopen(keymap_path, "re"); if (f) merge_table(fd, f); diff --git a/src/libudev/Makefile.am b/src/libudev/Makefile.am index 36647d13ed..9ccc3fe9ab 100644 --- a/src/libudev/Makefile.am +++ b/src/libudev/Makefile.am @@ -5,6 +5,8 @@ LIBUDEV_REVISION=0 LIBUDEV_AGE=2 AM_CPPFLAGS = \ + -DUDEV_CONF_FILE=\"$(udevconffile)\" \ + -DUDEV_HWDB_BIN=\"$(udevhwdbbin)\" \ -I $(top_srcdir)/src/udev lib_LTLIBRARIES = \ diff --git a/src/libudev/libudev-hwdb.c b/src/libudev/libudev-hwdb.c index 751b34209e..7521942eff 100644 --- a/src/libudev/libudev-hwdb.c +++ b/src/libudev/libudev-hwdb.c @@ -271,30 +271,30 @@ _public_ struct udev_hwdb *udev_hwdb_new(struct udev *udev) { hwdb->refcount = 1; udev_list_init(udev, &hwdb->properties_list, true); - hwdb->f = fopen("/etc/udev/hwdb.bin", "re"); + hwdb->f = fopen(UDEV_HWDB_BIN, "re"); if (!hwdb->f) { - log_debug("error reading /etc/udev/hwdb.bin: %m"); + log_debug("error reading " UDEV_HWDB_BIN ": %m"); udev_hwdb_unref(hwdb); return NULL; } if (fstat(fileno(hwdb->f), &hwdb->st) < 0 || (size_t)hwdb->st.st_size < offsetof(struct trie_header_f, strings_len) + 8) { - log_debug("error reading /etc/udev/hwdb.bin: %m"); + log_debug("error reading " UDEV_HWDB_BIN ": %m"); udev_hwdb_unref(hwdb); return NULL; } hwdb->map = mmap(0, hwdb->st.st_size, PROT_READ, MAP_SHARED, fileno(hwdb->f), 0); if (hwdb->map == MAP_FAILED) { - log_debug("error mapping /etc/udev/hwdb.bin: %m"); + log_debug("error mapping " UDEV_HWDB_BIN ": %m"); udev_hwdb_unref(hwdb); return NULL; } if (memcmp(hwdb->map, sig, sizeof(hwdb->head->signature)) != 0 || (size_t)hwdb->st.st_size != le64toh(hwdb->head->file_size)) { - log_debug("error recognizing the format of /etc/udev/hwdb.bin"); + log_debug("error recognizing the format of " UDEV_HWDB_BIN); udev_hwdb_unref(hwdb); return NULL; } diff --git a/src/libudev/libudev.c b/src/libudev/libudev.c index 3341ee8ada..09c41e43a9 100644 --- a/src/libudev/libudev.c +++ b/src/libudev/libudev.c @@ -127,7 +127,7 @@ _public_ struct udev *udev_new(void) udev->log_priority = LOG_ERR; udev_list_init(udev, &udev->properties_list, true); - f = fopen("/etc/udev/udev.conf", "re"); + f = fopen( UDEV_CONF_FILE, "re"); if (f != NULL) { char line[UTIL_LINE_SIZE]; int line_nr = 0; @@ -151,7 +151,7 @@ _public_ struct udev *udev_new(void) /* split key/value */ val = strchr(key, '='); if (val == NULL) { - udev_err(udev, "missing <key>=<value> in /etc/udev/udev.conf[%i]; skip line\n", line_nr); + udev_err(udev, "missing <key>=<value> in " UDEV_CONF_FILE "[%i]; skip line\n", line_nr); continue; } val[0] = '\0'; @@ -183,7 +183,7 @@ _public_ struct udev *udev_new(void) /* unquote */ if (val[0] == '"' || val[0] == '\'') { if (val[len-1] != val[0]) { - udev_err(udev, "inconsistent quoting in /etc/udev/udev.conf[%i]; skip line\n", line_nr); + udev_err(udev, "inconsistent quoting in " UDEV_CONF_FILE"[%i]; skip line\n", line_nr); continue; } val[len-1] = '\0'; diff --git a/src/udev/Makefile.am b/src/udev/Makefile.am index f353e079a8..6e85181ae2 100644 --- a/src/udev/Makefile.am +++ b/src/udev/Makefile.am @@ -7,7 +7,10 @@ AM_CPPFLAGS = \ -include $(top_builddir)/config.h \ -DMODPROBE=\"$(MODPROBE)\" \ -DROOTPREFIX=\"$(rootprefix)\" \ - -DUDEVLIBEXECDIR=\"$(udevlibexecdir)\" \ + -DUDEV_HWDB_DIR=\"$(udevhwdbdir)\" \ + -DUDEV_HWDB_BIN=\"$(udevhwdbbin)\" \ + -DUDEV_RULES_DIR=\"$(udevrulesdir)\" \ + -DUDEV_LIBEXEC_DIR=\"$(udevlibexecdir)\" \ -I $(top_srcdir)/src/libudev sbin_PROGRAMS = \ diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c index 30c3771fe6..46e7578d0d 100644 --- a/src/udev/udev-event.c +++ b/src/udev/udev-event.c @@ -688,7 +688,7 @@ int udev_event_spawn(struct udev_event *event, /* allow programs in /usr/lib/udev/ to be called without the path */ if (argv[0][0] != '/') { - util_strscpyl(program, sizeof(program), UDEVLIBEXECDIR "/", argv[0], NULL); + util_strscpyl(program, sizeof(program), UDEV_LIBEXEC_DIR "/", argv[0], NULL); #ifdef HAVE_SPLIT_USR if(access(program, X_OK)) util_strscpyl(program, sizeof(program), "/lib/udev/", argv[0], NULL); diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index 38d5215c55..0611c1d6fa 100644 --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c @@ -1600,9 +1600,9 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) if (!rules->strbuf) return udev_rules_unref(rules); - rules->dirs = strv_new("/etc/udev/rules.d", + rules->dirs = strv_new(UDEV_RULES_DIR, "/run/udev/rules.d", - UDEVLIBEXECDIR "/rules.d", + UDEV_LIBEXEC_DIR "/rules.d", #ifdef HAVE_SPLIT_USR "/lib/udev/rules.d", #endif diff --git a/src/udev/udevadm-hwdb.c b/src/udev/udevadm-hwdb.c index e545689f3d..279e9255f0 100644 --- a/src/udev/udevadm-hwdb.c +++ b/src/udev/udevadm-hwdb.c @@ -35,8 +35,8 @@ */ static const char * const conf_file_dirs[] = { - "/etc/udev/hwdb.d", - UDEVLIBEXECDIR "/hwdb.d", + UDEV_HWDB_DIR, + UDEV_LIBEXEC_DIR "/hwdb.d", NULL }; @@ -570,10 +570,11 @@ static int adm_hwdb(struct udev *udev, int argc, char *argv[]) { log_debug("strings dedup'ed: %8zu bytes (%8zu)\n", trie->strings->dedup_len, trie->strings->dedup_count); - mkdir_parents("/etc/udev/hwdb.bin", 0755); - err = trie_store(trie, "/etc/udev/hwdb.bin"); + mkdir_parents(UDEV_HWDB_BIN, 0755); + err = trie_store(trie, UDEV_HWDB_BIN); if (err < 0) { - log_error("Failure writing hardware database '%s': %s", "/etc/udev/hwdb.bin", strerror(-err)); + log_error("Failure writing hardware database '%s': %s", + UDEV_HWDB_BIN, strerror(-err)); rc = EXIT_FAILURE; } } |