Merge commit '4ca5ea5b7e8333b2cde1b7cdddf167c67cc3f23c' into main
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201
diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml
index 264fce2..ccc0266 100644
--- a/.github/workflows/android.yml
+++ b/.github/workflows/android.yml
@@ -38,6 +38,7 @@ jobs:
-DANDROID_PLATFORM=${{ matrix.platform.android_platform }} \
-DANDROID_ABI=${{ matrix.platform.android_abi }} \
-DSDL_STATIC_PIC=ON \
+ -DSDL_VENDOR_INFO="Github Workflow" \
-DCMAKE_INSTALL_PREFIX=prefix \
-DCMAKE_BUILD_TYPE=Release \
-GNinja
diff --git a/.github/workflows/emscripten.yml b/.github/workflows/emscripten.yml
index b1ab07e..5f41cb5 100644
--- a/.github/workflows/emscripten.yml
+++ b/.github/workflows/emscripten.yml
@@ -33,6 +33,7 @@ jobs:
run: |
emcmake cmake -S cmake/test -B cmake_config_build \
-DCMAKE_BUILD_TYPE=Release \
+ -DSDL_VENDOR_INFO="Github Workflow" \
-DTEST_SHARED=FALSE \
-DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }}
cmake --build cmake_config_build --verbose
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index d4ce2f2..f96eb73 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -72,6 +72,7 @@ jobs:
-DSDL_TESTS=ON \
-DSDL_WERROR=ON \
-DSDL_INSTALL_TESTS=ON \
+ -DSDL_VENDOR_INFO="Github Workflow" \
-DCMAKE_INSTALL_PREFIX=cmake_prefix \
-DCMAKE_BUILD_TYPE=Release \
${{ matrix.platform.cmake }}
@@ -102,6 +103,7 @@ jobs:
(
cd build-autotools
${{ github.workspace }}/configure \
+ --enable-vendor-info="Github Workflow" \
--enable-werror \
--prefix=${{ github.workspace }}/autotools_prefix \
)
diff --git a/.github/workflows/msvc.yml b/.github/workflows/msvc.yml
index 4f561b9..b4644ec 100644
--- a/.github/workflows/msvc.yml
+++ b/.github/workflows/msvc.yml
@@ -43,6 +43,7 @@ jobs:
-DSDL_WERROR=${{ !matrix.platform.nowerror }} `
-DSDL_TESTS=ON `
-DSDL_INSTALL_TESTS=ON `
+ -DSDL_VENDOR_INFO="Github Workflow" `
-DSDL2_DISABLE_INSTALL=OFF `
${{ matrix.platform.flags }} `
-DCMAKE_INSTALL_PREFIX=prefix
diff --git a/.github/workflows/n3ds.yml b/.github/workflows/n3ds.yml
index c7c1c30..f35577e 100644
--- a/.github/workflows/n3ds.yml
+++ b/.github/workflows/n3ds.yml
@@ -20,6 +20,7 @@ jobs:
-DSDL_WERROR=ON \
-DSDL_TESTS=ON \
-DSDL_INSTALL_TESTS=ON \
+ -DSDL_VENDOR_INFO="Github Workflow" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=prefix
- name: Build
diff --git a/.github/workflows/riscos.yml b/.github/workflows/riscos.yml
index 7b1e435..1fec840 100644
--- a/.github/workflows/riscos.yml
+++ b/.github/workflows/riscos.yml
@@ -46,6 +46,7 @@ jobs:
-DSDL_GCC_ATOMICS=OFF \
-DSDL_TESTS=ON \
-DSDL_INSTALL_TESTS=ON \
+ -DSDL_VENDOR_INFO="Github Workflow" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/prefix_cmake
- name: Build (CMake)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a6d865b..cf86675 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -510,6 +510,7 @@ dep_option(SDL_HIDAPI_LIBUSB "Use libusb for low level joystick drivers" O
dep_option(SDL_HIDAPI_JOYSTICK "Use HIDAPI for low level joystick drivers" ON SDL_HIDAPI OFF)
dep_option(SDL_VIRTUAL_JOYSTICK "Enable the virtual-joystick driver" ON SDL_HIDAPI OFF)
set_option(SDL_ASAN "Use AddressSanitizer to detect memory errors" OFF)
+option_string(SDL_VENDOR_INFO "Vendor name and/or version to add to SDL_REVISION" "")
option(SDL_WERROR "Enable -Werror" OFF)
diff --git a/Makefile.in b/Makefile.in
index 1418a62..d4eeee4 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -32,6 +32,7 @@ RANLIB = @RANLIB@
RC = @RC@
LINKER = @LINKER@
LIBTOOLLINKERTAG = @LIBTOOLLINKERTAG@
+SDL_VENDOR_INFO = @SDL_VENDOR_INFO@
TARGET = libSDL2.la
OBJECTS = @OBJECTS@
@@ -152,7 +153,7 @@ $(objects)/.created:
touch $@
update-revision:
- $(SHELL) $(auxdir)/updaterev.sh
+ $(SHELL) $(auxdir)/updaterev.sh --vendor "$(SDL_VENDOR_INFO)"
.PHONY: all update-revision install install-bin install-hdrs install-lib install-data uninstall uninstall-bin uninstall-hdrs uninstall-lib uninstall-data clean distclean dist $(OBJECTS:.lo=.d)
@@ -252,6 +253,7 @@ dist $(distfile):
-name '.#*' \) \
-exec rm -f {} \;
if test -f $(distdir)/test/Makefile; then (cd $(distdir)/test && make distclean); fi
+ # Intentionally no vendor suffix: that's a property of the build, not the source
(cd $(distdir); $(srcdir)/build-scripts/updaterev.sh --dist)
tar cvf - $(distdir) | gzip --best >$(distfile)
rm -rf $(distdir)
diff --git a/build-scripts/updaterev.sh b/build-scripts/updaterev.sh
index a15784d..3ab034f 100755
--- a/build-scripts/updaterev.sh
+++ b/build-scripts/updaterev.sh
@@ -7,6 +7,7 @@ cd `dirname $0`
srcdir=..
header=$outdir/include/SDL_revision.h
dist=
+vendor=
while [ "$#" -gt 0 ]; do
case "$1" in
@@ -14,6 +15,10 @@ while [ "$#" -gt 0 ]; do
dist=yes
shift
;;
+ (--vendor)
+ vendor="$2"
+ shift 2
+ ;;
(*)
echo "$0: Unknown option: $1" >&2
exit 2
@@ -27,7 +32,14 @@ if [ "$rev" != "" ]; then
echo "$rev" > "$outdir/VERSION"
fi
echo "/* Generated by updaterev.sh, do not edit */" >"$header.new"
+ if [ -n "$vendor" ]; then
+ echo "#define SDL_VENDOR_INFO \"$vendor\"" >>"$header.new"
+ fi
+ echo "#ifdef SDL_VENDOR_INFO" >>"$header.new"
+ echo "#define SDL_REVISION \"SDL-$rev (\" SDL_VENDOR_INFO \")\"" >>"$header.new"
+ echo "#else" >>"$header.new"
echo "#define SDL_REVISION \"SDL-$rev\"" >>"$header.new"
+ echo "#endif" >>"$header.new"
echo "#define SDL_REVISION_NUMBER 0" >>"$header.new"
if diff $header $header.new >/dev/null 2>&1; then
rm "$header.new"
diff --git a/configure.ac b/configure.ac
index 6391bae..b520d21 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4684,6 +4684,12 @@ else
fi
AC_SUBST([INSTALL_SDL2_CONFIG], [$enable_sdl2_config])
+AC_ARG_ENABLE([vendor-info],
+ [AS_HELP_STRING([--enable-vendor-info=STRING], [Add vendor info to SDL_REVISION])],
+ [enable_vendor_info="$enableval"], [enable_vendor_info=])
+AS_IF([test "$enable_vendor_info" = no], [enable_vendor_info=])
+AC_SUBST([SDL_VENDOR_INFO], [$enable_vendor_info])
+
# Verify that we have all the platform specific files we need
if test x$have_audio != xyes; then
diff --git a/include/SDL_revision.h b/include/SDL_revision.h
index 3e9b63a..36691f5 100644
--- a/include/SDL_revision.h
+++ b/include/SDL_revision.h
@@ -1,2 +1,6 @@
+#ifdef SDL_VENDOR_INFO
+#define SDL_REVISION SDL_VENDOR_INFO
+#else
#define SDL_REVISION ""
+#endif
#define SDL_REVISION_NUMBER 0
diff --git a/include/SDL_revision.h.cmake b/include/SDL_revision.h.cmake
index dc12088..84e5f41 100644
--- a/include/SDL_revision.h.cmake
+++ b/include/SDL_revision.h.cmake
@@ -1,2 +1,8 @@
-#define SDL_REVISION "@SDL_REVISION@"
+#cmakedefine SDL_VENDOR_INFO "@SDL_VENDOR_INFO@"
#define SDL_REVISION_NUMBER 0
+
+#ifdef SDL_VENDOR_INFO
+#define SDL_REVISION "@SDL_REVISION@ (" SDL_VENDOR_INFO ")"
+#else
+#define SDL_REVISION "@SDL_REVISION@"
+#endif