很早的时候交叉编译了gtk+directfb,并移植到ARM9开发板。下面是详细编译步骤
1.tslib-1.0
2.glib-2.12.13
3.atk-1.19.3
4.libjpeg-6b
5.zlib-1.2.3
6.libpng-1.2.19
7.expat-2.0.1
8.freetype-2.3.5
9.libxml2-2.6.29
10.fontconfig-2.4.2
11.tiff-3.7.4
12.DirectFB-1.1.1
13.cairo-1.4.10
14.pango-1.16.4
15.gtk+-2.10.14
首先执行cross.sh脚本
脚本内容:
#!/bin/sh
if [ ! -e "$ROOTFS_DIR/usr/local/include" ]; then sudo mkdir -p $ROOTFS_DIR/usr/local/include;fi;
if [ ! -e "$ROOTFS_DIR/usr/local/lib" ]; then sudo mkdir -p $ROOTFS_DIR/usr/local/lib; fi;
if [ ! -e "$ROOTFS_DIR/usr/local/etc" ]; then sudo mkdir -p $ROOTFS_DIR/usr/local/etc; fi;
if [ ! -e "$ROOTFS_DIR/usr/local/bin" ]; then sudo mkdir -p $ROOTFS_DIR/usr/local/bin; fi;
if [ ! -e "$ROOTFS_DIR/usr/local/share" ]; then sudo mkdir -p $ROOTFS_DIR/usr/local/share; fi;
if [ ! -e "$ROOTFS_DIR/usr/local/man" ]; then sudo mkdir -p $ROOTFS_DIR/usr/local/man; fi;
if [ ! -e "$ROOTFS_DIR/usr/include" ]; then sudo mkdir -p $ROOTFS_DIR/usr/include; fi;
if [ ! -e "$ROOTFS_DIR/usr/lib" ]; then sudo mkdir -p $ROOTFS_DIR/usr/lib; fi;
if [ ! -e "$ROOTFS_DIR/usr/etc" ]; then sudo mkdir -p $ROOTFS_DIR/usr/etc; fi;
if [ ! -e "$ROOTFS_DIR/usr/bin" ]; then sudo mkdir -p $ROOTFS_DIR/usr/bin; fi;
if [ ! -e "$ROOTFS_DIR/usr/share" ]; then sudo mkdir -p $ROOTFS_DIR/usr/share; fi;
if [ ! -e "$ROOTFS_DIR/usr/man" ]; then sudo mkdir -p $ROOTFS_DIR/usr/man; fi;
就是创建目录
这是文件夹对应的关系
WORK_DIR=/work/cross
ROOTFS_DIR=$WORK_DIR/rootfs
ARCH=arm
1.tslib
./autogen.sh
echo ac_cv_func_malloc_0_nonnull=yes>$ARCH-linux.cache
./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr --cache-file=$ARCH-linux.cache --enable-inputapi=no
2.glib
在giounix.c添加#include
[root@linux glib-2.8.0]# echo ac_cv_type_long_long=yes>$ARCH-linux.cache
[root@linux glib-2.8.0]# echo glib_cv_stack_grows=no>>$ARCH-linux.cache
[root@linux glib-2.8.0]# echo glib_cv_uscore=no>>$ARCH-linux.cache
[root@linux glib-2.8.0]# echo ac_cv_func_posix_getpwuid_r=yes>>$ARCH-linux.cache
[root@linux glib-2.8.0]# CC=arm-linux-gcc ./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr --cache-file=$ARCH-linux.cache
3.atk
./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr
4.libjpeg-6b
CC=arm-linux-gcc ./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr --enable-shared
5.zlib
CC=arm-linux-gcc ./configure --prefix=$ROOTFS_DIR/usr --shared
6.libpng
[root@linux libpng-1.2.8-config]# export LDFLAGS=-L$ROOTFS_DIR/usr/lib
[root@linux libpng-1.2.8-config]# export CFLAGS=-I$ROOTFS_DIR/usr/include
[root@linux libpng-1.2.8-config]# ./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr
7.expat
./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr
8.freetype
./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr
9.libxml2
在testModule.c添加
#define _MAX_PATH 256
#define PATH_MAX _MAX_PATH
./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr
10.fontconfig
export LDFLAGS=-L$ROOTFS_DIR/usr/lib
export CFLAGS=-I$ROOTFS_DIR/usr/include
export LIBXML2_CFLAGS=-I$ROOTFS_DIR/usr/include/libxml2
export LIBXML2_LIBS="-L$ROOTFS_DIR/usr/lib -lxml2"
./configure --host=$ARCH-linux --prefix=/$ROOTFS_DIR/usr --with-freetype-config=$ROOTFS_DIR/usr/bin/freetype-config --with-arch=arm
11.tiff
./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr --enable-shared
12.DirectFB
./configure -host=$ARCH-linux --prefix=$ROOTFS_DIR/usr --with-gfxdrivers=none --with-inputdrivers=all --enable-png --enable-jpeg --disable-tiff --enable-zlib --enable-sdl=no --enable-gif=no --disable-x11 --enable-freetype
13.cairo
./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr --without-x --disable-xlib --disable-xlib-xrender --enable-directfb --enable-freetype --disable-win32 --enable-pdf --enable-ps --disable-svg --enable-png
14.pango
#export LDFLAGS="-L$ROOTFS_DIR/usr/lib -Wl,-rpath=$ROOTFS_DIR/usr/lib"
#export CFLAGS=-I$ROOTFS_DIR/usr/include
#echo ac_cv_cairo_ft_scaled_font_lock_face=yes>arm-linux.cache
#echo ac_cv_lib_cairo_cairo_surface_write_to_png=yes>>arm-linux.cache
#echo ac_cv_path_FREETYPE_CONFIG=$ROOTFS_DIR/usr/bin/freetype-config>>arm-linux.cache
#echo ac_cv_have_x=no>>arm-linux.cache
#echo ac_cv_lib_freetype_FT_Get_Next_Char=yes>>arm-linux.cache
修改configure文件 与之前执行cairo的脚本configure参数是对应地,如果不对应,会出现can't link to pango的错误。
have_cairo=true
have_cairo_png=true
have_cairo_ps=true
have_cairo_pdf=true
have_cairo_freetype=true
export FREETYPE_CONFIG=$ROOTFS_DIR/usr/bin/freetype-config
./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr --enable-cairo --without-x
15.gtk+
export LDFLAGS="-L$ROOTFS_DIR/usr/lib -Wl,-rpath-link=$ROOTFS_DIR/usr/lib"
export CFLAGS=-I$ROOTFS_DIR/usr/include
export CPPFLAGS=-I$ROOTFS_DIR/usr/include
./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr --with-gdktarget=directfb --without-x
LDFLAGS中的-Wl,-rpath-link,$ROOTFS_DIR/usr/lib设定,解决了找不到pango的问题
设定了CPPFLAGS,解决了jpeglib.h找不到的问题,从而支持了jpeg
阅读(919) | 评论(0) | 转发(0) |