Skip to content

Commit

Permalink
Disable relocation support within gdk-pixbuf (lovell/sharp#2384)
Browse files Browse the repository at this point in the history
  • Loading branch information
kleisauke committed Oct 13, 2020
1 parent 7e4a724 commit e5afa9d
Showing 1 changed file with 67 additions and 23 deletions.
90 changes: 67 additions & 23 deletions build/patches/gdk-pixbuf-1-fixes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,38 @@ This file is part of MXE. See LICENSE.md for licensing information.
Contains ad hoc patches for cross building.

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jeroen Ooms <[email protected]>
Date: Tue, 2 Aug 2016 16:05:31 +0200
Subject: [PATCH 1/3] Remove DllMain from static glib2 libraries
From: Kleis Auke Wolthuizen <[email protected]>
Date: Tue, 13 Oct 2020 16:30:00 +0200
Subject: [PATCH 1/4] Avoid multiple definitions of DllMain in static builds


diff --git a/gdk-pixbuf/gdk-pixbuf-io.c b/gdk-pixbuf/gdk-pixbuf-io.c
index 1111111..2222222 100644
--- a/gdk-pixbuf/gdk-pixbuf-io.c
+++ b/gdk-pixbuf/gdk-pixbuf-io.c
@@ -199,6 +199,7 @@ get_file_formats (void)

static HMODULE gdk_pixbuf_dll;

+#ifdef DLL_EXPORT
BOOL WINAPI
DllMain (HINSTANCE hinstDLL,
DWORD fdwReason,
@@ -213,6 +214,7 @@ DllMain (HINSTANCE hinstDLL,
return TRUE;
}
#endif
+#endif


#ifdef GDK_PIXBUF_RELOCATABLE

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Kleis Auke Wolthuizen <[email protected]>
Date: Tue, 13 Oct 2020 16:40:45 +0200
Subject: [PATCH 2/4] Don't force relocation support on Windows

We don't use loadable modules for gdk-pixbuf.

diff --git a/gdk-pixbuf/gdk-pixbuf-io.c b/gdk-pixbuf/gdk-pixbuf-io.c
index 1111111..2222222 100644
Expand All @@ -17,33 +45,49 @@ index 1111111..2222222 100644
}

-#ifdef G_OS_WIN32
+#if defined (G_OS_WIN32) && defined (DLL_EXPORT)
+#if defined(G_OS_WIN32) && defined(GDK_PIXBUF_RELOCATABLE)

/* DllMain function needed to tuck away the gdk-pixbuf DLL handle */

@@ -223,7 +223,7 @@ gdk_pixbuf_get_toplevel (void)
static gchar *toplevel = NULL;
diff --git a/gdk-pixbuf/queryloaders.c b/gdk-pixbuf/queryloaders.c
index 1111111..2222222 100644
--- a/gdk-pixbuf/queryloaders.c
+++ b/gdk-pixbuf/queryloaders.c
@@ -280,7 +280,7 @@ query_module (GString *contents, const char *dir, const char *file)
g_free (path);
}

if (toplevel == NULL) {
-#if defined(G_OS_WIN32)
+#if defined (G_OS_WIN32) && defined (DLL_EXPORT)
toplevel = g_win32_get_package_installation_directory_of_module (gdk_pixbuf_dll);
#elif defined(OS_DARWIN)
char pathbuf[PATH_MAX + 1];
@@ -234,7 +234,7 @@ gdk_pixbuf_get_toplevel (void)
bin_dir = g_dirname(pathbuf);
toplevel = g_build_path (G_DIR_SEPARATOR_S, bin_dir, "..", NULL);
g_free (bin_dir);
-#elif defined (OS_LINUX)
+#elif defined (OS_LINUX) || defined(__MINGW32__)
gchar *exe_path, *bin_dir;
-#ifdef G_OS_WIN32
+#if defined(G_OS_WIN32) && defined(GDK_PIXBUF_RELOCATABLE)

static char *
get_libdir (void)
diff --git a/meson.build b/meson.build
index 1111111..2222222 100644
--- a/meson.build
+++ b/meson.build
@@ -347,15 +347,8 @@ if get_option('tiff') and not native_windows_loaders
endif
endif

-# Determine whether we enable application bundle relocation support, and we use
-# this always on Windows
-if host_system == 'windows'
- relocatable = true
-else
- relocatable = get_option('relocatable')
-endif
-
-if relocatable
+# Determine whether we enable application bundle relocation support
+if get_option('relocatable')
add_project_arguments([ '-DGDK_PIXBUF_RELOCATABLE' ], language: 'c')
endif

exe_path = g_file_read_link ("/proc/self/exe", NULL);

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Lovell Fuller <[email protected]>
Date: Wed, 5 Jun 2019 20:49:17 +0100
Subject: [PATCH 2/3] Ensure gdk-pixbuf can find libjpeg-turbo when cross-compiling
Subject: [PATCH 3/4] Ensure gdk-pixbuf can find libjpeg-turbo when cross-compiling


diff --git a/meson.build b/meson.build
Expand All @@ -63,7 +107,7 @@ index 1111111..2222222 100644
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Kleis Auke Wolthuizen <[email protected]>
Date: Mon, 7 Oct 2019 11:30:00 +0200
Subject: [PATCH 3/3] Fix pkg-config file when using built-in loader(s)
Subject: [PATCH 4/4] Fix pkg-config file when using built-in loader(s)

See: https://gitlab.gnome.org/GNOME/gdk-pixbuf/merge_requests/50

Expand Down

0 comments on commit e5afa9d

Please sign in to comment.