ACK: [PATCH] Don't hard-code the installation prefix
Alex Hung
alex.hung at canonical.com
Thu Apr 24 07:49:48 UTC 2014
On 04/24/2014 03:34 PM, Jeremy Kerr wrote:
> If we configure fwts to use a prefix other than /usr, then the json
> files don't get loaded; their paths are hardcoded to under /usr/share.
>
> This change uses the autotools' ${datarootdir} instead.
>
> Signed-off-by: Jeremy Kerr <jk at ozlabs.org>
>
> ---
> src/lib/include/fwts.h | 2 +-
> src/lib/src/Makefile.am | 1 +
> src/utilities/Makefile.am | 2 +-
> src/utilities/kernelscan.c | 2 +-
> 4 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/src/lib/include/fwts.h b/src/lib/include/fwts.h
> index c423fef..b8b0602 100644
> --- a/src/lib/include/fwts.h
> +++ b/src/lib/include/fwts.h
> @@ -26,7 +26,7 @@
>
> #define FWTS_UNUSED(var) (void)var
>
> -#define FWTS_JSON_DATA_PATH "/usr/share/fwts"
> +#define FWTS_JSON_DATA_PATH DATAROOTDIR "/fwts"
>
> #include "fwts_version.h"
> #include "fwts_types.h"
> diff --git a/src/lib/src/Makefile.am b/src/lib/src/Makefile.am
> index d004236..f85586d 100644
> --- a/src/lib/src/Makefile.am
> +++ b/src/lib/src/Makefile.am
> @@ -2,6 +2,7 @@ AM_CPPFLAGS = \
> -I$(top_srcdir)/src/lib/include \
> -I$(top_srcdir)/src/acpica/source/include \
> -I$(top_srcdir)/src/acpica/source/compiler \
> + -DDATAROOTDIR=\"$(datarootdir)\" \
> -Wall -Werror -Wextra
>
> pkglib_LTLIBRARIES = libfwts.la
> diff --git a/src/utilities/Makefile.am b/src/utilities/Makefile.am
> index 4e2f37f..01b534a 100644
> --- a/src/utilities/Makefile.am
> +++ b/src/utilities/Makefile.am
> @@ -1,4 +1,4 @@
> -AM_CPPFLAGS = -Wall -Werror -Wextra
> +AM_CPPFLAGS = -Wall -Werror -Wextra -DDATAROOTDIR=\"$(datarootdir)\"
>
> bin_PROGRAMS = kernelscan
> kernelscan_SOURCES = kernelscan.c
> diff --git a/src/utilities/kernelscan.c b/src/utilities/kernelscan.c
> index 4ed3152..0ddbdb8 100644
> --- a/src/utilities/kernelscan.c
> +++ b/src/utilities/kernelscan.c
> @@ -243,7 +243,7 @@ static klog_pattern *klog_load(const char *table)
> json_object *klog_table;
> klog_pattern *patterns;
>
> - klog_objs = json_object_from_file("/usr/share/fwts/klog.json");
> + klog_objs = json_object_from_file(DATAROOTDIR "/fwts/klog.json");
> if (JSON_ERROR(klog_objs)) {
> fprintf(stderr, "Cannot load klog data\n");
> exit(EXIT_FAILURE);
>
Acked-by: Alex Hung <alex.hung at canoniocal.com>
More information about the fwts-devel
mailing list