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: Boris Pek <tehnick-8@yandex.ru>
Date: Sat, 18 Jun 2016 16:24:52 +0300
Subject: [PATCH 1/2] Back compatibility with older freeglut packages in MXE


diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1111111..2222222 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,7 +11,7 @@ INCLUDE(GNUInstallDirs)
 # CMAKE_ARCHIVE_OUTPUT_DIRECTORY instead.
 # Static libraries end up in CMAKE_ARCHIVE_OUTPUT_DIRECTORY on all
 # platforms.
-SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
+SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
 SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
 SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
 
@@ -53,9 +53,7 @@ ENDIF()
 OPTION(FREEGLUT_GLES "Use OpenGL ES (requires EGL)" OFF)
 
 # option to build either as "glut" (ON) or "freeglut" (OFF)
-IF(NOT WIN32)
-    OPTION(FREEGLUT_REPLACE_GLUT "Be a replacement for GLUT" ON)
-ENDIF()
+OPTION(FREEGLUT_REPLACE_GLUT "Be a replacement for GLUT" ON)
 
 
 SET(FREEGLUT_HEADERS
@@ -346,12 +344,18 @@ ENDIF()
 
 
 IF(WIN32)
+    IF(FREEGLUT_REPLACE_GLUT)
+        SET(LIBNAME glut)
+    ELSE()
+        SET(LIBNAME freeglut)
+    ENDIF()
+
     LIST(APPEND LIBS winmm)
     IF(FREEGLUT_BUILD_SHARED_LIBS)
-        SET_TARGET_PROPERTIES(freeglut PROPERTIES COMPILE_FLAGS -DFREEGLUT_EXPORTS)
+        SET_TARGET_PROPERTIES(freeglut PROPERTIES COMPILE_FLAGS -DFREEGLUT_EXPORTS OUTPUT_NAME ${LIBNAME})
     ENDIF()
     IF(FREEGLUT_BUILD_STATIC_LIBS)
-        SET_TARGET_PROPERTIES(freeglut_static PROPERTIES COMPILE_FLAGS -DFREEGLUT_STATIC)
+        SET_TARGET_PROPERTIES(freeglut_static PROPERTIES COMPILE_FLAGS -DFREEGLUT_STATIC OUTPUT_NAME ${LIBNAME})
         # need to set machine:x64 for linker, at least for VC10, and
         # doesn't hurt for older compilers:
         # http://public.kitware.com/Bug/view.php?id=11240#c22768
@@ -514,12 +518,13 @@ ELSE()
 ENDIF()
 # Client applications need to define FreeGLUT GLES version to
 # bootstrap headers inclusion in freeglut_std.h:
-SET(PC_LIBNAME "glut")
-SET(PC_FILENAME "freeglut.pc")
+SET(PC_LIBNAME "${LIBNAME}")
+SET(PC_FILENAME "${LIBNAME}.pc")
 IF(FREEGLUT_GLES)
   SET(PC_CFLAGS "-DFREEGLUT_GLES")
-  SET(PC_LIBNAME "freeglut-gles")
-  SET(PC_FILENAME "freeglut-gles.pc")
+ENDIF()
+IF(FREEGLUT_BUILD_STATIC_LIBS)
+  LIST(APPEND PC_CFLAGS -DFREEGLUT_STATIC)
 ENDIF()
 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/freeglut.pc.in ${CMAKE_BINARY_DIR}/freeglut.pc @ONLY)
 INSTALL(FILES ${CMAKE_BINARY_DIR}/freeglut.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/ RENAME ${PC_FILENAME})

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Boris Nagaev <bnagaev@gmail.com>
Date: Thu, 14 Jul 2016 19:15:17 +0300
Subject: [PATCH 2/2] add glu to requirements in .pc file

glu.pc is generated by mxe-conf and it adds -lglu32 to linker flags.
libglu32.a defines gluUnProject and other symbols used by users of GLU.

Fix https://github.com/mxe/mxe/issues/1434
See https://github.com/mxe/mxe/pull/1429
See http://stackoverflow.com/a/17451000

diff --git a/freeglut.pc.in b/freeglut.pc.in
index 1111111..2222222 100644
--- a/freeglut.pc.in
+++ b/freeglut.pc.in
@@ -8,3 +8,4 @@ Version: @VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@
 Libs: -L${libdir} -l@PC_LIBNAME@
 Libs.private: @PC_LIBS_PRIVATE@
 Cflags: -I${includedir} @PC_CFLAGS@
+Requires: glu
