Travis: MacOS & fcitx support (#118)

travis add MacOS support & fcitx support for AppImage
This commit is contained in:
Ahmed Zetao Yang
2018-02-19 22:12:52 +08:00
committed by Dharkael
parent 58f8d4131e
commit 8bff093839
3 changed files with 86 additions and 16 deletions

View File

@@ -5,8 +5,9 @@ services:
language: cpp
os:
- linux
branches:
only:
- master
cache:
directories:
@@ -21,26 +22,43 @@ env:
- ARCH=x86_64
# - DOCKER_REPO=packpack/packpack
- DOCKER_REPO=vitzy/packpack
matrix:
#The actual list of distribution is available on
#https://hub.docker.com/r/packpack/packpack/tags/
#https://hub.docker.com/r/vitzy/packpack/tags/
- OS=fedora DIST=26
- OS=fedora DIST=27
# trusty: only for build & test & AppImage
- OS=ubuntu DIST=trusty #14.04 LTS; Qt version is 5.2.1, flameshot not support
- OS=ubuntu DIST=xenial #16.04 LTS
- OS=ubuntu DIST=artful #17.10
- OS=debian DIST=jessie #8
- OS=debian DIST=stretch #9
#The actual list of distribution is available on
#https://hub.docker.com/r/packpack/packpack/tags/
#https://hub.docker.com/r/vitzy/packpack/tags/
matrix:
include:
- os: linux
env: OS=fedora DIST=26
- os: linux
env: OS=fedora DIST=27
- os: linux
# trusty: only for build & test & AppImage
# 14.04 LTS; Qt version is 5.2.1, flameshot not support
env: OS=ubuntu DIST=trusty
- os: linux
# 16.04 LTS
env: OS=ubuntu DIST=xenial
- os: linux
# 17.10
env: OS=ubuntu DIST=artful
- os: linux
# 8
env: OS=debian DIST=jessie
- os: linux
# 9
env: OS=debian DIST=stretch
- os: osx
compiler: clang
osx_image: xcode9.2
before_install:
- if [[ "${TRAVIS_OS_NAME}" == "linux" && "${DIST}" == "trusty" ]]; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test; fi
- if [[ "${TRAVIS_OS_NAME}" == "linux" && "${DIST}" == "trusty" ]]; then sudo apt-get -qq update ; fi
# - export VERSION=0.5.0
before_script:
- if [[ "${TRAVIS_OS_NAME}" == "linux" && "${DIST}" == "trusty" ]]; then chmod +x .travis_linux.sh ; fi
- if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then chmod +x .travis_macos.sh ; fi
install:
- if [[ "${TRAVIS_OS_NAME}" == "linux" && "${DIST}" == "trusty" ]]; then sudo apt-get install -qq git; sudo apt-get install -qq build-essential ; fi
@@ -54,6 +72,7 @@ script:
# - git submodule update --init --recursive
# - git describe --long
- if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then bash ./.travis_linux.sh ; fi
- if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then bash ./.travis_macos.sh ; fi
- pwd && ls
# deploy:
@@ -61,7 +80,7 @@ script:
# provider: releases
# api_key: "GITHUB ENCYPTED OAUTH TOKEN"
# file_glob: true
# file: dist/*.{deb,rpm,AppImage}
# file: dist/*.{deb,rpm,AppImage,dmg}
# skip_cleanup: true
# on:
# tags: true

View File

@@ -31,6 +31,9 @@ elif [[ "${DIST}" == "trusty" ]]; then
source /opt/qt53/bin/qt53-env.sh && qmake --version
export CC=gcc-4.9 CXX=g++-4.9
# Install fcitx-frontend-qt5
sudo apt-get -y install fcitx-frontend-qt5
mkdir build-test
qmake QMAKE_CXX=$CXX QMAKE_CC=$CC QMAKE_LINK=$CXX DESTDIR=$BUILD_DST_PATH
# Building flameshot
@@ -79,6 +82,7 @@ elif [[ "${DIST}" == "trusty" ]]; then
./linuxdeployqt $APPIMAGE_DST_PATH/appdir/usr/bin/flameshot -bundle-non-qt-libs
rm -f $APPIMAGE_DST_PATH/appdir/usr/lib/libatk-1.0.so.0
cp /usr/lib/x86_64-linux-gnu/qt5/plugins/platforminputcontexts/libfcitxplatforminputcontextplugin.so $APPIMAGE_DST_PATH/appdir/usr/plugins/platforminputcontexts/
cd $APPIMAGE_DST_PATH/appdir/usr/bin
ln -sf ../plugins/platforms/ . # An unknown bug
cd ${project_dir}

47
.travis_macos.sh Normal file
View File

@@ -0,0 +1,47 @@
#!/bin/bash
project_dir=$(pwd)
brew update > /dev/null
brew install qt
QTDIR="/usr/local/opt/qt"
PATH="$QTDIR/bin:$PATH"
LDFLAGS=-L$QTDIR/lib
CPPFLAGS=-I$QTDIR/include
# Build your app
cd ${project_dir}
mkdir dist
mkdir build
cd build
qmake -version
qmake CONFIG-=debug CONFIG+=release CONFIG+=packaging ../flameshot.pro
make -j$(nproc)
git clone https://github.com/aurelien-rainone/macdeployqtfix.git
pwd && ls
ls /Users/travis/build/ZetaoYang/flameshot
# Package DMG from build/flamshot.app directory
$QTDIR/bin/macdeployqt flameshot.app
python ${project_dir}/build/macdeployqtfix/macdeployqtfix.py flameshot.app/Contents/MacOS/flameshot $QTDIR
cd ${project_dir}/build
mkdir -p distrib/Flameshot
cd distrib/Flameshot
mv ${project_dir}/build/flameshot.app ${project_dir}/build/distrib/Flameshot/
cp "${project_dir}/LICENSE" "LICENSE"
cp "${project_dir}/README.md" "README.md"
echo ${VERSION} > version
echo "${TRAVIS_COMMIT}" >> version
ln -s /Applications ./Applications
cd ..
hdiutil create -srcfolder ./Flameshot -format UDBZ ./flameshot.dmg
mv flameshot.dmg flameshot_X64_$VERSION.dmg
mv flameshot_X64_$VERSION.dmg ${project_dir}/dist/flameshot_X64_$VERSION.dmg
curl --upload-file ./flameshot_X64_$VERSION.dmg "https://transfer.sh/flameshot_X64_$VERSION.dmg"
cd ..
exit 0