summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Theodore <tonyt@logyst.com>2017-02-01 02:27:22 (GMT)
committerGitHub <noreply@github.com>2017-02-01 02:27:22 (GMT)
commit4d1df0598e6856224e2dee6b1dc94ca2f8eb1170 (patch)
treee145afebbecf677a7821323bcaa9b54f0d093b13
parentc3edbe9f89ec5221c0caddeb416a2713e22755cb (diff)
parent769a3c39fc270522e978f85efd87db2dd5a11e13 (diff)
downloadmxe-4d1df0598e6856224e2dee6b1dc94ca2f8eb1170.zip
mxe-4d1df0598e6856224e2dee6b1dc94ca2f8eb1170.tar.gz
mxe-4d1df0598e6856224e2dee6b1dc94ca2f8eb1170.tar.bz2
Merge pull request #1652 from LuaAndC/libepoxy-fix-static
libepoxy: fix linking in static targets and add test
-rw-r--r--src/libepoxy-1-fixes.patch34
-rw-r--r--src/libepoxy-test.c10
-rw-r--r--src/libepoxy.mk12
3 files changed, 55 insertions, 1 deletions
diff --git a/src/libepoxy-1-fixes.patch b/src/libepoxy-1-fixes.patch
new file mode 100644
index 0000000..dda8e3c
--- /dev/null
+++ b/src/libepoxy-1-fixes.patch
@@ -0,0 +1,34 @@
+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 Nagaev <bnagaev@gmail.com>
+Date: Tue, 31 Jan 2017 02:03:55 +0100
+Subject: [PATCH] fix EPOXY_IMPORTEXPORT for static targets
+
+Based on https://github.com/mxe/mxe/issues/1647#issuecomment-275967915
+
+diff --git a/include/epoxy/gl.h b/include/epoxy/gl.h
+index 1111111..2222222 100644
+--- a/include/epoxy/gl.h
++++ b/include/epoxy/gl.h
+@@ -71,7 +71,17 @@ extern "C" {
+ #endif
+
+ #ifndef EPOXY_IMPORTEXPORT
+-#define EPOXY_IMPORTEXPORT __declspec(dllimport)
++# ifdef EPOXY_SHARED
++# ifdef EPOXY_DLL
++# define EPOXY_IMPORTEXPORT __declspec(dllexport)
++# else
++# define EPOXY_IMPORTEXPORT __declspec(dllimport)
++# endif
++# elif EPOXY_STATIC
++# define EPOXY_IMPORTEXPORT
++# else
++# error "Please define EPOXY_STATIC or EPOXY_SHARED"
++# endif
+ #endif
+
+ #ifndef GLAPI
diff --git a/src/libepoxy-test.c b/src/libepoxy-test.c
new file mode 100644
index 0000000..c8d1c19
--- /dev/null
+++ b/src/libepoxy-test.c
@@ -0,0 +1,10 @@
+/*
+ * This file is part of MXE. See LICENSE.md for licensing information.
+ */
+
+#include <epoxy/gl.h>
+
+int main() {
+ glGetString(GL_SHADING_LANGUAGE_VERSION);
+ return 0;
+}
diff --git a/src/libepoxy.mk b/src/libepoxy.mk
index 7126949..64a9f03 100644
--- a/src/libepoxy.mk
+++ b/src/libepoxy.mk
@@ -19,7 +19,17 @@ endef
define $(PKG)_BUILD
cd '$(1)' && autoreconf -fi -I'$(PREFIX)/$(TARGET)/share/aclocal'
- cd '$(1)' && ./configure \
+ cd '$(1)' && \
+ CFLAGS='$(if $(BUILD_STATIC),-DEPOXY_STATIC,-DEPOXY_SHARED -DEPOXY_DLL)' \
+ ./configure \
$(MXE_CONFIGURE_OPTS)
$(MAKE) -C '$(1)' -j '$(JOBS)' install $(MXE_DISABLE_CRUFT)
+ $(SED) 's/Cflags:/Cflags: -DEPOXY_$(if $(BUILD_STATIC),STATIC,SHARED)/' \
+ -i '$(PREFIX)/$(TARGET)/lib/pkgconfig/epoxy.pc'
+
+ # compile test
+ '$(TARGET)-gcc' \
+ -W -Wall -Werror -ansi -pedantic \
+ '$(TEST_FILE)' -o '$(PREFIX)/$(TARGET)/bin/test-$(PKG).exe' \
+ `'$(TARGET)-pkg-config' epoxy --cflags --libs`
endef