gtk directfb 交叉编译过程
直接把编译脚本贴出来吧,仅供参考。
#!/usr/bin/bash
#Packages list
#atk-1.26.0.tar.bz2 expat_2.0.1.orig.tar.gz glib-2.21.5.tar.bz2 gtk-doc-1.11.tar.bz2 librsvg-2.22.3.tar.bz2 poppler-0.10.7.tar.gz
#cairo-1.8.2.tar.gz fontconfig-2.5.91.tar.gz gst-plugins-base-0.10.23.tar.bz2 hicolor-icon-theme-0.10.tar.gz libxml2-sources-2.6.31.tar.gz SHA256SUMS-for-bz2
#dbus_1.2.16.orig.tar.gz freetype-2.3.6.tar.bz2 gstreamer-0.10.23.tar.bz2 jpegsrc.v7.tar.gz pango-1.24.5.tar.bz2 tslib_1.0.orig.tar.gz
#DirectFB-1.3.0.tar.gz gettext-0.16.tar.gz gtk+-2.16.6.tar.bz2 libpng-1.2.38.tar.bz2 pixman-0.12.0.tar.gz
# Step 1: Build Glib
#************Important**********************************************#
# you need to check your cross compiling toolchain to find whether
# there is an underscore before symbols, for example:
# cat >test.c <<"EOF"
# int test(){}
# EOF
# arm-linux-gcc -c test.c
# nm test.o
# rm test.c test.o
# then set glib_cv_uscore to "no" or "yes" according to the result of "nm test.o"
#************Important**********************************************#
tar jxvf ../src/glib-2.21.5.tar.bz2
cd glib-2.21.5
cat > config.cache << "EOF"
glib_cv_stack_grows=no
glib_cv_has__inline=yes
glib_cv_working_bcopy=no
glib_cv_uscore=no
ac_cv_func_posix_getpwuid_r=yes
ac_cv_func_posix_getgrgid_r=yes
EOF
CC=arm-linux-gcc ./configure --host=arm-linux --prefix=/opt --cache-file=config.cache
make
sudo PATH=$PATH:/usr/local/arm/4.2.2-eabi/usr/bin make install
cd .. && rm -rf glib*
# Step 2: Build atk
tar jxvf ../src/atk-1.26.0.tar.bz2
cd atk-1.26.0/
PKG_CONFIG_PATH=/opt/lib/pkgconfig CC=arm-linux-gcc ./configure --host=arm-linux --prefix=/opt
make && make install
cd .. && rm -rf atk*
# Step 3: png
tar jxvf ../src/libpng-1.2.38.tar.bz2
cd libpng-1.2.38/
PKG_CONFIG_PATH=/opt/lib/pkgconfig CC=arm-linux-gcc ./configure --host=arm-linux --prefix=/opt
make && make install
cd .. && rm -rf libpng*
# Step 4: jpeg
tar zxvf ../src/jpegsrc.v7.tar.gz
cd jpeg-7/
CC=arm-linux-gcc ./configure --host=arm-linux --prefix=/opt
make && make install
cd .. && rm -rf jpeg*
# Step 5: libxml
tar zxvf ../src/libxml2-sources-2.6.31.tar.gz
cd libxml2-2.6.31/
PKG_CONFIG_PATH=/opt/lib/pkgconfig CC=arm-linux-gcc ./configure --host=arm-linux --prefix=/opt
make && make install
cd .. && rm -rf libxml*
# Step 6: pixman
tar zxvf ../src/pixman-0.12.0.tar.gz
cd pixman-0.12.0/
PKG_CONFIG_PATH=/opt/lib/pkgconfig CC=arm-linux-gcc ./configure --host=arm-linux \
--prefix=/opt --disable-gtk
make && make install
cd .. && rm -rf pixman*
# Step 7: freetype
tar jxvf ../src/freetype-2.3.6.tar.bz2
cd freetype-2.3.6/
PKG_CONFIG_PATH=/opt/lib/pkgconfig CC=arm-linux-gcc ./configure --host=arm-linux --prefix=/opt
make && make install
cd .. && rm -rf freetype*
# Step 8: fontconfig
tar zxvf ../src/fontconfig-2.5.91.tar.gz
cd fontconfig-2.5.91
PKG_CONFIG_PATH=/opt/lib/pkgconfig CC=arm-linux-gcc ./configure --host=arm-linux \
--with-arch=arm --prefix=/opt --with-freetype-config=/opt/bin/freetype-config
make && make install
cd .. && rm -rf fontconfig*
# Step 9: directfb
tar zxvf ../src/DirectFB-1.3.0.tar.gz
cd DirectFB-1.3.0/
CPPFLAGS="-I/opt/include" CFLAGS="-I/opt/include" LDFLAGS="-L/opt/lib" \
PKG_CONFIG_PATH="/opt/lib/pkgconfig" \
./configure --host=arm-linux --prefix=/opt --exec-prefix=/opt --enable-zlib --disable-x11 \
--enable-fbdev --disable-sdl --disable-vnc --enable-jpeg --disable-gif --with-gfxdrivers=none
make && make install
cd .. && rm -rf DirectFB*
# Step 10: poppler
tar zxvf ../src/poppler-0.10.7.tar.gz
cd poppler-0.10.7/
PKG_CONFIG_PATH=/opt/lib/pkgconfig CC=arm-linux-gcc CPPFLAGS="-I/opt/include" \
CFLAGS="-I/opt/include" LDFLAGS="-L/opt/lib" \
./configure --host=arm-linux --enable-libjpeg --without-x --disable-gtk-test \
--disable-utils --disable-splash-output --disable-gdk --prefix=/opt
make && make install
cd .. && rm -rf poppler*
# Step 11: cairo
tar zxvf ../src/cairo-1.8.2.tar.gz
cd cairo-1.8.2/
PKG_CONFIG_PATH=/opt/lib/pkgconfig CPPFLAGS="-I/opt/include" CFLAGS="-I/opt/include" LDFLAGS="-L/opt/lib" \
./configure --without-x --prefix=/opt --enable-directfb --enable-xlib=no --host=arm-linux --enable-ps=yes \
--enable-svg=yes --enable-pdf=yes
make && make install
cd .. && rm -rf cairo*
# Step 12: pango
tar jxvf ../src/pango-1.24.5.tar.bz2
cd pango-1.24.5/
PKG_CONFIG_PATH=/opt/lib/pkgconfig CC=arm-linux-gcc ./configure --host=arm-linux \
--without-x --prefix=/opt
make && make install
cd .. && rm -rf pango*
# Step 12: gtk+
# There is a "Can't link to Pango " problem, not find a better solution but the following:
# change [ if $PKG_CONFIG uninstalled $PANGO_PACKAGES; then ] to
# ---> [ if $PKG_CONFIG $PANGO_PACKAGES; then ]
#
tar jxvf ../src/gtk+-2.16.6.tar.bz2
cd gtk+-2.16.6/
cat>config.cache<<"EOF"
gio_can_sniff=yes
EOF
CPPFLAGS="-I/opt/include" CFLAGS="-I/opt/include" LDFLAGS="-L/opt/lib" \
PKG_CONFIG_LIBDIR=/opt/lib/pkgconfig CC=arm-linux-gcc ./configure --host=arm-linux \
--without-x --prefix=/opt --without-libtiff --without-libjasper --with-gdktarget=directfb \
--cache-file=config.cache --disable-glibtest --disable-gdiplus --disable-cups
make && make install
cd .. && rm -rf gtk
# Test
# Hello World
# download from:
# http://library.gnome.org/devel/gtk-tutorial/stable/c39.html#SEC-HELLOWORLD
# Makefile
DEBUG=-g
CFLAGS=-Wall -c ${DEBUG}
GTK_CFLAGS=`pkg-config --cflags gtk+-2.0 cairo cairo-ft cairo-directfb directfb freetype2 pangoft2 pangocairo pango pixman-1`
GTK_LIBS=`pkg-config --libs libpng12 libxml-2.0 gtk+-2.0 atk cairo cairo-ft cairo-directfb directfb freetype2 pangoft2 pangocairo pango pixman-1`
GMODULE_LIBS= `pkg-config --libs gmodule-2.0`
CC=arm-linux-gcc
gtkdemo:
${CC} ${GTK_CFLAGS} ${OBJS} -v -o gtkdemo gtkdemo.c ${GTK_LIBS} ${GMODULE_LIBS}
clean:
rm gtkdemo
# Build method
PKG_CONFIG_PATH=/opt/lib/pkgconfig make
# Strip Libs
# decrease libs size
cd /opt/lib
arm-linux-strip -s ./*
cd /opt/bin
arm-linux-strip -s ./*
# rootfile system config
pango-querymodules > '/opt/etc/pango/pango.modules'
# At last you should copy fonts and config them.
#!/usr/bin/bash
#Packages list
#atk-1.26.0.tar.bz2 expat_2.0.1.orig.tar.gz glib-2.21.5.tar.bz2 gtk-doc-1.11.tar.bz2 librsvg-2.22.3.tar.bz2 poppler-0.10.7.tar.gz
#cairo-1.8.2.tar.gz fontconfig-2.5.91.tar.gz gst-plugins-base-0.10.23.tar.bz2 hicolor-icon-theme-0.10.tar.gz libxml2-sources-2.6.31.tar.gz SHA256SUMS-for-bz2
#dbus_1.2.16.orig.tar.gz freetype-2.3.6.tar.bz2 gstreamer-0.10.23.tar.bz2 jpegsrc.v7.tar.gz pango-1.24.5.tar.bz2 tslib_1.0.orig.tar.gz
#DirectFB-1.3.0.tar.gz gettext-0.16.tar.gz gtk+-2.16.6.tar.bz2 libpng-1.2.38.tar.bz2 pixman-0.12.0.tar.gz
# Step 1: Build Glib
#************Important**********************************************#
# you need to check your cross compiling toolchain to find whether
# there is an underscore before symbols, for example:
# cat >test.c <<"EOF"
# int test(){}
# EOF
# arm-linux-gcc -c test.c
# nm test.o
# rm test.c test.o
# then set glib_cv_uscore to "no" or "yes" according to the result of "nm test.o"
#************Important**********************************************#
tar jxvf ../src/glib-2.21.5.tar.bz2
cd glib-2.21.5
cat > config.cache << "EOF"
glib_cv_stack_grows=no
glib_cv_has__inline=yes
glib_cv_working_bcopy=no
glib_cv_uscore=no
ac_cv_func_posix_getpwuid_r=yes
ac_cv_func_posix_getgrgid_r=yes
EOF
CC=arm-linux-gcc ./configure --host=arm-linux --prefix=/opt --cache-file=config.cache
make
sudo PATH=$PATH:/usr/local/arm/4.2.2-eabi/usr/bin make install
cd .. && rm -rf glib*
# Step 2: Build atk
tar jxvf ../src/atk-1.26.0.tar.bz2
cd atk-1.26.0/
PKG_CONFIG_PATH=/opt/lib/pkgconfig CC=arm-linux-gcc ./configure --host=arm-linux --prefix=/opt
make && make install
cd .. && rm -rf atk*
# Step 3: png
tar jxvf ../src/libpng-1.2.38.tar.bz2
cd libpng-1.2.38/
PKG_CONFIG_PATH=/opt/lib/pkgconfig CC=arm-linux-gcc ./configure --host=arm-linux --prefix=/opt
make && make install
cd .. && rm -rf libpng*
# Step 4: jpeg
tar zxvf ../src/jpegsrc.v7.tar.gz
cd jpeg-7/
CC=arm-linux-gcc ./configure --host=arm-linux --prefix=/opt
make && make install
cd .. && rm -rf jpeg*
# Step 5: libxml
tar zxvf ../src/libxml2-sources-2.6.31.tar.gz
cd libxml2-2.6.31/
PKG_CONFIG_PATH=/opt/lib/pkgconfig CC=arm-linux-gcc ./configure --host=arm-linux --prefix=/opt
make && make install
cd .. && rm -rf libxml*
# Step 6: pixman
tar zxvf ../src/pixman-0.12.0.tar.gz
cd pixman-0.12.0/
PKG_CONFIG_PATH=/opt/lib/pkgconfig CC=arm-linux-gcc ./configure --host=arm-linux \
--prefix=/opt --disable-gtk
make && make install
cd .. && rm -rf pixman*
# Step 7: freetype
tar jxvf ../src/freetype-2.3.6.tar.bz2
cd freetype-2.3.6/
PKG_CONFIG_PATH=/opt/lib/pkgconfig CC=arm-linux-gcc ./configure --host=arm-linux --prefix=/opt
make && make install
cd .. && rm -rf freetype*
# Step 8: fontconfig
tar zxvf ../src/fontconfig-2.5.91.tar.gz
cd fontconfig-2.5.91
PKG_CONFIG_PATH=/opt/lib/pkgconfig CC=arm-linux-gcc ./configure --host=arm-linux \
--with-arch=arm --prefix=/opt --with-freetype-config=/opt/bin/freetype-config
make && make install
cd .. && rm -rf fontconfig*
# Step 9: directfb
tar zxvf ../src/DirectFB-1.3.0.tar.gz
cd DirectFB-1.3.0/
CPPFLAGS="-I/opt/include" CFLAGS="-I/opt/include" LDFLAGS="-L/opt/lib" \
PKG_CONFIG_PATH="/opt/lib/pkgconfig" \
./configure --host=arm-linux --prefix=/opt --exec-prefix=/opt --enable-zlib --disable-x11 \
--enable-fbdev --disable-sdl --disable-vnc --enable-jpeg --disable-gif --with-gfxdrivers=none
make && make install
cd .. && rm -rf DirectFB*
# Step 10: poppler
tar zxvf ../src/poppler-0.10.7.tar.gz
cd poppler-0.10.7/
PKG_CONFIG_PATH=/opt/lib/pkgconfig CC=arm-linux-gcc CPPFLAGS="-I/opt/include" \
CFLAGS="-I/opt/include" LDFLAGS="-L/opt/lib" \
./configure --host=arm-linux --enable-libjpeg --without-x --disable-gtk-test \
--disable-utils --disable-splash-output --disable-gdk --prefix=/opt
make && make install
cd .. && rm -rf poppler*
# Step 11: cairo
tar zxvf ../src/cairo-1.8.2.tar.gz
cd cairo-1.8.2/
PKG_CONFIG_PATH=/opt/lib/pkgconfig CPPFLAGS="-I/opt/include" CFLAGS="-I/opt/include" LDFLAGS="-L/opt/lib" \
./configure --without-x --prefix=/opt --enable-directfb --enable-xlib=no --host=arm-linux --enable-ps=yes \
--enable-svg=yes --enable-pdf=yes
make && make install
cd .. && rm -rf cairo*
# Step 12: pango
tar jxvf ../src/pango-1.24.5.tar.bz2
cd pango-1.24.5/
PKG_CONFIG_PATH=/opt/lib/pkgconfig CC=arm-linux-gcc ./configure --host=arm-linux \
--without-x --prefix=/opt
make && make install
cd .. && rm -rf pango*
# Step 12: gtk+
# There is a "Can't link to Pango " problem, not find a better solution but the following:
# change [ if $PKG_CONFIG uninstalled $PANGO_PACKAGES; then ] to
# ---> [ if $PKG_CONFIG $PANGO_PACKAGES; then ]
#
tar jxvf ../src/gtk+-2.16.6.tar.bz2
cd gtk+-2.16.6/
cat>config.cache<<"EOF"
gio_can_sniff=yes
EOF
CPPFLAGS="-I/opt/include" CFLAGS="-I/opt/include" LDFLAGS="-L/opt/lib" \
PKG_CONFIG_LIBDIR=/opt/lib/pkgconfig CC=arm-linux-gcc ./configure --host=arm-linux \
--without-x --prefix=/opt --without-libtiff --without-libjasper --with-gdktarget=directfb \
--cache-file=config.cache --disable-glibtest --disable-gdiplus --disable-cups
make && make install
cd .. && rm -rf gtk
# Test
# Hello World
# download from:
# http://library.gnome.org/devel/gtk-tutorial/stable/c39.html#SEC-HELLOWORLD
# Makefile
DEBUG=-g
CFLAGS=-Wall -c ${DEBUG}
GTK_CFLAGS=`pkg-config --cflags gtk+-2.0 cairo cairo-ft cairo-directfb directfb freetype2 pangoft2 pangocairo pango pixman-1`
GTK_LIBS=`pkg-config --libs libpng12 libxml-2.0 gtk+-2.0 atk cairo cairo-ft cairo-directfb directfb freetype2 pangoft2 pangocairo pango pixman-1`
GMODULE_LIBS= `pkg-config --libs gmodule-2.0`
CC=arm-linux-gcc
gtkdemo:
${CC} ${GTK_CFLAGS} ${OBJS} -v -o gtkdemo gtkdemo.c ${GTK_LIBS} ${GMODULE_LIBS}
clean:
rm gtkdemo
# Build method
PKG_CONFIG_PATH=/opt/lib/pkgconfig make
# Strip Libs
# decrease libs size
cd /opt/lib
arm-linux-strip -s ./*
cd /opt/bin
arm-linux-strip -s ./*
# rootfile system config
pango-querymodules > '/opt/etc/pango/pango.modules'
# At last you should copy fonts and config them.
转载请注明出处