Skip to content

Commit f612c46

Browse files
committed
(+)add travis configurations
1 parent 2e60f68 commit f612c46

File tree

3 files changed

+178
-0
lines changed

3 files changed

+178
-0
lines changed

.travis.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
dist: trusty
2+
sudo: required
3+
git:
4+
depth: 1
5+
language: cpp
6+
7+
matrix:
8+
include:
9+
- os: osx
10+
compiler: clang
11+
osx_image: xcode8
12+
13+
branches:
14+
only:
15+
- master
16+
17+
before_install:
18+
- if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test; fi
19+
- if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then sudo apt-get -qq update ; fi
20+
- export version="0.5"
21+
22+
install:
23+
- if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then sudo -E apt-get -yq --no-install-suggests --no-install-recommends --force-yes install p7zip-full ; fi
24+
- if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then sudo -E apt-get -yq --no-install-suggests --no-install-recommends --force-yes install chrpath ; fi
25+
- if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then sudo -E apt-get -yq --no-install-suggests --no-install-recommends --force-yes install openssl libssl-dev ; fi
26+
- if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then sudo -E apt-get -yq --no-install-suggests --no-install-recommends --force-yes install libgl1-mesa-dev ; fi
27+
- if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then sudo -E apt-get -yq --no-install-suggests --no-install-recommends --force-yes install tree ; fi
28+
- if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then sudo apt-get install -qq gcc-6; sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 100 ; fi
29+
- if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then sudo apt-get install -qq g++-6; sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-6 100 ; fi
30+
31+
before_script:
32+
- if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then chmod +x .travis_linux.sh ; fi
33+
- if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then chmod +x .travis_macos.sh ; fi
34+
35+
script:
36+
- if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then CXX="g++-6" CC="gcc-6" ./.travis_linux.sh ; fi
37+
- if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then ./.travis_macos.sh ; fi

.travis_linux.sh

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
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

.travis_macos.sh

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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+
exit 1
8+
fi
9+
10+
brew update > /dev/null
11+
brew install qt
12+
13+
QTDIR="/usr/local/opt/qt"
14+
PATH="$QTDIR/bin:$PATH"
15+
LDFLAGS=-L$QTDIR/lib
16+
CPPFLAGS=-I$QTDIR/include
17+
18+
# Build your app
19+
cd ${project_dir}
20+
mkdir build
21+
cd build
22+
qmake -v
23+
qmake CONFIG-=debug CONFIG+=release ../src/q5go.pro
24+
make -j2
25+
26+
git clone https://github.com/aurelien-rainone/macdeployqtfix.git
27+
28+
$QTDIR/bin/macdeployqt q5go.app
29+
python ../macdeployqtfix/macdeployqtfix.py q5go.app/Contents/MacOS/q5go $QTDIR
30+
31+
cd ${project_dir}/build
32+
mkdir -p distrib/q5Go
33+
cd distrib/q5go
34+
mv ../../q5go.app ./
35+
cp "${project_dir}/README.md" "README.md"
36+
echo "${version}" > version
37+
echo "${TRAVIS_COMMIT}" >> version
38+
39+
ln -s /Applications ./Applications
40+
41+
cd ..
42+
hdiutil create -srcfolder ./q5Go -format UDBZ ./q5Go.dmg
43+
mv q5Go.dmg q5Go-${version}-x64.dmg
44+
cd ..
45+
46+
exit 0

0 commit comments

Comments
 (0)