Fixed bug 5463 - generated Wayland interfaces are included in the library's ABI
Simon McVittie
In versions since 1.15, the `code` mode is a deprecated alias for
`public-code`, which emits symbols with default visibility, overriding
SDL's -fvisibility=hidden option.
Use the `private-code` mode instead. This emits symbols with hidden
visibility, so they do not affect the ABI of libSDL.
See also: https://bugreports.qt.io/browse/QTBUG-73099,
https://lists.freedesktop.org/archives/wayland-devel/2018-February/037097.html
diff --git a/Makefile.in b/Makefile.in
index 57871be..6d0b7e3 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -43,6 +43,7 @@
SDLTEST_OBJECTS = @SDLTEST_OBJECTS@
WAYLAND_SCANNER = @WAYLAND_SCANNER@
+WAYLAND_SCANNER_CODE_MODE = @WAYLAND_SCANNER_CODE_MODE@
INSTALL_SDL2_CONFIG = @INSTALL_SDL2_CONFIG@
diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake
index d08ad24..ea70774 100644
--- a/cmake/sdlchecks.cmake
+++ b/cmake/sdlchecks.cmake
@@ -564,7 +564,7 @@
endif()
endmacro()
-macro(WaylandProtocolGen _SCANNER _XML _PROTL)
+macro(WaylandProtocolGen _SCANNER _CODE_MODE _XML _PROTL)
set(_WAYLAND_PROT_C_CODE "${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols/${_PROTL}-protocol.c")
set(_WAYLAND_PROT_H_CODE "${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols/${_PROTL}-client-protocol.h")
@@ -579,7 +579,7 @@
OUTPUT "${_WAYLAND_PROT_C_CODE}"
DEPENDS "${_WAYLAND_PROT_H_CODE}"
COMMAND "${_SCANNER}"
- ARGS code "${_XML}" "${_WAYLAND_PROT_C_CODE}"
+ ARGS "${_CODE_MODE}" "${_XML}" "${_WAYLAND_PROT_C_CODE}"
)
set(SOURCE_FILES ${SOURCE_FILES} "${_WAYLAND_PROT_C_CODE}")
@@ -594,6 +594,7 @@
macro(CheckWayland)
if(VIDEO_WAYLAND)
pkg_check_modules(WAYLAND wayland-client wayland-scanner wayland-egl wayland-cursor egl xkbcommon)
+ pkg_check_modules(WAYLAND_SCANNER_1_15 "wayland-scanner>=1.15")
if(WAYLAND_FOUND)
execute_process(
@@ -610,6 +611,12 @@
endif()
if(WAYLAND_FOUND)
+ if(WAYLAND_SCANNER_1_15_FOUND)
+ set(WAYLAND_SCANNER_CODE_MODE "private-code")
+ else()
+ set(WAYLAND_SCANNER_CODE_MODE "code")
+ endif()
+
link_directories(
${WAYLAND_LIBRARY_DIRS}
)
@@ -629,7 +636,7 @@
file(GLOB WAYLAND_PROTOCOLS_XML RELATIVE "${SDL2_SOURCE_DIR}/wayland-protocols/" "${SDL2_SOURCE_DIR}/wayland-protocols/*.xml")
foreach(_XML ${WAYLAND_PROTOCOLS_XML})
string(REGEX REPLACE "\\.xml$" "" _PROTL "${_XML}")
- WaylandProtocolGen("${WAYLAND_SCANNER}" "${SDL2_SOURCE_DIR}/wayland-protocols/${_XML}" "${_PROTL}")
+ WaylandProtocolGen("${WAYLAND_SCANNER}" "${WAYLAND_SCANNER_CODE_MODE}" "${SDL2_SOURCE_DIR}/wayland-protocols/${_XML}" "${_PROTL}")
endforeach()
if(VIDEO_WAYLAND_QT_TOUCH)
diff --git a/configure b/configure
index a4dae08..39aaee0 100755
--- a/configure
+++ b/configure
@@ -630,6 +630,7 @@
#endif"
ac_subst_vars='LTLIBOBJS
+WAYLAND_SCANNER_CODE_MODE
WAYLAND_SCANNER
EXTRA_LDFLAGS
BUILD_LDFLAGS
@@ -19793,6 +19794,11 @@
WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor xkbcommon`
WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor xkbcommon`
WAYLAND_SCANNER=`$PKG_CONFIG --variable=wayland_scanner wayland-scanner`
+ if $PKG_CONFIG --exists 'wayland-scanner >= 1.15'; then :
+ WAYLAND_SCANNER_CODE_MODE=private-code
+else
+ WAYLAND_SCANNER_CODE_MODE=code
+fi
video_wayland=yes
fi
fi
@@ -22901,6 +22907,47 @@
fi
}
+CheckInputWSCONS()
+{
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenBSD wscons" >&5
+$as_echo_n "checking for OpenBSD wscons... " >&6; }
+ use_input_wscons=no
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ #include <sys/time.h>
+ #include <dev/wscons/wsconsio.h>
+ #include <dev/wscons/wsksymdef.h>
+ #include <dev/wscons/wsksymvar.h>
+ #include <sys/ioctl.h>
+
+int
+main ()
+{
+
+ struct wskbd_map_data data;
+ ioctl(0, WSKBDIO_GETMAP, &data);
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ use_input_wscons=yes
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $use_input_wscons" >&5
+$as_echo "$use_input_wscons" >&6; }
+ if test x$use_input_wscons = xyes; then
+
+$as_echo "#define SDL_INPUT_WSCONS 1" >>confdefs.h
+
+ SUMMARY_input="${SUMMARY_input} wscons"
+ fi
+}
+
CheckLibUDev()
{
# Check whether --enable-libudev was given.
@@ -24853,6 +24900,9 @@
freebsd)
CheckInputKBIO
;;
+ openbsd)
+ CheckInputWSCONS
+ ;;
esac
CheckUSBHID
CheckHIDAPI
@@ -25028,6 +25078,11 @@
SOURCES="$SOURCES $srcdir/src/core/linux/SDL_evdev_kbd.c"
SOURCES="$SOURCES $srcdir/src/core/freebsd/SDL_evdev_kbd_freebsd.c"
fi
+ # Set up files for wscons input
+ if test x$use_input_wscons = xyes; then
+ SOURCES="$SOURCES $srcdir/src/core/openbsd/SDL_wscons_kbd.c"
+ SOURCES="$SOURCES $srcdir/src/core/openbsd/SDL_wscons_mouse.c"
+ fi
# Set up other core UNIX files
SOURCES="$SOURCES $srcdir/src/core/linux/SDL_evdev_capabilities.c"
SOURCES="$SOURCES $srcdir/src/core/linux/SDL_threadprio.c"
@@ -25822,7 +25877,7 @@
echo ;\
printf '%s\n' "\\$(gen)/\$p-protocol.c: \\$(srcdir)/wayland-protocols/\$p.xml" ;\
printf '%s\n' " @\\$(SHELL) \\$(auxdir)/mkinstalldirs \\$(gen)" ;\
- printf '%s\n' " \\$(RUN_CMD_GEN)\\$(WAYLAND_SCANNER) code \\$< \\$@" ;\
+ printf '%s\n' " \\$(RUN_CMD_GEN)\\$(WAYLAND_SCANNER) \\$(WAYLAND_SCANNER_CODE_MODE) \\$< \\$@" ;\
echo ;\
printf '%s\n' "\\$(objects)/\$p-protocol.lo: \\$(gen)/\$p-protocol.c \\$(gen)/\$p-client-protocol.h" ;\
printf '%s\n' " \\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@" ;\
diff --git a/configure.ac b/configure.ac
index 898f446..cc2f064 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1539,6 +1539,9 @@
WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor xkbcommon`
WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor xkbcommon`
WAYLAND_SCANNER=`$PKG_CONFIG --variable=wayland_scanner wayland-scanner`
+ AS_IF([$PKG_CONFIG --exists 'wayland-scanner >= 1.15'],
+ [WAYLAND_SCANNER_CODE_MODE=private-code],
+ [WAYLAND_SCANNER_CODE_MODE=code])
video_wayland=yes
fi
fi
@@ -4381,7 +4384,7 @@
echo ;\
printf '%s\n' "\\$(gen)/\$p-protocol.c: \\$(srcdir)/wayland-protocols/\$p.xml" ;\
printf '%s\n' " @\\$(SHELL) \\$(auxdir)/mkinstalldirs \\$(gen)" ;\
- printf '%s\n' " \\$(RUN_CMD_GEN)\\$(WAYLAND_SCANNER) code \\$< \\$@" ;\
+ printf '%s\n' " \\$(RUN_CMD_GEN)\\$(WAYLAND_SCANNER) \\$(WAYLAND_SCANNER_CODE_MODE) \\$< \\$@" ;\
echo ;\
printf '%s\n' "\\$(objects)/\$p-protocol.lo: \\$(gen)/\$p-protocol.c \\$(gen)/\$p-client-protocol.h" ;\
printf '%s\n' " \\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@" ;\
@@ -4492,6 +4495,7 @@
AC_SUBST(BUILD_LDFLAGS)
AC_SUBST(EXTRA_LDFLAGS)
AC_SUBST(WAYLAND_SCANNER)
+AC_SUBST(WAYLAND_SCANNER_CODE_MODE)
cat >Makefile.rules <<__EOF__