summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Meyer2020-03-01 19:45:47 +0100
committerSebastian Meyer2020-03-01 20:06:27 +0100
commit9bd8d030845c89c1ae35a0432b4497cb971e8325 (patch)
tree4413f1d27ddd3a4f8f096ff133d0e64a69ff61fc
downloadaur-9bd8d030845c89c1ae35a0432b4497cb971e8325.tar.gz
Initial PKGBUILD for sdl12-compat
-rw-r--r--.SRCINFO21
-rw-r--r--PKGBUILD44
-rw-r--r--fix-cmakelists.patch22
-rw-r--r--fix-srcdir-reference.patch17
4 files changed, 104 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..0094e55ae96c
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,21 @@
+pkgbase = sdl2_compat12-git
+ pkgdesc = Provides a binary-compatible API for programs written against SDL 1.2, but it uses SDL 2.0 behind the scenes.
+ pkgver = latest
+ pkgrel = 1
+ url = https://github.com/SDL-mirror/sdl12-compat.git
+ arch = i686
+ arch = x86_64
+ license = ZLIB
+ makedepends = cmake
+ depends = sdl2
+ provides = sdl
+ conflicts = sdl
+ source = git+https://github.com/SDL-mirror/sdl12-compat.git
+ source = fix-cmakelists.patch
+ source = fix-srcdir-reference.patch
+ sha256sums = SKIP
+ sha256sums = 6b89938e36ceafbe0e5fec87aa03606c20166890ea73320e5fabf4fd2c3ff4b5
+ sha256sums = e59519698276b34277a76746b84c06afe5f21037e3c4a5a8e8f913306f0bd812
+
+pkgname = sdl2_compat12-git
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..63712faa37e0
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,44 @@
+# Maintainer: Sebastian Meyer <aur@mailhell.seb7.de>
+
+_pkgname=sdl2_compat12
+pkgname=sdl2_compat12-git
+provides=('sdl')
+conflicts=('sdl')
+pkgver=latest
+pkgrel=1
+pkgdesc="Provides a binary-compatible API for programs written against SDL 1.2, but it uses SDL 2.0 behind the scenes."
+url='https://github.com/SDL-mirror/sdl12-compat.git'
+arch=('i686' 'x86_64')
+license=('ZLIB')
+depends=('sdl2')
+makedepends=('cmake')
+source=('git+https://github.com/SDL-mirror/sdl12-compat.git' 'fix-cmakelists.patch' 'fix-srcdir-reference.patch')
+sha256sums=('SKIP'
+ '6b89938e36ceafbe0e5fec87aa03606c20166890ea73320e5fabf4fd2c3ff4b5'
+ 'e59519698276b34277a76746b84c06afe5f21037e3c4a5a8e8f913306f0bd812')
+
+prepare() {
+ cd sdl12-compat
+ patch --forward --strip=1 --input="${srcdir}/fix-cmakelists.patch"
+ patch --forward --strip=1 --input="${srcdir}/fix-srcdir-reference.patch"
+}
+
+pkgver() {
+ cd sdl12-compat
+ git log | head -n1 | sed -e 's/^commit\s*\(........\).*/\1/'
+}
+
+build() {
+ cd sdl12-compat
+ cmake .
+ make
+}
+
+package() {
+ cd "sdl12-compat"
+ mkdir -p "$pkgdir/usr/lib"
+ mkdir -p "$pkgdir/usr/share/licenses/$_pkgname/"
+
+ cp libSDL-1.2.so* "$pkgdir/usr/lib"
+ cp COPYING "$pkgdir/usr/share/licenses/$_pkgname/LICENSE"
+}
diff --git a/fix-cmakelists.patch b/fix-cmakelists.patch
new file mode 100644
index 000000000000..d8bcaa364bf6
--- /dev/null
+++ b/fix-cmakelists.patch
@@ -0,0 +1,22 @@
+1. Patch the include path for SDL2
+2. No testsprite.c because the build script doesn't seem to add the -lm
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 1987b27..86f0bae 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -3,7 +3,7 @@ project(sdl12_compat)
+
+ add_library(SDL SHARED "src/SDL12_compat.c")
+
+-target_include_directories(SDL PUBLIC "/usr/local/include/SDL2") # !!! FIXME
++target_include_directories(SDL PUBLIC "/usr/include/SDL2") # !!! FIXME
+ target_include_directories(SDL PUBLIC "/usr/X11/include") # !!! FIXME
+ add_definitions("-D_THREAD_SAFE") # !!! FIXME
+
+@@ -40,4 +40,4 @@ macro(test_program _NAME _SRCS)
+ target_link_libraries(${_NAME} SDL)
+ endmacro()
+
+-test_program(testsprite "test/testsprite.c")
++#test_program(testsprite "test/testsprite.c")
diff --git a/fix-srcdir-reference.patch b/fix-srcdir-reference.patch
new file mode 100644
index 000000000000..f42414b9fd38
--- /dev/null
+++ b/fix-srcdir-reference.patch
@@ -0,0 +1,17 @@
+This reference to __FILE__ would include the whole $srcdir - hence triggering the
+> ==> WARNING: Package contains reference to $srcdir
+and preventing reproducible builds.
+
+diff --git a/src/SDL12_compat.c b/src/SDL12_compat.c
+index 2fb0d2c..f89e1c3 100644
+--- a/src/SDL12_compat.c
++++ b/src/SDL12_compat.c
+@@ -104,7 +104,7 @@
+ do { \
+ static SDL_bool seen = SDL_FALSE; \
+ if (!seen) { \
+- fprintf(stderr, "FIXME: %s (%s, %s:%d)\n", x, __FUNCTION__, __FILE__, __LINE__); \
++ fprintf(stderr, "FIXME: %s (%s, SDL12_compat.c:%d)\n", x, __FUNCTION__, __LINE__); \
+ seen = SDL_TRUE; \
+ } \
+ } while (0)