From b5db950da6d1e1e09ae5df40fc3cac24b8463287 Mon Sep 17 00:00:00 2001
From: Juergen Buchmueller <pullmoll@t-online.de>
Date: Thu, 15 Sep 2016 10:38:23 +0200
Subject: [PATCH] EmulationStation: fix gcc6 build

---
 .../patches/fix-gcc6-round.patch              | 13 ++++++++
 .../patches/fix-msc_check.patch               | 32 +++++++++++++++++++
 srcpkgs/EmulationStation/template             |  2 +-
 3 files changed, 46 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/EmulationStation/patches/fix-gcc6-round.patch
 create mode 100644 srcpkgs/EmulationStation/patches/fix-msc_check.patch

diff --git a/srcpkgs/EmulationStation/patches/fix-gcc6-round.patch b/srcpkgs/EmulationStation/patches/fix-gcc6-round.patch
new file mode 100644
index 00000000000..c0411c31645
--- /dev/null
+++ b/srcpkgs/EmulationStation/patches/fix-gcc6-round.patch
@@ -0,0 +1,13 @@
+Explicit cast to float to avoid ambiguity.
+
+--- es-core/src/components/HelpComponent.cpp	2016-03-13 20:31:00.000000000 +0100
++++ es-core/src/components/HelpComponent.cpp	2016-09-15 10:28:21.700078076 +0200
+@@ -71,7 +71,7 @@
+ 	std::vector< std::shared_ptr<TextComponent> > labels;
+ 
+ 	float width = 0;
+-	const float height = round(font->getLetterHeight() * 1.25f);
++	const float height = round(static_cast<float>(font->getLetterHeight() * 1.25f));
+ 	for(auto it = mPrompts.begin(); it != mPrompts.end(); it++)
+ 	{
+ 		auto icon = std::make_shared<ImageComponent>(mWindow);
diff --git a/srcpkgs/EmulationStation/patches/fix-msc_check.patch b/srcpkgs/EmulationStation/patches/fix-msc_check.patch
new file mode 100644
index 00000000000..0c08dacd6e3
--- /dev/null
+++ b/srcpkgs/EmulationStation/patches/fix-msc_check.patch
@@ -0,0 +1,32 @@
+Also needs to check if _MSC_VER is defined at all.
+
+--- es-core/src/Util.h	2016-03-13 20:31:00.000000000 +0100
++++ es-core/src/Util.h	2016-09-15 10:33:18.964427356 +0200
+@@ -15,7 +15,7 @@
+ Eigen::Vector3f roundVector(const Eigen::Vector3f& vec);
+ Eigen::Vector2f roundVector(const Eigen::Vector2f& vec);
+ 
+-#if _MSC_VER < 1800
++#if defined(_MSC_VER) && (_MSC_VER < 1800)
+ float round(float num);
+ #endif /* _MSC_VER */
+ 
+--- es-core/src/Util.cpp	2016-03-13 20:31:00.000000000 +0100
++++ es-core/src/Util.cpp	2016-09-15 10:36:10.972624004 +0200
+@@ -32,14 +32,14 @@
+ }
+ 
+ 
+-#if _MSC_VER < 1800
++#if defined(_MSC_VER) && (_MSC_VER < 1800)
+ float round(float num)
+ {
+ 	return (float)((int)(num + 0.5f));
+ }
+ #endif
+ 
+-#if _MSC_VER >= 1700
++#if defined(_MSC_VER) && (_MSC_VER >= 1700)
+ FILE iob[] = {*stdin, *stdout, *stderr };
+ FILE * __iob_func(void)
+ {
diff --git a/srcpkgs/EmulationStation/template b/srcpkgs/EmulationStation/template
index 1f4759dbbcd..f9dae97dfd3 100644
--- a/srcpkgs/EmulationStation/template
+++ b/srcpkgs/EmulationStation/template
@@ -1,7 +1,7 @@
 # Template file for 'EmulationStation'
 pkgname=EmulationStation
 version=2.0.1a
-revision=1
+revision=2
 _githash=93f6e11c95f9e7a0c00d3a70c744b22d9a931127
 build_style=cmake
 hostmakedepends="cmake"