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: Tony Theodore <tonyt@logyst.com>
Date: Fri, 11 Jan 2019 18:02:55 +1100
Subject: [PATCH 1/4] ad hoc fixes


diff --git a/Source/JavaScriptCore/llint/LLIntOfflineAsmConfig.h b/Source/JavaScriptCore/llint/LLIntOfflineAsmConfig.h
index 1111111..2222222 100644
--- a/Source/JavaScriptCore/llint/LLIntOfflineAsmConfig.h
+++ b/Source/JavaScriptCore/llint/LLIntOfflineAsmConfig.h
@@ -92,13 +92,13 @@
 #define OFFLINE_ASM_ARM 0
 #endif
 
-#if CPU(X86_64) && !COMPILER(MSVC)
+#if CPU(X86_64) && !OS(WINDOWS)
 #define OFFLINE_ASM_X86_64 1
 #else
 #define OFFLINE_ASM_X86_64 0
 #endif
 
-#if CPU(X86_64) && COMPILER(MSVC)
+#if CPU(X86_64) && OS(WINDOWS)
 #define OFFLINE_ASM_X86_64_WIN 1
 #else
 #define OFFLINE_ASM_X86_64_WIN 0
diff --git a/Source/WTF/wtf/Atomics.h b/Source/WTF/wtf/Atomics.h
index 1111111..2222222 100644
--- a/Source/WTF/wtf/Atomics.h
+++ b/Source/WTF/wtf/Atomics.h
@@ -125,7 +125,7 @@ inline void memoryBarrierBeforeUnlock() { armV7_dmb(); }
 
 inline void x86_mfence()
 {
-#if OS(WINDOWS)
+#if OS(WINDOWS) && !COMPILER(GCC)
     // I think that this does the equivalent of a dummy interlocked instruction,
     // instead of using the 'mfence' instruction, at least according to MSDN. I
     // know that it is equivalent for our purposes, but it would be good to
diff --git a/Source/WebCore/bindings/scripts/preprocess-idls.pl b/Source/WebCore/bindings/scripts/preprocess-idls.pl
index 1111111..2222222 100644
--- a/Source/WebCore/bindings/scripts/preprocess-idls.pl
+++ b/Source/WebCore/bindings/scripts/preprocess-idls.pl
@@ -179,9 +179,9 @@ my $cygwinPathAdded;
 sub CygwinPathIfNeeded
 {
     my $path = shift;
-    if ($path && $Config{osname} eq "cygwin") {
+    if ($path && ($Config{osname} eq "cygwin" || $Config{osname} eq "msys")) {
         if (not $cygwinPathAdded) {
-            $ENV{PATH} = "$ENV{PATH}:/cygdrive/c/cygwin/bin";
+            $ENV{PATH} = "$ENV{PATH}:/usr/bin";
             $cygwinPathAdded = 1; 
         }
         chomp($path = `cygpath -u '$path'`);
diff --git a/Source/cmake/ECMGeneratePriFile.cmake b/Source/cmake/ECMGeneratePriFile.cmake
index 1111111..2222222 100644
--- a/Source/cmake/ECMGeneratePriFile.cmake
+++ b/Source/cmake/ECMGeneratePriFile.cmake
@@ -101,7 +101,11 @@ if(KDE_INSTALL_USE_QT_SYS_PATHS OR _askqmake)
   query_qmake(qt_host_data_dir QT_HOST_DATA)
   set(ECM_MKSPECS_INSTALL_DIR ${qt_host_data_dir}/mkspecs/modules CACHE PATH "The directory where mkspecs will be installed to.")
 else()
-  set(ECM_MKSPECS_INSTALL_DIR mkspecs/modules CACHE PATH "The directory where mkspecs will be installed to.")
+  if(MINGW)
+    set(ECM_MKSPECS_INSTALL_DIR share/qt5/mkspecs/modules CACHE PATH "The directory where mkspecs will be installed to.")
+  else()
+    set(ECM_MKSPECS_INSTALL_DIR mkspecs/modules CACHE PATH "The directory where mkspecs will be installed to.")
+  endif()
 endif()
 
 function(ECM_GENERATE_PRI_FILE)
diff --git a/Source/cmake/FindICU.cmake b/Source/cmake/FindICU.cmake
index 1111111..2222222 100644
--- a/Source/cmake/FindICU.cmake
+++ b/Source/cmake/FindICU.cmake
@@ -49,7 +49,7 @@ if (ICU_INCLUDE_DIR AND ICU_LIBRARY)
     pkg_check_modules(PC_ICU_I18N icu-i18n)
     find_library(
         ICU_I18N_LIBRARY
-        NAMES icui18n icuin cygicuin cygicuin32
+        NAMES icuin icui18n cygicuin cygicuin32
         HINTS ${PC_ICU_I18N_LIBRARY_DIRS}
               ${PC_ICU_I18N_LIBDIR}
         DOC "Libraries to link against for ICU internationalization")

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Konstantin Tokarev <annulen@yandex.ru>
Date: Fri, 3 Nov 2017 18:59:25 +0300
Subject: [PATCH 2/4] Install private headers for WK2 and private .pri modules


diff --git a/Source/WebKit/PlatformQt.cmake b/Source/WebKit/PlatformQt.cmake
index 1111111..2222222 100644
--- a/Source/WebKit/PlatformQt.cmake
+++ b/Source/WebKit/PlatformQt.cmake
@@ -418,7 +418,7 @@ install(
     COMPONENT Data
 )
 
-file(GLOB WebKit_PRIVATE_HEADERS qt/Api/*_p.h)
+file(GLOB WebKit_PRIVATE_HEADERS qt/Api/*_p.h ../WebKit2/UIProcess/API/qt/*_p.h)
 
 # This is needed to install WK2 private headers into macOS bundle
 if (ENABLE_WEBKIT2)
@@ -521,7 +521,7 @@ if (NOT MACOS_BUILD_FRAMEWORKS)
     install(FILES ${WebKit_PKGCONFIG_FILENAME} DESTINATION ${ECM_PKGCONFIG_INSTALL_DIR} COMPONENT Data)
 endif ()
 
-if (KDE_INSTALL_USE_QT_SYS_PATHS)
+if (KDE_INSTALL_USE_QT_SYS_PATHS OR MINGW)
     set(WebKit_PRI_ARGUMENTS
         BIN_INSTALL_DIR "$$QT_MODULE_BIN_BASE"
         LIB_INSTALL_DIR "$$QT_MODULE_LIB_BASE"
@@ -751,7 +751,7 @@ if (NOT MACOS_BUILD_FRAMEWORKS)
     install(FILES ${WebKitWidgets_PKGCONFIG_FILENAME} DESTINATION ${ECM_PKGCONFIG_INSTALL_DIR} COMPONENT Data)
 endif ()
 
-if (KDE_INSTALL_USE_QT_SYS_PATHS)
+if (KDE_INSTALL_USE_QT_SYS_PATHS OR MINGW)
     set(WebKitWidgets_PRI_ARGUMENTS
         BIN_INSTALL_DIR "$$QT_MODULE_BIN_BASE"
         LIB_INSTALL_DIR "$$QT_MODULE_LIB_BASE"
diff --git a/Source/cmake/WebKitMacros.cmake b/Source/cmake/WebKitMacros.cmake
index 1111111..2222222 100644
--- a/Source/cmake/WebKitMacros.cmake
+++ b/Source/cmake/WebKitMacros.cmake
@@ -269,8 +269,6 @@ macro(WEBKIT_FRAMEWORK _target)
         ${${_target}_HEADERS}
         ${${_target}_SOURCES}
         ${${_target}_DERIVED_SOURCES}
-        ${${_target}_PRIVATE_HEADERS}
-        ${${_target}_PUBLIC_HEADERS}
     )
     target_link_libraries(${_target} ${${_target}_LIBRARIES})
     set_target_properties(${_target} PROPERTIES COMPILE_DEFINITIONS "BUILDING_${_target}")

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Boris Pek <tehnick-8@yandex.ru>
Date: Fri, 11 Jan 2019 18:06:01 +1100
Subject: [PATCH 3/4] cmake: fix Cflags sections in pkg-config files


diff --git a/Source/cmake/ECMGeneratePkgConfigFile.cmake b/Source/cmake/ECMGeneratePkgConfigFile.cmake
index 1111111..2222222 100644
--- a/Source/cmake/ECMGeneratePkgConfigFile.cmake
+++ b/Source/cmake/ECMGeneratePkgConfigFile.cmake
@@ -129,6 +129,7 @@ function(ECM_GENERATE_PKGCONFIG_FILE)
       else()
           set(EGPF_INCLUDE_INSTALL_DIR "include/${EGPF_BASE_NAME}")
       endif()
+      string(REPLACE "/Qt5" "/Qt" EGPF_INCLUDE_INSTALL_DIR "${EGPF_INCLUDE_INSTALL_DIR}")
   endif()
   if(NOT EGPF_LIB_INSTALL_DIR)
       if(LIB_INSTALL_DIR)

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Boris Pek <tehnick-8@yandex.ru>
Date: Fri, 11 Jan 2019 18:07:10 +1100
Subject: [PATCH 4/4] Fix cross-compilation using MinGW

with USE_MEDIA_FOUNDATION=ON. (Part 1)

diff --git a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.h b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.h
index 1111111..2222222 100644
--- a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.h
+++ b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.h
@@ -31,12 +31,13 @@
 #include "MediaPlayerPrivate.h"
 #include "Win32Handle.h"
 
-#include <D3D9.h>
-#include <Dxva2api.h>
+#include <d3d9.h>
+#include <dxva2api.h>
 
-#include <Mfapi.h>
-#include <Mferror.h>
-#include <Mfidl.h>
+#include <mfapi.h>
+#include <mferror.h>
+#include <mfidl.h>
+#include <mfobjects.h>
 #include <evcode.h>
 #include <evr.h>
 
diff --git a/Source/WebCore/platform/win/HWndDC.h b/Source/WebCore/platform/win/HWndDC.h
index 1111111..2222222 100644
--- a/Source/WebCore/platform/win/HWndDC.h
+++ b/Source/WebCore/platform/win/HWndDC.h
@@ -27,7 +27,7 @@
 #define HWndDC_h
 
 #include <windows.h>
-#include <wtf/NonCopyable.h>
+#include <wtf/Noncopyable.h>
 
 namespace WebCore {
 
