From 3fef2dcc58486d2a6e0230e79592cfca3ff6db06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Wed, 19 Dec 2007 15:37:10 +0000 Subject: [PATCH] Prefix autotools macros with GEANY to avoid problems with already defined symbols on Windows. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2117 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 4 ++++ HACKING | 13 +++++++------ src/Makefile.am | 4 ++-- src/build.c | 2 +- src/main.c | 14 +++++++------- src/makefile.win32 | 9 +++++---- src/plugins.c | 2 +- src/prefix.h | 12 ++++++++---- src/symbols.c | 2 +- 9 files changed, 36 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3da3f0e1..43d4e166 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,10 @@ * TODO, src/main.c: Apply patch Jeff Pohlmeyer to handle unknown command line options better (thanks). + * HACKING, src/Makefile.am, src/main.c, src/makefile.win32, + src/plugins.c, src/prefix.h, src/symbols.c: + Prefix autotools macros with GEANY to avoid problems with already + defined symbols on Windows. 2007-12-18 Frank Lanitz diff --git a/HACKING b/HACKING index cb7c49e2..94fae2c6 100644 --- a/HACKING +++ b/HACKING @@ -89,12 +89,13 @@ just appending fields to structs. Using pre-defined autotools values ---------------------------------- -When you are use macros supplied by the autotools like PREFIX, LIBDIR, -DATADIR and LOCALEDIR be aware that these might not be static strings -when Geany is configured with --enable-binreloc. Then these macros will -be replaced by function calls (in src/prefix.h). So, don't use anything -like printf("Prefix: " PREFIX); but instead use -printf("Prefix: %s", PREFIX); +When you are use macros supplied by the autotools like GEANY_PREFIX, +GEANY_LIBDIR, GEANY_DATADIR and GEANY_LOCALEDIR be aware that these +might not be static strings when Geany is configured with +--enable-binreloc. Then these macros will be replaced by function calls +(in src/prefix.h). So, don't use anything like +printf("Prefix: " GEANY_PREFIX); but instead use +printf("Prefix: %s", GEANY_PREFIX); Adding a file foo.[hc] in src/ or plugins/ ------------------------------------------ diff --git a/src/Makefile.am b/src/Makefile.am index c892d269..d4656950 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -76,8 +76,8 @@ nodist_EXTRA_geany_SOURCES = dummy.cxx geany_LDADD = ../scintilla/libscintilla.a ../tagmanager/libtagmanager.a @GTK_LIBS@ $(INTLLIBS) INCLUDES = \ - -DDATADIR=\""$(datadir)"\" -DLIBDIR=\""$(libdir)"\" \ - -DLOCALEDIR=\""$(localedir)"\" -DPREFIX=\""$(prefix)"\" \ + -DGEANY_DATADIR=\""$(datadir)"\" -DGEANY_LIBDIR=\""$(libdir)"\" \ + -DGEANY_LOCALEDIR=\""$(localedir)"\" -DGEANY_PREFIX=\""$(prefix)"\" \ -I$(srcdir)/../scintilla/include -I$(srcdir)/../tagmanager/include @GTK_CFLAGS@ clean-local: diff --git a/src/build.c b/src/build.c index c3a3ed1d..ad9e9b23 100644 --- a/src/build.c +++ b/src/build.c @@ -760,7 +760,6 @@ static gchar *prepare_run_script(gint idx, gchar **vte_cmd_nonscript) static GPid build_run_cmd(gint idx) { - GeanyProject *project = app->project; gchar *working_dir; gchar *vte_cmd_nonscript = NULL; GError *error = NULL; @@ -779,6 +778,7 @@ static GPid build_run_cmd(gint idx) #ifdef HAVE_VTE if (vte_info.load_vte && vc != NULL && vc->run_in_vte) { + GeanyProject *project = app->project; gchar *vte_cmd; if (vc->skip_run_script) diff --git a/src/main.c b/src/main.c index 2f794452..04c4d18b 100644 --- a/src/main.c +++ b/src/main.c @@ -381,8 +381,8 @@ static void setup_paths() g_free(install_dir); #else - data_dir = g_strconcat(DATADIR, "/" PACKAGE "/", NULL); // e.g. /usr/share/geany - doc_dir = g_strconcat(DATADIR, "/doc/" PACKAGE "/html/", NULL); + data_dir = g_strconcat(GEANY_DATADIR, "/geany/", NULL); // e.g. /usr/share/geany + doc_dir = g_strconcat(GEANY_DATADIR, "/doc/geany/html/", NULL); #endif // convert path names to locale encoding @@ -409,7 +409,7 @@ static void locale_init() locale_dir = g_strconcat(install_dir, "\\lib\\locale", NULL); g_free(install_dir); #else - locale_dir = g_strdup(LOCALEDIR); + locale_dir = g_strdup(GEANY_LOCALEDIR); #endif bindtextdomain(GETTEXT_PACKAGE, locale_dir); @@ -451,10 +451,10 @@ static void parse_command_line_options(gint *argc, gchar ***argv) if (print_prefix) { - printf("%s\n", PREFIX); - printf("%s\n", DATADIR); - printf("%s\n", LIBDIR); - printf("%s\n", LOCALEDIR); + printf("%s\n", GEANY_PREFIX); + printf("%s\n", GEANY_DATADIR); + printf("%s\n", GEANY_LIBDIR); + printf("%s\n", GEANY_LOCALEDIR); exit(0); } diff --git a/src/makefile.win32 b/src/makefile.win32 index 9289558f..d5a07adb 100644 --- a/src/makefile.win32 +++ b/src/makefile.win32 @@ -1,9 +1,10 @@ # Note: PACKAGE_DATA_DIR and PACKAGE_LOCALE_DIR are no longer used on Windows. -DEFINES = -DPACKAGE_DATA_DIR=\"data\" \ - -DHAVE_CONFIG_H \ - -DPACKAGE_LOCALE_DIR=\"data\" \ - -DENABLE_NLS +DEFINES = -DHAVE_CONFIG_H \ + -DGEANY_DATADIR=\"data\" \ + -DGEANY_LOCALEDIR=\"data\" \ + -DGEANY_LIBDIR=\"\" \ + -DGEANY_PREFIX=\"\" .SUFFIXES: .c .o .h .a WINDRES = windres.exe diff --git a/src/plugins.c b/src/plugins.c index 6cc5f86f..6790a7a5 100644 --- a/src/plugins.c +++ b/src/plugins.c @@ -545,7 +545,7 @@ static void load_plugin_paths() #ifdef G_OS_WIN32 path = get_plugin_path(); #else - path = g_strconcat(LIBDIR, G_DIR_SEPARATOR_S "geany", NULL); + path = g_strconcat(GEANY_LIBDIR, G_DIR_SEPARATOR_S "geany", NULL); #endif load_plugins(path); diff --git a/src/prefix.h b/src/prefix.h index baf57c55..93c6b6cc 100644 --- a/src/prefix.h +++ b/src/prefix.h @@ -60,19 +60,23 @@ #undef SYSCONFDIR #undef CONFDIR #undef LOCALEDIR + #undef GEANY_PREFIX + #undef GEANY_DATADIR + #undef GEANY_LIBDIR + #undef GEANY_LOCALEDIR #define SELFPATH (br_thread_local_store (br_locate ((void *) ""))) - #define PREFIX (br_thread_local_store (br_locate_prefix ((void *) ""))) #define PREFIXDIR (br_thread_local_store (br_locate_prefix ((void *) ""))) #define BINDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/bin"))) #define SBINDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/sbin"))) - #define DATADIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/share"))) - #define LIBDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/lib"))) #define LIBEXECDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/libexec"))) #define ETCDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/etc"))) #define SYSCONFDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/etc"))) #define CONFDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/etc"))) - #define LOCALEDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/share/locale"))) + #define GEANY_PREFIX (br_thread_local_store (br_locate_prefix ((void *) ""))) + #define GEANY_DATADIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/share"))) + #define GEANY_LIBDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/lib"))) + #define GEANY_LOCALEDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/share/locale"))) #endif /* BR_NO_MACROS */ diff --git a/src/symbols.c b/src/symbols.c index 159e2f08..caa93f0d 100644 --- a/src/symbols.c +++ b/src/symbols.c @@ -465,7 +465,7 @@ tag_list_add_groups(GtkTreeStore *tree_store, ...) if (icon_theme == NULL) { #ifndef G_OS_WIN32 - gchar *path = g_strconcat(DATADIR, "/icons", NULL); + gchar *path = g_strconcat(GEANY_DATADIR, "/icons", NULL); #endif gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &x, &y); icon_theme = gtk_icon_theme_get_default();