[arch-commits] Commit in sdl2/trunk (PKGBUILD dynapi.patch)
Jan Steffens
heftig at archlinux.org
Sat Jul 21 12:01:14 UTC 2018
Date: Saturday, July 21, 2018 @ 12:01:13
Author: heftig
Revision: 329351
2.0.8-9: Disable SDL_STATIC (causes config scripts to misreport available static libs) and pick a patch from Fedora
Added:
sdl2/trunk/dynapi.patch
Modified:
sdl2/trunk/PKGBUILD
--------------+
PKGBUILD | 22 ++++++++++----
dynapi.patch | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 100 insertions(+), 6 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2018-07-21 08:39:13 UTC (rev 329350)
+++ PKGBUILD 2018-07-21 12:01:13 UTC (rev 329351)
@@ -1,10 +1,12 @@
+# $Id$
# Maintainer: Sven-Hendrik Haase <sh at lutzhaase.com>
+
pkgname=sdl2
pkgver=2.0.8
-pkgrel=8
+pkgrel=9
pkgdesc="A library for portable low-level access to a video framebuffer, audio output, mouse, and keyboard (Version 2)"
arch=('x86_64')
-url="http://www.libsdl.org"
+url="https://www.libsdl.org"
license=('MIT')
depends=('glibc' 'libxext' 'libxrender' 'libx11' 'libgl' 'libxcursor' 'libibus')
makedepends=('alsa-lib' 'mesa' 'libpulse' 'libxrandr' 'libxinerama' 'wayland' 'libxkbcommon'
@@ -12,11 +14,12 @@
optdepends=('alsa-lib: ALSA audio driver'
'libpulse: PulseAudio audio driver')
source=("https://www.libsdl.org/release/SDL2-${pkgver}.tar.gz"{,.sig}
- cmake-include-paths.patch)
+ cmake-include-paths.patch dynapi.patch)
sha512sums=('673c6058b8692a36b4a3594456b10ef6051efe79e4fb644421fc5c76b11fd68b895840a2c8b72413418c378733e2993d33f19767d0d7ed101eda6310bd70c869'
'SKIP'
- '53eb853153b189bd9c0978ab8c7375608b6df5fc78e22168505bf9f6e695f6fbdc553eead0b17deb734002e047c6d5ae06642363fc629aa9ab7bef0c30388c84')
-validpgpkeys=('1528635D8053A57F77D1E08630A59377A7763BE6')
+ '53eb853153b189bd9c0978ab8c7375608b6df5fc78e22168505bf9f6e695f6fbdc553eead0b17deb734002e047c6d5ae06642363fc629aa9ab7bef0c30388c84'
+ 'bdb634b070af2f67fddcdd7908fe9ec0ea49d6edb013c35aaf1dbc840f941072ee16b21e5158de500aa5ec81165780a3aaf03e27d8bb30d50c2efb2a5465f824')
+validpgpkeys=('1528635D8053A57F77D1E08630A59377A7763BE6') # Sam Lantinga
prepare() {
cd SDL2-${pkgver}
@@ -23,6 +26,9 @@
patch -Np1 -i "${srcdir}"/cmake-include-paths.patch
+ # Taken from Fedora; fixes "Firewatch" and "Enter the Gungeon"
+ patch -Np1 -i "${srcdir}"/dynapi.patch
+
rm -rf build
mkdir build
}
@@ -31,6 +37,7 @@
cd SDL2-${pkgver}/build
cmake .. \
-DCMAKE_INSTALL_PREFIX=/usr \
+ -DSDL_STATIC=OFF \
-DSDL_DLOPEN=ON \
-DARTS=OFF \
-DESD=OFF \
@@ -46,8 +53,11 @@
package() {
cd SDL2-${pkgver}/build
- make DESTDIR="$pkgdir" install
+ make DESTDIR="${pkgdir}" install
sed -i "s/libSDL2\.a/libSDL2main.a/g" "$pkgdir"/usr/lib/cmake/SDL2/SDL2Targets-noconfig.cmake
+
install -Dm644 ../COPYING.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
+
+# vim: ts=2 sw=2 et:
Added: dynapi.patch
===================================================================
--- dynapi.patch (rev 0)
+++ dynapi.patch 2018-07-21 12:01:13 UTC (rev 329351)
@@ -0,0 +1,84 @@
+
+# HG changeset patch
+# User Ryan C. Gordon <icculus at 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. */
+ }
+ }
+
More information about the arch-commits
mailing list