QT在平台上的porting过程,步骤简略的记录了下:

1.首先DirectFB以及OpenGL 都需要先编译完成,并且需要以动态链接库so的方式config中加入--enable-shared 和 在CFLAGS中加入-fPIC

2.然后是需要修改QT\mkspecs\qws\linux-arm-g++\qmake.conf,在其中加入DirectFB和OpenGL的链接路径,这部分我们通过patch文件实现

--- qt-everywhere-opensource-src-4.7.2/mkspecs/qws/linux-arm-g++/qmake.conf    2011-02-22 20:02:55.000000000 +0800
+++ qt-everywhere-opensource-src-4.7.2/mkspecs/qws/linux-arm-g++/qmake.conf    2011-04-21 15:25:50.000000000 +0800
@@ -6,15 +6,58 @@
 include(../../common/linux.conf)
 include(../../common/qws.conf)
 
-# modifications to g++.conf
-QMAKE_CC                = arm-linux-gcc
-QMAKE_CXX               = arm-linux-g++
-QMAKE_LINK              = arm-linux-g++
-QMAKE_LINK_SHLIB        = arm-linux-g++
-
+# modifications to g++.conf 
+QMAKE_CC                = arm-linux-uclibcgnueabi-gcc
+QMAKE_CXX               = arm-linux-uclibcgnueabi-g++
+QMAKE_LINK              = arm-linux-uclibcgnueabi-g++
+QMAKE_LINK_SHLIB        = arm-linux-uclibcgnueabi-g++
 # modifications to linux.conf
 QMAKE_AR                = arm-linux-ar cqs
 QMAKE_OBJCOPY           = arm-linux-objcopy
 QMAKE_STRIP             = arm-linux-strip
+QMAKE_INCDIR        =  $(GCC_BASE)/arm-linux/sys-include
+QMAKE_LIBDIR        =  $(GCC_BASE)/lib $(DIRECTFB_LIBS_QT) $(QT_DFB_FLAGS)
+QMAKE_LFLAGS        =  --sysroot $(_TMSYSROOT) -Wl,-rpath,-$(GCC_BASE)/lib
+QMAKE_CFLAGS_RELEASE     = -O3 -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=softfp -funroll-loops -fomit-frame-pointer
+QMAKE_CXXFLAGS_RELEASE     = $$QMAKE_CFLAGS_RELEASE
+QT_CFLAGS_DIRECTFB     = -I$(_TMTGTBUILDROOT)/comps/generic_apps/usr/include/directfb
+QT_LIBS_DIRECTFB        = -L$(_TMTGTBUILDROOT)/comps/generic_apps/usr -ldirectfb -lfusion -ldirect -lpthread
+QT_LIBS_DIRECTFB        += -L$(_TMTGTBUILDROOT)/comps/generic_apps/usr/lib
+QT_LIBS_DIRECTFB        += -L$(_TMTGTBUILDROOT)/comps/generic_apps/usr/lib/directfb-1.4-0/systems
+QT_LIBS_DIRECTFB        += -L$(_TMTGTBUILDROOT)/comps/generic_apps/usr/lib/directfb-1.4-0/wm
+QT_LIBS_DIRECTFB        += -L$(_TMTGTBUILDROOT)/comps/generic_apps/usr/lib/directfb-1.4-0/inputdrivers
+QT_LIBS_DIRECTFB        += -L$(_TMTGTBUILDROOT)/comps/generic_apps/usr/lib/directfb-1.4-0/interfaces/IDirectFBFont
+QT_LIBS_DIRECTFB        += -L$(_TMTGTBUILDROOT)/comps/generic_apps/usr/lib/directfb-1.4-0/interfaces/IDirectFBImageProvider
+QT_LIBS_DIRECTFB        += -L$(_TMTGTBUILDROOT)/comps/generic_apps/usr/lib/directfb-1.4-0/interfaces/IDirectFBVideoProvider
+QT_LIBS_DIRECTFB        += -L$(_TMTGTBUILDROOT)/comps/generic_apps/usr/lib/directfb-1.4-0/gfxdrivers
+QT_LIBS_DIRECTFB        += $(QT_DFB_FLAGS)
+
+QT_LIBS_DIRECTFB +=     -udirectfb_cnxtgfx -ldirectfb_fbdev -udirectfb_fbdev -ldirectfb_cnxtgfx -udirectfbwm_default -ldirectfbwm_default -ldirectfb_linux_input
+QT_LIBS_DIRECTFB +=     -udirectfb_linux_input_ctor -udirectfb_linux_input_dtor -lidirectfbp_w_picpathprovider_png -uIDirectFBImageProvider_PNG_ctor
+QT_LIBS_DIRECTFB +=     -uIDirectFBImageProvider_PNG_dtor -lpng -lz -lidirectfbp_w_picpathprovider_jpeg -uIDirectFBImageProvider_JPEG_ctor -uIDirectFBImageProvider_JPEG_dtor
+QT_LIBS_DIRECTFB +=     -ljpeg -lidirectfbfont_ft2 -uIDirectFBFont_FT2_ctor -uIDirectFBFont_FT2_dtor -lidirectfbfont_dgiff -uIDirectFBFont_DGIFF_ctor -uIDirectFBFont_DGIFF_dtor
+QT_LIBS_DIRECTFB +=     -lidirectfbfont_default -uIDirectFBFont_DEFAULT_ctor -uIDirectFBFont_DEFAULT_dtor -ldirectfb -udirectfb -ldirect -udirect -lpthread -lm -lrt -lc -lfusion
+QT_LIBS_DIRECTFB +=     -ljpeg -lfreetype
+QT_LIBS_DIRECTFB +=     $(DIRECTFB_LIBS_QT)
+
+## # opengl
+#TARGET_GL_PREFIX        = _TMROOT/sd/video/drivers/comps/tmvssDD3DGraphics/eurasia
+
+#QMAKE_INCDIR_EGL        =  $${TARGET_GL_PREFIX}/eurasiacon/unittests/include
+#QMAKE_INCDIR_EGL        += $${TARGET_GL_PREFIX}/pvr2d
+
+#QMAKE_INCDIR_OPENGL_ES2 =  $${TARGET_GL_PREFIX}/eurasiacon/unittests/include
+#QMAKE_INCDIR_OPENGL_ES2 += $${TARGET_GL_PREFIX}/pvr2d
+
+
+#QMAKE_LIBS_EGL     = -L$${TARGET_GL_PREFIX}/eurasiacon/binary_apollo_531_linux_release -lEGL -lIMGegl -lsrv_um
+#QMAKE_LIBS_OPENGL_ES2     = $$QMAKE_LIBS_EGL -lGLESv2 -lGLES_CM
+
+#DEFINES += QT_QWS_CLIENTBLIT
+
+#DEFINES += QT_NO_QWS_CURSOR
+
+#QMAKE_INCDIR=$${TOOLCHAIN_BASE_PREFIX}/usr/include
+#QMAKE_LIBDIR=$${TOOLCHAIN_BASE_PREFIX}/usr/lib
 
 load(qt_config)

3.将simplegl的插件放在QT\src\plugins\gfxdrivers下,并修改gfxdrivers.pro添加这个插件,这一步也可以和patch文件一起实现。

4.然后按照makefile里面的config选项做配置,然后编译,其中可能会因为DirectFB的一个头文件报错,需要屏蔽掉#if 0//DIRECT_BUILD_STDBOOL,因为其他地方已经定义过了。此步骤也可以用types.h-1.4.3.patch文件来实现。

5.最后在运行QT的应用之前你需要export一下环境变量:

export QT_QWS_FONTDIR=/opt/lib/fonts

export QT_PLUGIN_PATH=/opt/lib/plugins

export LD_LIBRARY_PATH=/opt/lib:/opt/lib/directfb-1.4-0/gfxdrivers:/opt/lib/directfb-1.4-0/inputdrivers:/opt/lib/directfb-1.4-0/interfaces/IDirectFBFont:/opt/lib/directfb-1.4-0/interfaces/IDirectFBImageProvider:/opt/lib/directfb-1.4-0/interfaces/IDirectFBVideoProvider:/opt/lib/directfb-1.4-0:/opt/lib/directfb-1.4-0/systems:/opt/lib/directfb-1.4-0/wm

使用键盘和遥控
export QWS_KEYBOARD="USB:/dev/input/event0 lirc:/dev/lircd"

鼠标和触摸屏
export set QWS_MOUSE_PROTO=" Intellimouse:/dev/mouse0" --只支持鼠标
export set QWS_MOUSE_PROTO="TSLIB:/dev/event0 Intellimouse:/dev/mouse0"