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: Mark Brand <mabrand@mabrand.nl>
Date: Sun, 12 Aug 2012 12:33:26 +0200
Subject: [PATCH 1/1] explicit mingw cross prefix

This patch has been taken from:
http://sourceforge.net/tracker/index.php?func=detail&aid=3305366&group_id=22049&atid=373085

diff --git a/SCons/Tools/crossmingw.py b/SCons/Tools/crossmingw.py
index 1111111..2222222 100755
--- a/SCons/Tools/crossmingw.py
+++ b/SCons/Tools/crossmingw.py
@@ -65,6 +65,9 @@ prefixes = SCons.Util.Split("""
 """)
 
 def find(env):
+    if env.has_key('MINGW_CROSS_PREFIX'):
+        return env['MINGW_CROSS_PREFIX']
+
     # Explicitly specified toolchain to build Windows executables
     # takes predominance.
     prefix = SCons.Script.ARGUMENTS.get('XGCC_W32_PREFIX', None)
diff --git a/SConstruct b/SConstruct
index 1111111..2222222 100755
--- a/SConstruct
+++ b/SConstruct
@@ -67,6 +67,7 @@ doctypes = [
 path = ARGUMENTS.get('PATH', '')
 toolset = ARGUMENTS.get('TOOLSET', '')
 arch = ARGUMENTS.get('TARGET_ARCH', 'x86')
+mingw_cross_prefix = ARGUMENTS.get('MINGW_CROSS_PREFIX', '')
 
 if toolset and path:
 	defenv = Environment(TARGET_ARCH = arch, ENV = {'PATH' : path}, TOOLS = toolset.split(',') + ['zip'])
@@ -77,6 +78,8 @@ else:
 		defenv = Environment(TARGET_ARCH = arch, TOOLS = toolset.split(',') + ['zip'])
 if not toolset and not path:
 	defenv = Environment(TARGET_ARCH = arch)
+if mingw_cross_prefix:
+	defenv['MINGW_CROSS_PREFIX'] = mingw_cross_prefix
 
 Export('defenv')
 
