SDL: build: Simplify library name

From 7ef38beb7ef8a04528693fdc5f04411492f8421a Mon Sep 17 00:00:00 2001
From: Simon McVittie <[EMAIL REDACTED]>
Date: Wed, 23 Nov 2022 16:33:38 +0000
Subject: [PATCH] build: Simplify library name

We want the library to come out as libSDL3.so.0 on Unix, or something
similar on other platforms. There's no need to have libSDL3-3.0.so.0,
because next time we intentionally break the API it should become libSDL4
anyway.

Partially implements #5626.

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 .github/workflows/main.yml |  4 ++--
 CMakeLists.txt             | 16 ++++------------
 Makefile.in                |  3 +--
 configure.ac               |  5 -----
 4 files changed, 7 insertions(+), 21 deletions(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 916b62182b91..a705d2c69262 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -88,7 +88,7 @@ jobs:
         ctest -VV --test-dir build/
         if test "${{ runner.os }}" = "Linux"; then
           # This should show us the SDL_REVISION
-          strings build/libSDL3-3.0.so.0 | grep SDL-
+          strings build/libSDL3.so.0 | grep SDL-
         fi
     - name: Install (CMake)
       if: "! matrix.platform.autotools"
@@ -147,7 +147,7 @@ jobs:
         make -j"${parallel}" -C build-autotools/test check LD_LIBRARY_PATH="${curdir}/build-autotools/build/.libs"
         if test "${{ runner.os }}" = "Linux"; then
           # This should show us the SDL_REVISION
-          strings "${curdir}/build-autotools/build/.libs/libSDL3-3.0.so.0" | grep SDL-
+          strings "${curdir}/build-autotools/build/.libs/libSDL3.so.0" | grep SDL-
         fi
     - name: Install (Autotools)
       if: matrix.platform.autotools
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 36b17c21dac2..9ef88362ccea 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -113,11 +113,6 @@ set(LT_MAJOR "0")
 math(EXPR LT_AGE "${SDL_BINARY_AGE} - ${SDL_INTERFACE_AGE}")
 math(EXPR LT_CURRENT "${LT_MAJOR} + ${LT_AGE}")
 set(LT_REVISION "${SDL_INTERFACE_AGE}")
-# For historical reasons, the library name redundantly includes the major
-# version twice: libSDL3-3.0.so.0.
-# TODO: in SDL 3, set the OUTPUT_NAME to plain SDL3, which will simplify
-# it to libSDL3.so.0
-set(LT_RELEASE "3.0")
 set(LT_VERSION "${LT_MAJOR}.${LT_AGE}.${LT_REVISION}")
 
 # The following should match the versions in the Xcode project file.
@@ -133,7 +128,7 @@ set(DYLIB_COMPATIBILITY_VERSION "${DYLIB_CURRENT_VERSION_MAJOR}.0.0")
 # To avoid generating them twice, these are added to a dummy target on which all sdl targets depend.
 set(SDL_GENERATED_HEADERS)
 
-#message(STATUS "${LT_VERSION} :: ${LT_AGE} :: ${LT_REVISION} :: ${LT_CURRENT} :: ${LT_RELEASE}")
+#message(STATUS "${LT_VERSION} :: ${LT_AGE} :: ${LT_REVISION} :: ${LT_CURRENT}")
 
 check_cpu_architecture(x86 SDL_CPU_X86)
 check_cpu_architecture(x64 SDL_CPU_X64)
@@ -3259,13 +3254,11 @@ if(SDL_SHARED)
     # FIXME: Remove SOVERSION in SDL3
     set_target_properties(SDL3 PROPERTIES
       MACOSX_RPATH 1
-      SOVERSION 0
-      OUTPUT_NAME "SDL3-${LT_RELEASE}")
+      SOVERSION 0)
   elseif(UNIX AND NOT ANDROID)
     set_target_properties(SDL3 PROPERTIES
       VERSION ${LT_VERSION}
-      SOVERSION ${LT_MAJOR}
-      OUTPUT_NAME "SDL3-${LT_RELEASE}")
+      SOVERSION ${LT_MAJOR})
   else()
     if(WINDOWS OR CYGWIN)
       set_target_properties(SDL3 PROPERTIES
@@ -3273,8 +3266,7 @@ if(SDL_SHARED)
     endif()
     set_target_properties(SDL3 PROPERTIES
       VERSION ${SDL_VERSION}
-      SOVERSION ${LT_REVISION}
-      OUTPUT_NAME "SDL3")
+      SOVERSION ${LT_REVISION})
   endif()
   # Note: The clang toolset for Visual Studio does not support /NODEFAULTLIB.
   if(MSVC AND NOT SDL_LIBC AND NOT MSVC_CLANG AND NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM")
diff --git a/Makefile.in b/Makefile.in
index afc29777700e..490a2b37b6be 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -135,9 +135,8 @@ SDLTEST_HDRS = $(shell ls $(srcdir)/include | $(FGREP) SDL_test)
 
 LT_AGE      = @LT_AGE@
 LT_CURRENT  = @LT_CURRENT@
-LT_RELEASE  = @LT_RELEASE@
 LT_REVISION = @LT_REVISION@
-LT_LDFLAGS  = -no-undefined -rpath $(libdir) -release $(LT_RELEASE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
+LT_LDFLAGS  = -no-undefined -rpath $(libdir) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
 
 all: $(srcdir)/configure Makefile $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET) $(objects)/$(SDLTEST_TARGET)
 
diff --git a/configure.ac b/configure.ac
index 085d39d396a1..6decba35066b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -36,10 +36,6 @@ AC_SUBST(SDL_VERSION)
 LT_INIT([win32-dll])
 LT_LANG([Windows Resource])
 
-# For historical reasons, the library name redundantly includes the major
-# version twice: libSDL3-3.0.so.0.
-# TODO: in SDL 3, stop using -release, which will simplify it to libSDL3.so.0
-LT_RELEASE=3.0
 # Increment this if there is an incompatible change - but if that happens,
 # we should rename the library from SDL2 to SDL3, at which point this would
 # reset to 0 anyway.
@@ -49,7 +45,6 @@ LT_CURRENT=`expr $LT_MAJOR + $LT_AGE`
 LT_REVISION=$SDL_INTERFACE_AGE
 m4_pattern_allow([^LT_])
 
-AC_SUBST(LT_RELEASE)
 AC_SUBST(LT_CURRENT)
 AC_SUBST(LT_REVISION)
 AC_SUBST(LT_AGE)