sdl-ttf: fix compilation when we never installed SDL on our system. the current buidl was relying on the sdl-config that doesn't exist.

Instead, generate a fake sdl.pc for pkg-config, and use it when compiling the SDL_ttf. closes #15
This commit is contained in:
Mathieu Virbel 2012-07-21 16:54:24 +02:00
parent b70106c280
commit f70b893790
4 changed files with 52 additions and 3 deletions

View file

@ -6,3 +6,22 @@ popd
cp src/SDL/Xcode-iOS/SDL/build/Release-iphoneos/libSDL.a $BUILDROOT/lib
cp -a src/SDL/include $BUILDROOT/include/SDL
cat>$BUILDROOT/pkgconfig/sdl.pc<<EOF
# sdl pkg-config source file
prefix=$BUILDROOT
exec_prefix=\${prefix}
libdir=\${exec_prefix}/lib
includedir=\${prefix}/include
Name: sdl
Description: Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer.
Version: 1.2.15
Requires:
Conflicts:
Libs: -L\${libdir} -lSDLmain -lSDL -Wl,-framework,Cocoa
Libs.private: \${libdir}/libSDLmain.a \${libdir}/libSDL.a -Wl,-framework,OpenGL -Wl,-framework,Cocoa -Wl,-framework,ApplicationServices -Wl,-framework,Carbon -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit -Wl,-framework,IOKit
Cflags: -I\${includedir}/SDL -D_GNU_SOURCE=1 -D_THREAD_SAFE
EOF

View file

@ -9,20 +9,25 @@ if [ ! -d $TMPROOT/SDL_ttf-$SDLTTF_VERSION ]; then
try rm -rf $TMPROOT/SDL_ttf-$SDLTTF_VERSION
try tar xzf $CACHEROOT/SDL_ttf-$SDLTTF_VERSION.tar.gz
try mv SDL_ttf-$SDLTTF_VERSION $TMPROOT
try pushd $TMPROOT/SDL_ttf-$SDLTTF_VERSION
try patch -p1 < $KIVYIOSROOT/tools/patches/SDL_ttf-colorkey.patch
popd
fi
if [ ! -f $TMPROOT/SDL_ttf-$SDLTTF_VERSION/.libs/libSDL_ttf.a ]; then
pushd $TMPROOT/SDL_ttf-$SDLTTF_VERSION
rm libSDL_ttf.la
./configure --prefix=/usr/local/iphone \
# generate a sdl.pc file that contain all the information of our generated SDL
try ./configure --prefix=/usr/local/iphone \
--host=arm-apple-darwin \
--enable-static=yes \
--enable-shared=no \
--without-x \
CC="$ARM_CC" AR="$ARM_AR" \
LDFLAGS="$ARM_LDFLAGS" CFLAGS="$ARM_CFLAGS"
make clean
make libSDL_ttf.la
try make clean
try make libSDL_ttf.la
popd
fi

View file

@ -35,6 +35,10 @@ export BUILDROOT="$KIVYIOSROOT/build"
export TMPROOT="$KIVYIOSROOT/tmp"
export CACHEROOT="$KIVYIOSROOT/.cache"
# pkg-config for SDL and futures
try mkdir -p $BUILDROOT/pkgconfig
export PKG_CONFIG_PATH="$BUILDROOT/pkgconfig:$PKG_CONFIG_PATH"
# some tools
export CCACHE=$(which ccache)

View file

@ -0,0 +1,21 @@
diff -Naur SDL_ttf-2.0.10/SDL_ttf.c SDL_ttf-2.0.10.orig/SDL_ttf.c
--- SDL_ttf-2.0.10.orig/SDL_ttf.c 2012-07-21 16:47:06.000000000 +0200
+++ SDL_ttf-2.0.10/SDL_ttf.c 2009-10-19 10:18:05.000000000 +0200
@@ -1336,7 +1336,7 @@
palette->colors[1].r = fg.r;
palette->colors[1].g = fg.g;
palette->colors[1].b = fg.b;
- SDL_SetColorKey( textbuf, SDL_SRCCOLORKEY, 0 );
+ SDL_SetColorKey( textbuf, SDL_TRUE, 0 );
/* check kerning */
use_kerning = FT_HAS_KERNING( font->face ) && font->kerning;
@@ -1461,7 +1461,7 @@
palette->colors[1].r = fg.r;
palette->colors[1].g = fg.g;
palette->colors[1].b = fg.b;
- SDL_SetColorKey(textbuf, SDL_SRCCOLORKEY, 0);
+ SDL_SetColorKey(textbuf, SDL_TRUE, 0);
/* Copy the character from the pixmap */
src = glyph->bitmap.buffer;