Qtopia 2.2.0的编译和移植(二):编译脚本

Stella981
• 阅读 657

前文提到了qtopia 2.2.0源代码编译移植的一些问题和注意事项,为了提高编译效率和可重复性,我编写了两个Shell脚本来实现自动修复源码错误和代码编译安装。

  • 源码错误修正脚本,参照前文中指出的错误,如发现有其它错误请自行在脚本中添加修改命令

    #! /bin/bash

    modify qtopia source files to fix some compile errors.

    QT_ROOT_DIR=$PWD/qtopia-free-2.2.0

    pushd $QT_ROOT_DIR

    1: pthread_yield --> sched_yield

    pushd qtopia/src/3rdparty/plugins/codecs/libffmpeg sed -i 's/pthread_yield/sched_yield/g' mediapacketbuffer.h popd

    2: fix ptrdiff_t is not a name type error

    pushd dqt/src/tools/ sed -i '52i\ #include \n #include "stddef.h" ' qvaluelist.h popd

    3:append ,remove function add object

    pushd qt2/src/tools sed -i '52c\ void push( const T& d ) { this->append(d);}' qvaluestack.h sed -i '57c\ this->remove( this->fromLast() );' qvaluestack.h popd

    4:about <asm/page.h> header file use

    pushd qt2/src/kernel sed -i '/<asm/page.h>/c
    #define PAGE_SHIFT 12
    #define PAGE_SIZE (1UL << PAGE_SHIFT)
    #define PAGE_MASK (~(PAGE_SIZE-1)) ' qpixmapcache.cpp popd

    pushd qt2/tools/qvfb sed -i '/<asm/page.h>/c
    #define PAGE_SHIFT 12
    #define PAGE_SIZE (1UL << PAGE_SHIFT)
    #define PAGE_MASK (~(PAGE_SIZE-1)) ' qvfbview.cpp popd

    5:remove class qualifier before destructor function

    pushd qtopia/src/libraries/qtopia sed -i '/~QDawgPrivate/c\ ~QDawgPrivate()' qdawg.cpp popd

    6: undef macro HAVE_PROGRAM_INVOCATION_NAME

    pushd qtopia/src/3rdparty/libraries/rsync sed -i '/HAVE_PROGRAM_INVOCATION_NAME/c#undef HAVE_PROGRAM_INVOCATION_NAME' config_linux.h popd

    7: open function lack the mode parameter

    pushd qt2/src/tools sed -i '143c\ f = ::open(tmpFile.latin1(), O_CREAT | O_WRONLY,0666);' qmemoryfile_unix.cpp popd

    pushd qtopia/src/libraries/qtopia sed -i '141c\ f = ::open(tmpFile.latin1(), O_CREAT | O_WRONLY, 0666);' qmemoryfile_unix.cpp popd

    8: fix error: cannot find zlib.h header file

    sed -i '/"zlib.h"/c\ #include "../zlib/zlib.h" ' qt2/src/3rdparty/libpng/png.h

    popd

    exit 0

  • 第三方库的编译安装,qtopia的编译安装脚本,可以自行修改qtopia的configure选项

    #! /bin/bash

    #====================================================================

    the script builds qtopia-2.2.0 embedded environment.

    #====================================================================

    includes qtopia-2.2.0 and png,zlib,jpeg,uuid 3rdparties.

    the content of the tar is listed below:

    Qt-2.2.0/Qtools/

    Qt-2.2.0/Qtools/libpng-1.2.14.tar.gz

    Qt-2.2.0/Qtools/zlib-1.2.3.tar.gz

    Qt-2.2.0/Qtools/qtopia-free-src-2.2.0.tar.gz

    Qt-2.2.0/Qtools/jpegsrc.v6b.tar.gz

    Qt-2.2.0/Qtools/e2fsprogs-1.39.tar.gz

    #====================================================================

    common variables,includes cross-toolchains,prefix-dir etc.

    QTOOLS_DIR=$PWD

    CROSS=/opt/hisi-linux/x86-arm/gcc-3.4.3-uClibc-0.9.28/usr/bin PLATFORM=arm-hismall-linux CC=$CROSS/$PLATFORM-gcc LD=$CROSS/$PLATFORM-ld AR=$CROSS/$PLATFORM-ar CPP=$CROSS/$PLATFORM-g++ RANLIB=$CROSS/$PLATFORM-ranlib

    create build directory for 3rd liraries and headers

    PREFIX=$PWD/build PREFIX_LIB=$PREFIX/lib PREFIX_INC=$PREFIX/include

    mkdir -p $PREFIX_LIB $PREFIX_INC

    create install directory for qtopia installation

    INSTALL=$PWD/install mkdir -p $INSTALL

    BUILD_LOG=$PWD/3rd_build.log

    echo "=======Begin to build 3rd libraries...======="

    echo "start to build e2fsprogs(uuid)" echo "start to build e2fsprogs(uuid)" > $BUILD_LOG tar -zxf Qtools/e2fsprogs-1.39.tar.gz pushd e2fsprogs-1.39 ./configure --host=$PLATFORM --enable-elf-shlibs --with-cc=$CC --with-linker=$LD --prefix=$PREFIX make 2>>$BUILD_LOG cp -fv lib/libuuid.so* $PREFIX_LIB cp -rfv lib/uuid $PREFIX_INC popd echo "e2fsprogs build successfull"

    echo "start to build jpegsrc.v6b" echo "start to build jpegsrc.v6b" >> $BUILD_LOG tar -zxf Qtools/jpegsrc.v6b.tar.gz pushd jpeg-6b mkdir -pv install/bin install/include install/lib install/man/man1 ./configure --enable-shared --prefix=$PWD/install echo y | cp jconfig.doc jconfig.h

    extract JPEG library version for libtool utility

    JPEG_LIB_VER=sed -n '/#define JPEG_LIB_VERSION/s/[[:space:]][[:space:]]*/ /gp' jpeglib.h |cut -d " " -f 3 make CC=$CC AR="$AR rc" AR2=$RANLIB JPEG_LIB_VERSION=$JPEG_LIB_VER 2>>$BUILD_LOG make install cp -fv install/lib/libjpeg.* $PREFIX_LIB cp -fv j*.h $PREFIX_INC cp -fv install/man $PREFIX/ popd echo "jpeg build successful"

    echo "start to build zlib" echo "start to build zlib" >> $BUILD_LOG tar -zxf Qtools/zlib-1.2.3.tar.gz pushd zlib-1.2.3 ./configure -shared make CC=$CC LDSHARED="$CC -shared -Wl,-soname,libz.so.1" CPP="$CC -E" AR="$AR rc" RANLIB=$RANLIB prefix=$PREFIX 2>>$BUILD_LOG cp -fv libz.so* $PREFIX_LIB cp -fv *.h $PREFIX_INC popd echo "zlib build successful"

    echo "start to build libpng" echo "start to build libpng" >> $BUILD_LOG tar -zxf Qtools/libpng-1.2.14.tar.gz mv -fv zlib-1.2.3 zlib pushd libpng-1.2.14 cp scripts/makefile.linux ./Makefile make CC=$CC AR_RC="$AR rc" RANLIB=$RANLIB prefix=$PREFIX 2>>$BUILD_LOG cp -fv libpng12.so* $PREFIX_LIB

    remove the libpng version number to let ld find it

    #ln -s $PREFIX_LIB/libpng12.so.0 $PREFIX_LIB/libpng.so.0 cp -fv $PREFIX_LIB/libpng12.so.0 $PREFIX_LIB/libpng.so cp -fv *.h $PREFIX_INC popd mv -fv zlib zlib-1.2.3 echo "libpng build successful"

    echo "=======End to build 3rd libraries.======="

    echo "=======Begin to build qtopia-2.2.0======="

    echo "-------step1:create platform tmake.conf and qmake.conf-------" tar -zxf Qtools/qtopia-free-src-2.2.0.tar.gz pushd qtopia-free-2.2.0 QT_ROOT_DIR=$PWD QT_BUILD_LOG=$QT_ROOT_DIR/build.log

    create platform tmake qws config file

    cp -frv tmake/lib/qws/linux-arm-g++ tmake/lib/qws/arm-hismall-linux-g++ pushd tmake/lib/qws/arm-hismall-linux-g++

    modify tmake.conf file

    sed -i 's/arm-linux/arm-hismall-linux/g' tmake.conf popd

    create platform qtopia mkspecs qws files

    cp -frv qtopia/mkspecs/qws/linux-arm-g++/ qtopia/mkspecs/qws/arm-hismall-linux-g++ pushd qtopia/mkspecs/qws/arm-hismall-linux-g++

    modify qmake.conf file

    sed -i 's/arm-linux/arm-hismall-linux/g' qmake.conf sed -i '61c\QMAKE_LIBS_QT = -lqte -lpng -lz -luuid -ljpeg' qmake.conf popd

    echo "-------step 2: create qconfig-qpe.h file for our project-------"

    modify qconfig-xxx.h

    pushd qtopia/src/qt #if let qtopia support mouse #/* #ifndef QT_NO_QWS_CURSOR #define QT_NO_QWS_MOUSE_PC #endif #/ sed -i '47a/ ' qconfig-qpe.h sed -i '60i*/ ' qconfig-qpe.h

    used for qte build

    cp qconfig-qpe.h $QT_ROOT_DIR/qt2/src/tools popd

    about touch panels feature

    pushd qtopia/src/libraries/qtopia

    iPAQ Touch Panel

    #cp custom-linux-ipaq-g++.cpp custom-linux-arm-g++.cpp #cp custom-linux-ipaq-g++.h custom-linux-arm-g++.h

    Don't use Touch Panel

    cp custom-linux-x86-g++.cpp custom-$PLATFORM-g++.cpp cp custom-linux-x86-g++.h custom-$PLATFORM-g++.h popd

    echo "-------step 3:fix source files compile errors-------" pushd $QTOOLS_DIR ./fix-src-errors.sh popd

    echo "-------step 4:configure,make and install qtopia-------" QTE_CFG="'-embedded -no-xft -xplatform $PLATFORM-g++ -qconfig qpe -depths 16,32 -no-qvfb -system-jpeg -gif -system-libpng -I$PREFIX_INC -lpng -lz -ljpeg -L$PREFIX_LIB'" QPE_CFG="'-xplatform $PLATFORM-g++ -edition pda -displaysize 240x320'" QT2_CFG= DQT_CFG=

    configure

    echo "yes" |./configure -qte "$QTE_CFG" -qpe "$QPE_CFG" -libpath $PREFIX_LIB -prefix $INSTALL > $QT_BUILD_LOG

    set environment variables

    if [ -f setQpeEnv ] then . ./setQpeEnv export PATH=$TMAKEDIR/bin:$PATH fi

    make

    make 2>>$QT_BUILD_LOG

    install

    make install

    popd

点赞
收藏
评论区
推荐文章
blmius blmius
3年前
MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1
文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s
皕杰报表之UUID
​在我们用皕杰报表工具设计填报报表时,如何在新增行里自动增加id呢?能新增整数排序id吗?目前可以在新增行里自动增加id,但只能用uuid函数增加UUID编码,不能新增整数排序id。uuid函数说明:获取一个UUID,可以在填报表中用来创建数据ID语法:uuid()或uuid(sep)参数说明:sep布尔值,生成的uuid中是否包含分隔符'',缺省为
待兔 待兔
4个月前
手写Java HashMap源码
HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22
Jacquelyn38 Jacquelyn38
3年前
2020年前端实用代码段,为你的工作保驾护航
有空的时候,自己总结了几个代码段,在开发中也经常使用,谢谢。1、使用解构获取json数据let jsonData  id: 1,status: "OK",data: 'a', 'b';let  id, status, data: number   jsonData;console.log(id, status, number )
Stella981 Stella981
3年前
KVM调整cpu和内存
一.修改kvm虚拟机的配置1、virsheditcentos7找到“memory”和“vcpu”标签,将<namecentos7</name<uuid2220a6d1a36a4fbb8523e078b3dfe795</uuid
Wesley13 Wesley13
3年前
mysql设置时区
mysql设置时区mysql\_query("SETtime\_zone'8:00'")ordie('时区设置失败,请联系管理员!');中国在东8区所以加8方法二:selectcount(user\_id)asdevice,CONVERT\_TZ(FROM\_UNIXTIME(reg\_time),'08:00','0
Wesley13 Wesley13
3年前
00:Java简单了解
浅谈Java之概述Java是SUN(StanfordUniversityNetwork),斯坦福大学网络公司)1995年推出的一门高级编程语言。Java是一种面向Internet的编程语言。随着Java技术在web方面的不断成熟,已经成为Web应用程序的首选开发语言。Java是简单易学,完全面向对象,安全可靠,与平台无关的编程语言。
Stella981 Stella981
3年前
Django中Admin中的一些参数配置
设置在列表中显示的字段,id为django模型默认的主键list_display('id','name','sex','profession','email','qq','phone','status','create_time')设置在列表可编辑字段list_editable
Wesley13 Wesley13
3年前
MySQL部分从库上面因为大量的临时表tmp_table造成慢查询
背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_
Python进阶者 Python进阶者
10个月前
Excel中这日期老是出来00:00:00,怎么用Pandas把这个去除
大家好,我是皮皮。一、前言前几天在Python白银交流群【上海新年人】问了一个Pandas数据筛选的问题。问题如下:这日期老是出来00:00:00,怎么把这个去除。二、实现过程后来【论草莓如何成为冻干莓】给了一个思路和代码如下:pd.toexcel之前把这