[gnome-build-meta/abderrahim/flatpak-sdk: 12/15] sdk/: build sdl2 ourselves



commit 3beba05c161a0a5cf19e5739ac3047a344296a85
Author: Abderrahim Kitouni <akitouni gnome org>
Date:   Mon Jul 2 22:28:40 2018 +0100

    sdk/: build sdl2 ourselves

 elements/sdk-platform.bst       |  5 +++
 elements/sdk/sdl2-image.bst     | 21 +++++++++++
 elements/sdk/sdl2-mixer.bst     | 18 +++++++++
 elements/sdk/sdl2-net.bst       | 21 +++++++++++
 elements/sdk/sdl2-ttf.bst       | 20 ++++++++++
 elements/sdk/sdl2.bst           | 45 ++++++++++++++++++++++
 files/sdl2/sdl2-unity-fix.patch | 84 +++++++++++++++++++++++++++++++++++++++++
 7 files changed, 214 insertions(+)
---
diff --git a/elements/sdk-platform.bst b/elements/sdk-platform.bst
index 51f8911..13605be 100644
--- a/elements/sdk-platform.bst
+++ b/elements/sdk-platform.bst
@@ -46,6 +46,11 @@ depends:
 - sdk/pango.bst
 - sdk/pycairo.bst
 - sdk/pygobject.bst
+- sdk/sdl2-image.bst
+- sdk/sdl2-mixer.bst
+- sdk/sdl2-net.bst
+- sdk/sdl2-ttf.bst
+- sdk/sdl2.bst
 - sdk/vte.bst
 - sdk/woff2.bst
 - sdk/yelp-xsl.bst
diff --git a/elements/sdk/sdl2-image.bst b/elements/sdk/sdl2-image.bst
new file mode 100644
index 0000000..101cdd3
--- /dev/null
+++ b/elements/sdk/sdl2-image.bst
@@ -0,0 +1,21 @@
+kind: autotools
+sources:
+- kind: tar
+  url: https://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.2.tar.gz
+depends:
+- sdk/sdl2.bst
+- filename: base.bst
+  junction: freedesktop-sdk.bst
+  type: build
+- filename: base-platform.bst
+  junction: freedesktop-sdk.bst
+  type: runtime
+variables:
+  conf-local: --disable-jpg-shared --disable-png-shared --disable-tif-shared --disable-webp-shared
+public:
+  bst:
+    split-rules:
+      devel:
+        (>):
+          - "%{libdir}/libSDL2_image.so"
+
diff --git a/elements/sdk/sdl2-mixer.bst b/elements/sdk/sdl2-mixer.bst
new file mode 100644
index 0000000..228a1ff
--- /dev/null
+++ b/elements/sdk/sdl2-mixer.bst
@@ -0,0 +1,18 @@
+kind: autotools
+sources:
+- kind: tar
+  url: https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.1.tar.gz
+depends:
+- sdk/sdl2.bst
+- filename: base.bst
+  junction: freedesktop-sdk.bst
+  type: build
+- filename: base-platform.bst
+  junction: freedesktop-sdk.bst
+  type: runtime
+public:
+  bst:
+    split-rules:
+      devel:
+        (>):
+          - "%{libdir}/libSDL2_mixer.so"
diff --git a/elements/sdk/sdl2-net.bst b/elements/sdk/sdl2-net.bst
new file mode 100644
index 0000000..489819a
--- /dev/null
+++ b/elements/sdk/sdl2-net.bst
@@ -0,0 +1,21 @@
+kind: autotools
+sources:
+- kind: tar
+  url: https://www.libsdl.org/projects/SDL_net/release/SDL2_net-2.0.1.tar.gz
+depends:
+- sdk/sdl2.bst
+- filename: base.bst
+  junction: freedesktop-sdk.bst
+  type: build
+- filename: base-platform.bst
+  junction: freedesktop-sdk.bst
+  type: runtime
+variables:
+  conf-local: --disable-gui
+public:
+  bst:
+    split-rules:
+      devel:
+        (>):
+          - "%{libdir}/libSDL2_net.so"
+
diff --git a/elements/sdk/sdl2-ttf.bst b/elements/sdk/sdl2-ttf.bst
new file mode 100644
index 0000000..47c36ea
--- /dev/null
+++ b/elements/sdk/sdl2-ttf.bst
@@ -0,0 +1,20 @@
+kind: autotools
+sources:
+- kind: tar
+  url: https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-2.0.14.tar.gz
+depends:
+- sdk/sdl2.bst
+- filename: desktop/freetype.bst
+  junction: freedesktop-sdk.bst
+- filename: base.bst
+  junction: freedesktop-sdk.bst
+  type: build
+- filename: base-platform.bst
+  junction: freedesktop-sdk.bst
+  type: runtime
+public:
+  bst:
+    split-rules:
+      devel:
+        (>):
+          - "%{libdir}/libSDL2_ttf.so"
diff --git a/elements/sdk/sdl2.bst b/elements/sdk/sdl2.bst
new file mode 100644
index 0000000..d06629a
--- /dev/null
+++ b/elements/sdk/sdl2.bst
@@ -0,0 +1,45 @@
+kind: autotools
+sources:
+- kind: tar
+  url: https://www.libsdl.org/release/SDL2-2.0.8.tar.gz
+- kind: patch
+  path: files/sdl2/sdl2-unity-fix.patch
+depends:
+- sdk/ibus.bst
+- filename: desktop/dbus.bst
+  junction: freedesktop-sdk.bst
+- filename: desktop/mesa.bst
+  junction: freedesktop-sdk.bst
+- filename: desktop/xorg-lib-x11.bst
+  junction: freedesktop-sdk.bst
+- filename: desktop/libpulse.bst
+  junction: freedesktop-sdk.bst
+- filename: desktop/wayland.bst
+  junction: freedesktop-sdk.bst
+- filename: base.bst
+  junction: freedesktop-sdk.bst
+  type: build
+- filename: base-platform.bst
+  junction: freedesktop-sdk.bst
+  type: runtime
+variables:
+  conf-local: |
+    --enable-sdl-dlopen \
+    --disable-arts \
+    --disable-esd \
+    --disable-nas \
+    --enable-pulseaudio \
+    --disable-alsa \
+    --disable-oss \
+    --disable-sndio \
+    --disable-libudev \
+    --enable-video-wayland \
+    --enable-wayland-shared=no
+public:
+  bst:
+    split-rules:
+      devel:
+        (>):
+          - "%{bindir}/sdl2-config"
+          - "%{libdir}/libSDL2.so"
+
diff --git a/files/sdl2/sdl2-unity-fix.patch b/files/sdl2/sdl2-unity-fix.patch
new file mode 100644
index 0000000..f8aac36
--- /dev/null
+++ b/files/sdl2/sdl2-unity-fix.patch
@@ -0,0 +1,84 @@
+
+# HG changeset patch
+# User Ryan C. Gordon <icculus icculus org>
+# Date 1526575846 14400
+# Node ID 7babfecee045fac18d95e5936fede534ca54ed24
+# Parent  9e46f3dd75fd2e85e0e3ebb8a77329bc74a16e70
+dynapi: don't let system loader resolve the initializer to the wrong version.
+
+Fixes problems launching Firewatch on Linux (which statically links SDL but
+also dynamically loads a system-wide copy from a plugin shared library) with
+a newer SDL build.
+
+diff -r 9e46f3dd75fd -r 7babfecee045 src/dynapi/SDL_dynapi.c
+--- a/src/dynapi/SDL_dynapi.c  Fri May 11 09:37:00 2018 +0300
++++ b/src/dynapi/SDL_dynapi.c  Thu May 17 12:50:46 2018 -0400
+@@ -167,15 +167,10 @@
+ #error Write me.
+ #endif
+ 
+-
+-
+-/* Here's the exported entry point that fills in the jump table. */
+-/*  Use specific types when an "int" might suffice to keep this sane. */
+-typedef Sint32 (SDLCALL *SDL_DYNAPI_ENTRYFN)(Uint32 apiver, void *table, Uint32 tablesize);
+-extern DECLSPEC Sint32 SDLCALL SDL_DYNAPI_entry(Uint32, void *, Uint32);
+-
+-Sint32
+-SDL_DYNAPI_entry(Uint32 apiver, void *table, Uint32 tablesize)
++/* we make this a static function so we can call the correct one without the
++   system's dynamic linker resolving to the wrong version of this. */
++static Sint32
++initialize_jumptable(Uint32 apiver, void *table, Uint32 tablesize)
+ {
+     SDL_DYNAPI_jump_table *output_jump_table = (SDL_DYNAPI_jump_table *) table;
+ 
+@@ -202,6 +197,18 @@
+ }
+ 
+ 
++/* Here's the exported entry point that fills in the jump table. */
++/*  Use specific types when an "int" might suffice to keep this sane. */
++typedef Sint32 (SDLCALL *SDL_DYNAPI_ENTRYFN)(Uint32 apiver, void *table, Uint32 tablesize);
++extern DECLSPEC Sint32 SDLCALL SDL_DYNAPI_entry(Uint32, void *, Uint32);
++
++Sint32
++SDL_DYNAPI_entry(Uint32 apiver, void *table, Uint32 tablesize)
++{
++    return initialize_jumptable(apiver, table, tablesize);
++}
++
++
+ /* Obviously we can't use SDL_LoadObject() to load SDL.  :)  */
+ /* Also obviously, we never close the loaded library. */
+ #if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)
+@@ -260,7 +267,7 @@
+ SDL_InitDynamicAPILocked(void)
+ {
+     const char *libname = SDL_getenv_REAL("SDL_DYNAMIC_API");
+-    SDL_DYNAPI_ENTRYFN entry = SDL_DYNAPI_entry;  /* funcs from here by default. */
++    SDL_DYNAPI_ENTRYFN entry = NULL;  /* funcs from here by default. */
+ 
+     if (libname) {
+         entry = (SDL_DYNAPI_ENTRYFN) get_sdlapi_entry(libname, "SDL_DYNAPI_entry");
+@@ -268,16 +275,15 @@
+             /* !!! FIXME: fail to startup here instead? */
+             /* !!! FIXME: definitely warn user. */
+             /* Just fill in the function pointers from this library. */
+-            entry = SDL_DYNAPI_entry;
+         }
+     }
+ 
+-    if (entry(SDL_DYNAPI_VERSION, &jump_table, sizeof (jump_table)) < 0) {
++    if (!entry || (entry(SDL_DYNAPI_VERSION, &jump_table, sizeof (jump_table)) < 0)) {
+         /* !!! FIXME: fail to startup here instead? */
+         /* !!! FIXME: definitely warn user. */
+         /* Just fill in the function pointers from this library. */
+-        if (entry != SDL_DYNAPI_entry) {
+-            if (!SDL_DYNAPI_entry(SDL_DYNAPI_VERSION, &jump_table, sizeof (jump_table))) {
++        if (!entry) {
++            if (!initialize_jumptable(SDL_DYNAPI_VERSION, &jump_table, sizeof (jump_table))) {
+                 /* !!! FIXME: now we're screwed. Should definitely abort now. */
+             }
+         }
+


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]