changeset 733:6f7cdcfc3279

bugfix and test program for package sdl_image
author Volker Grabsch <vog@notjusthosting.com>
date Sun, 14 Feb 2010 19:33:14 +0100
parents 5703bf82e5b7
children 25087a6e47ed
files src/sdl_image-test.c src/sdl_image.mk
diffstat 2 files changed, 31 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/sdl_image-test.c	Sun Feb 14 19:33:14 2010 +0100
@@ -0,0 +1,22 @@
+/* This file is part of mingw-cross-env.       */
+/* See doc/index.html for further information. */
+
+#include <SDL.h>
+#include <SDL_image.h>
+
+int main(int argc, char* argv[])
+{
+    SDL_Surface *image;
+    SDL_Surface *screen;
+
+    (void)argc;
+    (void)argv;
+
+    if (SDL_Init(SDL_INIT_EVERYTHING) < 0) return 1;
+
+    image = IMG_Load("test.png");
+    screen = SDL_SetVideoMode(640, 480, 32, SDL_HWSURFACE);
+
+    SDL_Quit();
+    return 0;
+}
--- a/src/sdl_image.mk	Sun Feb 14 19:02:10 2010 +0100
+++ b/src/sdl_image.mk	Sun Feb 14 19:33:14 2010 +0100
@@ -20,6 +20,8 @@
 endef
 
 define $(PKG)_BUILD
+    $(SED) 's,^\(Requires:.*\),\1 libpng,' -i '$(1)/SDL_image.pc.in'
+    echo 'Libs.private: -ltiff -ljpeg -lz' >> '$(1)/SDL_image.pc.in'
     cd '$(1)' && ./configure \
         --host='$(TARGET)' \
         --disable-shared \
@@ -31,4 +33,11 @@
         --disable-tif-shared \
         LIBS='-lz'
     $(MAKE) -C '$(1)' -j '$(JOBS)' install bin_PROGRAMS= sbin_PROGRAMS= noinst_PROGRAMS=
+
+    '$(TARGET)-gcc' \
+        -W -Wall -Werror -ansi -pedantic \
+        `'$(TARGET)-pkg-config' SDL_image --cflags` \
+        '$(2).c' \
+        `'$(TARGET)-pkg-config' SDL_image --libs` \
+        -o '$(PREFIX)/$(TARGET)/bin/test-sdl_image.exe'
 endef