2008年11月5日 星期三

第四章 Cairo與Pango移植

*******************************************************************************************
41.expat-2.0.0

CC=arm-softfloat-linux-gnu-gcc NM=arm-softfloat-linux-gnu-nm AR=arm-softfloat-linux-gnu-ar ./configure --host=$HOST --build=$BUILD --prefix=$PREFIX

make all
make instal
*******************************************************************************************
42.fontconfig-2.4.2

$ CC=arm-softfloat-linux-gnu-gcc CFLAGS="-I/mnt/sd/arm_lib_4.2.1/include -I/mnt/sd/arm_lib_4.2.1/include/freetype2/freetype -I/mnt/sd/arm_lib_4.2.1/include/freetype2/freetype/config" LDFLAGS="-L/mnt/sd/arm_lib_4.2.1/lib" ./configure --build=$BUILD --host=$HOST --prefix=$PREFIX --with-freetype-config=$PREFIX/bin/freetype-config --with-arch=aarmv5te --enable-static=yes --enable-shared=yes --with-default-fonts=/mnt/sd/fonts --with-cache-dir=/mnt/sd/fonts/var/cache/fontconfig --with-confdir=/mnt/sd/fonts

$ make all
$ make install

--with-confdir=/mnt/sd/fonts 設定尋找字型的目錄

ps. Makefile中這幾行有點礙眼
FC_ADD_FONTS = /usr/X11R6/lib/X11/fonts
FC_CACHEDIR = /home/clouds/project/var/cache/fontconfig
FC_DEFAULT_FONTS = /usr/share/fonts
FC_FONTDATE = Mon Mar 10 17:36:16 CST 2008
FC_FONTPATH = /usr/X11R6/lib/X11/fonts
若以後找沒字型可能要改這裡

***
*** Warning: fonts.cache not built
***
*** Generate this file manually on host system using fc-cache
***
FC_CACHEDIR = /mnt/sd/fonts/var/cache/fontconfig
FC_DEFAULT_FONTS = /mnt/sd/fonts
*******************************************************************************************
43.jpeg-6b, http://www.ijg.org/files/jpegsrc.v6b.tar.gz

打 patch < ldflags.patch
patch -Np1 -i ldflags.patch

./ltconfig --disable-static --no-verify ltmain.sh arm-softfloat-linux-gnu

$CC=arm-softfloat-linux-gnu-gcc NM=arm-softfloat-linux-gnu-nm AR=arm-softfloat-linux-gnu-ar ./configure --prefix=$PREFIX --host=$HOST --build=$BUILD --enable-static=yes --enable-shared=yes
修改Makefile

CFLAGS= -O2 -I$(srcdir) -D_REENTRANT

$ make all
$ make install
$ make install-lib
$ make install-headers
*******************************************************************************************
44.libpng-1.2.16

$CC=arm-softfloat-linux-gnu-gcc NM=arm-softfloat-linux-gnu-nm AR=arm-softfloat-linux-gnu-ar ac_cv_lib_z_zlibVersion=yes ./configure --host=$HOST --build=$BUILD --prefix=$PREFIX --enable-shared=yes --enable-static=yes

edit Makefile
DEFAULT_INCLUDES = -I. -I$(srcdir) -I. -I$(PREFIX)/include
LIBS = -L$(PREFIX)/lib -lz -lm

$make all
$make install
*******************************************************************************************
45.libICE-1.0.3(為製作libsm所需)

$CC=arm-softfloat-linux-gnu-gcc ./configure --prefix=$PREFIX --host=$HOST --build=$BUILD --enable-shared=yes --enable-static=yes

$ make all

有一堆這種警告
warning: function declaration isn't a prototype
先裝死吧

$ make install
*******************************************************************************************
46.libSM-1.0.3

$ CC=arm-softfloat-linux-gnu-gcc ./configure --prefix=$PREFIX --host=$HOST --build=$BUILD --enable-shared=yes --enable-static=yes

$ make all

有一堆這種警告
warning: function declaration isn't a prototype
先裝死吧

$ make install
*******************************************************************************************
47. cairo-1.4.14
edit configure 加以下3行
ac_cv_lib_z_compress=yes
ac_header_compiler=yes
ac_header_preproc=yes
ELF file OS ABI invalid

找 24099 行 unset cairo_cv_backend_xcb_use 下面加
cairo_cv_backend_xcb_use=yes
找 27869 行 unset cairo_cv_backend_pdf_use 下面加
cairo_cv_backend_pdf_use=yes

第一次用的~
$ CC=arm-softfloat-linux-gnu-gcc ./configure --prefix=$PREFIX --host=$HOST --build=$BUILD --enable-xcb=no --enable-win32=no --enable-win32-font=no --enable-gtk-doc=yes --enable-pdf=yes --enable-static=yes --enable-shared=yes --disable-some-floating-point

最近用的~
$ ac_cv_header_zlib_h=yes CC=arm-softfloat-linux-gnu-gcc ./configure --prefix=$PREFIX --host=$HOST --build=$BUILD --enable-static=yes --enable-shared=yes --disable-some-floating-point

ps. svg是好物 以後有空研究enable

$ make all
一堆warning: missing initializer 裝死

$ make install


cairo will be compiled with the following surface backends:
image: yes (always builtin)
Xlib: yes
Xlib Xrender: yes
Quartz: no (disabled, use --enable-quartz to enable)
XCB: no (disabled, use --enable-xcb to enable)
Win32: no (disabled, use --enable-win32 to enable)
OS2: no (disabled, use --enable-os2 to enable)
PostScript: no (requires zlib http://www.gzip.org/zlib/)
PDF: yes
SVG: yes
glitz: no (disabled, use --enable-glitz to enable)
BeOS: no (disabled, use --enable-beos to enable)
DirectFB: no (disabled, use --enable-directfb to enable)

the following font backends:
FreeType: yes
Win32: no (disabled, use --enable-win32-font to enable)
ATSUI: no (disabled, use --enable-atsui to enable)

the following features:
PNG functions: yes

and the following debug options:
gcov support: no
test surfaces: no
pdf testing: no (requires poppler-glib >= 0.4.1)
svg testing: yes

using CFLAGS:
-I/arm_lib_4.2.1/include/freetype2 -I/arm_lib_4.2.1/include -I/arm_lib_4.2.1/include -DPNG_NO_MMX_CODE -I/arm_lib_4.2.1/include/libpng12 -I/arm_lib_4.2.1/include -I/arm_lib_4.2.1/include -Wall -Wextra -Wsign-compare -Werror-implicit-function-declaration -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wpacked -Wswitch-enum -Wmissing-format-attribute -Wstrict-aliasing=2 -Winit-self -Wunsafe-loop-optimizations -Wdeclaration-after-statement -Wold-style-definition -Wno-missing-field-initializers -Wno-unused-parameter -Wno-attributes -fno-strict-aliasing
*******************************************************************************************
48.libXft-2.1.12

$ CC=arm-softfloat-linux-gnu-gcc ./configure --prefix=$PREFIX --host=$HOST --build=$BUILD --enable-shared=yes --enable-static=yes

$ make all
$ make install
*******************************************************************************************
49.glib-2.14.6
若Cross過程中有出現這一個錯誤訊息 "ELF file OS ABI invalid" 要將環境變數改成以這四行

$export PREFIX=/mnt/sd/arm_lib_4.2.1
$export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
$export HOST=arm-softfloat-linux-gnu
$export BUILD=i686-linux


Cross環境設定
$export PREFIX=/mnt/sd/arm_lib_4.2.1
$export LD_LIBRARY_PATH=$PREFIX/lib
$export PKG_CONFIG_PATH=$LD_LIBRARY_PATH/pkgconfig
$export HOST=arm-softfloat-linux-gnu
$export BUILD=i686-linux


glib-2.14.6
$CC=arm-softfloat-linux-gnu-gcc ./configure --build=$BUILD --host=$HOST --prefix=$PREFIX --enable-shared=yes --enable-static=yes


這一個不加 --enable-included-printf=no


出現了如下錯誤:
  checking for growing stack pointer... configure: error: cannot run test program while cross compiling
  原來configure不能為交叉編譯檢查glib_cv_stack_grows,glib_cv_stack_grows表示堆棧的增長方向。 configure無法在目標機上運行測試程序,自然無法檢查,只好手工指定。順便看一下還哪些相關的變量不能檢查的,一起寫到cache文件中,並重新配置:

  clouds@ubu-lin:~/work/glib-2.12.13$ echo ac_cv_type_long_long=yes>> 1.cache
  clouds@ubu-lin:~/work/glib-2.12.13$ echo glib_cv_stack_grows=no>>1.cache
  clouds@ubu-lin:~/work/glib-2.12.13$ echo glib_cv_uscore=no>>1.cache
  clouds@ubu-lin:~/work/glib-2.12.13$ echo ac_cv_func_posix_getpwuid_r=no>>1.cache
  

$ CC=arm-softfloat-linux-gnu-gcc ./configure --prefix=$PREFIX --host=$HOST --build=$BUILD --enable-shared=yes --enable-static=yes --cache-file=1.cache
這回配置成功了,編譯

$make
$make install


在測試arm版gtk-demo時會出現以下錯誤
(gtk-demo:712): GLib-WARNING **: getpwuid_r(): failed due to unknown user id (0)

(gtk-demo:712): Gtk-WARNING **: cannot open display:

將echo ac_cv_func_posix_getpwuid_r=yes>>1.cache 改為 echo ac_cv_func_posix_getpwuid_r=no>>1.cache 再編一次

*******************************************************************************************
50.pango-1.18.3

patch -Np1 -i no-tests.patch
patch -Np1 -i configure_fixes.patch

modified 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


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 CC=arm-softfloat-linux-gnu-gcc CAIRO_CFLAGS='-I/mnt/sd/arm_lib_4.2.1/include -I/mnt/sd/arm_lib_4.2.1/include/cairo' CAIRO_LIBS='-L/mnt/sd/arm_lib_4.2.1/lib -lcairo' GLIB_CFLAGS='-I/mnt/sd/arm_lib_4.2.1/include -I/mnt/sd/arm_lib_4.2.1/include/glib-2.0 -I/mnt/sd/arm_lib_4.2.1/include/glib-2.0/glib -I/mnt/sd/arm_lib_4.2.1/include/glib-2.0/gobject -I/mnt/sd/arm_lib_4.2.1/lib/glib-2.0/include' GLIB_LIBS='-L/mnt/sd/arm_lib_4.2.1/lib -lglib-2.0 -lgmodule-2.0 -lgobject-2.0 -lgthread-2.0' ./configure --prefix=$PREFIX --host=$HOST --build=$BUILD --enable-shared=yes --enable-static=yes --enable-explicit-deps=no --disable-glibtest --disable-debug

configure 結束後一行的結果:
configuration:
backends: FreeType X Xft Cairo



錯誤
checking pkg-config is at least version 0.9.0... /usr/bin/pkg-config: error while loading shared libraries: /arm_lib_4.2.1/lib/libglib-2.0.so.0: ELF file OS ABI invalid
no

解決
這一個不要打 export LD_LIBRARY_PATH=

$export PREFIX=/mnt/sd/arm_lib_4.2.1
$export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
$export HOST=arm-softfloat-linux-gnu
$export BUILD=i686-linux


CAIRO_CFLAGS='-I/mnt/sd/arm_lib_4.2.1/include -I/arm_lib_4.2.1/include/cairo'

CAIRO_LIBS='-L/mnt/sdarm_lib_4.2.1/lib -lcairo'

GLIB_CFLAGS='-I/mnt/sd/arm_lib_4.2.1/include -I/mnt/sd/arm_lib_4.2.1/include/glib-2.0 -I/mnt/sd/arm_lib_4.2.1/include/glib-2.0/glib -I/mnt/sd/arm_lib_4.2.1/include/glib-2.0/gobject -I/mnt/sd/arm_lib_4.2.1/lib/glib-2.0/include'

GLIB_LIBS='-L/mnt/sd/arm_lib_4.2.1/lib -lglib-2.0 -lgmodule-2.0 -lgobject-2.0 -lgthread-2.0'

*******************************************************************************************