# Description: SDL-based DOS emulator for classic games
# URL: http://dosbox.sourceforge.net
# Maintainer: Tilman Sauerbeck, tilman at crux dot nu
# Arch Maintainer: CRUX-ARM System Team, devel at crux-arm dot nu
# Depends on: libsdl

name=dosbox
version=0.73
release=1
source=(http://dl.sourceforge.net/sourceforge/$name/$name-$version.tar.gz)

build() {
  cd $name-$version

  export DEFAULT_LIBS="-L$CLFS/usr/lib"
  export DEFAULT_CFLAGS="-I$CLFS/usr/include"
  export SDL_LIBS="$DEFAULT_LIBS -lSDL -lSDL_image -lpthread"
  export SDL_CFLAGS="$DEFAULT_CFLAGS -I$CLFS/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DHAVE_LIBSDL_IMAGE"
  
  sed -i configure \
      -e 's|SDL_VERSION=.*|SDL_VERSION=1.2.14|g' \
      -e "s|SDL_LIBS=.*|SDL_LIBS=\"$SDL_LIBS\"|" \
      -e "s|SDL_CFLAGS=.*|SDL_CFLAGS=\"$SDL_CFLAGS\"|"
  ./configure --build=$CHOST \
              --host=$CTARGET \
              --prefix=/usr \
              --mandir=/usr/man \
              --with-sdl-prefix=$CLFS/usr \
              --disable-sdltest \
              --disable-alsatest \
              --disable-dynamic-x86 \
              --disable-fpu-x86 \
	      --disable-debug

  make
  make DESTDIR=$PKG install
  rm -rf $PKG/usr/share

}