diff options
-rw-r--r-- | recipes/gdk-pixbuf.recipe | 5 | ||||
-rw-r--r-- | recipes/gdk-pixbuf/0001-io-extened-support-for-relotations-to-OS-X-and-Linux.patch | 205 |
2 files changed, 209 insertions, 1 deletions
diff --git a/recipes/gdk-pixbuf.recipe b/recipes/gdk-pixbuf.recipe index 73162235..68c1ffe9 100644 --- a/recipes/gdk-pixbuf.recipe +++ b/recipes/gdk-pixbuf.recipe @@ -8,7 +8,10 @@ class Recipe(recipe.Recipe): licenses = [License.LGPLv2Plus] stype = SourceType.TARBALL url = 'http://ftp.gnome.org/pub/gnome/sources/gdk-pixbuf/2.30/gdk-pixbuf-2.30.7.tar.xz' - patches = ['gdk-pixbuf/0002-nls-update-gettext-macros-for-0.18.patch'] + patches = [ + 'gdk-pixbuf/0001-io-extened-support-for-relotations-to-OS-X-and-Linux.patch', + 'gdk-pixbuf/0002-nls-update-gettext-macros-for-0.18.patch', + ] configure_options = '--with-included-loaders --enable-static --enable-gio-sniffing=no ' deps = ['jpeg', 'glib', 'libpng', 'tiff', 'zlib' ] autoreconf = True diff --git a/recipes/gdk-pixbuf/0001-io-extened-support-for-relotations-to-OS-X-and-Linux.patch b/recipes/gdk-pixbuf/0001-io-extened-support-for-relotations-to-OS-X-and-Linux.patch new file mode 100644 index 00000000..ced85d6b --- /dev/null +++ b/recipes/gdk-pixbuf/0001-io-extened-support-for-relotations-to-OS-X-and-Linux.patch @@ -0,0 +1,205 @@ +From 618259694147a134377eae4a0aaead939190b983 Mon Sep 17 00:00:00 2001 +From: Andoni Morales Alastruey <ylatuya@gmail.com> +Date: Thu, 9 Oct 2014 11:33:36 +0200 +Subject: [PATCH] io: extened support for relotations to OS X and Linux + +--- + configure.ac | 25 ++++++++++++++++++++++ + gdk-pixbuf/gdk-pixbuf-io.c | 49 +++++++++++++++++++++++++++++++++----------- + gdk-pixbuf/gdk-pixbuf-util.c | 10 ++++++--- + 3 files changed, 69 insertions(+), 15 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 626e9e9..8501a83 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -130,6 +130,9 @@ case $host in + *-*-linux*) + os_linux=yes + ;; ++ *-*-darwin*) ++ AC_DEFINE(OS_DARWIN, 1, [Define to 1 if it's a darwin platform]) ++ ;; + esac + + if test "$os_win32" = "yes"; then +@@ -1000,6 +1003,28 @@ fi + + AM_CONDITIONAL(ENABLE_MAN, test x$enable_man != xno) + ++####################################################### ++# Enable replacing the build-time prefix in the loaders ++# cache with the installation prefix on this machine ++# for relocatable packages such as Windows and OS X ++# applicationsapplications and linux bundles ++####################################################### ++ ++enable_relocations=no ++case $host in ++ *-*-mingw*) ++ enable_relocations=yes ++ ;; ++ *-*-darwin*) ++ enable_relocations=yes ++ ;; ++esac ++ ++if test "x$enable_relocations" = "xyes"; then ++ AC_DEFINE(GDK_PIXBUF_RELOCATABLE, 1, ++ [Define to 1 to replace the build-time prefix in modules]) ++fi ++ + + ################################################## + # Check for -Bsymbolic-functions linker flag used +diff --git a/gdk-pixbuf/gdk-pixbuf-io.c b/gdk-pixbuf/gdk-pixbuf-io.c +index 2d952e5..49e294d 100644 +--- a/gdk-pixbuf/gdk-pixbuf-io.c ++++ b/gdk-pixbuf/gdk-pixbuf-io.c +@@ -44,6 +44,9 @@ + #include <windows.h> + #undef STRICT + #endif ++#ifdef OS_DARWIN ++#include <mach-o/dyld.h> ++#endif + + /** + * SECTION:file-loading +@@ -189,6 +192,7 @@ get_file_formats (void) + return file_formats; + } + ++ + #ifdef G_OS_WIN32 + + /* DllMain function needed to tuck away the gdk-pixbuf DLL handle */ +@@ -208,19 +212,40 @@ DllMain (HINSTANCE hinstDLL, + + return TRUE; + } ++#endif ++ + + char * +-_gdk_pixbuf_win32_get_toplevel (void) ++_gdk_pixbuf_get_toplevel (void) + { + static char *toplevel = NULL; + +- if (toplevel == NULL) +- toplevel = g_win32_get_package_installation_directory_of_module (gdk_pixbuf_dll); +- ++ if (toplevel == NULL) { ++#if defined(G_OS_WIN32) ++ toplevel = g_win32_get_package_installation_directory_of_module (gdk_pixbuf_dll); ++#elif defined(OS_DARWIN) ++ char pathbuf[PATH_MAX + 1]; ++ uint32_t bufsize = sizeof(pathbuf); ++ gchar *bin_dir; ++ ++ _NSGetExecutablePath(pathbuf, &bufsize); ++ bin_dir = g_dirname(pathbuf); ++ toplevel = g_build_path (G_DIR_SEPARATOR_S, bin_dir, "..", NULL); ++ g_free (bin_dir); ++#elif defined (G_OS_UNIX) ++ gchar *exe_path, *bin_dir; ++ ++ exe_path = g_file_read_link ("/proc/self/exe", NULL); ++ bin_dir = g_dirname(exe_path); ++ toplevel = g_build_path (G_DIR_SEPARATOR_S, bin_dir, "..", NULL); ++ g_free (exe_path); ++ g_free (bin_dir); ++#else ++#error "Relocations not supported for this platform" ++#endif ++ } + return toplevel; + } +-#endif +- + + #ifdef USE_GMODULE + +@@ -302,8 +327,8 @@ skip_space (const char **pos) + + return !(*p == '\0'); + } +- +-#ifdef G_OS_WIN32 ++ ++#ifdef GDK_PIXBUF_RELOCATABLE + + static char * + get_libdir (void) +@@ -311,7 +336,7 @@ get_libdir (void) + static char *libdir = NULL; + + if (libdir == NULL) +- libdir = g_build_filename (_gdk_pixbuf_win32_get_toplevel (), "lib", NULL); ++ libdir = g_build_filename (_gdk_pixbuf_get_toplevel (), "lib", NULL); + + return libdir; + } +@@ -340,12 +365,12 @@ correct_prefix (gchar **path) + * installation prefix on this machine. + */ + tem = *path; +- *path = g_strconcat (_gdk_pixbuf_win32_get_toplevel (), tem + strlen (GDK_PIXBUF_PREFIX), NULL); ++ *path = g_strconcat (_gdk_pixbuf_get_toplevel (), tem + strlen (GDK_PIXBUF_PREFIX), NULL); + g_free (tem); + } + } + +-#endif /* G_OS_WIN32 */ ++#endif /* GDK_PIXBUF_RELOCATABLE */ + + static gchar * + gdk_pixbuf_get_module_file (void) +@@ -496,7 +521,7 @@ gdk_pixbuf_io_init (void) + /* Blank line marking the end of a module + */ + if (module && *p != '#') { +-#ifdef G_OS_WIN32 ++#ifdef GDK_PIXBUF_RELOCATABLE + correct_prefix (&module->module_path); + #endif + file_formats = g_slist_prepend (file_formats, module); +diff --git a/gdk-pixbuf/gdk-pixbuf-util.c b/gdk-pixbuf/gdk-pixbuf-util.c +index 6fbaa8e..be381cb 100644 +--- a/gdk-pixbuf/gdk-pixbuf-util.c ++++ b/gdk-pixbuf/gdk-pixbuf-util.c +@@ -342,7 +342,7 @@ gdk_pixbuf_apply_embedded_orientation (GdkPixbuf *src) + return dest; + } + +-#ifdef G_OS_WIN32 ++#ifdef GDK_PIXBUF_RELOCATABLE + + static const gchar * + get_localedir (void) +@@ -351,15 +351,19 @@ get_localedir (void) + gchar *retval; + + /* In gdk-pixbuf-io.c */ +- extern char *_gdk_pixbuf_win32_get_toplevel (void); ++ extern char *_gdk_pixbuf_get_toplevel (void); + +- temp = g_build_filename (_gdk_pixbuf_win32_get_toplevel (), "share/locale", NULL); ++ temp = g_build_filename (_gdk_pixbuf_get_toplevel (), "share/locale", NULL); + ++#ifdef G_OS_WIN32 + /* The localedir is passed to bindtextdomain() which isn't + * UTF-8-aware. + */ + retval = g_win32_locale_filename_from_utf8 (temp); + g_free (temp); ++#else ++ retval = temp; ++#endif + return retval; + } + +-- +1.9.1 + |