Created
November 22, 2021 02:40
-
-
Save goooooouwa/d3745564ed85765789ff2660d03dde03 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo INFO: host: red hat 9.0 with all packages in installation CDs installed. | |
echo INFO: target: armv4tl Linux 2.6.12-h1940 libc 2.3.2 | |
echo INFO: all operations are executed under root | |
#build mode | |
INSTALL_CROSSTOOL="" | |
COPY_LIBS="" | |
COMPILE_QT="" | |
EDIT_CROSS_FILES="" | |
COMPILE_QTOPIA="" | |
#edit before run | |
CROSS_VERSION=2.95.3 | |
CROSSTOOL_PACKAGE=cross-$CROSS_VERSION | |
CROSS_ROOT=/usr/local/arm | |
QT_PACKAGE=qt-2.3.10 | |
QTOPIA_SRC_PACKAGE=qtopia-free-src-2.2.0 | |
export QTOPIA_SRC=qtopia-free-2.2.0 | |
PACKAGES=/root/packages/ | |
export YIZHI=/root/yizhi/ | |
#env | |
export QTDIR=$YIZHI/$QTOPIA_SRC/qt2 | |
export QPEDIR=$YIZHI/$QTOPIA_SRC/qtopia | |
export LD_LIBRARY_PATH=$QTDIR/lib:$QPEDIR/lib:$LD_LIBRARY_PATH | |
export TMAKEDIR=$YIZHI/$QTOPIA_SRC/tmake | |
export TMAKEPATH=$TMAKEDIR/lib/qws/linux-arm-g++ | |
export PATH=$CROSS_ROOT/$CROSS_VERSION/bin:$PATH | |
echo STEP 1 prepare installation packages | |
echo 'Content in "packages":' | |
ls $PACKAGES | |
read -p 'Check if exist: '$CROSSTOOL_PACKAGE'.tar.gz, arminclude.tar.gz, armlib.tar.gz, '$QT_PACKAGE'.tar.gz, qtopia.tar.gz, '$QTOPIA_SRC_PACKAGE'.tar.gz, build-qtopia.sh, press "ENTER" to continue...' | |
echo STEP 2 setup QTE development directories | |
mkdir -p $YIZHI | |
cd $YIZHI | |
mkdir -p host qtopia/lib $QT_PACKAGE | |
echo STEP 3 build dependencies | |
echo STEP 3.1 install crosstool | |
read -p "DO you want to install crosstool?(type 'y' for yes)" INSTALL_CROSSTOOL | |
if [[ $INSTALL_CROSSTOOL = "y" ]] | |
then | |
mkdir -p /usr/local/arm | |
cd $PACKAGES | |
tar jxf $CROSSTOOL_PACKAGE.tar.bz2 -C $CROSS_ROOT | |
arm-linux-gcc -v | |
fi | |
echo STEP 3.2 copy arminclude, armlib, $QT_PACKAGE/include and lib/ into crosstool directory | |
read -p "DO you want to copy libs and headers into crosstool dir?(type 'y' for yes)" COPY_LIBS | |
if [[ $COPY_LIBS = "y" ]] | |
then | |
cd $PACKAGES | |
cp -rf arminclude.tar.gz armlib.tar.gz $QT_PACKAGE.tar.gz $YIZHI | |
cd $YIZHI | |
tar zxf arminclude.tar.gz | |
tar zxf armlib.tar.gz | |
tar zxf $QT_PACKAGE.tar.gz | |
cp -rf $YIZHI/armlib/* $CROSS_ROOT/$CROSS_VERSION/arm-linux/lib | |
cp -rf $YIZHI/arminclude/* $CROSS_ROOT/$CROSS_VERSION/arm-linux/include | |
cp -rf $YIZHI/$QT_PACKAGE/lib/* $CROSS_ROOT/$CROSS_VERSION/arm-linux/lib | |
cp -rf $YIZHI/$QT_PACKAGE/include/* $CROSS_ROOT/$CROSS_VERSION/arm-linux/include | |
fi | |
echo STEP 3.3 build qtopia-2.2.0 tools: uic and qvfb | |
read -p "DO you want to compile qt?(type 'y' for yes)" COMPILE_QT | |
if [[ $COMPILE_QT = "y" ]] | |
then | |
cd $PACKAGES | |
tar xzf $QTOPIA_SRC_PACKAGE.tar.gz -C $YIZHI/host/ | |
tar xzf $QTOPIA_SRC_PACKAGE.tar.gz -C $YIZHI/ | |
cd $YIZHI/host/$QTOPIA_SRC | |
./configure | |
make | |
cp -rf $YIZHI/host/$QTOPIA_SRC/qt2/bin/uic $YIZHI/$QTOPIA_SRC/qt2/bin/ | |
fi | |
echo STEP 4 cross-compile qtopia | |
echo STEP 4.1 edit files for cross-compiling | |
read -p "Do you want to edit files for cross-compiling?(type 'y' for yes)" EDIT_CROSS_FILES | |
if [[ $EDIT_CROSS_FILES = 'y' ]] | |
then | |
echo STEP 4.1.1 edit $YIZHI/$QTOPIA_SRC/qtopia/mkspecs/qws/linux-arm-g++/qmake.conf | |
chmod u+w $YIZHI/$QTOPIA_SRC/qtopia/mkspecs/qws/linux-arm-g++/qmake.conf | |
read -p 'DIY: search& replace "QMAKE_LIBS_QT = -lqte" with "QMAKE_LIBS_QT = -lqte -lpng -lz -luuid -ljpeg", press [ENTER] to continue...' | |
vi $YIZHI/$QTOPIA_SRC/qtopia/mkspecs/qws/linux-arm-g++/qmake.conf | |
chmod u-w $YIZHI/$QTOPIA_SRC/qtopia/mkspecs/qws/linux-arm-g++/qmake.conf | |
echo STEP 4.1.2 #if want support mouse, edit $YIZHI/$QTOPIA_SRC/qtopia/src/qt/qconfig-qpe.h | |
read -p 'DIY: search "#ifndef QT_NO_QWS_CURSOR" and comment out the whole code block, press [ENTER] to continue...' | |
vi $YIZHI/$QTOPIA_SRC/qtopia/src/qt/qconfig-qpe.h | |
echo STEP 4.1.3 copy ipaq header and lib into arm | |
cd $YIZHI/$QTOPIA_SRC/qtopia/src/libraries/qtopia | |
cp -rf custom-linux-ipaq-g++.cpp custom-linux-arm-g++.cpp | |
cp -rf custom-linux-ipaq-g++.h custom-linux-arm-g++.h | |
echo STEP 4.1.4 comment "#include <linux/version.h>" in $CROSS_ROOT/$CROSS_VERSION/arm-linux/sys-include/linux/videodev.h | |
read -p 'DIY: search "#include <linux/version.h>" and comment it out, press [ENTER] to continue...' | |
vi $CROSS_ROOT/$CROSS_VERSION/arm-linux/sys-include/linux/videodev.h | |
fi | |
echo STEP 4.2 setup environment variables | |
echo STEP 4.3 build qtopia | |
echo INFO: try typing below by hand instead of copying if not working. | |
read -p "DO you want to compile qtopia?(type 'y' for yes)" COMPILE_QTOPIA | |
if [[ $COMPILE_QTOPIA = "y" ]] | |
then | |
cd $PACKAGES | |
tar xzf qtopia.tar.gz | |
cp -rf qtopia/lib/libqte.so* $YIZHI/$QTOPIA_SRC/qtopia/lib | |
cd $YIZHI/$QTOPIA_SRC | |
./configure -qte '-embedded -xplatform linux-arm-g++ -qconfig qpe -no-qvfb -depths 8,16,24,32 -no-xft -system-jpeg -system-libpng -system-zlib -gif -thread -release -I/root/yizhi/arminclude -L/root/yizhi/armlib -lpng -lz -luuid -ljpeg' -qpe '-xplatform linux-arm-g++ -edition pda -displaysize 640*480 -I/root/yizhi/armiinclude -L/root/yizhi/armlib -prefix=/root/yizhi/qtopia' | |
make | |
make install | |
fi | |
echo STEP 4.4 copy all needed libraries into newly built qtopia/lib | |
cp -rf $YIZHI/armlib/*.so* $YIZHI/qtopia/lib | |
cd $PACKAGES | |
echo INFO: THE END. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment