set -e PREFIX=~/opt/qt5pi ROOTFS_MOUNT=/mnt/rasp-pi-rootfs # On Ubuntu 14.04 do the following first to get the ia32-lib if [ `lsb_release -ds` -eq "Ubuntu 14.04 LTS" ] sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 lib32stdc++6 fi ### Get the RaspberryPi cross compilation tools git clone https://github.com/raspberrypi/tools.git mv tools rpi-tools ### Create the environment for building our cross compiled Qt mkdir qt-on-raspberry cd qt-on-raspberry ### Get the root file system and mount it # Get the latest Raspbian image wget http://downloads.raspberrypi.org/raspbian_latest mv raspbian_latest raspbian_latest.zip unzip raspbian_latest.zip sudo mkdir $ROOTFS_MOUNT # The offset is probably always the same due to the requirements for RaspberryPi SD Cards sudo mount -o loop,offset=62914560 2014-09-09-wheezy-raspbian.img $ROOTFS_MOUNT ### Get the Qt sources and cross compilation scripts git clone git://gitorious.org/cross-compile-tools/cross-compile-tools.git git clone git://gitorious.org/qt/qt5.git cd qt5 ./init-repository cd .. ### Fix symlinks and lib paths in the mounted rootfs cd cross-compile-tools sudo ./fixQualifiedLibraryPaths $ROOTFS_MOUNT ~/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc cd .. ### Compiling qtbase cd qt5/qtbase ./configure -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=~/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf- -sysroot $(ROOTFS_MOUNT) -opensource -confirm-license -optimized-qmake -reduce-exports -release -make libs -prefix $(PREFIX) make -j4 sudo make install cd .. ### Compile other packages for MODULE in qtimageformats qtsvg qtscript qtxmlpatterns qtdeclarative qtsensors qtgraphicaleffects qtlocation qtserialport qttools qtquick1 qtquickcontrols do cd $MODULE $PREFIX/bin/qmake . make -j4 sudo make install cd .. done ### Finish the modified Raspbian image cd .. sync sudo umount $ROOTFS_MOUNT