diff --git a/mingw-w64-pkg-config/0002-check-for-host.mingw.patch b/mingw-w64-pkg-config/0002-check-for-host.mingw.patch deleted file mode 100644 index 9e3cbb2b72..0000000000 --- a/mingw-w64-pkg-config/0002-check-for-host.mingw.patch +++ /dev/null @@ -1,17 +0,0 @@ - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/configure.ac b/configure.ac -index 2b33371..4ed7e4d 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -138,7 +138,7 @@ fi - AC_SUBST(WARN_CFLAGS) - - AC_MSG_CHECKING([for Win32]) --case "$build" in -+case "$host" in - *-*-mingw*) - native_win32=yes - ;; --- 1.8.1.4 \ No newline at end of file diff --git a/mingw-w64-pkg-config/0003-flush.mingw.patch b/mingw-w64-pkg-config/0003-flush.mingw.patch deleted file mode 100644 index dde3bd0821..0000000000 --- a/mingw-w64-pkg-config/0003-flush.mingw.patch +++ /dev/null @@ -1,24 +0,0 @@ - main.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/main.c b/main.c -index b61ca34..c937efc 100644 ---- a/main.c -+++ b/main.c -@@ -190,6 +190,7 @@ output_opt_cb (const char *opt, const char *arg, gpointer data, - { - fprintf (stderr, "Ignoring incompatible output option \"%s\"\n", - opt); -+ fflush (stderr); - return TRUE; - } - } -@@ -322,6 +323,7 @@ process_package_args (const char *cmdline, GList **packages, FILE *log) - if (reqs == NULL) - { - fprintf (stderr, "Must specify package names on the command line\n"); -+ fflush (stderr); - return FALSE; - } - --- 1.8.1.4 \ No newline at end of file diff --git a/mingw-w64-pkg-config/0004-expected-path-for.mingw.patch b/mingw-w64-pkg-config/0004-expected-path-for.mingw.patch deleted file mode 100644 index 427edf34ca..0000000000 --- a/mingw-w64-pkg-config/0004-expected-path-for.mingw.patch +++ /dev/null @@ -1,75 +0,0 @@ - check/check-path | 29 +++++++++++++++++++++-------- - check/config.sh.in | 2 ++ - configure.ac | 1 + - 3 files changed, 24 insertions(+), 8 deletions(-) - -diff --git a/check/check-path b/check/check-path -index fecfc06..37244d9 100755 ---- a/check/check-path -+++ b/check/check-path -@@ -9,14 +9,27 @@ PKG_CONFIG_PATH="$srcdir/sub" run_test --exists sub1 - - # default pkg-config path, making sure to resolve the variables fully - eval pc_path="$pc_path" --case ${MACHTYPE} in --*-msys) -- # Make sure path doesn't get mangled on MSYS -- RESULT=$(echo $pc_path | sed 's,/,\\/,g') -- ;; --*) -+if [ "$native_win32" = yes ]; then -+ # This is pretty hacky. On native win32 (MSYS/MINGW), pkg-config -+ # builds the default path from the installation directory. It -+ # then adds lib/pkgconfig and share/pkgconfig to it. Normally, -+ # the autoconf build directory would be used, but that path is in -+ # Unix format. -+ if [ "$OSTYPE" = msys ]; then -+ # MSYS has "pwd -W" to get the current directory in Windows format -+ pcdir=$(cd $top_builddir/.libs && pwd -W) -+ else -+ # Assume we have cmd somewhere to get variable %cd%. Make sure -+ # to strip carriage returns. -+ pcdir=$(cd $top_builddir/.libs && -+ cmd /C echo %cd% | sed -r 's/\r//g') -+ fi -+ win_path="$pcdir/lib/pkgconfig;$pcdir/share/pkgconfig" -+ -+ # Convert from forward slashes to Windows backslashes -+ RESULT=$(echo $win_path | sed 's,/,\\,g') -+else - RESULT=$pc_path -- ;; --esac -+fi - unset PKG_CONFIG_LIBDIR - run_test --variable=pc_path pkg-config -diff --git a/check/config.sh.in b/check/config.sh.in -index 91f20a2..68fa097 100644 ---- a/check/config.sh.in -+++ b/check/config.sh.in -@@ -2,6 +2,7 @@ - # Settings from the configure script - # - -+top_builddir=@top_builddir@ - prefix=@prefix@ - exec_prefix=@exec_prefix@ - includedir=@includedir@ -@@ -13,3 +14,4 @@ system_include_path="@system_include_path@" - system_library_path="@system_library_path@" - list_indirect_deps=@use_indirect_deps@ - PACKAGE_VERSION=@PACKAGE_VERSION@ -+native_win32=@native_win32@ -diff --git a/configure.ac b/configure.ac -index 4ed7e4d..4de9b16 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -147,6 +147,7 @@ case "$host" in - ;; - esac - AC_MSG_RESULT([$native_win32]) -+AC_SUBST([native_win32]) - AM_CONDITIONAL(NATIVE_WIN32, [test "x$native_win32" = xyes]) - - dnl --- 1.8.1.4 \ No newline at end of file diff --git a/mingw-w64-pkg-config/0005-mangle.mingw.patch b/mingw-w64-pkg-config/0005-mangle.mingw.patch deleted file mode 100644 index cbb228dd30..0000000000 --- a/mingw-w64-pkg-config/0005-mangle.mingw.patch +++ /dev/null @@ -1,39 +0,0 @@ -MSYS mangles UNIX paths on execution such that it prepends its root in -Windows format. This affects PKG_CONFIG_SYSROOT_DIR and thus the -check-sysroot test. Detect MSYS from the OSTYPE environment variable and -adjust the expected test results to match. This likely means that -sysroot support doesn't actually work on MSYS, but there probably aren't -any toolchains that support sysroot there, anyway. ---- - check/check-sysroot | 9 +++++++-- - 1 file changed, 7 insertions(+), 2 deletions(-) - -diff --git a/check/check-sysroot b/check/check-sysroot -index 0820206..d03d1c7 100755 ---- a/check/check-sysroot -+++ b/check/check-sysroot -@@ -6,6 +6,12 @@ set -e - - export PKG_CONFIG_SYSROOT_DIR=/sysroot - -+# MSYS mangles / paths to its own root in windows format. This probably -+# means sysroot doesn't work there, but match what pkg-config passes -+# back anyway. -+[ "x$OSTYPE" = "xmsys" ] && root=$(cd / && pwd -W) || root= -+root=${root%/} -+ - RESULT="" - run_test --cflags simple - -@@ -20,8 +25,8 @@ if [ "$list_indirect_deps" = yes ]; then - fi - run_test --libs --static simple - --RESULT="-I/sysroot/public-dep/include" -+RESULT="-I$root/sysroot/public-dep/include" - run_test --cflags public-dep - --RESULT="-L/sysroot/public-dep/lib -lpublic-dep" -+RESULT="-L$root/sysroot/public-dep/lib -lpublic-dep" - run_test --libs public-dep --- 1.8.1.4 diff --git a/mingw-w64-pkg-config/0006-path-for-tests.mingw.patch b/mingw-w64-pkg-config/0006-path-for-tests.mingw.patch deleted file mode 100644 index 6521c2db19..0000000000 --- a/mingw-w64-pkg-config/0006-path-for-tests.mingw.patch +++ /dev/null @@ -1,22 +0,0 @@ -For native Windows, the PKG_CONFIG_PATH separator is ; rather than :. ---- - check/check-sort-order | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/check/check-sort-order b/check/check-sort-order -index 77c0806..6482f6f 100755 ---- a/check/check-sort-order -+++ b/check/check-sort-order -@@ -34,8 +34,9 @@ set -e - - . ${srcdir}/common - --order1="$srcdir/sort/sort:$srcdir/sort" --order2="$srcdir/sort:$srcdir/sort/sort" -+[ "x$native_win32" = "xyes" ] && sep=';' || sep=':' -+order1="${srcdir}/sort/sort${sep}${srcdir}/sort" -+order2="${srcdir}/sort${sep}${srcdir}/sort/sort" - - export PKG_CONFIG_PATH - PKG_CONFIG_PATH="$order1" --- 1.8.1.4 \ No newline at end of file diff --git a/mingw-w64-pkg-config/0007-sub-path-for-tests.mingw.patch b/mingw-w64-pkg-config/0007-sub-path-for-tests.mingw.patch deleted file mode 100644 index 5bfcae796d..0000000000 --- a/mingw-w64-pkg-config/0007-sub-path-for-tests.mingw.patch +++ /dev/null @@ -1,31 +0,0 @@ -This just paves the way to calculate more useful defaults in a shell. ---- - check/Makefile.am | 1 - - configure.ac | 4 ++++ - 2 files changed, 4 insertions(+), 1 deletion(-) - -diff --git a/check/Makefile.am b/check/Makefile.am -index 30a527c..5006b5f 100644 ---- a/check/Makefile.am -+++ b/check/Makefile.am -@@ -1,4 +1,3 @@ --TESTS_PKG_CONFIG = $(top_builddir)/pkg-config$(EXEEXT) - TESTS_ENVIRONMENT = PKG_CONFIG='$(TESTS_PKG_CONFIG)' $(TESTS_SHELL) - - TESTS = \ -diff --git a/configure.ac b/configure.ac -index 4de9b16..73f2cf4 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -32,6 +32,10 @@ AC_ARG_VAR([TESTS_SHELL], [Path to a POSIX shell to be used for testing]) - conf_path="$PATH:`getconf PATH 2>/dev/null`" - AC_PATH_PROGS([TESTS_SHELL], [bash ksh sh], [$CONFIG_SHELL], [$conf_path]) - -+dnl The built pkg-config to use for testing. This allows it to be set -+dnl from the make command line if necessary. -+AC_SUBST([TESTS_PKG_CONFIG], ['${top_builddir}/pkg-config${EXEEXT}']) -+ - dnl - dnl Default pkg-config search path - dnl --- 1.8.1.4 \ No newline at end of file diff --git a/mingw-w64-pkg-config/0008-check-for-wine.mingw.patch b/mingw-w64-pkg-config/0008-check-for-wine.mingw.patch deleted file mode 100644 index 73de8de8d4..0000000000 --- a/mingw-w64-pkg-config/0008-check-for-wine.mingw.patch +++ /dev/null @@ -1,25 +0,0 @@ -If Wine is available when cross-compiling to Windows, it can be used to -run the test suite from the build machine. ---- - configure.ac | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/configure.ac b/configure.ac -index 73f2cf4..94666a4 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -154,6 +154,13 @@ AC_MSG_RESULT([$native_win32]) - AC_SUBST([native_win32]) - AM_CONDITIONAL(NATIVE_WIN32, [test "x$native_win32" = xyes]) - -+dnl When cross compiling to Windows, Wine might be available to help -+dnl for testing. -+if test "$cross_compiling" = yes && test "$native_win32" = yes; then -+ AC_CHECK_PROG([WINE], [wine], [wine]) -+ test "x$WINE" != x && TESTS_PKG_CONFIG='${WINE} '"$TESTS_PKG_CONFIG" -+fi -+ - dnl - dnl Find glib or use internal copy. Required version is 2.16 for - dnl g_win32_get_package_installation_directory_of_module(). --- 1.8.1.4 \ No newline at end of file diff --git a/mingw-w64-pkg-config/0009-use-wine-if-present.mingw.patch b/mingw-w64-pkg-config/0009-use-wine-if-present.mingw.patch deleted file mode 100644 index c42f87379c..0000000000 --- a/mingw-w64-pkg-config/0009-use-wine-if-present.mingw.patch +++ /dev/null @@ -1,30 +0,0 @@ -If we have Wine, it will provide cmd so we can build the pkg-config path -for the test. ---- - check/check-path | 2 +- - check/config.sh.in | 1 + - 2 files changed, 2 insertions(+), 1 deletion(-) - -diff --git a/check/check-path b/check/check-path -index 37244d9..2a6be75 100755 ---- a/check/check-path -+++ b/check/check-path -@@ -22,7 +22,7 @@ if [ "$native_win32" = yes ]; then - # Assume we have cmd somewhere to get variable %cd%. Make sure - # to strip carriage returns. - pcdir=$(cd $top_builddir/.libs && -- cmd /C echo %cd% | sed -r 's/\r//g') -+ $WINE cmd /C echo %cd% | sed -r 's/\r//g') - fi - win_path="$pcdir/lib/pkgconfig;$pcdir/share/pkgconfig" - -diff --git a/check/config.sh.in b/check/config.sh.in -index 68fa097..8b7ffb5 100644 ---- a/check/config.sh.in -+++ b/check/config.sh.in -@@ -15,3 +15,4 @@ system_library_path="@system_library_path@" - list_indirect_deps=@use_indirect_deps@ - PACKAGE_VERSION=@PACKAGE_VERSION@ - native_win32=@native_win32@ -+WINE=@WINE@ --- 1.8.1.4 \ No newline at end of file diff --git a/mingw-w64-pkg-config/0099-no-prefix-on.mingw.patch b/mingw-w64-pkg-config/0099-no-prefix-on.mingw.patch deleted file mode 100644 index 3c81c8d59a..0000000000 --- a/mingw-w64-pkg-config/0099-no-prefix-on.mingw.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- pkg-config-0.28/pkg.m4.orig 2013-04-01 15:45:41 +0400 -+++ pkg-config-0.28/pkg.m4 2013-04-03 02:13:38 +0400 -@@ -73,7 +73,7 @@ - pkg_cv_[]$1="$$1" - elif test -n "$PKG_CONFIG"; then - PKG_CHECK_EXISTS([$3], -- [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` -+ [pkg_cv_[]$1=`$PKG_CONFIG --dont-define-prefix --[]$2 "$3" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes ], - [pkg_failed=yes]) - else -@@ -122,9 +122,9 @@ - AC_MSG_RESULT([no]) - _PKG_SHORT_ERRORS_SUPPORTED - if test $_pkg_short_errors_supported = yes; then -- $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` -+ $1[]_PKG_ERRORS=`$PKG_CONFIG --dont-define-prefix --short-errors --print-errors --cflags --libs "$2" 2>&1` - else -- $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` -+ $1[]_PKG_ERRORS=`$PKG_CONFIG --dont-define-prefix --print-errors --cflags --libs "$2" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD diff --git a/mingw-w64-pkg-config/1001-Use-CreateFile-on-Win32-to-make-sure-g_unlink-always.patch b/mingw-w64-pkg-config/1001-Use-CreateFile-on-Win32-to-make-sure-g_unlink-always.patch new file mode 100644 index 0000000000..e53fd8d166 --- /dev/null +++ b/mingw-w64-pkg-config/1001-Use-CreateFile-on-Win32-to-make-sure-g_unlink-always.patch @@ -0,0 +1,316 @@ +diff -Naur glib-2.46.0-orig/glib/gstdio.c glib-2.46.0/glib/gstdio.c +--- glib-2.46.0-orig/glib/gstdio.c 2015-02-26 15:57:09.000000000 +0300 ++++ glib-2.46.0/glib/gstdio.c 2015-09-22 09:08:58.032066100 +0300 +@@ -192,6 +192,11 @@ + int mode) + { + #ifdef G_OS_WIN32 ++ HANDLE hFile; ++ DWORD dwDesiredAccess = 0; ++ DWORD dwFlagsAndAttributes = 0; ++ DWORD dwDisposition = OPEN_EXISTING; ++ DWORD dwSharedAccess = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE; + wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL); + int retval; + int save_errno; +@@ -202,12 +207,114 @@ + return -1; + } + +- retval = _wopen (wfilename, flags, mode); +- save_errno = errno; ++ /* Set up the access modes and other attributes */ ++ if ((flags & _O_CREAT) && (mode & _S_IREAD)) ++ { ++ if (! (mode & _S_IWRITE)) ++ dwFlagsAndAttributes = FILE_ATTRIBUTE_READONLY; /* Sets file to 'read only' after the file gets closed */ ++ } ++ if ( !(flags & _O_ACCMODE)) ++ { ++ /* 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; ++ } ++ if (flags & _O_WRONLY) ++ { ++ if (flags & _O_RDWR) ++ { ++ errno = EINVAL; ++ g_free (wfilename); ++ return -1; ++ } + ++ dwDesiredAccess |= GENERIC_WRITE; ++ } ++ if (flags & _O_RDWR) ++ { ++ dwDesiredAccess |= GENERIC_READ; ++ dwDesiredAccess |= GENERIC_WRITE; ++ } ++ if (flags & _O_TRUNC) ++ { ++ if (flags & _O_CREAT) ++ 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; ++ } ++ if (flags & _O_CREAT) ++ { ++ /* Handle the other flags that can be attached to _O_CREAT */ ++ if ((flags & _O_TEMPORARY) || (flags & _O_SHORT_LIVED)) ++ dwFlagsAndAttributes |= FILE_ATTRIBUTE_TEMPORARY; ++ ++ if (flags & _O_TEMPORARY) ++ dwFlagsAndAttributes |= FILE_FLAG_DELETE_ON_CLOSE; ++ } ++ if ((flags & _O_SEQUENTIAL) || (flags & _O_APPEND)) ++ { ++ dwFlagsAndAttributes |= FILE_FLAG_SEQUENTIAL_SCAN; ++ } ++ else if (flags & _O_RANDOM) ++ { ++ dwFlagsAndAttributes |= FILE_FLAG_RANDOM_ACCESS; ++ } ++ ++ if (0 == dwFlagsAndAttributes) ++ dwFlagsAndAttributes = FILE_ATTRIBUTE_NORMAL; ++ hFile = CreateFileW(wfilename, dwDesiredAccess, dwSharedAccess, NULL, dwDisposition, dwFlagsAndAttributes, NULL); ++ ++ if (INVALID_HANDLE_VALUE == hFile) ++ { ++ retval = (-1); ++ ++ switch (GetLastError ()) ++ { ++#define CASE(a,b) case ERROR_##a: errno = b; break ++ CASE (FILE_NOT_FOUND, ENOENT); ++ CASE (PATH_NOT_FOUND, ENOENT); ++ CASE (ACCESS_DENIED, EACCES); ++ CASE (NOT_SAME_DEVICE, EXDEV); ++ CASE (LOCK_VIOLATION, EACCES); ++ CASE (SHARING_VIOLATION, EACCES); ++ CASE (FILE_EXISTS, EEXIST); ++ CASE (ALREADY_EXISTS, EEXIST); ++#undef CASE ++ default: errno = EIO; ++ } ++ } ++ 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 */ ++ if ((!(flags & _O_TEXT)) && (_fmode == _O_BINARY)) ++ _setmode(retval, _O_BINARY); ++ else if ((flags & _O_TEXT) || (_fmode == _O_TEXT)) ++ _setmode(retval, _O_TEXT); ++ else ++ _setmode(retval, _O_BINARY); ++ } ++ ++ save_errno = errno; ++ g_free (wfilename); + errno = save_errno; ++ + return retval; + #else + int fd; +@@ -254,6 +361,8 @@ + int mode) + { + #ifdef G_OS_WIN32 ++ HANDLE hFile; ++ DWORD dwFlagsAndAttributes = FILE_ATTRIBUTE_NORMAL; + wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL); + int retval; + int save_errno; +@@ -264,12 +373,41 @@ + return -1; + } + +- retval = _wcreat (wfilename, mode); +- save_errno = errno; ++ if (mode & _S_IREAD) ++ { ++ if (! (mode & _S_IWRITE)) ++ dwFlagsAndAttributes = FILE_ATTRIBUTE_READONLY; /* Sets file to 'read only' after the file gets closed */ ++ } ++ ++ 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); ++ ++ switch (GetLastError ()) ++ { ++#define CASE(a,b) case ERROR_##a: errno = b; break ++ CASE (FILE_NOT_FOUND, ENOENT); ++ CASE (PATH_NOT_FOUND, ENOENT); ++ CASE (ACCESS_DENIED, EACCES); ++ CASE (NOT_SAME_DEVICE, EXDEV); ++ CASE (LOCK_VIOLATION, EACCES); ++ CASE (SHARING_VIOLATION, EACCES); ++ CASE (FILE_EXISTS, EEXIST); ++ CASE (ALREADY_EXISTS, EEXIST); ++#undef CASE ++ default: errno = EIO; ++ } ++ } ++ else ++ retval = _open_osfhandle((long)hFile, _O_RDWR); + ++ save_errno = errno; + g_free (wfilename); +- + errno = save_errno; ++ + return retval; + #else + return creat (filename, mode); +@@ -702,33 +840,102 @@ + const gchar *mode) + { + #ifdef G_OS_WIN32 +- wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL); +- wchar_t *wmode; +- FILE *retval; +- int save_errno; +- +- if (wfilename == NULL) +- { +- errno = EINVAL; +- return NULL; +- } +- +- wmode = g_utf8_to_utf16 (mode, -1, NULL, NULL, NULL); +- +- 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; ++ goto out; ++ } ++ if ((strlen(mode) < 1) || (strlen(mode) > 3)) ++ { ++ errno = EINVAL; ++ goto out; ++ } ++ ++ strncpy(priv_mode, mode, 3); ++ priv_mode[3] = '\0'; ++ ++ /* 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 ++ { ++ if (0 == strcmp(priv_mode, "a+b")) ++ flags = _O_RDWR | _O_CREAT | _O_APPEND | _O_BINARY; ++ else if (0 == strcmp(priv_mode, "a+t")) ++ flags = _O_RDWR | _O_CREAT | _O_APPEND | _O_TEXT; ++ else if (0 == strcmp(priv_mode, "r+b")) ++ flags = _O_RDWR | _O_BINARY; ++ else if (0 == strcmp(priv_mode, "r+t")) ++ flags = _O_RDWR | _O_TEXT; ++ else if (0 == strcmp(priv_mode, "w+b")) ++ flags = _O_RDWR | _O_CREAT |_O_TRUNC | _O_BINARY; ++ else if (0 == strcmp(priv_mode, "w+t")) ++ flags = _O_RDWR | _O_CREAT |_O_TRUNC | _O_TEXT; ++ else ++ { ++ errno = EINVAL; ++ goto out; ++ } ++ } ++ } ++ if (2 == strlen(priv_mode)) ++ { ++ if (('c' == priv_mode[1]) || ('n' == priv_mode[1])) ++ priv_mode[1] = '\0'; ++ else ++ { ++ if (0 == strcmp(priv_mode, "a+")) ++ flags = _O_RDWR | _O_CREAT | _O_APPEND; ++ else if (0 == strcmp(priv_mode, "ab")) ++ flags = _O_WRONLY | _O_CREAT | _O_APPEND | _O_BINARY; ++ else if (0 == strcmp(priv_mode, "at")) ++ flags = _O_WRONLY | _O_CREAT | _O_APPEND | _O_TEXT; ++ else if (0 == strcmp(priv_mode, "rb")) ++ flags = _O_RDONLY | _O_BINARY; ++ else if (0 == strcmp(priv_mode, "rt")) ++ flags = _O_RDONLY | _O_TEXT; ++ else if (0 == strcmp(priv_mode, "wb")) ++ flags = _O_WRONLY | _O_CREAT | _O_TRUNC | _O_BINARY; ++ else if (0 == strcmp(priv_mode, "wt")) ++ flags = _O_WRONLY | _O_CREAT | _O_TRUNC | _O_TEXT; ++ else ++ { ++ errno = EINVAL; ++ goto out; ++ } ++ } ++ } ++ if (1 == strlen(priv_mode)) ++ { ++ if (0 == strcmp(priv_mode, "a")) ++ flags = _O_WRONLY | _O_CREAT | _O_APPEND; ++ else if (0 == strcmp(priv_mode, "r")) ++ flags = _O_RDONLY; ++ 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; ++ 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 + return fopen (filename, mode); diff --git a/mingw-w64-pkg-config/1003-g_abort.all.patch b/mingw-w64-pkg-config/1003-g_abort.all.patch new file mode 100644 index 0000000000..ae6712f7f6 --- /dev/null +++ b/mingw-w64-pkg-config/1003-g_abort.all.patch @@ -0,0 +1,238 @@ +diff -Naur glib-2.46.0-orig/glib/gbacktrace.c glib-2.46.0/glib/gbacktrace.c +--- glib-2.46.0-orig/glib/gbacktrace.c 2014-12-20 00:49:48.000000000 +0300 ++++ glib-2.46.0/glib/gbacktrace.c 2015-09-22 09:08:59.311126700 +0300 +@@ -254,7 +254,7 @@ + if (IsDebuggerPresent ()) + G_BREAKPOINT (); + else +- abort (); ++ g_abort (); + #endif + } + +diff -Naur glib-2.46.0-orig/glib/giowin32.c glib-2.46.0/glib/giowin32.c +--- glib-2.46.0-orig/glib/giowin32.c 2014-12-20 00:49:48.000000000 +0300 ++++ glib-2.46.0/glib/giowin32.c 2015-09-22 09:08:59.357921600 +0300 +@@ -798,7 +798,7 @@ + + default: + g_assert_not_reached (); +- abort (); ++ g_abort (); + } + if (channel->debug) + g_print ("\n"); +@@ -945,7 +945,7 @@ + + default: + g_assert_not_reached (); +- abort (); ++ g_abort (); + } + } + +@@ -1010,7 +1010,7 @@ + + default: + g_assert_not_reached (); +- abort (); ++ g_abort (); + } + if (channel->debug) + g_print ("\n"); +@@ -1295,7 +1295,7 @@ + default: + whence = -1; /* Keep the compiler quiet */ + g_assert_not_reached (); +- abort (); ++ g_abort (); + } + + tmp_offset = offset; +@@ -1690,7 +1690,7 @@ + break; + default: + g_assert_not_reached (); +- abort (); ++ g_abort (); + } + + /* always open 'untranslated' */ +@@ -1736,7 +1736,7 @@ + break; + default: + g_assert_not_reached (); +- abort (); ++ g_abort (); + } + + return channel; +@@ -2225,7 +2225,7 @@ + + default: + g_assert_not_reached (); +- abort (); ++ g_abort (); + } + + fd->events = condition; +diff -Naur glib-2.46.0-orig/glib/gmessages.c glib-2.46.0/glib/gmessages.c +--- glib/glib/gmessages.c 2015-09-21 06:33:23.000000000 +0300 ++++ glib/glib/gmessages.c 2015-09-22 09:08:59.373519900 +0300 +@@ -252,7 +252,7 @@ + if (exit_on_fatal) + _exit (1); + else +- abort (); ++ g_abort (); + } + + #ifdef G_OS_WIN32 +@@ -983,12 +983,12 @@ + if (IsDebuggerPresent () && !(test_level & G_LOG_FLAG_RECURSION)) + G_BREAKPOINT (); + else +- abort (); ++ g_abort (); + #else + if (!(test_level & G_LOG_FLAG_RECURSION)) + G_BREAKPOINT (); + else +- abort (); ++ g_abort (); + #endif /* !G_OS_WIN32 */ + } + +diff -Naur glib-2.46.0-orig/glib/gslice.c glib-2.46.0/glib/gslice.c +--- glib-2.46.0-orig/glib/gslice.c 2015-09-08 20:40:27.000000000 +0300 ++++ glib-2.46.0/glib/gslice.c 2015-09-22 09:08:59.404716500 +0300 +@@ -1082,7 +1082,7 @@ + return; + if (G_UNLIKELY (allocator->config.debug_blocks) && + !smc_notify_free (mem_block, mem_size)) +- abort(); ++ g_abort(); + if (G_LIKELY (acat == 1)) /* allocate through magazine layer */ + { + ThreadMemory *tmem = thread_memory_from_self(); +@@ -1165,7 +1165,7 @@ + slice = *(gpointer*) (current + next_offset); + if (G_UNLIKELY (allocator->config.debug_blocks) && + !smc_notify_free (current, mem_size)) +- abort(); ++ g_abort(); + if (G_UNLIKELY (thread_memory_magazine2_is_full (tmem, ix))) + { + thread_memory_swap_magazines (tmem, ix); +@@ -1186,7 +1186,7 @@ + slice = *(gpointer*) (current + next_offset); + if (G_UNLIKELY (allocator->config.debug_blocks) && + !smc_notify_free (current, mem_size)) +- abort(); ++ g_abort(); + if (G_UNLIKELY (g_mem_gc_friendly)) + memset (current, 0, chunk_size); + slab_allocator_free_chunk (chunk_size, current); +@@ -1200,7 +1200,7 @@ + slice = *(gpointer*) (current + next_offset); + if (G_UNLIKELY (allocator->config.debug_blocks) && + !smc_notify_free (current, mem_size)) +- abort(); ++ g_abort(); + if (G_UNLIKELY (g_mem_gc_friendly)) + memset (current, 0, mem_size); + g_free (current); +@@ -1436,7 +1436,7 @@ + vfprintf (stderr, format, args); + va_end (args); + fputs ("\n", stderr); +- abort(); ++ g_abort(); + _exit (1); + } + +diff -Naur glib-2.46.0-orig/glib/gtestutils.c glib-2.46.0/glib/gtestutils.c +--- glib-2.46.0-orig/glib/gtestutils.c 2015-09-01 06:34:13.000000000 +0300 ++++ glib-2.46.0/glib/gtestutils.c 2015-09-22 09:08:59.576297800 +0300 +@@ -751,7 +751,7 @@ + { + if (test_tap_log) + g_print ("Bail out!\n"); +- abort(); ++ g_abort(); + } + break; + case G_TEST_LOG_MIN_RESULT: +@@ -2292,7 +2292,7 @@ + s = g_strconcat ("assertion failed: (", expr, ")", NULL); + g_assertion_message (domain, file, line, func, s); + g_free (s); +- abort (); ++ g_abort(); + } + + void +diff -Naur glib-2.46.0-orig/glib/gthread-posix.c glib-2.46.0/glib/gthread-posix.c +--- glib-2.46.0-orig/glib/gthread-posix.c 2015-08-19 06:35:30.000000000 +0300 ++++ glib-2.46.0/glib/gthread-posix.c 2015-09-22 09:08:59.560699500 +0300 +@@ -46,6 +46,7 @@ + #include "gslice.h" + #include "gmessages.h" + #include "gstrfuncs.h" ++#include "gutils.h" + + #include + #include +@@ -77,7 +78,7 @@ + { + fprintf (stderr, "GLib (gthread-posix.c): Unexpected error from C library during '%s': %s. Aborting.\n", + function, strerror (status)); +- abort (); ++ g_abort (); + } + + /* {{{1 GMutex */ +diff -Naur glib-2.46.0-orig/glib/gthread-win32.c glib-2.46.0/glib/gthread-win32.c +--- glib-2.46.0-orig/glib/gthread-win32.c 2014-12-20 00:49:48.000000000 +0300 ++++ glib-2.46.0/glib/gthread-win32.c 2015-09-22 09:08:59.467109700 +0300 +@@ -58,7 +58,7 @@ + { + fprintf (stderr, "GLib (gthread-win32.c): Unexpected error from C library during '%s': %s. Aborting.\n", + strerror (status), function); +- abort (); ++ g_abort (); + } + + /* Starting with Vista and Windows 2008, we have access to the +diff -Naur glib-2.46.0-orig/glib/gutils.c glib-2.46.0/glib/gutils.c +--- glib-2.46.0-orig/glib/gutils.c 2015-08-28 21:15:54.000000000 +0300 ++++ glib-2.46.0/glib/gutils.c 2015-09-22 09:08:59.498306300 +0300 +@@ -2375,3 +2375,15 @@ + return FALSE; + #endif + } ++ ++/* Crashes the program. */ ++void ++g_abort (void) ++{ ++#ifdef G_OS_WIN32 ++ DebugBreak (); ++ ExitProcess (127); ++#else ++ abort (); ++#endif ++} +diff -Naur glib-2.46.0-orig/glib/gutils.h glib-2.46.0/glib/gutils.h +--- glib-2.46.0-orig/glib/gutils.h 2015-08-21 03:20:48.000000000 +0300 ++++ glib-2.46.0/glib/gutils.h 2015-09-22 09:08:59.529502900 +0300 +@@ -228,6 +228,9 @@ + GLIB_DEPRECATED_FOR(g_format_size) + gchar *g_format_size_for_display (goffset size); + ++GLIB_AVAILABLE_IN_2_30 ++void g_abort (void); ++ + #ifndef G_DISABLE_DEPRECATED + /** + * GVoidFunc: diff --git a/mingw-w64-pkg-config/1005-glib-send-log-messages-to-correct-stdout-and-stderr.patch b/mingw-w64-pkg-config/1005-glib-send-log-messages-to-correct-stdout-and-stderr.patch new file mode 100644 index 0000000000..6731f9ff61 --- /dev/null +++ b/mingw-w64-pkg-config/1005-glib-send-log-messages-to-correct-stdout-and-stderr.patch @@ -0,0 +1,12 @@ +diff -Naur glib-2.46.0-orig/glib/gmessages.c glib-2.46.0/glib/gmessages.c +--- glib-2.46.0-orig/glib/gmessages.c 2015-09-22 09:09:00.356212800 +0300 ++++ glib-2.46.0/glib/gmessages.c 2015-09-22 09:09:01.292110800 +0300 +@@ -932,7 +932,7 @@ + if ((log_level & G_LOG_FLAG_FATAL) != 0 && !g_test_initialized ()) + win32_keep_fatal_message = TRUE; + #endif +- return to_stdout ? 1 : 2; ++ return to_stdout ? fileno(stdout) : fileno(stderr); + } + + typedef struct { diff --git a/mingw-w64-pkg-config/1017-glib-use-gnu-print-scanf.patch b/mingw-w64-pkg-config/1017-glib-use-gnu-print-scanf.patch new file mode 100644 index 0000000000..5e4a3a3c5a --- /dev/null +++ b/mingw-w64-pkg-config/1017-glib-use-gnu-print-scanf.patch @@ -0,0 +1,85 @@ +diff -Naur glib-2.46.0-orig/configure.ac glib-2.46.0/configure.ac +--- glib-2.46.0-orig/configure.ac 2015-09-21 15:38:33.000000000 +0300 ++++ glib-2.46.0/configure.ac 2015-09-22 09:09:02.118820700 +0300 +@@ -567,7 +567,7 @@ + ]) + fi + +-AS_IF([test x$glib_native_win32 != xyes && test x$ac_cv_sizeof_long_long = x8], [ ++AS_IF([test x$ac_cv_sizeof_long_long = x8], [ + # long long is a 64 bit integer. + AC_MSG_CHECKING(for format to printf and scanf a guint64) + AC_CACHE_VAL(glib_cv_long_long_format,[ +@@ -589,8 +589,8 @@ + AS_IF([ test -n "$glib_cv_long_long_format"], [ + AC_MSG_RESULT(%${glib_cv_long_long_format}u) + AC_DEFINE(HAVE_LONG_LONG_FORMAT,1,[define if system printf can print long long]) +- if test x"$glib_cv_long_long_format" = xI64; then +- AC_DEFINE(HAVE_INT64_AND_I64,1,[define to support printing 64-bit integers with format I64]) ++ if test x"$glib_cv_long_long_format" = xll; then ++ AC_DEFINE(HAVE_INT64_AND_I64,1,[define to support printing 64-bit integers with format ll]) + fi + ], [AC_MSG_RESULT(none)]) + ],[ test x$ac_cv_sizeof___int64 = x8], [ +@@ -3177,8 +3177,8 @@ + glib_msize_type='LONG' + ;; + "long long"|__int64) +- gsize_modifier='"I64"' +- gsize_format='"I64u"' ++ gsize_modifier='"z"' ++ gsize_format='"zu"' + glib_msize_type='INT64' + ;; + esac +@@ -3200,8 +3200,8 @@ + glib_mssize_type='LONG' + ;; + "long long"|__int64) +- gssize_modifier='"I64"' +- gssize_format='"I64i"' ++ gssize_modifier='"z"' ++ gssize_format='"zi"' + glib_mssize_type='INT64' + ;; + esac +@@ -3230,9 +3230,9 @@ + ;; + $ac_cv_sizeof_long_long) + glib_intptr_type_define='long long' +- gintptr_modifier='"I64"' +- gintptr_format='"I64i"' +- guintptr_format='"I64u"' ++ gintptr_modifier='"ll"' ++ gintptr_format='"lli"' ++ guintptr_format='"llu"' + glib_gpi_cast='(gint64)' + glib_gpui_cast='(guint64)' + ;; +diff -Naur glib-2.46.0-orig/glib/gmacros.h glib-2.46.0/glib/gmacros.h +--- glib-2.46.0-orig/glib/gmacros.h 2015-08-19 06:35:30.000000000 +0300 ++++ glib-2.46.0/glib/gmacros.h 2015-09-22 09:09:02.118820700 +0300 +@@ -79,9 +79,9 @@ + + #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4) + #define G_GNUC_PRINTF( format_idx, arg_idx ) \ +- __attribute__((__format__ (__printf__, format_idx, arg_idx))) ++ __attribute__((__format__ (gnu_printf, format_idx, arg_idx))) + #define G_GNUC_SCANF( format_idx, arg_idx ) \ +- __attribute__((__format__ (__scanf__, format_idx, arg_idx))) ++ __attribute__((__format__ (gnu_scanf, format_idx, arg_idx))) + #define G_GNUC_FORMAT( arg_idx ) \ + __attribute__((__format_arg__ (arg_idx))) + #define G_GNUC_NORETURN \ +diff -Naur glib-2.46.0-orig/glib/gpoll.h glib-2.46.0/glib/gpoll.h +--- glib-2.46.0-orig/glib/gpoll.h 2014-12-20 00:49:48.000000000 +0300 ++++ glib-2.46.0/glib/gpoll.h 2015-09-22 09:09:02.118820700 +0300 +@@ -108,7 +108,7 @@ + */ + #ifdef G_OS_WIN32 + #if GLIB_SIZEOF_VOID_P == 8 +-#define G_POLLFD_FORMAT "%#I64x" ++#define G_POLLFD_FORMAT "%#llx" + #else + #define G_POLLFD_FORMAT "%#x" + #endif diff --git a/mingw-w64-pkg-config/1024-return-actually-written-data-in-printf.all.patch b/mingw-w64-pkg-config/1024-return-actually-written-data-in-printf.all.patch new file mode 100644 index 0000000000..478b2be211 --- /dev/null +++ b/mingw-w64-pkg-config/1024-return-actually-written-data-in-printf.all.patch @@ -0,0 +1,23 @@ +diff -Naur glib-2.46.0-orig/glib/gnulib/printf.c glib-2.46.0/glib/gnulib/printf.c +--- glib-2.46.0-orig/glib/gnulib/printf.c 2014-12-20 00:49:48.000000000 +0300 ++++ glib-2.46.0/glib/gnulib/printf.c 2015-09-22 09:09:03.834633700 +0300 +@@ -88,16 +88,16 @@ + int _g_gnulib_vfprintf (FILE *file, char const *format, va_list args) + { + char *result; +- size_t length; ++ size_t length, rlength; + + result = vasnprintf (NULL, &length, format, args); + if (result == NULL) + return -1; + +- fwrite (result, 1, length, file); ++ rlength = fwrite (result, 1, length, file); + free (result); + +- return length; ++ return rlength; + } + + int _g_gnulib_vsprintf (char *string, char const *format, va_list args) diff --git a/mingw-w64-pkg-config/1030-fix-stat.all.patch b/mingw-w64-pkg-config/1030-fix-stat.all.patch new file mode 100644 index 0000000000..06cb998582 --- /dev/null +++ b/mingw-w64-pkg-config/1030-fix-stat.all.patch @@ -0,0 +1,11 @@ +--- glib-2.39.3/glib/gstdio.h.orig 2013-12-09 01:30:33.000000000 +0000 ++++ glib-2.39.3/glib/gstdio.h 2014-01-23 16:01:09.254148700 +0000 +@@ -27,7 +27,7 @@ + + G_BEGIN_DECLS + +-#if defined (_MSC_VER) && !defined(_WIN64) ++#if (defined (__MINGW32__) || defined (_MSC_VER)) && !defined(_WIN64) + + /* Make it clear that we mean the struct with 32-bit st_size and + * 32-bit st_*time fields as that is how the 32-bit GLib DLL normally diff --git a/mingw-w64-pkg-config/PKGBUILD b/mingw-w64-pkg-config/PKGBUILD index d583dd3033..4ef885b675 100644 --- a/mingw-w64-pkg-config/PKGBUILD +++ b/mingw-w64-pkg-config/PKGBUILD @@ -3,8 +3,8 @@ _realname=pkg-config pkgbase=mingw-w64-${_realname} pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}" -pkgver=0.28 -pkgrel=5 +pkgver=0.29 +pkgrel=1 pkgdesc="A system for managing library compile/link flags (mingw-w64)" arch=('any') url="http://pkgconfig.freedesktop.org/wiki/" @@ -14,43 +14,40 @@ conflicts=("${MINGW_PACKAGE_PREFIX}-pkgconf") replaces=("${MINGW_PACKAGE_PREFIX}-pkgconf") groups=("${MINGW_PACKAGE_PREFIX}-toolchain") source=(http://pkgconfig.freedesktop.org/releases/${_realname}-${pkgver}.tar.gz - 0002-check-for-host.mingw.patch - 0003-flush.mingw.patch - 0004-expected-path-for.mingw.patch - 0005-mangle.mingw.patch - 0006-path-for-tests.mingw.patch - 0007-sub-path-for-tests.mingw.patch - 0008-check-for-wine.mingw.patch - 0009-use-wine-if-present.mingw.patch 0010-expand-paths.mingw.patch 0011-platform-dependent-separator-and-adjustable-prefix.mingw.patch - 0099-no-prefix-on.mingw.patch) -md5sums=('aa3c86e67551adc3ac865160e34a2a0d' - '073729fca79eb7415a88eec68504dc92' - 'a14107b8eb8640aac2e59798467128a3' - 'a605f371133ea78af740109a2b690a69' - '0824f3b39004b24168b98280160e4045' - '27602f99a978c28f963afe9313fd1604' - 'e1b804a1b0a15e9af895f6fd92907f23' - '2ba25b1a52a48afa0d2e1b0e06aaa07c' - '377256964716a68e8fe170e8df157641' + 1001-Use-CreateFile-on-Win32-to-make-sure-g_unlink-always.patch + 1003-g_abort.all.patch + 1005-glib-send-log-messages-to-correct-stdout-and-stderr.patch + 1017-glib-use-gnu-print-scanf.patch + 1024-return-actually-written-data-in-printf.all.patch + 1030-fix-stat.all.patch) +md5sums=('77f27dce7ef88d0634d0d6f90e03a77f' 'cb65caa60584d471aa6f76b181790ee1' 'd6b6acdb90f93c35378f53e34e7cd6fa' - 'd61554e8456fa9f67fbf90c8219dd2bf') + '10cf1e482b6a1367d79648466f2cf23c' + '629431fe82711812531f6367205783e8' + '80fb538441701d2dd3ab8bcb13baf90c' + '22105e191551caf9d94d9f637f05ed77' + '3f896edd80eaa9c4e98abca0df6c83bd' + '963a72f6efcaa3405204b76b27b44645') prepare() { cd ${srcdir}/${_realname}-${pkgver} - patch -p1 -i ${srcdir}/0002-check-for-host.mingw.patch - patch -p1 -i ${srcdir}/0003-flush.mingw.patch - patch -p1 -i ${srcdir}/0004-expected-path-for.mingw.patch - patch -p1 -i ${srcdir}/0005-mangle.mingw.patch - patch -p1 -i ${srcdir}/0006-path-for-tests.mingw.patch - patch -p1 -i ${srcdir}/0007-sub-path-for-tests.mingw.patch - patch -p1 -i ${srcdir}/0008-check-for-wine.mingw.patch - patch -p1 -i ${srcdir}/0009-use-wine-if-present.mingw.patch patch -p1 -i ${srcdir}/0010-expand-paths.mingw.patch patch -p1 -i ${srcdir}/0011-platform-dependent-separator-and-adjustable-prefix.mingw.patch - #patch -p1 -i ${srcdir}/0099-no-prefix-on.mingw.patch + + cd glib + + patch -Np1 -i "${srcdir}/1001-Use-CreateFile-on-Win32-to-make-sure-g_unlink-always.patch" + patch -Np1 -i "${srcdir}/1003-g_abort.all.patch" + patch -Np1 -i "${srcdir}/1005-glib-send-log-messages-to-correct-stdout-and-stderr.patch" + patch -Np1 -i "${srcdir}/1017-glib-use-gnu-print-scanf.patch" + patch -Np1 -i "${srcdir}/1024-return-actually-written-data-in-printf.all.patch" + patch -Np1 -i "${srcdir}/1030-fix-stat.all.patch" + + cd .. + autoreconf -fi }