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 c3c4c75..201ee1d 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 @@ -15,14 +15,14 @@ and _wfopen() Patch initially created by John Emmas --- - glib/gstdio.c | 259 ++++++++++++++++++++++++++++++++++++++++++++++++++++------ - 1 file changed, 233 insertions(+), 26 deletions(-) + glib/gstdio.c | 264 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------- + 1 file changed, 235 insertions(+), 29 deletions(-) diff --git a/glib/gstdio.c b/glib/gstdio.c -index 6d763e1..c1d072f 100644 +index 653c8a3..26e8158 100644 --- a/glib/gstdio.c +++ b/glib/gstdio.c -@@ -758,6 +758,11 @@ +@@ -1035,6 +1035,11 @@ g_open (const gchar *filename, int mode) { #ifdef G_OS_WIN32 @@ -34,7 +34,7 @@ index 6d763e1..c1d072f 100644 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; } @@ -55,8 +55,7 @@ index 6d763e1..c1d072f 100644 + g_free (wfilename); + return -1; + } - -- g_free (wfilename); ++ + dwDesiredAccess |= GENERIC_READ; + dwSharedAccess |= FILE_SHARE_WRITE; + } @@ -107,7 +106,8 @@ index 6d763e1..c1d072f 100644 + { + dwFlagsAndAttributes |= FILE_FLAG_RANDOM_ACCESS; + } -+ + +- g_free (wfilename); + if (0 == dwFlagsAndAttributes) + dwFlagsAndAttributes = FILE_ATTRIBUTE_NORMAL; + hFile = CreateFileW(wfilename, dwDesiredAccess, dwSharedAccess, NULL, dwDisposition, dwFlagsAndAttributes, NULL); @@ -152,7 +152,7 @@ index 6d763e1..c1d072f 100644 return retval; #else int fd; -@@ -821,6 +928,8 @@ +@@ -1098,6 +1205,8 @@ g_creat (const gchar *filename, int mode) { #ifdef G_OS_WIN32 @@ -161,7 +161,7 @@ index 6d763e1..c1d072f 100644 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; } @@ -172,10 +172,11 @@ index 6d763e1..c1d072f 100644 + 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); @@ -197,46 +198,32 @@ index 6d763e1..c1d072f 100644 + } + 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; -- } -+ int hFile; -+ int flags = 0; -+ gchar priv_mode[4]; -+ FILE *retval = NULL; -+ + if ((NULL == filename) || (NULL == mode)) + { + errno = EINVAL; @@ -247,17 +234,22 @@ index 6d763e1..c1d072f 100644 + 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")) @@ -275,7 +267,16 @@ index 6d763e1..c1d072f 100644 + 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)) + { @@ -318,20 +319,15 @@ index 6d763e1..c1d072f 100644 + goto out; + } + } - -- retval = _wfopen (wfilename, wmode); -- save_errno = errno; ++ + hFile = g_open (filename, flags, (_S_IREAD | _S_IWRITE)); - -- g_free (wfilename); -- g_free (wmode); ++ + 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/glib-prefer-constructors-over-DllMain.patch b/glib-prefer-constructors-over-DllMain.patch index 2edec2b..4bb5233 100644 --- a/glib-prefer-constructors-over-DllMain.patch +++ b/glib-prefer-constructors-over-DllMain.patch @@ -9,13 +9,14 @@ 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 | 22 ++++++++++++++-------- - 1 file changed, 14 insertions(+), 8 deletions(-) + glib/glib-init.c | 27 ++++++++++++++++----------- + 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/glib/glib-init.c b/glib/glib-init.c ---- a/glib/glib-init.c 2018-08-02 16:09:46.277047195 +0200 -+++ b/glib/glib-init.c 2018-08-02 16:10:23.617387056 +0200 -@@ -272,12 +272,14 @@ +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) @@ -32,10 +33,11 @@ diff --git a/glib/glib-init.c b/glib/glib-init.c BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, -@@ -287,13 +289,6 @@ +@@ -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 (); @@ -46,7 +48,7 @@ diff --git a/glib/glib-init.c b/glib/glib-init.c break; case DLL_THREAD_DETACH: -@@ -317,7 +312,10 @@ +@@ -318,7 +312,10 @@ DllMain (HINSTANCE hinstDLL, return TRUE; } @@ -58,7 +60,7 @@ diff --git a/glib/glib-init.c b/glib/glib-init.c #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(glib_init_ctor) -@@ -327,7 +325,15 @@ +@@ -328,7 +325,15 @@ G_DEFINE_CONSTRUCTOR(glib_init_ctor) static void glib_init_ctor (void) { diff --git a/mingw-glib2.spec b/mingw-glib2.spec index a19f5b8..db51a30 100644 --- a/mingw-glib2.spec +++ b/mingw-glib2.spec @@ -8,8 +8,8 @@ %global __python %{__python3} Name: mingw-glib2 -Version: 2.58.3 -Release: 3%{?dist} +Version: 2.61.2 +Release: 1%{?dist} Summary: MinGW Windows GLib2 library License: LGPLv2+ @@ -20,7 +20,11 @@ Source0: http://download.gnome.org/sources/glib/%{release_version}/glib-% BuildArch: noarch -BuildRequires: mingw32-filesystem >= 95 +BuildRequires: meson +BuildRequires: gcc +BuildRequires: gcc-c++ + +BuildRequires: mingw32-filesystem >= 107 BuildRequires: mingw32-gcc BuildRequires: mingw32-binutils BuildRequires: mingw32-win-iconv @@ -29,7 +33,7 @@ BuildRequires: mingw32-libffi BuildRequires: mingw32-pcre BuildRequires: mingw32-zlib -BuildRequires: mingw64-filesystem >= 95 +BuildRequires: mingw64-filesystem >= 107 BuildRequires: mingw64-gcc BuildRequires: mingw64-binutils BuildRequires: mingw64-win-iconv @@ -43,10 +47,6 @@ BuildRequires: gettext # Native version required for glib-genmarshal BuildRequires: glib2-devel >= 2.45.3 BuildRequires: python3-devel -# glib starting from 2.57.2 does not ship autoconf scripts anymore -BuildRequires: autoconf -BuildRequires: automake -BuildRequires: libtool # https://bugzilla.gnome.org/show_bug.cgi?id=674214 Patch1: 0001-Use-CreateFile-on-Win32-to-make-sure-g_unlink-always.patch @@ -102,25 +102,13 @@ Static version of the MinGW Windows GLib2 library. %prep %setup -q -n glib-%{version} %patch1 -p1 -%patch5 -p1 +#%patch5 -p1 %build -NOCONFIGURE=1 ./autogen.sh -#GLib can't build static and shared libraries in one go, so we build GLib twice -MINGW_BUILDDIR_SUFFIX=_static %mingw_configure --with-python=%{__python3} --disable-shared --enable-static -MINGW_BUILDDIR_SUFFIX=_shared %mingw_configure --with-python=%{__python3} --disable-static - -MINGW_BUILDDIR_SUFFIX=_static %mingw_make %{?_smp_mflags} V=1 -MINGW_BUILDDIR_SUFFIX=_shared %mingw_make %{?_smp_mflags} V=1 - +%mingw_meson --default-library=both %install -MINGW_BUILDDIR_SUFFIX=_static %mingw_make install DESTDIR=$RPM_BUILD_ROOT/build_static -MINGW_BUILDDIR_SUFFIX=_shared %mingw_make install DESTDIR=$RPM_BUILD_ROOT - -# Move the static libraries to the right location -mv $RPM_BUILD_ROOT/build_static%{mingw32_libdir}/*.a $RPM_BUILD_ROOT%{mingw32_libdir} -mv $RPM_BUILD_ROOT/build_static%{mingw64_libdir}/*.a $RPM_BUILD_ROOT%{mingw64_libdir} +%mingw_ninja_install # There's a small difference in the file glibconfig.h between the # shared and the static build: @@ -144,8 +132,6 @@ mv $RPM_BUILD_ROOT/build_static%{mingw64_libdir}/*.a $RPM_BUILD_ROOT%{mingw64_li # and -DGOBJECT_STATIC_COMPILATION to their CFLAGS to avoid compile failures # Drop the folder which was temporary used for installing the static bits -rm -rf $RPM_BUILD_ROOT/build_static - rm -f $RPM_BUILD_ROOT/%{mingw32_libdir}/charset.alias rm -f $RPM_BUILD_ROOT/%{mingw64_libdir}/charset.alias @@ -187,7 +173,6 @@ find $RPM_BUILD_ROOT -name "*.la" -delete %{mingw32_bindir}/gdbus.exe %{mingw32_bindir}/gio.exe %{mingw32_bindir}/gio-querymodules.exe -%{mingw32_bindir}/gio-launch-desktop.exe %{mingw32_bindir}/glib-compile-resources.exe %{mingw32_bindir}/glib-compile-schemas.exe %{mingw32_bindir}/glib-genmarshal @@ -198,6 +183,7 @@ find $RPM_BUILD_ROOT -name "*.la" -delete %{mingw32_bindir}/gsettings.exe %{mingw32_bindir}/gspawn-win32-helper-console.exe %{mingw32_bindir}/gspawn-win32-helper.exe +%{mingw32_bindir}/gtester-report %{mingw32_bindir}/libgio-2.0-0.dll %{mingw32_bindir}/libglib-2.0-0.dll %{mingw32_bindir}/libgmodule-2.0-0.dll @@ -206,8 +192,6 @@ find $RPM_BUILD_ROOT -name "*.la" -delete %{mingw32_includedir}/glib-2.0/ %{mingw32_includedir}/gio-win32-2.0/ %{mingw32_libdir}/glib-2.0/ -%dir %{mingw32_libdir}/gio/ -%dir %{mingw32_libdir}/gio/modules/ %{mingw32_libdir}/libgio-2.0.dll.a %{mingw32_libdir}/libglib-2.0.dll.a %{mingw32_libdir}/libgmodule-2.0.dll.a @@ -240,7 +224,6 @@ find $RPM_BUILD_ROOT -name "*.la" -delete %{mingw64_bindir}/gdbus.exe %{mingw64_bindir}/gio.exe %{mingw64_bindir}/gio-querymodules.exe -%{mingw64_bindir}/gio-launch-desktop.exe %{mingw64_bindir}/glib-compile-resources.exe %{mingw64_bindir}/glib-compile-schemas.exe %{mingw64_bindir}/glib-genmarshal @@ -251,6 +234,7 @@ find $RPM_BUILD_ROOT -name "*.la" -delete %{mingw64_bindir}/gsettings.exe %{mingw64_bindir}/gspawn-win64-helper-console.exe %{mingw64_bindir}/gspawn-win64-helper.exe +%{mingw64_bindir}/gtester-report %{mingw64_bindir}/libgio-2.0-0.dll %{mingw64_bindir}/libglib-2.0-0.dll %{mingw64_bindir}/libgmodule-2.0-0.dll @@ -259,8 +243,6 @@ find $RPM_BUILD_ROOT -name "*.la" -delete %{mingw64_includedir}/glib-2.0/ %{mingw64_includedir}/gio-win32-2.0/ %{mingw64_libdir}/glib-2.0/ -%dir %{mingw64_libdir}/gio/ -%dir %{mingw64_libdir}/gio/modules/ %{mingw64_libdir}/libgio-2.0.dll.a %{mingw64_libdir}/libglib-2.0.dll.a %{mingw64_libdir}/libgmodule-2.0.dll.a @@ -289,6 +271,9 @@ find $RPM_BUILD_ROOT -name "*.la" -delete %changelog +* Thu Aug 15 2019 Fabiano FidĂȘncio - 2.61.2-1 +- Update to 2.61.2 + * Thu Jul 25 2019 Fedora Release Engineering - 2.58.3-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild diff --git a/sources b/sources index 64e15a0..5991a3a 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (glib-2.58.3.tar.xz) = 1e1cb5b607367dcbadb95563d463e81702cf396b28f1173f6d933707f4f3d5595a70225423e918807a05994a24f16fa3ac87d2ec67e4b670244ea99836634cce +SHA512 (glib-2.61.2.tar.xz) = 8ae0f6bc4cc867e9977370c7840012076908def6d752906b204fd10f29c657b2642a7a57a06d520e008d6b3858198a143763693b88ae54ee6dd90c612e4634bc