|
| 1 | +#!/bin/bash |
| 2 | +project_dir=$(pwd) |
| 3 | + |
| 4 | +# Complain when not in Travis environment |
| 5 | +if [ -z ${TRAVIS_COMMIT+x} ]; then |
| 6 | + echo "This script is intended to be used only in Travis CI environment." |
| 7 | + echo "To build q5Go from source, please see the [documentation](https://tamlok.github.io/q5Go/en_us/#!docs/Developers/Build%20q5Go.md)." |
| 8 | + exit 1 |
| 9 | +fi |
| 10 | + |
| 11 | +# Install qt5.9 |
| 12 | +sudo add-apt-repository ppa:george-edison55/cmake-3.x -y |
| 13 | +sudo add-apt-repository ppa:beineri/opt-qt597-trusty -y |
| 14 | +sudo apt-get update -qq |
| 15 | +sudo apt-get -y install qt59base qt59webchannel qt59svg qt59location qt59tools qt59translations |
| 16 | +source /opt/qt*/bin/qt*-env.sh |
| 17 | + |
| 18 | +# Compile newer version fcitx-qt5 |
| 19 | +sudo apt-get -y install fcitx-libs-dev libgl1-mesa-dev bison |
| 20 | +sudo apt-get -y install cmake |
| 21 | + |
| 22 | +wget http://xkbcommon.org/download/libxkbcommon-0.5.0.tar.xz |
| 23 | +tar xf libxkbcommon-0.5.0.tar.xz |
| 24 | +cd libxkbcommon-0.5.0 |
| 25 | +./configure -prefix=/usr -libdir=/usr/lib/x86_64-linux-gnu -disable-x11 |
| 26 | +make -j$(nproc) && sudo make install |
| 27 | + |
| 28 | +git clone git://anongit.kde.org/extra-cmake-modules |
| 29 | +cd extra-cmake-modules |
| 30 | +mkdir build && cd build |
| 31 | +cmake .. |
| 32 | +make -j$(nproc) && sudo make install |
| 33 | + |
| 34 | +git clone https://github.com/fcitx/fcitx-qt5 |
| 35 | +cd fcitx-qt5 |
| 36 | +git checkout 1.0.5 |
| 37 | +cmake . |
| 38 | +make -j$(nproc) && sudo make install |
| 39 | + |
| 40 | +# Copy fcitx-qt5 files to qt |
| 41 | +sudo cp /usr/local/lib/libFcitxQt5DBusAddons.so* /opt/qt*/lib/ |
| 42 | +sudo cp /usr/local/lib/libFcitxQt5WidgetsAddons.so* /opt/qt*/lib/ |
| 43 | + |
| 44 | +tree /opt/qt59/lib/ |
| 45 | + |
| 46 | +cd ${project_dir} |
| 47 | +mkdir build |
| 48 | +cd build |
| 49 | +qmake -v |
| 50 | +qmake CONFIG+=release -spec linux-g++-64 ../q5Go.pro |
| 51 | +make -j$(nproc) |
| 52 | + |
| 53 | +# |
| 54 | +# Pack AppImage using linuxdeployqt |
| 55 | +# |
| 56 | +mkdir dist |
| 57 | +INSTALL_ROOT=${project_dir}/build/dist make install ; tree dist/ |
| 58 | + |
| 59 | +# Copy SVG module |
| 60 | +mkdir -p ./dist/usr/plugins/iconengines |
| 61 | +mkdir -p ./dist/usr/plugins/imageformats |
| 62 | +mkdir -p ./dist/usr/plugins/platforminputcontexts |
| 63 | +cp /opt/qt59/plugins/iconengines/* ./dist/usr/plugins/iconengines/ |
| 64 | +cp /opt/qt59/plugins/imageformats/* ./dist/usr/plugins/imageformats/ |
| 65 | +cp /opt/qt59/plugins/platforminputcontexts/* ./dist/usr/plugins/platforminputcontexts/ |
| 66 | + |
| 67 | +# Copy other project files |
| 68 | +cp "${project_dir}/README.md" "dist/README.md" |
| 69 | +cp "${project_dir}/LICENSE" "dist/LICENSE" |
| 70 | +echo ${version} > ./dist/version |
| 71 | +echo "${TRAVIS_COMMIT}" >> ./dist/version |
| 72 | + |
| 73 | +# Get linuxdeployqt tool |
| 74 | +git clone https://github.com/tamlok/q5Go-utils.git q5Go-utils.git |
| 75 | +cp q5Go-utils.git/linuxdeployqt-continuous-x86_64.AppImage ./linuxdeployqt-continuous-x86_64.AppImage |
| 76 | +# wget -c "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage" |
| 77 | +chmod a+x linuxdeployqt*.AppImage |
| 78 | +unset QTDIR; unset QT_PLUGIN_PATH ; unset LD_LIBRARY_PATH |
| 79 | +./linuxdeployqt*.AppImage ./dist/usr/share/applications/*.desktop -bundle-non-qt-libs -exclude-libs=libnss3,libnssutil3 |
| 80 | + |
| 81 | +# Copy translations |
| 82 | +cp /opt/qt59/translations/*_zh_CN.qm ./dist/usr/translations/ |
| 83 | + |
| 84 | +# Package it for the second time. |
| 85 | +./linuxdeployqt*.AppImage ./dist/usr/share/applications/*.desktop -appimage -exclude-libs=libnss3,libnssutil3 |
| 86 | + |
| 87 | +tree dist/ |
| 88 | + |
| 89 | +ls -l *.AppImage |
| 90 | + |
| 91 | +mv q5Go-*.AppImage q5Go-${version}-x86_64.AppImage |
| 92 | + |
| 93 | +cd .. |
| 94 | + |
| 95 | +exit 0 |
0 commit comments