libsdl: config tweaks, remove sdlmain lib

This patch contains changes to the libSDL port that were needed to build
the Hatari emulator using cmake.

- Since SDL programs cannot use the posix library (because sdl's init
  function needs a way to get hold of the Genode env), the sdl_main
  library must be used instead of the posix library. The sdl_main
  code implements the Libc::Component::construct function for the
  final binary. However, 3rd-party build systems are not aware of this
  Genode-specific peculiarity and thereby create binaries that leave
  libsdl uninitialized. This patch adds the sdl_main to libsdl by
  default and thereby eliminates the need for specifying the extra
  sdl_main library. Customizing the Libc::Component::construct is
  still possible by overriding the library-provided implementation
  in the main program.

- A few missing config definitions are added to compile Hatari
  successfully.

- Avoid reliance on the include/SDL convention in SDL_config.h

- Cmake relies on the upper-case naming of the library with no way
  to tweak this convention. So we install an symlink named `SDL.lib.so`
  when installing the library into the <build-dir>/bin/ directory.

Fixes #161
This commit is contained in:
Norman Feske
2019-05-14 10:44:33 +02:00
parent 5c353771ba
commit c070e64bd4
21 changed files with 31 additions and 30 deletions

View File

@@ -81,6 +81,8 @@ SRC_C += cdrom/SDL_cdrom.c \
cdrom/dummy/SDL_syscdrom.c
INC_DIR += $(SDL_DIR)/src/cdrom
SRC_CC += sdl_main.cc
# we need libc
LIBS = libc mesa_api
@@ -90,3 +92,9 @@ vpath % $(REP_DIR)/src/lib/sdl
vpath % $(SDL_DIR)/src
CC_CXX_WARN_STRICT =
$(INSTALL_DIR)/sdl.lib.so: $(INSTALL_DIR)/SDL.lib.so
$(INSTALL_DIR)/SDL.lib.so:
$(VERBOSE)ln -sf sdl.lib.so $@

View File

@@ -1,7 +0,0 @@
SRC_CC = sdl_main.cc
LIBS += libc
vpath sdl_main.cc $(REP_DIR)/src/lib/sdl
CC_CXX_WARN_STRICT =

View File

@@ -1,3 +1,4 @@
_ZN4Libc9Component9constructERNS_3EnvE T
SDL_AddTimer T
SDL_AllocBlitMap T
SDL_AllocFormat T