wayland: Build own version of core protocol

Since we are loading shared objects dynamically, build our own version of the
core protocol symbols, so that we in the future can include protocol
extensions.
This commit is contained in:
Jonas ?dahl 2016-06-23 18:39:05 +08:00
parent 736a624df0
commit 19d3500ae1
5 changed files with 89 additions and 7 deletions

View File

@ -8,6 +8,7 @@ Makefile
sdl-config sdl-config
SDL2.spec SDL2.spec
build build
gen
Build Build
# for Xcode # for Xcode

View File

@ -3,6 +3,7 @@
top_builddir = . top_builddir = .
srcdir = @srcdir@ srcdir = @srcdir@
objects = build objects = build
gen = gen
prefix = @prefix@ prefix = @prefix@
exec_prefix = @exec_prefix@ exec_prefix = @exec_prefix@
bindir = @bindir@ bindir = @bindir@
@ -31,6 +32,8 @@ WINDRES = @WINDRES@
TARGET = libSDL2.la TARGET = libSDL2.la
OBJECTS = @OBJECTS@ OBJECTS = @OBJECTS@
GEN_HEADERS = @GEN_HEADERS@
GEN_OBJECTS = @GEN_OBJECTS@
VERSION_OBJECTS = @VERSION_OBJECTS@ VERSION_OBJECTS = @VERSION_OBJECTS@
SDLMAIN_TARGET = libSDL2main.a SDLMAIN_TARGET = libSDL2main.a
@ -39,6 +42,8 @@ SDLMAIN_OBJECTS = @SDLMAIN_OBJECTS@
SDLTEST_TARGET = libSDL2_test.a SDLTEST_TARGET = libSDL2_test.a
SDLTEST_OBJECTS = @SDLTEST_OBJECTS@ SDLTEST_OBJECTS = @SDLTEST_OBJECTS@
WAYLAND_SCANNER = @WAYLAND_SCANNER@
SRC_DIST = *.txt acinclude Android.mk autogen.sh android-project build-scripts cmake cmake_uninstall.cmake.in configure configure.in debian docs include Makefile.* sdl2-config.cmake.in sdl2-config.in sdl2.m4 sdl2.pc.in SDL2.spec.in src test VisualC.html VisualC VisualC-WinRT Xcode Xcode-iOS SRC_DIST = *.txt acinclude Android.mk autogen.sh android-project build-scripts cmake cmake_uninstall.cmake.in configure configure.in debian docs include Makefile.* sdl2-config.cmake.in sdl2-config.in sdl2.m4 sdl2.pc.in SDL2.spec.in src test VisualC.html VisualC VisualC-WinRT Xcode Xcode-iOS
GEN_DIST = SDL2.spec GEN_DIST = SDL2.spec
@ -48,6 +53,7 @@ RUN_CMD_CC = @echo " CC " $@;
RUN_CMD_CXX = @echo " CXX " $@; RUN_CMD_CXX = @echo " CXX " $@;
RUN_CMD_LTLINK = @echo " LTLINK" $@; RUN_CMD_LTLINK = @echo " LTLINK" $@;
RUN_CMD_RANLIB = @echo " RANLIB" $@; RUN_CMD_RANLIB = @echo " RANLIB" $@;
RUN_CMD_GEN = @echo " GEN " $@;
LIBTOOL += --quiet LIBTOOL += --quiet
endif endif
@ -137,8 +143,8 @@ update-revision:
.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) .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)
$(objects)/$(TARGET): $(OBJECTS) $(VERSION_OBJECTS) $(objects)/$(TARGET): $(GEN_HEADERS) $(GEN_OBJECTS) $(OBJECTS) $(VERSION_OBJECTS)
$(RUN_CMD_LTLINK)$(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ $(OBJECTS) $(VERSION_OBJECTS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS) $(RUN_CMD_LTLINK)$(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ $(OBJECTS) $(GEN_OBJECTS) $(VERSION_OBJECTS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS)
$(objects)/$(SDLMAIN_TARGET): $(SDLMAIN_OBJECTS) $(objects)/$(SDLMAIN_TARGET): $(SDLMAIN_OBJECTS)
$(RUN_CMD_AR)$(AR) cru $@ $(SDLMAIN_OBJECTS) $(RUN_CMD_AR)$(AR) cru $@ $(SDLMAIN_OBJECTS)
@ -200,6 +206,7 @@ uninstall-data:
clean: clean:
rm -rf $(objects) rm -rf $(objects)
rm -rf $(gen)
if test -f test/Makefile; then (cd test; $(MAKE) $@); fi if test -f test/Makefile; then (cd test; $(MAKE) $@); fi
distclean: clean distclean: clean

42
configure vendored
View File

@ -630,6 +630,7 @@ ac_includes_default="\
#endif" #endif"
ac_subst_vars='LTLIBOBJS ac_subst_vars='LTLIBOBJS
WAYLAND_SCANNER
EXTRA_LDFLAGS EXTRA_LDFLAGS
BUILD_LDFLAGS BUILD_LDFLAGS
EXTRA_CFLAGS EXTRA_CFLAGS
@ -637,6 +638,8 @@ BUILD_CFLAGS
SDLTEST_OBJECTS SDLTEST_OBJECTS
SDLMAIN_OBJECTS SDLMAIN_OBJECTS
VERSION_OBJECTS VERSION_OBJECTS
GEN_OBJECTS
GEN_HEADERS
OBJECTS OBJECTS
INCLUDE INCLUDE
ac_aux_dir ac_aux_dir
@ -18804,9 +18807,11 @@ $as_echo_n "checking for Wayland support... " >&6; }
if test x$PKG_CONFIG != xno && \ if test x$PKG_CONFIG != xno && \
test x$video_opengl_egl = xyes && \ test x$video_opengl_egl = xyes && \
test x$video_opengles_v2 = xyes; then test x$video_opengles_v2 = xyes; then
if $PKG_CONFIG --exists wayland-client wayland-egl wayland-cursor egl xkbcommon ; then if $PKG_CONFIG --exists wayland-client wayland-scanner wayland-egl wayland-cursor egl xkbcommon ; then
WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor xkbcommon` 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_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor xkbcommon`
WAYLAND_SCANNER=`$PKG_CONFIG --variable=wayland_scanner wayland-scanner`
WAYLAND_CORE_PROTOCOL_DIR=`$PKG_CONFIG --variable=pkgdatadir wayland-client`
video_wayland=yes video_wayland=yes
fi fi
fi fi
@ -18823,7 +18828,7 @@ $as_echo "#define SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 1" >>confdefs.h
fi fi
SOURCES="$SOURCES $srcdir/src/video/wayland/*.c" SOURCES="$SOURCES $srcdir/src/video/wayland/*.c"
EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS" EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS -I\$(gen)"
# Check whether --enable-wayland-shared was given. # Check whether --enable-wayland-shared was given.
if test "${enable_wayland_shared+set}" = set; then : if test "${enable_wayland_shared+set}" = set; then :
enableval=$enable_wayland_shared; enableval=$enable_wayland_shared;
@ -23728,6 +23733,33 @@ if test x$SDLMAIN_SOURCES = x; then
fi fi
SDLTEST_SOURCES="$srcdir/src/test/*.c" SDLTEST_SOURCES="$srcdir/src/test/*.c"
if test x$video_wayland = xyes; then
WAYLAND_CORE_PROTOCOL_SOURCE='$(gen)/wayland-protocol.c'
WAYLAND_CORE_PROTOCOL_HEADER='$(gen)/wayland-client-protocol.h'
GEN_SOURCES="$GEN_SOURCES $WAYLAND_CORE_PROTOCOL_SOURCE"
GEN_HEADERS="$GEN_HEADERS $WAYLAND_CORE_PROTOCOL_HEADER"
WAYLAND_CORE_PROTOCOL_SOURCE_DEPENDS="
$WAYLAND_CORE_PROTOCOL_SOURCE: $WAYLAND_CORE_PROTOCOL_DIR/wayland.xml
\$(SHELL) \$(auxdir)/mkinstalldirs \$(gen)
\$(RUN_CMD_GEN)\$(WAYLAND_SCANNER) code \$< \$@"
WAYLAND_CORE_PROTOCOL_HEADER_DEPENDS="
$WAYLAND_CORE_PROTOCOL_HEADER: $WAYLAND_CORE_PROTOCOL_DIR/wayland.xml
\$(SHELL) \$(auxdir)/mkinstalldirs \$(gen)
\$(RUN_CMD_GEN)\$(WAYLAND_SCANNER) client-header \$< \$@"
WAYLAND_CORE_PROTOCOL_OBJECT="
\$(objects)/`echo $WAYLAND_CORE_PROTOCOL_SOURCE | sed 's/\$(gen)\/\(.*\).c$/\1.lo/'`: $WAYLAND_CORE_PROTOCOL_SOURCE
\$(RUN_CMD_CC)\$(LIBTOOL) --tag=CC --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \$< -o \$@"
WAYLAND_PROTOCOLS_DEPENDS="
$WAYLAND_CORE_PROTOCOL_SOURCE_DEPENDS
$WAYLAND_CORE_PROTOCOL_HEADER_DEPENDS
$WAYLAND_CORE_PROTOCOL_OBJECT
"
fi
OBJECTS=`echo $SOURCES` OBJECTS=`echo $SOURCES`
DEPENDS=`echo $SOURCES | tr ' ' '\n'` DEPENDS=`echo $SOURCES | tr ' ' '\n'`
for EXT in asm cc m c S; do for EXT in asm cc m c S; do
@ -23737,6 +23769,8 @@ for EXT in asm cc m c S; do
\\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"` \\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
done done
GEN_OBJECTS=`echo "$GEN_SOURCES" | sed 's,[^ ]*/\([^ ]*\)\.c,$(objects)/\1.lo,g'`
VERSION_OBJECTS=`echo $VERSION_SOURCES` VERSION_OBJECTS=`echo $VERSION_SOURCES`
VERSION_DEPENDS=`echo $VERSION_SOURCES` VERSION_DEPENDS=`echo $VERSION_SOURCES`
VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[^ ]*/\([^ ]*\)\.rc,$(objects)/\1.o,g'` VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[^ ]*/\([^ ]*\)\.rc,$(objects)/\1.o,g'`
@ -23838,6 +23872,9 @@ fi
cat >Makefile.rules <<__EOF__ cat >Makefile.rules <<__EOF__
# Build rules for objects # Build rules for objects
@ -23849,6 +23886,7 @@ $DEPENDS
$VERSION_DEPENDS $VERSION_DEPENDS
$SDLMAIN_DEPENDS $SDLMAIN_DEPENDS
$SDLTEST_DEPENDS $SDLTEST_DEPENDS
$WAYLAND_PROTOCOLS_DEPENDS
__EOF__ __EOF__
ac_config_files="$ac_config_files Makefile:Makefile.in:Makefile.rules sdl2-config sdl2-config.cmake SDL2.spec sdl2.pc" ac_config_files="$ac_config_files Makefile:Makefile.in:Makefile.rules sdl2-config sdl2-config.cmake SDL2.spec sdl2.pc"

View File

@ -1201,9 +1201,11 @@ AC_HELP_STRING([--enable-video-wayland-qt-touch], [QtWayland server support for
if test x$PKG_CONFIG != xno && \ if test x$PKG_CONFIG != xno && \
test x$video_opengl_egl = xyes && \ test x$video_opengl_egl = xyes && \
test x$video_opengles_v2 = xyes; then test x$video_opengles_v2 = xyes; then
if $PKG_CONFIG --exists wayland-client wayland-egl wayland-cursor egl xkbcommon ; then if $PKG_CONFIG --exists wayland-client wayland-scanner wayland-egl wayland-cursor egl xkbcommon ; then
WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor xkbcommon` 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_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor xkbcommon`
WAYLAND_SCANNER=`$PKG_CONFIG --variable=wayland_scanner wayland-scanner`
WAYLAND_CORE_PROTOCOL_DIR=`$PKG_CONFIG --variable=pkgdatadir wayland-client`
video_wayland=yes video_wayland=yes
fi fi
fi fi
@ -1215,7 +1217,7 @@ AC_HELP_STRING([--enable-video-wayland-qt-touch], [QtWayland server support for
AC_DEFINE(SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH, 1, [ ]) AC_DEFINE(SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH, 1, [ ])
fi fi
SOURCES="$SOURCES $srcdir/src/video/wayland/*.c" SOURCES="$SOURCES $srcdir/src/video/wayland/*.c"
EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS" EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS -I\$(gen)"
AC_ARG_ENABLE(wayland-shared, AC_ARG_ENABLE(wayland-shared,
AC_HELP_STRING([--enable-wayland-shared], [dynamically load Wayland support [[default=maybe]]]), AC_HELP_STRING([--enable-wayland-shared], [dynamically load Wayland support [[default=maybe]]]),
, enable_wayland_shared=maybe) , enable_wayland_shared=maybe)
@ -3481,6 +3483,33 @@ if test x$SDLMAIN_SOURCES = x; then
fi fi
SDLTEST_SOURCES="$srcdir/src/test/*.c" SDLTEST_SOURCES="$srcdir/src/test/*.c"
if test x$video_wayland = xyes; then
WAYLAND_CORE_PROTOCOL_SOURCE='$(gen)/wayland-protocol.c'
WAYLAND_CORE_PROTOCOL_HEADER='$(gen)/wayland-client-protocol.h'
GEN_SOURCES="$GEN_SOURCES $WAYLAND_CORE_PROTOCOL_SOURCE"
GEN_HEADERS="$GEN_HEADERS $WAYLAND_CORE_PROTOCOL_HEADER"
WAYLAND_CORE_PROTOCOL_SOURCE_DEPENDS="
$WAYLAND_CORE_PROTOCOL_SOURCE: $WAYLAND_CORE_PROTOCOL_DIR/wayland.xml
\$(SHELL) \$(auxdir)/mkinstalldirs \$(gen)
\$(RUN_CMD_GEN)\$(WAYLAND_SCANNER) code \$< \$@"
WAYLAND_CORE_PROTOCOL_HEADER_DEPENDS="
$WAYLAND_CORE_PROTOCOL_HEADER: $WAYLAND_CORE_PROTOCOL_DIR/wayland.xml
\$(SHELL) \$(auxdir)/mkinstalldirs \$(gen)
\$(RUN_CMD_GEN)\$(WAYLAND_SCANNER) client-header \$< \$@"
WAYLAND_CORE_PROTOCOL_OBJECT="
\$(objects)/`echo $WAYLAND_CORE_PROTOCOL_SOURCE | sed 's/\$(gen)\/\(.*\).c$/\1.lo/'`: $WAYLAND_CORE_PROTOCOL_SOURCE
\$(RUN_CMD_CC)\$(LIBTOOL) --tag=CC --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \$< -o \$@"
WAYLAND_PROTOCOLS_DEPENDS="
$WAYLAND_CORE_PROTOCOL_SOURCE_DEPENDS
$WAYLAND_CORE_PROTOCOL_HEADER_DEPENDS
$WAYLAND_CORE_PROTOCOL_OBJECT
"
fi
OBJECTS=`echo $SOURCES` OBJECTS=`echo $SOURCES`
DEPENDS=`echo $SOURCES | tr ' ' '\n'` DEPENDS=`echo $SOURCES | tr ' ' '\n'`
for EXT in asm cc m c S; do for EXT in asm cc m c S; do
@ -3490,6 +3519,8 @@ for EXT in asm cc m c S; do
\\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"` \\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
done done
GEN_OBJECTS=`echo "$GEN_SOURCES" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
VERSION_OBJECTS=`echo $VERSION_SOURCES` VERSION_OBJECTS=`echo $VERSION_SOURCES`
VERSION_DEPENDS=`echo $VERSION_SOURCES` VERSION_DEPENDS=`echo $VERSION_SOURCES`
VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'` VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
@ -3567,6 +3598,8 @@ dnl Expand the sources and objects needed to build the library
AC_SUBST(ac_aux_dir) AC_SUBST(ac_aux_dir)
AC_SUBST(INCLUDE) AC_SUBST(INCLUDE)
AC_SUBST(OBJECTS) AC_SUBST(OBJECTS)
AC_SUBST(GEN_HEADERS)
AC_SUBST(GEN_OBJECTS)
AC_SUBST(VERSION_OBJECTS) AC_SUBST(VERSION_OBJECTS)
AC_SUBST(SDLMAIN_OBJECTS) AC_SUBST(SDLMAIN_OBJECTS)
AC_SUBST(SDLTEST_OBJECTS) AC_SUBST(SDLTEST_OBJECTS)
@ -3575,6 +3608,7 @@ AC_SUBST(EXTRA_CFLAGS)
AC_SUBST(BUILD_LDFLAGS) AC_SUBST(BUILD_LDFLAGS)
AC_SUBST(EXTRA_LDFLAGS) AC_SUBST(EXTRA_LDFLAGS)
AC_SUBST(WINDRES) AC_SUBST(WINDRES)
AC_SUBST(WAYLAND_SCANNER)
cat >Makefile.rules <<__EOF__ cat >Makefile.rules <<__EOF__
@ -3587,6 +3621,7 @@ $DEPENDS
$VERSION_DEPENDS $VERSION_DEPENDS
$SDLMAIN_DEPENDS $SDLMAIN_DEPENDS
$SDLTEST_DEPENDS $SDLTEST_DEPENDS
$WAYLAND_PROTOCOLS_DEPENDS
__EOF__ __EOF__
AC_CONFIG_FILES([ AC_CONFIG_FILES([

View File

@ -94,7 +94,8 @@ void SDL_WAYLAND_UnloadSymbols(void);
#endif /* SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC */ #endif /* SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC */
#include "wayland-client.h" #include "wayland-client-core.h"
#include "wayland-client-protocol.h"
#include "wayland-egl.h" #include "wayland-egl.h"
#endif /* !defined _SDL_waylanddyn_h */ #endif /* !defined _SDL_waylanddyn_h */