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
This commit is contained in:
Enrico Tröger 2007-12-19 15:37:10 +00:00
parent ee5ea6b728
commit 3fef2dcc58
9 changed files with 36 additions and 26 deletions

View File

@ -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 <frank(at)frank(dot)uvena(dot)de>

13
HACKING
View File

@ -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/
------------------------------------------

View File

@ -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:

View File

@ -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)

View File

@ -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);
}

View File

@ -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

View File

@ -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);

View File

@ -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 */

View File

@ -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();