由于要经常编译各种版本的qt库,每次都configure --help挺麻烦,于是写了个脚本来简化配置和编译。另外还写了两个脚本又来提取和替换私有头文件。
配置和编译脚本buildqt4.sh
脚本支持编译桌面版和嵌入式linux,已经测试的mkspec有linux-g++, qws/linux-armv6-g++, qws/linux-x86-g++,qt版本支持4.7.4, 4.8.0,其他未测试。
如果源码不是放在qt-everywhare-opensource-x.x.x这样的目录,那么你需要设定脚本开头处的QT__VERSION值。
若交叉编译设置脚本开头处的XPLATFORM值,如qws/linux-armv6-g++,否则留空或注释掉。
默认安装到/opt/QtSDK相应的位置
运行方法
./buildqt4.sh [configure绝对或相对路径]
若脚本放在qt源码目录qt-everywhare-opensource-x.x.x,则可直接./buildqt4.sh。当然比较推荐源码和构建分开。
#!/bin/bash
#############################################################################
##
## Copyright (C) 2012 Wangbin
## All rights reserved.
## Contact: Wangbin ([email protected])
##
## Script to build qt4 for desktop and embedded linux
## Tested version: 4.8.0, 4.7.4
## Tested mkspecs: linux-g++, qws/linux-armv6-g++, qws/linux-x86-g++
##
## GNU General Public License Usage
## This file may be used under the terms of the GNU General
## Public License version