add documentation, scons check for jpg support in sdl_image

It was reported on Dec 22 2014 in irc that the game is broken if
this is missing, and a search shows that bigmaps and many campaign
story screens use jpg images.

It makes more sense imo to document this as an official dependency
now, and if we decide to change everything to png's then we can go
back and disable the jpg check then.

Conflicts:
	SConstruct
This commit is contained in:
Chris Beck 2014-12-22 22:07:14 -05:00
parent a2d8752a5c
commit 45d7882fa7
3 changed files with 36 additions and 3 deletions

View file

@ -21,7 +21,7 @@ You'll need to have these libraries and their development headers to build Wesno
libfontconfig >= 2.4.1
libpango (with cairo backend) >= 1.21.3
libsdl >= 1.2.7
libsdl-image >= 1.2 (with png support)
libsdl-image >= 1.2 (with png and jpg support)
libsdl-mixer >= 1.2.12 (with Vorbis support)
vorbisfile
libsdl-net

View file

@ -357,7 +357,9 @@ if env["prereqs"]:
conf.CheckSDL("SDL_mixer", require_version = '1.2.12') and \
conf.CheckLib("vorbisfile") and \
conf.CheckSDL("SDL_image", require_version = '1.2.0') and \
conf.CheckOgg() or Warning("Client prerequisites are not met. wesnoth, cutter and exploder cannot be built.")
conf.CheckOgg() and \
conf.CheckPNG() and \
conf.CheckJPG() or Warning("Client prerequisites are not met. wesnoth, cutter and exploder cannot be built.")
have_X = False
if have_client_prereqs:

View file

@ -122,6 +122,37 @@ def CheckPNG(context):
context.Result("no")
return False
def CheckJPG(context):
test_program = '''
#include <SDL_image.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
SDL_RWops *src;
char *testimage = "data/core/images/maps/background.jpg";
src = SDL_RWFromFile(testimage, "rb");
if (src == NULL) {
exit(2);
}
exit(!IMG_isJPG(src));
}
\n
'''
context.Message("Checking for JPG support in SDL... ")
if context.env["host"]:
context.Result("n/a (cross-compile)")
return True
(result, output) = context.TryRun(test_program, ".c")
if result:
context.Result("yes")
return True
else:
context.Result("no")
return False
config_checks = { 'CheckSDL' : CheckSDL,
'CheckOgg' : CheckOgg,
'CheckPNG' : CheckPNG }
'CheckPNG' : CheckPNG,
'CheckJPG' : CheckJPG }