fix(x11/sdl2-compat): do not version the library filename extension component after the '.so' substring

- Fixes https://github.com/termux/termux-packages/issues/26656

**Termux** `sdl2` is a unique build of SDL2 that **mixes traits of the intended official Android target of SDL2 and the official GNU/Linux target of SDL2 together**, without exactly matching the entire set of traits that either one would otherwise have by default.

Therefore, in order for **Termux** `sdl2-compat` to be a **correct backwards compatibility layer** of **Termux** `sdl3` to programs intended for **Termux** `sdl2`, an intervention in **Termux** `sdl2-compat` must be performed so that it provides the exact same shared libary filenames that **Termux** `sdl2` does.

Emphasis on **Termux** is used to denote that **in Termux `sdl2`, we deviated from the set of configurations that upstream considered while they developed upstream SDL2-compat**, and therefore, **to produce a correct `sdl2-compat` package for Termux, we need to modify it wherever necessary to simulate the behavior that specifically **Termux** `sdl2` has had for a long time, not just a generic SDL2.

`sdl2` vs. `sdl2-compat` before (note the presence of `libSDL2-2.0.so.0` and `libSDL2-2.0.so.0.3200.56` which never existed in Termux `sdl2`):

```diff
--- sdl2.txt	2025-09-23 12:33:30.112715258 -0500
+++ sdl2-compat.txt	2025-09-23 12:32:22.642218098 -0500
@@ -16,6 +16,20 @@
 /data/data/com.termux/files/usr/include/SDL2/SDL_blendmode.h
 /data/data/com.termux/files/usr/include/SDL2/SDL_clipboard.h
 /data/data/com.termux/files/usr/include/SDL2/SDL_config.h
+/data/data/com.termux/files/usr/include/SDL2/SDL_config_android.h
+/data/data/com.termux/files/usr/include/SDL2/SDL_config_emscripten.h
+/data/data/com.termux/files/usr/include/SDL2/SDL_config_iphoneos.h
+/data/data/com.termux/files/usr/include/SDL2/SDL_config_macosx.h
+/data/data/com.termux/files/usr/include/SDL2/SDL_config_minimal.h
+/data/data/com.termux/files/usr/include/SDL2/SDL_config_ngage.h
+/data/data/com.termux/files/usr/include/SDL2/SDL_config_os2.h
+/data/data/com.termux/files/usr/include/SDL2/SDL_config_pandora.h
+/data/data/com.termux/files/usr/include/SDL2/SDL_config_unix.h
+/data/data/com.termux/files/usr/include/SDL2/SDL_config_windows.h
+/data/data/com.termux/files/usr/include/SDL2/SDL_config_wingdk.h
+/data/data/com.termux/files/usr/include/SDL2/SDL_config_winrt.h
+/data/data/com.termux/files/usr/include/SDL2/SDL_config_xbox.h
+/data/data/com.termux/files/usr/include/SDL2/SDL_copying.h
 /data/data/com.termux/files/usr/include/SDL2/SDL_cpuinfo.h
 /data/data/com.termux/files/usr/include/SDL2/SDL_egl.h
 /data/data/com.termux/files/usr/include/SDL2/SDL_endian.h
@@ -89,15 +103,30 @@
 /data/data/com.termux/files/usr/lib
 /data/data/com.termux/files/usr/lib/cmake
 /data/data/com.termux/files/usr/lib/cmake/SDL2
+/data/data/com.termux/files/usr/lib/cmake/SDL2/SDL2Config.cmake
+/data/data/com.termux/files/usr/lib/cmake/SDL2/SDL2ConfigVersion.cmake
+/data/data/com.termux/files/usr/lib/cmake/SDL2/SDL2Targets-release.cmake
+/data/data/com.termux/files/usr/lib/cmake/SDL2/SDL2Targets.cmake
+/data/data/com.termux/files/usr/lib/cmake/SDL2/SDL2_testTargets-release.cmake
+/data/data/com.termux/files/usr/lib/cmake/SDL2/SDL2_testTargets.cmake
+/data/data/com.termux/files/usr/lib/cmake/SDL2/SDL2mainTargets-release.cmake
+/data/data/com.termux/files/usr/lib/cmake/SDL2/SDL2mainTargets.cmake
 /data/data/com.termux/files/usr/lib/cmake/SDL2/sdl2-config-version.cmake
 /data/data/com.termux/files/usr/lib/cmake/SDL2/sdl2-config.cmake
-/data/data/com.termux/files/usr/lib/libSDL2-2.0.so
+/data/data/com.termux/files/usr/lib/libSDL2-2.0.so.0.3200.56
+/data/data/com.termux/files/usr/lib/libSDL2_test.a
+/data/data/com.termux/files/usr/lib/libSDL2main.a
 /data/data/com.termux/files/usr/lib/pkgconfig
-/data/data/com.termux/files/usr/lib/pkgconfig/sdl2.pc
+/data/data/com.termux/files/usr/lib/pkgconfig/sdl2-compat.pc
 /data/data/com.termux/files/usr/share
 /data/data/com.termux/files/usr/share/aclocal
 /data/data/com.termux/files/usr/share/aclocal/sdl2.m4
 /data/data/com.termux/files/usr/share/doc
-/data/data/com.termux/files/usr/share/doc/sdl2
-/data/data/com.termux/files/usr/share/doc/sdl2/copyright
+/data/data/com.termux/files/usr/share/doc/sdl2-compat
+/data/data/com.termux/files/usr/share/doc/sdl2-compat/copyright
+/data/data/com.termux/files/usr/share/licenses
+/data/data/com.termux/files/usr/share/licenses/sdl2-compat
+/data/data/com.termux/files/usr/share/licenses/sdl2-compat/LICENSE.txt
+/data/data/com.termux/files/usr/lib/libSDL2-2.0.so
+/data/data/com.termux/files/usr/lib/libSDL2-2.0.so.0
 /data/data/com.termux/files/usr/lib/libSDL2.so
```

**Termux** `sdl2` vs **Termux** `sdl2-compat` after (note that there are now **no differences between the provided `.so` filenames**)

```diff
--- sdl2.txt	2025-08-15 12:17:33.590054363 -0500
+++ sdl2-compat-new.txt	2025-09-23 13:16:52.812714265 -0500
@@ -16,6 +16,20 @@
 /data/data/com.termux/files/usr/include/SDL2/SDL_blendmode.h
 /data/data/com.termux/files/usr/include/SDL2/SDL_clipboard.h
 /data/data/com.termux/files/usr/include/SDL2/SDL_config.h
+/data/data/com.termux/files/usr/include/SDL2/SDL_config_android.h
+/data/data/com.termux/files/usr/include/SDL2/SDL_config_emscripten.h
+/data/data/com.termux/files/usr/include/SDL2/SDL_config_iphoneos.h
+/data/data/com.termux/files/usr/include/SDL2/SDL_config_macosx.h
+/data/data/com.termux/files/usr/include/SDL2/SDL_config_minimal.h
+/data/data/com.termux/files/usr/include/SDL2/SDL_config_ngage.h
+/data/data/com.termux/files/usr/include/SDL2/SDL_config_os2.h
+/data/data/com.termux/files/usr/include/SDL2/SDL_config_pandora.h
+/data/data/com.termux/files/usr/include/SDL2/SDL_config_unix.h
+/data/data/com.termux/files/usr/include/SDL2/SDL_config_windows.h
+/data/data/com.termux/files/usr/include/SDL2/SDL_config_wingdk.h
+/data/data/com.termux/files/usr/include/SDL2/SDL_config_winrt.h
+/data/data/com.termux/files/usr/include/SDL2/SDL_config_xbox.h
+/data/data/com.termux/files/usr/include/SDL2/SDL_copying.h
 /data/data/com.termux/files/usr/include/SDL2/SDL_cpuinfo.h
 /data/data/com.termux/files/usr/include/SDL2/SDL_egl.h
 /data/data/com.termux/files/usr/include/SDL2/SDL_endian.h
@@ -89,15 +103,28 @@
 /data/data/com.termux/files/usr/lib
 /data/data/com.termux/files/usr/lib/cmake
 /data/data/com.termux/files/usr/lib/cmake/SDL2
+/data/data/com.termux/files/usr/lib/cmake/SDL2/SDL2Config.cmake
+/data/data/com.termux/files/usr/lib/cmake/SDL2/SDL2ConfigVersion.cmake
+/data/data/com.termux/files/usr/lib/cmake/SDL2/SDL2Targets-release.cmake
+/data/data/com.termux/files/usr/lib/cmake/SDL2/SDL2Targets.cmake
+/data/data/com.termux/files/usr/lib/cmake/SDL2/SDL2_testTargets-release.cmake
+/data/data/com.termux/files/usr/lib/cmake/SDL2/SDL2_testTargets.cmake
+/data/data/com.termux/files/usr/lib/cmake/SDL2/SDL2mainTargets-release.cmake
+/data/data/com.termux/files/usr/lib/cmake/SDL2/SDL2mainTargets.cmake
 /data/data/com.termux/files/usr/lib/cmake/SDL2/sdl2-config-version.cmake
 /data/data/com.termux/files/usr/lib/cmake/SDL2/sdl2-config.cmake
 /data/data/com.termux/files/usr/lib/libSDL2-2.0.so
+/data/data/com.termux/files/usr/lib/libSDL2_test.a
+/data/data/com.termux/files/usr/lib/libSDL2main.a
 /data/data/com.termux/files/usr/lib/pkgconfig
-/data/data/com.termux/files/usr/lib/pkgconfig/sdl2.pc
+/data/data/com.termux/files/usr/lib/pkgconfig/sdl2-compat.pc
 /data/data/com.termux/files/usr/share
 /data/data/com.termux/files/usr/share/aclocal
 /data/data/com.termux/files/usr/share/aclocal/sdl2.m4
 /data/data/com.termux/files/usr/share/doc
-/data/data/com.termux/files/usr/share/doc/sdl2
-/data/data/com.termux/files/usr/share/doc/sdl2/copyright
+/data/data/com.termux/files/usr/share/doc/sdl2-compat
+/data/data/com.termux/files/usr/share/doc/sdl2-compat/copyright
+/data/data/com.termux/files/usr/share/licenses
+/data/data/com.termux/files/usr/share/licenses/sdl2-compat
+/data/data/com.termux/files/usr/share/licenses/sdl2-compat/LICENSE.txt
 /data/data/com.termux/files/usr/lib/libSDL2.so
```

difference between old `sdl2-compat` and new `sdl2-compat` directly (note the removal of `libSDL2-2.0.so.0.3200.56` and `libSDL2-2.0.so.0`):

```diff
--- sdl2-compat.txt	2025-08-15 12:14:01.610054444 -0500
+++ sdl2-compat-new.txt	2025-09-23 13:16:52.812714265 -0500
@@ -113,7 +113,7 @@
 /data/data/com.termux/files/usr/lib/cmake/SDL2/SDL2mainTargets.cmake
 /data/data/com.termux/files/usr/lib/cmake/SDL2/sdl2-config-version.cmake
 /data/data/com.termux/files/usr/lib/cmake/SDL2/sdl2-config.cmake
-/data/data/com.termux/files/usr/lib/libSDL2-2.0.so.0.3200.56
+/data/data/com.termux/files/usr/lib/libSDL2-2.0.so
 /data/data/com.termux/files/usr/lib/libSDL2_test.a
 /data/data/com.termux/files/usr/lib/libSDL2main.a
 /data/data/com.termux/files/usr/lib/pkgconfig
@@ -127,6 +127,4 @@
 /data/data/com.termux/files/usr/share/licenses
 /data/data/com.termux/files/usr/share/licenses/sdl2-compat
 /data/data/com.termux/files/usr/share/licenses/sdl2-compat/LICENSE.txt
-/data/data/com.termux/files/usr/lib/libSDL2-2.0.so
-/data/data/com.termux/files/usr/lib/libSDL2-2.0.so.0
 /data/data/com.termux/files/usr/lib/libSDL2.so
```

- Also: The Termux `sdl2-compat` does **not** need the `termux_step_post_make_install()` of Termux `sdl2`, because it internally automatically creates the symbolic link using its `CMakeLists.txt` in a way that Termux `sdl2` does not - therefore, the `termux_step_post_make_install()` should be removed from `sdl2-compat` to avoid causing confusion, because it is redundant.
This commit is contained in:
termux-pacman-bot
2025-10-02 06:05:54 +00:00
parent a999b91b84
commit 55364d96a4
5 changed files with 16 additions and 10 deletions

View File

@@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="Simple DirectMedia Layer (SDL) sdl2-compat"
TERMUX_PKG_LICENSE="ZLIB" TERMUX_PKG_LICENSE="ZLIB"
TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION="2.32.56" TERMUX_PKG_VERSION="2.32.56"
TERMUX_PKG_REVISION=2 TERMUX_PKG_REVISION=3
TERMUX_PKG_SRCURL=https://github.com/libsdl-org/sdl2-compat/releases/download/release-${TERMUX_PKG_VERSION}/sdl2-compat-${TERMUX_PKG_VERSION}.tar.gz TERMUX_PKG_SRCURL=https://github.com/libsdl-org/sdl2-compat/releases/download/release-${TERMUX_PKG_VERSION}/sdl2-compat-${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=27e845b1b7dc0a91a85f1a1f18892ed205adb38caf767741eb258008d8264de0 TERMUX_PKG_SHA256=27e845b1b7dc0a91a85f1a1f18892ed205adb38caf767741eb258008d8264de0
TERMUX_PKG_DEPENDS="sdl3" TERMUX_PKG_DEPENDS="sdl3"
@@ -27,9 +27,3 @@ termux_step_pre_configure() {
echo "INFO: Modified files:" echo "INFO: Modified files:"
diff -uNr "${TERMUX_PKG_TMPDIR}"/{a,b} --color || : diff -uNr "${TERMUX_PKG_TMPDIR}"/{a,b} --color || :
} }
termux_step_post_make_install() {
# ld(1)ing with `-lSDL2` won't work without this:
# https://github.com/termux/x11-packages/issues/633
ln -sf libSDL2-2.0.so ${TERMUX_PREFIX}/lib/libSDL2.so
}

View File

@@ -0,0 +1,12 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 666ec9f..0bd9bef 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -353,7 +353,5 @@ elseif(UNIX AND NOT ANDROID)
# !!! FIXME: check OUTPUT_NAME value
set_target_properties(SDL2 PROPERTIES
OUTPUT_NAME "SDL2-2.0"
- VERSION "${SDL_SO_VERSION}"
- SOVERSION "${SDL_SO_VERSION_MAJOR}"
)
elseif(WIN32)

View File

@@ -4,7 +4,7 @@ TERMUX_PKG_LICENSE="ZLIB"
TERMUX_PKG_LICENSE_FILE="COPYING" TERMUX_PKG_LICENSE_FILE="COPYING"
TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION="1.0.4" TERMUX_PKG_VERSION="1.0.4"
TERMUX_PKG_REVISION=3 TERMUX_PKG_REVISION=4
TERMUX_PKG_SRCURL=https://www.ferzkopp.net/Software/SDL2_gfx/SDL2_gfx-${TERMUX_PKG_VERSION}.tar.gz TERMUX_PKG_SRCURL=https://www.ferzkopp.net/Software/SDL2_gfx/SDL2_gfx-${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=63e0e01addedc9df2f85b93a248f06e8a04affa014a835c2ea34bfe34e576262 TERMUX_PKG_SHA256=63e0e01addedc9df2f85b93a248f06e8a04affa014a835c2ea34bfe34e576262
TERMUX_PKG_DEPENDS="sdl2 | sdl2-compat" TERMUX_PKG_DEPENDS="sdl2 | sdl2-compat"

View File

@@ -4,7 +4,7 @@ TERMUX_PKG_LICENSE="ZLIB"
TERMUX_PKG_LICENSE_FILE="LICENSE.txt" TERMUX_PKG_LICENSE_FILE="LICENSE.txt"
TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION="2.8.8" TERMUX_PKG_VERSION="2.8.8"
TERMUX_PKG_REVISION=1 TERMUX_PKG_REVISION=2
TERMUX_PKG_SRCURL=https://github.com/libsdl-org/SDL_image/releases/download/release-${TERMUX_PKG_VERSION}/SDL2_image-${TERMUX_PKG_VERSION}.tar.gz TERMUX_PKG_SRCURL=https://github.com/libsdl-org/SDL_image/releases/download/release-${TERMUX_PKG_VERSION}/SDL2_image-${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=2213b56fdaff2220d0e38c8e420cbe1a83c87374190cba8c70af2156097ce30a TERMUX_PKG_SHA256=2213b56fdaff2220d0e38c8e420cbe1a83c87374190cba8c70af2156097ce30a
# Prevent updating to SDL3 version # Prevent updating to SDL3 version

View File

@@ -4,7 +4,7 @@ TERMUX_PKG_LICENSE="ZLIB"
TERMUX_PKG_LICENSE_FILE="LICENSE.txt" TERMUX_PKG_LICENSE_FILE="LICENSE.txt"
TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION="2.24.0" TERMUX_PKG_VERSION="2.24.0"
TERMUX_PKG_REVISION=2 TERMUX_PKG_REVISION=3
TERMUX_PKG_SRCURL=https://github.com/libsdl-org/SDL_ttf/releases/download/release-${TERMUX_PKG_VERSION}/SDL2_ttf-${TERMUX_PKG_VERSION}.tar.gz TERMUX_PKG_SRCURL=https://github.com/libsdl-org/SDL_ttf/releases/download/release-${TERMUX_PKG_VERSION}/SDL2_ttf-${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=0b2bf1e7b6568adbdbc9bb924643f79d9dedafe061fa1ed687d1d9ac4e453bfd TERMUX_PKG_SHA256=0b2bf1e7b6568adbdbc9bb924643f79d9dedafe061fa1ed687d1d9ac4e453bfd
# Prevent updating to 3.x.x version # Prevent updating to 3.x.x version