SDL支持库的移植参见.我的博客文章.<
http://blog.chinaunix.net/u3/105675/showart_2195157.html
|
- --enable-input-tslib #支持tslib 触摸屏
- --disable-x11 --enable-video-fbcon #关闭X11支持,打开framebuffer LCD输出
- --disable-alsa #音频使用oss,如果使用--enable-alsa,必须先编译alsa-libs
- --host=arm-linux #使用arm-linux-gcc编译工具.
- --prefix=$PWD/../../output/arm_linux #SDL安装目录
- --disable-joystick #去掉游戏杠支持
- CPPFLAGS,LDFLAGS主要是为 --enable-input-tslib准备。否则在依赖文件里(.libs/libSDL.lai)会采用 dependency_libs=' -lm /usr/local/lib/libts.la -ldl -lpthread'这样在ARM版明显错误。如果对触摸屏输入不敏感,可以直接 --disable-input-tslib
- 而-liconv因为在扫描目录也有libiconv,这样自动加入依赖。以免编译其它SDL依赖库出错。
执行如下的configure 脚本生成Makefile
NM=arm-linux-nm LD=arm-linux-ld CC=arm-linux-gcc CXX=arm-linux-g++ AR=arm-linux-ar ./configure --host=arm-linux --prefix=$PWD/../../../output/arm_linux |
testgl,testjoystick的编译.
CFLAGS = -g -O2 -I/usr/local/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -I/usr/include -DHAVE_OPENGL LIBS = -L/usr/local/lib -Wl,-rpath,/usr/local/lib -lSDL -lpthread -liconv |
SDL_DIR = /home/hxy/common_lib/arm-linux CFLAGS = -g -O2 -I$(SDL_DIR)/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT LIBS = -L$(SDL_DIR)/lib -lSDL -lpthread |
|
3.SDL_image移植
- 下载:http://www.libsdl.org/projects/SDL_image/release/SDL_image-1.2.10.tar.gz
- 解压 tar xvzf SDL_image-1.2.8.tar.gz
- cd SDL_image-1.2.8
- 生成 configure ,执行 ./autogen.sh
- 生成Makefile
./configure --enable-shared --enable-static --host=arm-linux --prefix=$PWD/../../output/arm-linux --enable-bmp --enable-gif --enable-jpg --enable-png --enable-tif --enable-pnm --enable-xpm --disable-sdltest SDL_CFLAGS="-I$PWD/../../output/arm-linux/include/SDL" SDL_LIBS="-L$PWD/../../output/arm-linux/lib -lSDL" LIBPNG_CFLAGS="-I$PWD/../../output/arm-linux/include" LIBPNG_LIBS="-L$PWD/../../output/arm-linux/lib -lpng" CPPFLAGS="-I$PWD/../../output/arm-linux/include" LDFLAGS="-L$PWD/../../output/arm-linux/lib -ltiff -ljpeg -lts -liconv" |
注意这里提示报错
configure: error: in `/home/huisen/libs/SDL_image-1.2.8': configure: error: C compiler cannot create executables |
最大可能性中间某一些库没有移植,比如libtiff,要先移植好库再使用SDL_image
实测发布发现libtiff还是尺寸较大。因此可以用如下语句取消对tiff的支持
./configure --enable-shared --enable-static --host=arm-linux --prefix=$PWD/../../output/arm-linux --enable-bmp --enable-gif --enable-jpg --enable-png --disable-tif --enable-pnm --enable-xpm --disable-sdltest SDL_CFLAGS="-I$PWD/../../output/arm-linux/include/SDL" SDL_LIBS="-L$PWD/../../output/arm-linux/lib -lSDL" LIBPNG_CFLAGS="-I$PWD/../../output/arm-linux/include" LIBPNG_LIBS="-L$PWD/../../output/arm-linux/lib -lpng" CPPFLAGS="-I$PWD/../../output/arm-linux/include" LDFLAGS="-L$PWD/../../output/arm-linux/lib -ljpeg -lts -liconv" |
编译 make
- 主页 http://www.libsdl.org/projects/SDL_ttf/
- 解压 tar xvzf SDL_ttf-2.0.9.tar.gz
cd SDL_ttf-2.0.9
生成Makefile
./configure --host=arm-linux --prefix=$PWD/../../output/arm-linux --enable-shared --enable-static --disable-sdltest --with-freetype-prefix=$PWD/../../output/arm-linux/ --with-sdl-prefix=$PWD/../../output/arm-linux/ CFLAG="-I$PWD/../../output/arm-linux/include" LDFLAGS="-L$PWD/../../output/arm-linux/lib -lSDL -lts -liconv -lfreetype" |
- 修改Makefile,把语句当中的去掉opengl支持(这可能是这一版的BUG)
这一句改成 GL_LIBS =
这一句修改成 glfont_LDADD = libSDL_ttf.la -lm
- 修改源码
cd SDL_mixer-1.2.9
./configure --enable-music-mp3-mad-gpl --enable-music-mp3=no --host=arm-linux --prefix=$PWD/../../output/arm-linux --with-sdl-prefix=$PWD/../../output/arm-linux --enable-shared --enable-static |
生成Makefile
./autogen.sh ./configure --host=arm-linux --prefix=$PWD/../../output/arm-linux --with-sdl-prefix=$PWD/../../output/arm-linux --enable-shared --enable-static --enable-SDL_ttf |
cd SDL_gfx-2.0.20
生成Makefile
./configure --host=arm-linux --prefix=$PWD/../../output/arm-linux --with-sdl-prefix=$PWD/../../output/arm-linux --enable-shared --enable-static --enable-mmx=no |