#!/bin/sh
#--enable-malloc0returnsnull 加了此项就不用去改configure, 相当于
#vi configure to find "cannot run test program while cross compiling"
#modify { (exit 1); exit 1; }; } to { (echo 1); echo 1; }; }
#编译环境: ubuntu 8.04 LTS / cross compile=arm-linux-3.4.2
#/xroot /xroot/build
#部分源码下载位置
#
#ftp://ftp.tw.freebsd.org/pub/ FreeBSD/distfiles/xorg/
#git clone git://git.freedesktop.org/git/xorg/proto/calibrateproto.git
#git clone git://git.freedesktop.org/git/xorg/lib/libXCalibrate.git
#
#补丁下载至 download pinky-3.1.1
#在pinky-3.1.1/meta/packages patch可用
#svn co poky 其中也有部分的patch可用
#step 1: Cross环境设定
export XROOT=/xroot
export PREFIX=$XROOT
#export LD_LIBRARY_PATH=$PREFIX/lib
export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
export HOST=arm-linux
export BUILD=i686-linux
export CC=arm-linux-gcc
export CXX=arm-linux-g++
export AR=arm-linux-ar
export RANLIB=arm-linux-ranlib
export NM=arm-linux-nm
export AS=arm-linux-as
export LD=arm-linux-ld
export STRIP=arm-linux-strip
export READELF=arm-linux-readelf
export STRINGS=arm-linux-strings
export SIZE=arm-linux-size
export ADDR2LINE=arm-linux-addr2line
#libXi 移植
1. libXi-1.1.2.tar.bz2
./configure --host=$HOST --build=$BUILD --prefix=$PREFIX --enable-static=yes --enable-shared=yes --enable-malloc0returnsnull
make -j 2 install;
#Cairo + Pango移植
1. expat-2.0.0
./configure --host=$HOST --build=$BUILD --prefix=$PREFIX --enable-static=yes --enable-shared=yes --enable-malloc0returnsnull
make -j 2 install;
2. fontconfig-2.4.2
#把configure文件中最后一个 ac_config_files= 的地方后加入
#LDFLAGS+="-L${PREFIX}/lib -lfreetype -lxml2"
#DEFAULT_INCLUDES+="-I${PREFIX}/include -I${PREFIX}/include/freetype2
-I${PREFIX}/include/freetype2/freetype
-I${PREFIX}/include/freetype2/freetype/config"
ARCH=arm
LD_LIBRARY_PATH=$PREFIX/lib
./configure --host=$HOST --build=$BUILD --prefix=$PREFIX
--enable-static=yes --enable-shared=yes --enable-malloc0returnsnull
--with-freetype-config=$PREFIX/bin/freetype-config --with-arch=$ARCH
--enable-libxml2 --disable-docs
--with-default-fonts=${PREFIX}/lib/X11/fonts
--with-cache-dir=${PREFIX}/fonts/var/cache/fontconfig
--with-confdir=${PREFIX}/fonts
make -j 2 install;
LD_LIBRARY_PATH=
3. jpeg-6b
CC=
AR=
patch -Np1 -i ../pinky-3.1.1/meta/packages/jpeg/jpeg-6b/ldflags.patch
./ltconfig --disable-static --no-verify ltmain.sh linux
./configure --host=$HOST --build=$BUILD --prefix=$PREFIX --enable-static=yes --enable-shared=yes --enable-malloc0returnsnull
#修改Makefile 把gcc 换成arm-linux-gcc ; AR= ar rc 换成AR= arm-linux-ar rc
export CC=arm-linux-gcc
export AR=arm-linux-ar
make -j 2 install; make install-lib; make install-headers
4. libpng-1.2.33
#把configure文件中最后一个 ac_config_files= 的地方后加入
#LDFLAGS+="-L${PREFIX}/lib -lfreetype -lxml2"
#DEFAULT_INCLUDES+="-I${PREFIX}/include -I${PREFIX}/include/freetype2"
LD_LIBRARY_PATH=$PREFIX/lib
ac_cv_lib_z_zlibVersion=yes
./configure --host=$HOST --build=$BUILD --prefix=$PREFIX --enable-static=yes --enable-shared=yes
make -j 2 install;
LD_LIBRARY_PATH=
5. libICE-1.0.4
./configure --host=$HOST --build=$BUILD --prefix=$PREFIX --enable-static=yes --enable-shared=yes --enable-malloc0returnsnull
make -j 2 install;
6. libSM-1.0.3
./configure --host=$HOST --build=$BUILD --prefix=$PREFIX --enable-static=yes --enable-shared=yes --enable-malloc0returnsnull
make -j 2 install;
7. cairo-1.4.14
#vi configure 加以下3行
# ac_cv_lib_z_compress=yes
# ac_header_compiler=yes
# ac_header_preproc=yes
#找 unset cairo_cv_backend_xcb_use 下面加
# cairo_cv_backend_xcb_use=yes
#找 unset cairo_cv_backend_pdf_use 下面加
# cairo_cv_backend_pdf_use=yes
#找 unset cairo_cv_backend_ps_use 下面加
# cairo_cv_backend_ps_use=yes
ac_cv_header_zlib_h=yes
./configure --host=$HOST --build=$BUILD --prefix=$PREFIX
--enable-static=yes --enable-shared=yes --enable-malloc0returnsnull
--disable-some-floating-point
make -j 2 install;
8. libXft-2.1.12
./configure --host=$HOST --build=$BUILD --prefix=$PREFIX --enable-static=yes --enable-shared=yes --enable-malloc0returnsnull
make -j 2 install;
9. glib-2.19.2
echo "ac_cv_type_long_long=yes" > arm.cache
echo "glib_cv_stack_grows=no" >> arm.cache
echo "glib_cv_uscore=no" >> arm.cache
echo "ac_cv_func_posix_getpwuid_r=no" >> arm.cache
echo "ac_cv_func_posix_getgrgid_r=yes" >> arm.cache
#vi glib/giounix.c, 添加 #include
./configure --host=$HOST --build=$BUILD --prefix=$PREFIX
--enable-static=yes --enable-shared=yes --cache-file=arm.cache
--enable-debug=no --disable-mem-pools
make -j 2 install;
10.pango-1.18.3
patch -Np1 -i ../pinky-3.1.1/meta/packages/pango/pango-1.18.3/no-tests.patch
#修改 configure: 找到以下定义并修改
# have_cairo=true
# have_cairo_png=true
# have_cairo_ps=true
# have_cairo_pdf=true
# have_cairo_xlib=true
# have_cairo_freetype=true
# have_cairo_win32=false
# have_cairo_atsui=false
# 把所有的LIBS="-lxxxx $LIBS" 改成 LIBS="-L${PREFIX}/lib -lxxxx $LIBS" # xxxx 代表 freetype X11 cairo ICE
#修改 configure: 在头部加入
# ac_cv_lib_cairo_cairo_surface_write_to_png=yes
# ac_cv_lib_cairo_cairo_ps_surface_create=yes
# ac_cv_lib_cairo_cairo_pdf_surface_create=yes
# ac_cv_lib_cairo_cairo_xlib_surface_create=yes
# ac_cv_lib_cairo_cairo_ft_scaled_font_lock_face=yes
#把configure文件中最后一个 ac_config_files= 的地方后加入
#LDFLAGS+="-L${PREFIX}/lib -lfreetype"
#DEFAULT_INCLUDES+="-I${PREFIX}/include -I${PREFIX}/include/freetype2"
CAIRO_CFLAGS=`pkg-config --cflags cairo`
CAIRO_LIBS=`pkg-config --libs cairo`
GLIB_CFLAGS=`pkg-config --cflags glib-2.0`
GLIB_LIBS=`pkg-config --libs glib-2.0`
XFT_CFLAGS=`pkg-config --cflags xft`
XFT_LIBS=`pkg-config --libs xft`
FONTCONFIG_CFLAGS=`pkg-config --cflags fontconfig`
FONTCONFIG_LIBS=`pkg-config --libs fontconfig`
FREETYPE_CONFIG=${PREFIX}/bin/free-config
FREETYPE_CFLAGS=`pkg-config --cflags freetype2`
FREETYPE_LIBS=`pkg-config --libs freetype2`
X_CFLAGS=`pkg-config --cflags x11`
X_LIBS=`pkg-config --libs x11`
X_EXTRA_LIBS="-L${PREFIX}/lib -lpng12 -lexpat -lXext -lxml2 -lX11 -lXft -lXrender"
X_PRE_LIBS="-L${PREFIX}/lib -lSM -lICE"
./configure --host=$HOST --build=$BUILD --prefix=$PREFIX
--enable-static=yes --enable-shared=yes --with-x
--x-includes=$PREFIX/include --x-libraries=$PREFIX/lib
--enable-explicit-deps=no --disable-glibtest --disable-debug
#确保 配置完成后出现 backends: FreeType X Xft Cairo
make -j 2 install;
11.libXinerama-1.0.2
./configure --host=$HOST --build=$BUILD --prefix=$PREFIX --enable-static=yes --enable-shared=yes --enable-malloc0returnsnull
make -j 2 install;
12.libXfixes-4.0.3
./configure --host=$HOST --build=$BUILD --prefix=$PREFIX --enable-static=yes --enable-shared=yes --enable-malloc0returnsnull
make -j 2 install;
13.libgpg-error-1.0
patch -Np1 -i ../pinky-3.1.1/meta/packages/libgpg-error/libgpg-error-1.0/pkgconfig.patch
./configure --host=$HOST --build=$BUILD --prefix=$PREFIX --enable-static=yes --enable-shared=yes --enable-malloc0returnsnull
make -j 2 install;
14.libgcrypt-1.2.3
./configure --host=$HOST --build=$BUILD --prefix=$PREFIX
--enable-static=yes --enable-shared=yes --enable-malloc0returnsnull
--with-gpg-error-prefix=$PREFIX
#修改line:127: 改为 LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
# $(AM_LDFLAGS) $(LDFLAGS) -L${PREFIX}/lib -lgpg-error -o $@
make -j 2 install;
15.libXcomposite-0.4.0
patch -Np1 -i ../pinky-3.1.1/meta/packages/xorg-lib/libxcomposite/change-include-order.patch
./configure --host=$HOST --build=$BUILD --prefix=$PREFIX --enable-static=yes --enable-shared=yes --enable-malloc0returnsnull
make -j 2 install;
16.atk-1.20.0
./configure --host=$HOST --build=$BUILD --prefix=$PREFIX
--enable-static=yes --enable-shared=yes --enable-malloc0returnsnull
--disable-glibtest
make -j 2 install;
17.libXcursor-X11R7.2-1.1.8
./configure --host=$HOST --build=$BUILD --prefix=$PREFIX
--enable-static=yes --enable-shared=yes --enable-malloc0returnsnull
--disable-glibtest
make -j 2 install;
18.libXdamage-1.1.1
./configure --host=$HOST --build=$BUILD --prefix=$PREFIX
--enable-static=yes --enable-shared=yes --enable-malloc0returnsnull
make -j 2 install;
19. gtk+-2.12.7
patch -Np1 -i ../pinky-3.1.1/meta/packages/gtk+/gtk+-2.12.7/xsettings.patch
patch -Np1 -i ../pinky-3.1.1/meta/packages/gtk+/gtk+-2.12.7/run-iconcache.patch
patch -Np1 -i ../pinky-3.1.1/meta/packages/gtk+/gtk+-2.12.7/disable-print.patch
patch -Np1 -i ../pinky-3.1.1/meta/packages/gtk+/gtk+-2.12.7/hardcoded_libtool.patch
patch -Np1 -i ../pinky-3.1.1/meta/packages/gtk+/gtk+-2.12.7/no-demos.patch
patch -Np1 -i ../pinky-3.1.1/meta/packages/gtk+/gtk+-2.12.7/filesystem-volumes.patch
patch -Np1 -i ../pinky-3.1.1/meta/packages/gtk+/gtk+-2.12.7/filechooser-props.patch
patch -Np1 -i ../pinky-3.1.1/meta/packages/gtk+/gtk+-2.12.7/filechooser-default.patch
patch -Np1 -i ../pinky-3.1.1/meta/packages/gtk+/gtk+-2.12.7/filechooser-sizefix.patch
cd gtk
patch -Np1 -i ../../pinky-3.1.1/meta/packages/gtk+/gtk+-2.12.7/cellrenderer-cairo.patch
patch -Np1 -i ../../pinky-3.1.1/meta/packages/gtk+/gtk+-2.12.7/entry-cairo.patch
patch -Np1 -i ../../pinky-3.1.1/meta/packages/gtk+/gtk+-2.12.7/toggle-font.diff
cd gdk/x11
patch -Np1 -i ../../../pinky-3.1.1/meta/packages/gtk+/gtk+-2.12.7/scrolled-placement.patch
#修改 configure 添加
#ac_cv_lib_jpeg_jpeg_destroy_decompress=yes
#ac_cv_func_XOpenDisplay=yes
#ac_cv_func_XextFindDisplay=yes
#ac_cv_lib_jpeg_jpeg_simple_progression=yes
#ac_cv_func_XRenderQueryExtension=yes
#把configure文件中最后一个 ac_config_files= 的地方后加入
#LDFLAGS+="-L${PREFIX}/lib -lfreetype -lpangocairo-1.0 -lpango-1.0
-lcairo -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lpng12 -lXdmcp -lXau"
#DEFAULT_INCLUDES+="-I${PREFIX}/include -I${PREFIX}/include/freetype2"
#查找 Can't link to Pango , 把下面的{ (exit 1); exit 1; }; } 为 { (echo 1); echo 1; }; }
# 把所有的LIBS="-lxxxx $LIBS" 改成 LIBS="-L${PREFIX}/lib -lxxxx $LIBS" # xxxx 代表 freetype X11 cairo ICE
CAIRO_CFLAGS=`pkg-config --cflags cairo`
CAIRO_LIBS=`pkg-config --libs cairo`
GLIB_CFLAGS=`pkg-config --cflags glib-2.0`
GLIB_LIBS=`pkg-config --libs glib-2.0`
XFT_CFLAGS=`pkg-config --cflags xft`
XFT_LIBS=`pkg-config --libs xft`
FONTCONFIG_CFLAGS=`pkg-config --cflags fontconfig`
FONTCONFIG_LIBS=`pkg-config --libs fontconfig`
FREETYPE_CONFIG=${PREFIX}/bin/free-config
FREETYPE_CFLAGS=`pkg-config --cflags freetype2`
FREETYPE_LIBS=`pkg-config --libs freetype2`
X_CFLAGS=`pkg-config --cflags x11`
X_LIBS=`pkg-config --libs x11`
PANGO_CFLAGS=`pkg-config --cflags pango`
PANGO_LIBS=`pkg-config --libs pango`
ATK_CFLAGS=`pkg-config --cflags atk`
ATK_LIBS=`pkg-config --libs atk`
FONTENC_CFLAGS=`pkg-config --cflags fontenc`
FONTENC_LIBS=`pkg-config --libs fontenc`
GIO_CFLAGS=`pkg-config --cflags gio-2.0`
GIO_LIBS=`pkg-config --libs gio-2.0`
GMODULE_CFLAGS=`pkg-config --cflags gmodule-2.0`
GMODULE_LIBS=`pkg-config --libs gmodule-2.0`
ICE_CFLAGS=`pkg-config --cflags ice`
ICE_LIBS=`pkg-config --libs ice`
PNG_CFLAGS=`pkg-config --cflags libpng12`
PNG_LIBS=`pkg-config --libs libpng12`
TSLIB_CFLAGS=`pkg-config --cflags tslib-1.0`
TSLIB_LIBS=`pkg-config --libs tslib-1.0`
XAU_CFLAGS=`pkg-config --cflags xau`
XAU_LIBS=`pkg-config --libs xau`
XCALIBRATE_CFLAGS=`pkg-config --cflags xcalibrate`
XCALIBRATE_LIBS=`pkg-config --libs xcalibrate`
XCOMPOSITE_CFLAGS=`pkg-config --cflags xcomposite`
XCOMPOSITE_LIBS=`pkg-config --libs xcomposite`
XEXT_CFLAGS=`pkg-config --cflags xext`
XEXT_LIBS=`pkg-config --libs xext`
XRANDR_CFLAGS=`pkg-config --cflags xrandr`
XRANDR_LIBS=`pkg-config --libs xrandr`
XRENDER_CFLAGS=`pkg-config --cflags xrender`
XRENDER_LIBS=`pkg-config --libs xrender`
XTRANS_CFLAGS=`pkg-config --cflags xtrans`
XTRANS_LIBS=`pkg-config --libs xtrans`
XORG_CFLAGS=`pkg-config --cflags xorg-server`
XORG_LIBS=`pkg-config --libs xorg-server`
XML_CFLAGS=`pkg-config --cflags xml-2.0`
XML_LIBS=`pkg-config --libs xml-2.0`
INCROOT=$PREFIX/include
USRLIBDIR=$PREFIX/lib
LIBDIR=$PREFIX/lib
BASE_DEPENDENCIES_CFLAGS="${CAIRO_CFLAGS} ${GLIB_CFLAGS} ${XFT_CFLAGS}
${FONTCONFIG_CFLAGS} ${FREETYPE_CFLAGS} ${X_CFLAGS} ${PANGO_CFLAGS}
${ATK_CFLAGS} ${FONTENC_CFLAGS} ${GIO_CFLAGS} ${GMODULE_CFLAGS}
${ICE_CFLAGS} ${PNG_CFLAGS} ${TSLIB_CFLAGS} ${XAU_CFLAGS}
${XCALIBRATE_CFLAGS} ${XCOMPOSITE_CFLAGS} ${XEXT_CFLAGS}
${XRANDR_CFLAGS} ${XRENDER_CFLAGS} ${XTRANS_CFLAGS} ${XORG_CFLAGS}
${XML_CFLAGS}"
BASE_DEPENDENCIES_LIBS="${CAIRO_LIBS}
${GLIB_LIBS} ${XFT_LIBS} ${FONTCONFIG_LIBS} ${FREETYPE_LIBS} ${X_LIBS}
${PANGO_LIBS} ${ATK_LIBS} ${FONTENC_LIBS} ${GIO_LIBS} ${GMODULE_LIBS}
${ICE_LIBS} ${PNG_LIBS} ${TSLIB_LIBS} ${XAU_LIBS} ${XCALIBRATE_LIBS}
${XCOMPOSITE_LIBS} ${XEXT_LIBS} ${XRANDR_LIBS} ${XRENDER_LIBS}
${XTRANS_LIBS} ${XORG_LIBS} ${XML_LIBS}"
GDK_DEP_CFLAGS="-pthread ${BASE_DEPENDENCIES_CFLAGS}"
GDK_DEP_LIBS="-L$PREFIX/lib -lpthread -ldl -lpangocairo-1.0 -lpango-1.0
-lcairo -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lpng12 -lXdmcp -lXau
-lm ${BASE_DEPENDENCIES_LIBS}"
GDK_PIXBUF_DEP_CFLAGS="-pthread ${BASE_DEPENDENCIES_CFLAGS}"
GDK_PIXBUF_DEP_LIBS="${BASE_DEPENDENCIES_LIBS} -L$PREFIX/lib
-lgmodule-2.0 -ldl -lgobject-2.0 -lglib-2.0 -lpng12 -lXdmcp -lXau -lm"
GDK_PIXBUF_EXTRA_CFLAGS="-pthread ${BASE_DEPENDENCIES_CFLAGS}"
GDK_PIXBUF_EXTRA_LIBS="${BASE_DEPENDENCIES_LIBS} -L$PREFIX/lib
-lgmodule-2.0 -ldl -lgobject-2.0 -lglib-2.0 -lpng12 -lXdmcp -lXau -lm"
GTK_DEP_CFLAGS="-pthread ${BASE_DEPENDENCIES_CFLAGS}"
GTK_DEP_LIBS="${BASE_DEPENDENCIES_LIBS} -L$PREFIX/lib -lpangocairo-1.0
-lpango-1.0 -latk-1.0 -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0
-lcairo -lXdmcp -lXau-lpng12 -lm"
GDK_EXTRA_CFLAGS="${BASE_DEPENDENCIES_CFLAGS}"
GDK_EXTRA_LIBS="${BASE_DEPENDENCIES_LIBS} -L$PREFIX/lib -lz -lxml2
-lfreetype -lX11 -lXext -lXrender -lexpat -lcairo -lXdmcp -lXau"
X_CFLAGS="${BASE_DEPENDENCIES_CFLAGS}"
X_LIBS="${BASE_DEPENDENCIES_LIBS} -L$PREFIX/lib -lz -lxml2 -lfreetype
-lX11 -lXext -lXrender -lexpat -lcairo -lXdmcp -lXau"
./configure --host=$HOST --build=$BUILD --prefix=$PREFIX
--enable-static=yes --enable-shared=yes --without-libtiff --disable-xkb
--disable-glibtest --with-gdktarget=x11 --with-xinput=yes
--enable-display-migration --enable-pangocairo
--x-libraries=${PREFIX}/lib --x-includes=${PREFIX}/include
--disable-cups
#修改config.h:
# #define HAVE_XCONVERTCASE 1 /*#undef HAVE_XCONVERTCASE */
# #define HAVE_SHAPE_EXT 1 /*#undef HAVE_SHAPE_EXT */
make -j 2 all; make -j 2 install;
20.libglade-2.6.3 //用于执行 glade或者 anjuta 作的UI界面或者代码
GTK_CFLAGS="pkg-config --cflags gtk+-2.0"
GTK_LIBS="pkg-config --libs gtk+-2.0"
./configure --host=$HOST --build=$BUILD --prefix=$PREFIX
--enable-static=yes --enable-shared=yes --enable-malloc0returnsnull
--disable-gtktest
make -j 2 install;
#/**************************************************************************/
启动XServer: 执行Xfbdev。 看看XServer的画面是否出现。mouse是否可以使用
fc-cache -f -v 把字体的cache载入内存。
fc-list 确定字体是否有成功载入。
cache的存放位置为 /xroot/fonts/var/cache/fontconfig
确认 /xroot/lib/xserver/SecurityPolicy 文件存在
确认 /xroot/etc/gtk-2.0/gdk-pixbuf.loaders 文件存在
{/xroot/bin/gdk-pixbuf-query-loaders > gdk-pixbuf.loaders 来生成}
确认 /xroot/etc/pango/pango.modules 文件存在
{/xroot/bin/pango-querymodules > pango.modules 来生成。
此文件会把pango+modules的相关资料调入/xroot/lib/pango/1.6.0/modules中}
测试步骤:
Xfbdev &
export DISPLAY=:0.0
./gtk-demo
看看GTK界面是否成功。
阅读(2054) | 评论(0) | 转发(0) |