diff options
author | Nicola Murino | 2019-09-19 23:10:52 +0200 |
---|---|---|
committer | Nicola Murino | 2019-09-19 23:10:52 +0200 |
commit | 25a3d762d7f1473e41f7c09ae61dfdfa2b77b90b (patch) | |
tree | b637bbac8867ac2b5db55b922c451c5e9f7f242d | |
parent | e559d5dc8767e5c42fdda6e1001f84a07497f309 (diff) | |
download | aur-25a3d762d7f1473e41f7c09ae61dfdfa2b77b90b.tar.gz |
update to 2.62.0-1
-rw-r--r-- | .SRCINFO | 10 | ||||
-rw-r--r-- | 0001-Use-CreateFile-on-Win32-to-make-sure-g_unlink-always.patch | 178 | ||||
-rw-r--r-- | 0001-win32-Make-the-static-build-work-with-MinGW-when-pos.patch | 84 | ||||
-rw-r--r-- | PKGBUILD | 12 | ||||
-rw-r--r-- | glib-prefer-constructors-over-DllMain.patch | 78 |
5 files changed, 186 insertions, 176 deletions
@@ -1,6 +1,6 @@ pkgbase = mingw-w64-glib2 pkgdesc = Low level core library (mingw-w64) - pkgver = 2.60.7 + pkgver = 2.62.0 pkgrel = 1 url = https://wiki.gnome.org/Projects/GLib arch = any @@ -15,12 +15,12 @@ pkgbase = mingw-w64-glib2 options = !buildflags options = staticlibs options = !emptydirs - source = git+https://gitlab.gnome.org/GNOME/glib.git#commit=a7da87e3e8dad5e53b2acf10617485d137a44ca5 + source = git+https://gitlab.gnome.org/GNOME/glib.git#commit=a1af0be78c6cb3bce4791a1598a796c3e912019f source = 0001-Use-CreateFile-on-Win32-to-make-sure-g_unlink-always.patch - source = 0001-win32-Make-the-static-build-work-with-MinGW-when-pos.patch + source = glib-prefer-constructors-over-DllMain.patch sha256sums = SKIP - sha256sums = ff0d3df5d57cf621cac79f5bea8bd175e6c18b3fbf7cdd02df38c1eab9f40ac3 - sha256sums = 838abaeab8ca4978770222ef5f88c4b464545dd591b2d532c698caa875b46931 + sha256sums = 1cea1995b0e21268e55ceed04484305418a471a932f268530e48e2d0e08f8e06 + sha256sums = 9698fe428a380e568c3b83035856f83b1c70bf76dc09df7948ddebe7ca39ed65 pkgname = mingw-w64-glib2 diff --git a/0001-Use-CreateFile-on-Win32-to-make-sure-g_unlink-always.patch b/0001-Use-CreateFile-on-Win32-to-make-sure-g_unlink-always.patch index 17f9895eadda..201ee1d4ee8f 100644 --- a/0001-Use-CreateFile-on-Win32-to-make-sure-g_unlink-always.patch +++ b/0001-Use-CreateFile-on-Win32-to-make-sure-g_unlink-always.patch @@ -1,6 +1,28 @@ ---- glib-2.57.2/glib/gstdio.c.orig 2018-07-31 20:31:07.000000000 +0200 -+++ glib-2.57.2/glib/gstdio.c 2018-08-03 16:32:42.447575300 +0200 -@@ -758,6 +758,11 @@ +From 7f4f4354540440c0a8a37beaccbec8bc7fc15ec7 Mon Sep 17 00:00:00 2001 +From: Erik van Pienbroek <epienbro@fedoraproject.org> +Date: Mon, 27 Aug 2012 23:28:54 +0200 +Subject: [PATCH] Use CreateFile on Win32 to make sure g_unlink always works + +The functions g_open(), g_creat() and g_fopen() defer to _wopen(), +_wcreat() and _wfopen() respectively. This is very similar to +the corresponding arrangement for Linux. However, those Windows +functions do not support renaming a file whilst it's open. As a +result, g_rename() behaves differently on the Windows platform +compared to its Linux behaviour, where files can be renamed even +while there are file handles still open. Resolved this by using +the Win32 API function CreateFile() instead of _wopen(), _wcreat() +and _wfopen() + +Patch initially created by John Emmas +--- + glib/gstdio.c | 264 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------- + 1 file changed, 235 insertions(+), 29 deletions(-) + +diff --git a/glib/gstdio.c b/glib/gstdio.c +index 653c8a3..26e8158 100644 +--- a/glib/gstdio.c ++++ b/glib/gstdio.c +@@ -1035,6 +1035,11 @@ g_open (const gchar *filename, int mode) { #ifdef G_OS_WIN32 @@ -8,11 +30,11 @@ + DWORD dwDesiredAccess = 0; + DWORD dwFlagsAndAttributes = 0; + DWORD dwDisposition = OPEN_EXISTING; -+ DWORD dwSharedAccess = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE; ++ DWORD dwSharedAccess = FILE_SHARE_READ | FILE_SHARE_DELETE; wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL); int retval; int save_errno; -@@ -768,12 +773,114 @@ +@@ -1045,12 +1050,114 @@ g_open (const gchar *filename, return -1; } @@ -28,45 +50,44 @@ + { + /* Equates to _O_RDONLY */ + if (flags & _O_TRUNC) -+ { -+ errno = EINVAL; -+ g_free (wfilename); -+ return -1; -+ } - -- g_free (wfilename); -+ dwDesiredAccess |= GENERIC_READ; -+ dwSharedAccess |= FILE_SHARE_WRITE; ++ { ++ errno = EINVAL; ++ g_free (wfilename); ++ return -1; ++ } ++ ++ dwDesiredAccess |= GENERIC_READ; ++ dwSharedAccess |= FILE_SHARE_WRITE; + } + if (flags & _O_WRONLY) + { + if (flags & _O_RDWR) -+ { -+ errno = EINVAL; -+ g_free (wfilename); -+ return -1; -+ } - -+ dwDesiredAccess |= GENERIC_WRITE; ++ { ++ errno = EINVAL; ++ g_free (wfilename); ++ return -1; ++ } ++ ++ dwDesiredAccess |= GENERIC_WRITE; + } + if (flags & _O_RDWR) + { -+ dwDesiredAccess |= GENERIC_READ; -+ dwDesiredAccess |= GENERIC_WRITE; ++ dwDesiredAccess |= GENERIC_READ; ++ dwDesiredAccess |= GENERIC_WRITE; + } + if (flags & _O_TRUNC) + { + if (flags & _O_CREAT) -+ dwDisposition = CREATE_ALWAYS; -+ else -+ dwDisposition = TRUNCATE_EXISTING; ++ dwDisposition = CREATE_ALWAYS; ++ else ++ dwDisposition = TRUNCATE_EXISTING; + } + if ((flags & _O_CREAT) && !(flags & _O_TRUNC)) + { + if (flags & _O_EXCL) -+ dwDisposition = CREATE_NEW; -+ else -+ dwDisposition = OPEN_ALWAYS; ++ dwDisposition = CREATE_NEW; ++ else ++ dwDisposition = OPEN_ALWAYS; + } + if (flags & _O_CREAT) + { @@ -85,7 +106,8 @@ + { + dwFlagsAndAttributes |= FILE_FLAG_RANDOM_ACCESS; + } -+ + +- g_free (wfilename); + if (0 == dwFlagsAndAttributes) + dwFlagsAndAttributes = FILE_ATTRIBUTE_NORMAL; + hFile = CreateFileW(wfilename, dwDesiredAccess, dwSharedAccess, NULL, dwDisposition, dwFlagsAndAttributes, NULL); @@ -111,7 +133,7 @@ + } + else + retval = _open_osfhandle((long)hFile, flags); -+ + + if ((-1) != retval) + { + /* We have a valid file handle. Set its translation mode to text or binary, as appropriate */ @@ -130,7 +152,7 @@ return retval; #else int fd; -@@ -821,6 +928,8 @@ +@@ -1098,6 +1205,8 @@ g_creat (const gchar *filename, int mode) { #ifdef G_OS_WIN32 @@ -139,7 +161,7 @@ wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL); int retval; int save_errno; -@@ -831,12 +940,41 @@ +@@ -1108,12 +1217,41 @@ g_creat (const gchar *filename, return -1; } @@ -150,10 +172,11 @@ + if (! (mode & _S_IWRITE)) + dwFlagsAndAttributes = FILE_ATTRIBUTE_READONLY; /* Sets file to 'read only' after the file gets closed */ + } -+ + +- g_free (wfilename); + hFile = CreateFileW(wfilename, (GENERIC_READ | GENERIC_WRITE), (FILE_SHARE_READ | FILE_SHARE_DELETE), + NULL, CREATE_ALWAYS, dwFlagsAndAttributes, NULL); -+ + + if (INVALID_HANDLE_VALUE == hFile) + { + retval = (-1); @@ -175,52 +198,32 @@ + } + else + retval = _open_osfhandle((long)hFile, _O_RDWR); - ++ + save_errno = errno; - g_free (wfilename); -- ++ g_free (wfilename); errno = save_errno; + return retval; #else return creat (filename, mode); -@@ -1286,36 +1424,102 @@ +@@ -1550,34 +1688,102 @@ g_fopen (const gchar *filename, const gchar *mode) { #ifdef G_OS_WIN32 - wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL); - wchar_t *wmode; -- gchar *mode2; - FILE *retval; - int save_errno; -- ++ int hFile; ++ int flags = 0; ++ gchar priv_mode[4]; ++ FILE *retval = NULL; + - if (wfilename == NULL) - { - errno = EINVAL; - return NULL; - } -- -- mode2 = _g_win32_get_mode_alias (mode); -- wmode = g_utf8_to_utf16 (mode2, -1, NULL, NULL, NULL); -- g_free (mode2); -- -- if (wmode == NULL) -- { -- g_free (wfilename); -- errno = EINVAL; -- return NULL; -- } -- -- retval = _wfopen (wfilename, wmode); -- save_errno = errno; -- -- g_free (wfilename); -- g_free (wmode); -+ int hFile; -+ int flags = 0; -+ gchar priv_mode[4]; -+ FILE *retval = NULL; -+ + if ((NULL == filename) || (NULL == mode)) + { + errno = EINVAL; @@ -228,20 +231,25 @@ + } + if ((strlen(mode) < 1) || (strlen(mode) > 3)) + { -+ errno = EINVAL; ++ errno - EINVAL; + goto out; + } -+ + +- wmode = g_utf8_to_utf16 (mode, -1, NULL, NULL, NULL); + strncpy(priv_mode, mode, 3); + priv_mode[3] = '\0'; -+ + +- if (wmode == NULL) + /* Set up any flags to pass to 'g_open()' */ + if (3 == strlen(priv_mode)) + { + if (('c' == priv_mode[2]) || ('n' == priv_mode[2])) + priv_mode[2] = '\0'; + else -+ { + { +- g_free (wfilename); +- errno = EINVAL; +- return NULL; + if (0 == strcmp(priv_mode, "a+b")) + flags = _O_RDWR | _O_CREAT | _O_APPEND | _O_BINARY; + else if (0 == strcmp(priv_mode, "a+t")) @@ -255,11 +263,20 @@ + else if (0 == strcmp(priv_mode, "w+t")) + flags = _O_RDWR | _O_CREAT |_O_TRUNC | _O_TEXT; + else -+ { -+ errno = EINVAL; ++ { ++ errno = EINVAL; + goto out; -+ } -+ } ++ } + } +- +- _g_win32_fix_mode (wmode); +- retval = _wfopen (wfilename, wmode); +- save_errno = errno; +- +- g_free (wfilename); +- g_free (wmode); +- +- errno = save_errno; + } + if (2 == strlen(priv_mode)) + { @@ -282,10 +299,10 @@ + else if (0 == strcmp(priv_mode, "wt")) + flags = _O_WRONLY | _O_CREAT | _O_TRUNC | _O_TEXT; + else -+ { -+ errno = EINVAL; ++ { ++ errno = EINVAL; + goto out; -+ } ++ } + } + } + if (1 == strlen(priv_mode)) @@ -297,21 +314,20 @@ + else if (0 == strcmp(priv_mode, "w")) + flags = _O_WRONLY | _O_CREAT | _O_TRUNC; + else if ( !((0 == strcmp(priv_mode, "c")) || (0 == strcmp(priv_mode, "n")))) -+ { -+ errno = EINVAL; ++ { ++ errno = EINVAL; + goto out; -+ } ++ } + } -+ ++ + hFile = g_open (filename, flags, (_S_IREAD | _S_IWRITE)); -+ ++ + if (INVALID_HANDLE_VALUE == (HANDLE)hFile) + /* 'errno' will have already been set by 'g_open()' */ + retval = NULL; + else + retval = _fdopen(hFile, mode); - -- errno = save_errno; ++ +out: return retval; #else diff --git a/0001-win32-Make-the-static-build-work-with-MinGW-when-pos.patch b/0001-win32-Make-the-static-build-work-with-MinGW-when-pos.patch deleted file mode 100644 index cfe978ba8851..000000000000 --- a/0001-win32-Make-the-static-build-work-with-MinGW-when-pos.patch +++ /dev/null @@ -1,84 +0,0 @@ -From cf8d0b69566b5b3bab9aacaeecd9ce465cc33413 Mon Sep 17 00:00:00 2001 -From: Christoph Reiter <reiter.christoph@gmail.com> -Date: Sat, 6 Jan 2018 22:04:23 +0100 -Subject: [PATCH] win32: Make the static build work with MinGW when posix - threads are used - -MinGW does not support the use of DllMain() for static builds, but that -is currently always used on Windows, partly because it is needed for -handling win32 threads and because there are problems with MSVC -optimizing constructors away (see 7a29771a743a8b5337). - -To make the static build at least work in case mingw+posix threads are used, -switch to using constructors for that. The g_clock_win32_init() call is -moved into glib_init(), so it's also called in that case. - -If mingw+static+win32 threads are used abort the build early and print -an error message. - -https://bugzilla.gnome.org/show_bug.cgi?id=792297 ---- - glib/glib-init.c | 15 ++++++++++++--- - gobject/gtype.c | 2 +- - 2 files changed, 13 insertions(+), 4 deletions(-) - -diff --git a/glib/glib-init.c b/glib/glib-init.c -index 5f312113a..cd32e25a5 100644 ---- a/glib/glib-init.c -+++ b/glib/glib-init.c -@@ -268,19 +268,29 @@ glib_init (void) - - glib_inited = TRUE; - -+#ifdef G_OS_WIN32 -+ g_clock_win32_init (); -+#endif - g_messages_prefixed_init (); - g_debug_init (); - g_quark_init (); - } - - #if defined (G_OS_WIN32) -+HMODULE glib_dll; -+#endif -+ -+#if defined(__MINGW32__) && defined(GLIB_STATIC_COMPILATION) && !defined(THREADS_POSIX) -+/* MinGW static builds do not work with DllMain, but win32 threads need it atm */ -+#error "Static build under MinGW only supported when build with posix threads" -+#endif -+ -+#if defined (G_OS_WIN32) && (!defined(__MINGW32__) || defined(DLL_EXPORT)) - - BOOL WINAPI DllMain (HINSTANCE hinstDLL, - DWORD fdwReason, - LPVOID lpvReserved); - --HMODULE glib_dll; -- - BOOL WINAPI - DllMain (HINSTANCE hinstDLL, - DWORD fdwReason, -@@ -290,7 +300,6 @@ DllMain (HINSTANCE hinstDLL, - { - case DLL_PROCESS_ATTACH: - glib_dll = hinstDLL; -- g_clock_win32_init (); - #ifdef THREADS_WIN32 - g_thread_win32_init (); - #endif -diff --git a/gobject/gtype.c b/gobject/gtype.c -index 275a8b60b..222b0a2f0 100644 ---- a/gobject/gtype.c -+++ b/gobject/gtype.c -@@ -4451,7 +4451,7 @@ gobject_init (void) - _g_signal_init (); - } - --#if defined (G_OS_WIN32) -+#if defined (G_OS_WIN32) && (!defined(__MINGW32__) || defined(DLL_EXPORT)) - - BOOL WINAPI DllMain (HINSTANCE hinstDLL, - DWORD fdwReason, --- -2.15.1 - @@ -4,9 +4,9 @@ # Contributor: Renato Silva <br.renatosilva@gmail.com> # Contributor: Martchus <martchus@gmx.net> pkgname=mingw-w64-glib2 -pkgver=2.60.7 +pkgver=2.62.0 pkgrel=1 -_commit=a7da87e3e8dad5e53b2acf10617485d137a44ca5 # tags/2.60.7^0 +_commit=a1af0be78c6cb3bce4791a1598a796c3e912019f # tags/2.62.0^0 arch=(any) pkgdesc="Low level core library (mingw-w64)" depends=(mingw-w64-libffi mingw-w64-pcre mingw-w64-gettext mingw-w64-zlib) @@ -16,10 +16,10 @@ options=(!strip !buildflags staticlibs !emptydirs) url="https://wiki.gnome.org/Projects/GLib" source=("git+https://gitlab.gnome.org/GNOME/glib.git#commit=$_commit" "0001-Use-CreateFile-on-Win32-to-make-sure-g_unlink-always.patch" - "0001-win32-Make-the-static-build-work-with-MinGW-when-pos.patch") + "glib-prefer-constructors-over-DllMain.patch") sha256sums=('SKIP' - 'ff0d3df5d57cf621cac79f5bea8bd175e6c18b3fbf7cdd02df38c1eab9f40ac3' - '838abaeab8ca4978770222ef5f88c4b464545dd591b2d532c698caa875b46931') + '1cea1995b0e21268e55ceed04484305418a471a932f268530e48e2d0e08f8e06' + '9698fe428a380e568c3b83035856f83b1c70bf76dc09df7948ddebe7ca39ed65') _architectures="i686-w64-mingw32 x86_64-w64-mingw32" @@ -33,7 +33,7 @@ prepare() { # https://gitlab.gnome.org/GNOME/glib/issues/539 patch -Np1 -i ../0001-Use-CreateFile-on-Win32-to-make-sure-g_unlink-always.patch # https://gitlab.gnome.org/GNOME/glib/issues/692 - patch -Np1 -i ../0001-win32-Make-the-static-build-work-with-MinGW-when-pos.patch + patch -Np1 -i ../glib-prefer-constructors-over-DllMain.patch } diff --git a/glib-prefer-constructors-over-DllMain.patch b/glib-prefer-constructors-over-DllMain.patch new file mode 100644 index 000000000000..4bb52334e1ab --- /dev/null +++ b/glib-prefer-constructors-over-DllMain.patch @@ -0,0 +1,78 @@ +From bc90511c1eb333e26e0bc0eaee62375d0e788db6 Mon Sep 17 00:00:00 2001 +From: Erik van Pienbroek <epienbro@fedoraproject.org> +Date: Tue, 16 Apr 2013 11:42:11 +0200 +Subject: [PATCH] win32: Prefer the use of constructors over DllMain + +This prevents having to depend on DllMain in static libraries + +Constructors are available in both the GCC build (GCC 2.7 and later) +and the MSVC build (MSVC 2008 and later using _Pragma, earlier +versions using #pragma) +--- + glib/glib-init.c | 27 ++++++++++++++++----------- + 1 file changed, 16 insertions(+), 11 deletions(-) + +diff --git a/glib/glib-init.c b/glib/glib-init.c +index ed800dc..f760bf1 100644 +--- a/glib/glib-init.c ++++ b/glib/glib-init.c +@@ -271,12 +271,14 @@ glib_init (void) + + #if defined (G_OS_WIN32) + ++HMODULE glib_dll = NULL; ++ ++#if defined (DLL_EXPORT) ++ + BOOL WINAPI DllMain (HINSTANCE hinstDLL, + DWORD fdwReason, + LPVOID lpvReserved); + +-HMODULE glib_dll; +- + BOOL WINAPI + DllMain (HINSTANCE hinstDLL, + DWORD fdwReason, +@@ -286,14 +288,6 @@ DllMain (HINSTANCE hinstDLL, + { + case DLL_PROCESS_ATTACH: + glib_dll = hinstDLL; +- g_crash_handler_win32_init (); +- g_clock_win32_init (); +-#ifdef THREADS_WIN32 +- g_thread_win32_init (); +-#endif +- glib_init (); +- /* must go after glib_init */ +- g_console_win32_init (); + break; + + case DLL_THREAD_DETACH: +@@ -318,7 +312,10 @@ DllMain (HINSTANCE hinstDLL, + return TRUE; + } + +-#elif defined (G_HAS_CONSTRUCTORS) ++#endif /* defined (DLL_EXPORT) */ ++#endif /* defined (G_OS_WIN32) */ ++ ++#if defined (G_HAS_CONSTRUCTORS) + + #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA + #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(glib_init_ctor) +@@ -328,7 +325,15 @@ G_DEFINE_CONSTRUCTOR(glib_init_ctor) + static void + glib_init_ctor (void) + { ++#if defined (G_OS_WIN32) ++ g_clock_win32_init (); ++#ifdef THREADS_WIN32 ++ g_thread_win32_init (); ++#endif /* defined (THREADS_WIN32) */ ++#endif /* defined (G_OS_WIN32) */ + glib_init (); ++ /* must go after glib_init */ ++ g_console_win32_init (); + } + + #else |