[gimp/meson: 6/9] Fix: Rename macros as it conflicts with Mingw headers. * DATADIR -> GIMPDATADIR * SYSCONFDIR -> GIMP



commit 8efaa10fd35ca067689aaeb777f10ce51b63e08b
Author: Félix Piédallu <felix piedallu me>
Date:   Tue Jan 30 17:27:43 2018 +0100

    Fix: Rename macros as it conflicts with Mingw headers.
    * DATADIR -> GIMPDATADIR
    * SYSCONFDIR -> GIMPSYSCONFDIR
    * SYSDATADIR -> GIMPSYSDATADIR

 app/config/Makefile.am    |    2 +-
 libgimpbase/Makefile.am   |    4 ++--
 libgimpbase/gimpenv.c     |   12 +++---------
 libgimpbase/gimputils.c   |    9 ++-------
 meson.build               |    3 +--
 plug-ins/help/Makefile.am |    2 +-
 tools/Makefile.am         |    2 +-
 tools/gimptool.c          |    2 +-
 tools/meson.build         |    5 -----
 9 files changed, 12 insertions(+), 29 deletions(-)
---
diff --git a/app/config/Makefile.am b/app/config/Makefile.am
index 7780250..a0f3efe 100644
--- a/app/config/Makefile.am
+++ b/app/config/Makefile.am
@@ -15,7 +15,7 @@ endif
 AM_CPPFLAGS = \
        -DG_LOG_DOMAIN=\"Gimp-Config\"                          \
        -DGIMP_APP_VERSION_STRING=\"$(GIMP_APP_VERSION)\"       \
-       -DDATADIR=\""$(datadir)"\"                              \
+       -DGIMPDATADIR=\""$(datadir)"\"                          \
        -I$(top_builddir)                                       \
        -I$(top_srcdir)                                         \
        -I$(top_builddir)/app                                   \
diff --git a/libgimpbase/Makefile.am b/libgimpbase/Makefile.am
index 2f3ac24..3c54276 100644
--- a/libgimpbase/Makefile.am
+++ b/libgimpbase/Makefile.am
@@ -49,10 +49,10 @@ libgimpbaseincludedir = $(includedir)/gimp-$(GIMP_API_VERSION)/libgimpbase
 AM_CPPFLAGS = \
        -DPREFIX=\""$(prefix)"\"                                \
        -DGIMPDIR=\""$(gimpdir)"\"                              \
-       -DDATADIR=\""$(gimpdatadir)"\"                          \
+       -DGIMPDATADIR=\""$(gimpdatadir)"\"                              \
        -DLOCALEDIR=\""$(gimplocaledir)"\"                      \
        -DPLUGINDIR=\""$(gimpplugindir)"\"                      \
-       -DSYSCONFDIR=\""$(gimpsysconfdir)"\"                    \
+       -DGIMPSYSCONFDIR=\""$(gimpsysconfdir)"\"                        \
        -DGIMP_PACKAGE=\""@PACKAGE@"\"                          \
        -DGIMP_DATA_VERSION=\"$(GIMP_DATA_VERSION)\"            \
        -DGIMP_USER_VERSION=\"$(GIMP_USER_VERSION)\"            \
diff --git a/libgimpbase/gimpenv.c b/libgimpbase/gimpenv.c
index a8bc641..200e69a 100644
--- a/libgimpbase/gimpenv.c
+++ b/libgimpbase/gimpenv.c
@@ -65,14 +65,8 @@
 #define geteuid() 0
 #define getegid() 0
 
-/* This is a hack for Windows known directory support.
- * DATADIR (autotools-generated constant) is a type defined in objidl.h
- * so we must #undef it before including shlobj.h in order to avoid a
- * name clash. */
-static const char* datadir = DATADIR;
-#undef DATADIR
 #include <shlobj.h>
-#define DATADIR datadir
+
 /* Constant available since Shell32.dll 4.72 */
 #ifndef CSIDL_APPDATA
 #define CSIDL_APPDATA 0x001a
@@ -485,7 +479,7 @@ gimp_data_directory (void)
                                      GIMP_DATA_VERSION,
                                      NULL);
 
-      gimp_data_dir = gimp_env_get_dir ("GIMP2_DATADIR", DATADIR, tmp);
+      gimp_data_dir = gimp_env_get_dir ("GIMP2_DATADIR", GIMPDATADIR, tmp);
       g_free (tmp);
     }
 
@@ -563,7 +557,7 @@ gimp_sysconf_directory (void)
                                      GIMP_SYSCONF_VERSION,
                                      NULL);
 
-      gimp_sysconf_dir = gimp_env_get_dir ("GIMP2_SYSCONFDIR", SYSCONFDIR, tmp);
+      gimp_sysconf_dir = gimp_env_get_dir ("GIMP2_SYSCONFDIR", GIMPSYSCONFDIR, tmp);
       g_free (tmp);
     }
 
diff --git a/libgimpbase/gimputils.c b/libgimpbase/gimputils.c
index 67f8df1..568346e 100644
--- a/libgimpbase/gimputils.c
+++ b/libgimpbase/gimputils.c
@@ -40,13 +40,8 @@
 #include <glib/gprintf.h>
 
 #if defined(G_OS_WIN32)
-/* This is a hack for Windows known directory support.
- * DATADIR (autotools-generated constant) is a type defined in objidl.h
- * so we must #undef it before including shlobj.h in order to avoid a
- * name clash. */
-#undef DATADIR
-#include <windows.h>
-#include <shlobj.h>
+# include <windows.h>
+# include <shlobj.h>
 #endif
 
 #include "gimpbasetypes.h"
diff --git a/meson.build b/meson.build
index d4dd42c..5d64727 100644
--- a/meson.build
+++ b/meson.build
@@ -1132,8 +1132,7 @@ config_defines = [
   '-DPREFIX='         +'"'+ prefix                +'"',
   '-DEXEC_PREFIX='    +'"'+ prefix                +'"',
   '-DGIMPDIR='        +'"'+ gimpdir               +'"',
-  '-DSYSCONFDIR='     +'"'+ gimpsysconfdir        +'"',
-  '-DDATADIR='        +'"'+ join_paths(prefix, gimpdatadir)    +'"',
+  '-DGIMPSYSCONFDIR=' +'"'+ gimpsysconfdir        +'"',
   '-DGIMPDATADIR='    +'"'+ join_paths(prefix, gimpdatadir)    +'"',
   '-DGIMPPLUGINDIR='  +'"'+ join_paths(prefix, gimpplugindir)  +'"',
   '-DPLUGINDIR='      +'"'+ join_paths(prefix, gimpplugindir)  +'"',
diff --git a/plug-ins/help/Makefile.am b/plug-ins/help/Makefile.am
index 8457c33..0b252a5 100644
--- a/plug-ins/help/Makefile.am
+++ b/plug-ins/help/Makefile.am
@@ -17,7 +17,7 @@ help_RC = help.rc.o
 endif
 
 AM_CPPFLAGS = \
-       -DDATADIR=\""$(gimpdatadir)"\"  \
+       -DGIMPDATADIR=\""$(gimpdatadir)"\"      \
        -I$(top_srcdir)                 \
        $(CAIRO_CFLAGS)                 \
        $(GIO_CFLAGS)                   \
diff --git a/tools/Makefile.am b/tools/Makefile.am
index e841daf..731dd14 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -102,7 +102,7 @@ AM_CPPFLAGS = \
        -DBINDIR=\""$(bindir)"\"                                \
        -DSBINDIR=\""$(sbindir)"\"                              \
        -DLIBEXECDIR=\""$(libexecdir)"\"                        \
-       -DDATADIR=\""$(datadir)"\"                              \
+       -DSYSDATADIR=\""$(datadir)"\"                           \
        -DDATAROOTDIR=\""$(datarootdir)"\"                      \
        -DSYSCONFDIR=\""$(sysconfdir)"\"                        \
        -DSHAREDSTATEDIR=\""$(sharedstatedir)"\"                \
diff --git a/tools/gimptool.c b/tools/gimptool.c
index 08fc6df..8470560 100644
--- a/tools/gimptool.c
+++ b/tools/gimptool.c
@@ -76,7 +76,7 @@ static struct {
   { "bindir",         BINDIR         },
   { "sbindir",        SBINDIR        },
   { "libexecdir",     LIBEXECDIR     },
-  { "datadir",        DATADIR        },
+  { "datadir",        SYSDATADIR     },
   { "datarootdir",    DATAROOTDIR    },
   { "sysconfdir",     SYSCONFDIR     },
   { "sharedstatedir", SHAREDSTATEDIR },
diff --git a/tools/meson.build b/tools/meson.build
index 6416cf7..886866e 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -5,10 +5,6 @@ if platform_win32
   )
 endif
 
-tools_cflags = [
-  '-DGIMPDATADIR=' +'"'+ join_paths(prefix, gimpdatadir) +'"',
-]
-
 
 gimptool = executable('gimptool-' + api_version,
   'gimptool.c',
@@ -19,7 +15,6 @@ gimptool = executable('gimptool-' + api_version,
   link_with: [
     libgimpbase,
   ],
-  c_args: tools_cflags,
   install: true,
 )
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]