Re: atk,pango,gtk+/cygwin
- From: Stefan Ondrejicka <ondrej idata sk>
- To: Owen Taylor <otaylor redhat com>
- Cc: gtk-devel-list gnome org
- Subject: Re: atk,pango,gtk+/cygwin
- Date: Fri, 8 Nov 2002 11:05:17 +0100 (CET)
On Thu, 7 Nov 2002, Owen Taylor wrote:
Hello,
thanks for comments.
> > * pango/pango-utils.c: use DllMain also on cygwin
> > pango_get_sysconf_subdirectory():
> > pango_get_lib_subdirectory(): on cygwin optionaly return standard "unix"
> > path or "win32"
>
> Can you explain this change? Adding more options for ways
> to install things very seldom makes things easier.
I would like to have both options there. The unix style for cygwin people
who use cygwin like their working enviroment and have the cygwin normaly
installed. And the windows style for windows users who would like to use
one gtk+ application which is only possible to compile with cygwin on
windows. So you will be able to package that program with cygwin.dll,
glib,...,gtk+ dlls+config files and give the users options to use that
program without forcing them to install cygwin.
> > atk:
> >
> > * configure.in: define -no-undefined also on cygwin
>
> I think the name 'atk_native_win32' was specifically meant to
> mean 'not-cygwin'. If you are setting it for cygwin, you
> probably should drop the 'native'.
ok, than attached patch will be more correct.
> > * gdk/gdktypes.h: when compiling DLLs on cygwin set GDKVAR to dllexport,
> > when compilng static gdk library, don't use dllexport
> >
> > * gtk/gtkprivate.h: G_OS_WIN32 -> G_PLATFORM_WIN32
> >
> > * gtk/gtkmain.c: removed functions _gtk_get_libdir(),
> > _gtk_get_localedir(), _gtk_get_sysconfdir, _gtk_get_data_prefix()
> >
> > * gtk/gtkutils.c: new file contains moved functions from gtk/gtkmain.c
> > and adapted for cygwin
>
> Why do you move these files into a different file?
Why, because gtkmain.c includes gtkprivate.h where are redefined the
install directory locations, and that will cause probably segfaults on
cygwin.
> +/*
> + * please don't include gtkprivate.h, on cygwin it will cause problems
> + */
>
> I think we probably should just use _gtk_get_libdir(), etc, throughout
> the code and on Unix do:
>
> const gchar *
> _gtk_get_libdir (void)
> {
> return GTK_LIBDIR;
> }
I agree, the attached patch does this.
Best regards,
Stevo.
--
/> | Stefan Ondrejicka <ondrej idata sk>
/< | http://www.idata.sk/~ondrej/
[XXXXXX( O):::<===================================-
\<
\>
diff -ruN ../gtk+-2.0.7/gtk/gtkmain.c ./gtk/gtkmain.c
--- ../gtk+-2.0.7/gtk/gtkmain.c Mon Nov 4 00:27:14 2002
+++ ./gtk/gtkmain.c Fri Nov 8 10:43:56 2002
@@ -40,11 +40,14 @@
#include <unistd.h>
#include <sys/types.h> /* For uid_t, gid_t */
#endif
-#ifdef G_OS_WIN32
+#ifdef G_PLATFORM_WIN32
#define STRICT
#include <windows.h>
#undef STRICT
#endif
+#ifdef G_WITH_CYGWIN
+#include <sys/cygwin.h>
+#endif
#include <pango/pango-utils.h> /* For pango_split_file_list */
@@ -229,8 +232,6 @@
return TRUE;
}
-#ifdef G_OS_WIN32
-
G_WIN32_DLLMAIN_FOR_DLL_NAME(static, dll_name)
const gchar *
@@ -238,8 +239,22 @@
{
static char *gtk_libdir = NULL;
if (gtk_libdir == NULL)
+#ifdef G_WITH_CYGWIN
+ {
+ gtk_libdir = g_win32_get_package_installation_subdirectory
+ (GETTEXT_PACKAGE, dll_name, "lib");
+ if (!g_file_test(gtk_libdir, G_FILE_TEST_IS_DIR))
+ {
+ g_free(gtk_libdir);
+ gtk_libdir = g_strdup(GTK_LIBDIR);
+ }
+ }
+#elif G_OS_WIN32
gtk_libdir = g_win32_get_package_installation_subdirectory
(GETTEXT_PACKAGE, dll_name, "lib");
+#else
+ gtk_libdir = g_strdup(GTK_LIBDIR);
+#endif
return gtk_libdir;
}
@@ -249,8 +264,22 @@
{
static char *gtk_localedir = NULL;
if (gtk_localedir == NULL)
+#ifdef G_WITH_CYGWIN
+ {
+ gtk_localedir = g_win32_get_package_installation_subdirectory
+ (GETTEXT_PACKAGE, dll_name, "lib/locale");
+ if (!g_file_test(gtk_localedir, G_FILE_TEST_IS_DIR))
+ {
+ g_free(gtk_localedir);
+ gtk_localedir = g_strdup(GTK_LOCALEDIR);
+ }
+ }
+#elif G_OS_WIN32
gtk_localedir = g_win32_get_package_installation_subdirectory
(GETTEXT_PACKAGE, dll_name, "lib\\locale");
+#else
+ gtk_localedir = g_strdup(GTK_LOCALEDIR);
+#endif
return gtk_localedir;
}
@@ -260,8 +289,22 @@
{
static char *gtk_sysconfdir = NULL;
if (gtk_sysconfdir == NULL)
+#ifdef G_WITH_CYGWIN
+ {
+ gtk_sysconfdir = g_win32_get_package_installation_subdirectory
+ (GETTEXT_PACKAGE, dll_name, "lib");
+ if (!g_file_test(gtk_sysconfdir, G_FILE_TEST_IS_DIR))
+ {
+ g_free(gtk_sysconfdir);
+ gtk_sysconfdir = g_strdup(GTK_SYSCONFDIR);
+ }
+ }
+#elif G_OS_WIN32
gtk_sysconfdir = g_win32_get_package_installation_subdirectory
(GETTEXT_PACKAGE, dll_name, "etc");
+#else
+ gtk_sysconfdir = g_strdup(GTK_SYSCONFDIR);
+#endif
return gtk_sysconfdir;
}
@@ -271,14 +314,26 @@
{
static char *gtk_data_prefix = NULL;
if (gtk_data_prefix == NULL)
+#ifdef G_WITH_CYGWIN
+ {
+ gtk_data_prefix = g_win32_get_package_installation_directory
+ (GETTEXT_PACKAGE, dll_name);
+ if (!g_file_test(gtk_data_prefix, G_FILE_TEST_IS_DIR))
+ {
+ g_free(gtk_data_prefix);
+ gtk_data_prefix = g_strdup(GTK_DATA_PREFIX);
+ }
+ }
+#elif G_OS_WIN32
gtk_data_prefix = g_win32_get_package_installation_directory
(GETTEXT_PACKAGE, dll_name);
+#else
+ gtk_data_prefix = g_strdup(GTK_DATA_PREFIX);
+#endif
return gtk_data_prefix;
}
-#endif /* G_OS_WIN32 */
-
static gchar **
get_module_path (void)
{
@@ -303,7 +358,7 @@
if (exe_prefix)
default_dir = g_build_filename (exe_prefix, "lib", "gtk-2.0", NULL);
else
- default_dir = g_build_filename (GTK_LIBDIR, "gtk-2.0", NULL);
+ default_dir = g_build_filename (_gtk_get_libdir(), "gtk-2.0", NULL);
if (module_path_env && home_gtk_dir)
module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
@@ -717,7 +772,7 @@
}
#ifdef ENABLE_NLS
- bindtextdomain (GETTEXT_PACKAGE, GTK_LOCALEDIR);
+ bindtextdomain (GETTEXT_PACKAGE, _gtk_get_localedir());
# ifdef HAVE_BIND_TEXTDOMAIN_CODESET
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
# endif
diff -ruN ../gtk+-2.0.7/gtk/gtkprivate.h ./gtk/gtkprivate.h
--- ../gtk+-2.0.7/gtk/gtkprivate.h Sun Nov 4 23:57:03 2001
+++ ./gtk/gtkprivate.h Fri Nov 8 10:27:42 2002
@@ -78,23 +78,10 @@
#define GTK_PRIVATE_SET_FLAG(wid,flag) G_STMT_START{ (GTK_PRIVATE_FLAGS (wid) |= (PRIVATE_ ## flag)); }G_STMT_END
#define GTK_PRIVATE_UNSET_FLAG(wid,flag) G_STMT_START{ (GTK_PRIVATE_FLAGS (wid) &= ~(PRIVATE_ ## flag)); }G_STMT_END
-#ifdef G_OS_WIN32
-
const gchar *_gtk_get_libdir ();
const gchar *_gtk_get_sysconfdir ();
const gchar *_gtk_get_localedir ();
const gchar *_gtk_get_data_prefix ();
-
-#undef GTK_LIBDIR
-#define GTK_LIBDIR _gtk_get_libdir ()
-#undef GTK_LOCALEDIR
-#define GTK_LOCALEDIR _gtk_get_localedir ()
-#undef GTK_SYSCONFDIR
-#define GTK_SYSCONFDIR _gtk_get_sysconfdir ()
-#undef GTK_DATA_PREFIX
-#define GTK_DATA_PREFIX _gtk_get_data_prefix ()
-
-#endif /* G_OS_WIN32 */
#ifdef __cplusplus
}
diff -ruN ../gtk+-2.0.7/gtk/gtkrc.c ./gtk/gtkrc.c
--- ../gtk+-2.0.7/gtk/gtkrc.c Mon Nov 4 00:27:31 2002
+++ ./gtk/gtkrc.c Fri Nov 8 10:43:26 2002
@@ -301,7 +301,7 @@
if (var)
path = g_build_filename (var, "lib", "gtk-2.0", GTK_BINARY_VERSION, type, NULL);
else
- path = g_build_filename (GTK_LIBDIR, "gtk-2.0", GTK_BINARY_VERSION, type, NULL);
+ path = g_build_filename (_gtk_get_libdir(), "gtk-2.0", GTK_BINARY_VERSION, type, NULL);
return path;
}
@@ -346,7 +346,7 @@
if (im_module_file)
result = g_strdup (im_module_file);
else
- result = g_build_filename (GTK_SYSCONFDIR, "gtk-2.0", "gtk.immodules", NULL);
+ result = g_build_filename (_gtk_get_sysconfdir(), "gtk-2.0", "gtk.immodules", NULL);
}
return result;
@@ -362,7 +362,7 @@
if (var)
path = g_build_filename (var, "share", "themes", NULL);
else
- path = g_build_filename (GTK_DATA_PREFIX, "share", "themes", NULL);
+ path = g_build_filename (_gtk_get_data_prefix(), "share", "themes", NULL);
return path;
}
@@ -412,7 +412,7 @@
}
else
{
- str = g_build_filename (GTK_SYSCONFDIR, "gtk-2.0", "gtkrc", NULL);
+ str = g_build_filename (_gtk_get_sysconfdir(), "gtk-2.0", "gtkrc", NULL);
gtk_rc_add_default_file (str);
g_free (str);
--- configure.in.orig Fri Nov 8 10:03:26 2002
+++ configure.in Fri Nov 8 10:03:55 2002
@@ -68,7 +68,7 @@
AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL
-AC_MSG_CHECKING([for Win32])
+AC_MSG_CHECKING([for native Win32])
case "$host" in
*-*-mingw*)
atk_native_win32=yes
@@ -84,6 +84,18 @@
AC_CHECK_PROG(ms_librarian, lib.exe, yes, no)
fi
AM_CONDITIONAL(MS_LIB_AVAILABLE, test x$ms_librarian = xyes)
+
+AC_MSG_CHECKING([for some Win32])
+case "$host" in
+ *-*-mingw*)
+ atk_platform_win32=yes
+ ;;
+ *)
+ atk_platform_win32=no
+ ;;
+esac
+AC_MSG_RESULT([$atk_platform_win32])
+AM_CONDITIONAL(PLATFORM_WIN32, test "$atk_platform_win32" = "yes")
dnl Cache $ACLOCAL_FLAGS
AC_CACHE_CHECK([for aclocal flags], ac_cv_atk_aclocal_flags,[
--- atk/Makefile.am.orig Fri Nov 8 10:04:08 2002
+++ atk/Makefile.am Fri Nov 8 10:04:55 2002
@@ -5,7 +5,6 @@
EXTRA_DIST = atk.def
if OS_WIN32
export_symbols = -export-symbols atk.def
-no_undefined = -no-undefined
install-libtool-import-lib:
$(INSTALL) .libs/libatk-$(ATK_API_VERSION).dll.a $(DESTDIR)$(libdir)
@@ -14,6 +13,10 @@
else
install-libtool-import-lib:
uninstall-libtool-import-lib:
+endif
+
+if PLATFORM_WIN32
+no_undefined = -no-undefined
endif
lib_LTLIBRARIES = libatk-1.0.la
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]