From 3f7c5df0a3672753567728e10004a84e315cb95f Mon Sep 17 00:00:00 2001 From: rakslice Date: Wed, 21 Jun 2017 23:04:12 -0700 Subject: [PATCH] Travis Mac build config (#184) * deploy_mac update guess * add travis config for mac * update for brew QTDIR * travis: add language setting * fix qmake path * travis: cache homebrew downloads * travis: qmake script step issues * travis: try skipping brew update for speed * travis: fix build dir * travis mac: add mpv install * travis mac: build with Qt multimedia * travis mac: remove unwanted dir change * more deploy paths tweaks * travis mac: fix deploy script failure due to existing dir * on tag, zip orion.api and upload to github releases using GITHUB_API_KEY from travis environment settings * a note about the github access token * add s3 upload provider; run providers on all branches * fix travis yaml spacing * travis mac: make zip non-conditional; use artifacts dir for zip as s3 deploy doesn't seem to support file param * travis mac: if statement missing then * travis mac: not sure what's up with existing orion.app, but let's try not clobbering it * reenable fixlibs * fix deploy_mac working directory for fixlibs * trying something else * specify qt version * correct brew formula version * fix typo * travis mac: use QTDIR value from brew installed package details * eliminate non-functional export * Revert "eliminate non-functional export" This reverts commit c8f97c785f30db5a58ddf1b848a10fef9e452d08. * remove array wrapper from jq output * remove quotes from jq output * in fixlibs also handle dylibs with $QTDIR/lib absolute references instead of rpaths * add more lib paths fo fixlibs * preserve symlinks * cleanup * travis mac: remove unused QTVER * travis mac: clarify comments * travis mac: clarify mac-specific parts for future non-mac travis builds * travis mac: fix env var --- .travis.yml | 58 +++++++++++++++++++++++++++++++++++++++++ distfiles/deploy_mac.sh | 25 ++++++------------ distfiles/fixlibs.sh | 40 ++++++++++++++++------------ 3 files changed, 90 insertions(+), 33 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..dc638e0 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,58 @@ +os: + - osx + +env: + - QTBREWVER=5.9 + +language: cpp + +compiler: + - clang + +cache: + directories: + - $HOME/Library/Caches/Homebrew + +before_install: + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install qt@$QTBREWVER jq; fi + +script: + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export QTDIR=$(brew info --json=v1 qt | jq -r '.[0].bottle.stable.cellar + "/" + .[0].name + "/" + .[0].installed[0].version'); fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export ORIONCONFIG=multimedia; fi + - $QTDIR/bin/qmake orion.pro CONFIG+=$ORIONCONFIG + - make + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then bash distfiles/deploy_mac.sh; fi + - mkdir -p artifacts + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then zip -vr --symlinks artifacts/orion.app.zip orion.app/; fi + +deploy: + - provider: releases + # To use this, create a Github token with the "public_repo" permission, and create an env var GITHUB_API_KEY in the Travis' project settings, making sure "Display value in build log" is set to OFF + api_key: '$GITHUB_API_KEY' + file: 'artifacts/orion.app.zip' + skip_cleanup: true + on: + tags: true + all_branches: true + # To use this, create an AWS S3 bucket with public read access, create IAM policy with the text below replacing the placeholder with the bucket name, + # create an AWS user for automation (with access key/secret) and give them that IAM policy, and set the env vars indicated in the Travis' project settings, making sure "Display value in build log" is set to OFF + - provider: s3 + access_key_id: "$AWS_ACCESS_KEY_ID" + secret_access_key: "$AWS_SECRET_ACCESS_KEY" + bucket: "$AWS_S3_BUCKET" + region: "$AWS_REGION" + # Example policy to allow writes to a bucket + # { + # "Version": "2012-10-17", + # "Statement": [ + # { + # "Effect": "Allow", + # "Action": "s3:PutObject", + # "Resource": "arn:aws:s3:::BUCKET-NAME-GOES-HERE/*" + # } + # ] + # } + local_dir: artifacts + skip_cleanup: true + on: + all_branches: true diff --git a/distfiles/deploy_mac.sh b/distfiles/deploy_mac.sh index 873c6bf..752aad9 100644 --- a/distfiles/deploy_mac.sh +++ b/distfiles/deploy_mac.sh @@ -1,24 +1,15 @@ #!/bin/bash - -QTVER=5.5 +set -e -x # macdeploy -~/Qt/$QTVER/clang_64/bin/macdeployqt orion.app -qmldir=~/git/orion/src/qml +$QTDIR/bin/macdeployqt orion.app -qmldir=./src/qml # qml libs -mkdir orion.app/Contents/Resources/qml -cp -r ~/Qt/$QTVER/clang_64/qml/Enginio orion.app/Contents/Resources/qml -cp -r ~/Qt/$QTVER/clang_64/qml/Qt orion.app/Contents/Resources/qml -cp -r ~/Qt/$QTVER/clang_64/qml/QtQml orion.app/Contents/Resources/qml -cp -r ~/Qt/$QTVER/clang_64/qml/QtQuick orion.app/Contents/Resources/qml -cp -r ~/Qt/$QTVER/clang_64/qml/QtQuick.2 orion.app/Contents/Resources/qml -cp -r ~/Qt/$QTVER/clang_64/qml/QtWebEngine orion.app/Contents/Resources/qml -cp -r ~/Qt/$QTVER/clang_64/qml/Communi orion.app/Contents/Resources/qml - -# additional frameworks -cp -r ~/Qt/$QTVER/clang_64/lib/IrcCore.framework orion.app/Contents/Frameworks/IrcCore.framework -cp -r ~/Qt/$QTVER/clang_64/lib/IrcModel.framework orion.app/Contents/Frameworks/IrcModel.framework -cp -r ~/Qt/$QTVER/clang_64/lib/IrcUtil.framework orion.app/Contents/Frameworks/IrcUtil.framework +mkdir -p orion.app/Contents/Resources/qml +cp -r $QTDIR/qml/Qt orion.app/Contents/Resources/qml +cp -r $QTDIR/qml/QtQml orion.app/Contents/Resources/qml +cp -r $QTDIR/qml/QtQuick orion.app/Contents/Resources/qml +cp -r $QTDIR/qml/QtQuick.2 orion.app/Contents/Resources/qml -sh fixlibs.sh orion.app +sh distfiles/fixlibs.sh orion.app diff --git a/distfiles/fixlibs.sh b/distfiles/fixlibs.sh index dc59dca..8e24ead 100644 --- a/distfiles/fixlibs.sh +++ b/distfiles/fixlibs.sh @@ -4,52 +4,60 @@ DIR=$1 #Qt frameworks -FRAMEWORKS="QtOpenGL QtWidgets QtGui QtCore QtWebEngine QtQuick QtQml QtNetwork QtMultimedia QtWebChannel QtWebEngineCore" +FRAMEWORKS="QtOpenGL QtWidgets QtGui QtCore QtQuick QtQml QtNetwork QtMultimedia" echo "Fixing lib paths..." + +echo "- orion" for FRAMEWORK in $FRAMEWORKS; do - echo $FRAMEWORK + echo " $FRAMEWORK" install_name_tool -id @executable_path/../Frameworks/$FRAMEWORK.framework/Versions/5/$FRAMEWORK \ $DIR/Contents/Frameworks/$FRAMEWORK.framework/Versions/5/$FRAMEWORK install_name_tool -change @rpath/$FRAMEWORK.framework/Versions/5/$FRAMEWORK \ @executable_path/../Frameworks/$FRAMEWORK.framework/Versions/5/$FRAMEWORK \ $DIR/Contents/MacOS/orion -done - -#QtQuick.2 dylib -FRAMEWORKS="QtQuick QtQml QtNetwork QtCore QtGui" -for FRAMEWORK in $FRAMEWORKS; do - echo $FRAMEWORK - install_name_tool -id @executable_path/../Frameworks/$FRAMEWORK.framework/Versions/5/$FRAMEWORK \ - $DIR/Contents/Frameworks/$FRAMEWORK.framework/Versions/5/$FRAMEWORK - install_name_tool -change @rpath/$FRAMEWORK.framework/Versions/5/$FRAMEWORK \ + install_name_tool -change $QTDIR/lib/$FRAMEWORK.framework/Versions/5/$FRAMEWORK \ @executable_path/../Frameworks/$FRAMEWORK.framework/Versions/5/$FRAMEWORK \ - $DIR/Contents/Resources/qml/QtQuick.2/libqtquick2plugin.dylib + $DIR/Contents/MacOS/orion done -#QtWebEngine -FRAMEWORKS="QtWebEngine QtWebEngineCore QtQuick QtQml QtCore QtNetwork QtGui QtWebChannel" +for ref in Resources/qml/{QtQuick/{Window.2/libwindow,Controls/libqtquickcontrols,Controls/Styles/Flat/libqtquickextrasflat,Controls.2/{libqtquickcontrols2,Material/libqtquickcontrols2materialstyle,Universal/libqtquickcontrols2universalstyle},Dialogs/{libdialog,Private/libdialogsprivate},Extras/libqtquickextras,LocalStorage/libqmllocalstorage,Particles.2/libparticles,PrivateWidgets/libwidgets,Scene2D/libqtquickscene2d,Scene3D/libqtquickscene3d,VirtualKeyboard/Styles/libqtvirtualkeyboardstyles,XmlListModel/libqmlxmllistmodel,Templates.2/libqtquicktemplates2,Layouts/libqquicklayouts},QtQuick.2/libqtquick2,Qt/labs/{calendar/libqtlabscalendar,folderlistmodel/libqmlfolderlistmodel,platform/libqtlabsplatform,settings/libqmlsettings,sharedimage/libsharedimage},QtQml/Models.2/libmodels}plugin.dylib PlugIns/quick/lib{models,qquicklayouts,qtquickcontrols2{material,universal}style,qtquickcontrols{,2},qtquickextrasflat,qtquicktemplates2,widgets,window}plugin.dylib Resources/qml/QtQml/StateMachine/libqtqmlstatemachine.dylib; do +echo "- $ref" + +FRAMEWORKS="QtQuick QtQuickControls2 QtQuickTemplates2 QtQml QtNetwork QtCore QtGui QtWidgets" for FRAMEWORK in $FRAMEWORKS; do - echo $FRAMEWORK + echo " $FRAMEWORK" install_name_tool -id @executable_path/../Frameworks/$FRAMEWORK.framework/Versions/5/$FRAMEWORK \ $DIR/Contents/Frameworks/$FRAMEWORK.framework/Versions/5/$FRAMEWORK install_name_tool -change @rpath/$FRAMEWORK.framework/Versions/5/$FRAMEWORK \ @executable_path/../Frameworks/$FRAMEWORK.framework/Versions/5/$FRAMEWORK \ - $DIR/Contents/Resources/qml/QtWebEngine/libqtwebengineplugin.dylib + $DIR/Contents/$ref + + install_name_tool -change $QTDIR/lib/$FRAMEWORK.framework/Versions/5/$FRAMEWORK \ + @executable_path/../Frameworks/$FRAMEWORK.framework/Versions/5/$FRAMEWORK \ + $DIR/Contents/$ref +done done +echo "- multimedia" + #Multimedia libs FRAMEWORKS="QtGui QtCore QtQuick QtQml QtNetwork QtMultimedia QtMultimediaQuick_p" for FRAMEWORK in $FRAMEWORKS; do + echo " $FRAMEWORK" install_name_tool -id @executable_path/../Frameworks/$FRAMEWORK.framework/Versions/5/$FRAMEWORK \ $DIR/Contents/Frameworks/$FRAMEWORK.framework/Versions/5/$FRAMEWORK install_name_tool -change @rpath/$FRAMEWORK.framework/Versions/5/$FRAMEWORK \ @executable_path/../Frameworks/$FRAMEWORK.framework/Versions/5/$FRAMEWORK \ $DIR/Contents/Resources/qml/QtMultimedia/libdeclarative_multimedia.dylib + + install_name_tool -change $QTDIR/lib/$FRAMEWORK.framework/Versions/5/$FRAMEWORK \ + @executable_path/../Frameworks/$FRAMEWORK.framework/Versions/5/$FRAMEWORK \ + $DIR/Contents/Resources/qml/QtMultimedia/libdeclarative_multimedia.dylib done