probonopd / linuxdeployqt

Makes Linux applications self-contained by copying in the libraries and plugins that the application uses, and optionally generates an AppImage. Can be used for Qt and other applications
Other
2.15k stars 407 forks source link

Make it super simple to use on Travis CI #81

Open probonopd opened 7 years ago

probonopd commented 7 years ago

A common use case for linuxdeployqt is to use it on Travis CI after the make command.

Currently quite some hoops are necessary. We should make linuxdeployqt so intelligent as to be a one-line operation, ideally replacing most of the manual work of

language: cpp
compiler: gcc
sudo: require
dist: trusty

before_install:
    - sudo add-apt-repository ppa:beineri/opt-qt58-trusty -y
    - sudo apt-get update -qq

install: 
    - sudo apt-get -y install qt58base
    - source /opt/qt58/bin/qt58-env.sh

script:
  - qmake PREFIX=/usr
  - make -j4
  - sudo apt-get -y install checkinstall
  - sudo checkinstall --pkgname=app --pkgversion="1" --pkgrelease="1" --backup=no --fstrans=no --default --deldoc 
  - mkdir appdir ; cd appdir
  - dpkg -x ../app_1-1_amd64.deb . ; find .
  - cp ./usr/share/applications/*.desktop .
  - cp ./usr/share/icons/hicolor/48x48/apps/*.png .
  - cd .. 
  - wget -c "https://github.com/probonopd/linuxdeployqt/releases/download/3/linuxdeployqt-3-x86_64.AppImage" 
  - chmod a+x linuxdeployqt*.AppImage
  - unset QTDIR; unset QT_PLUGIN_PATH ; unset LD_LIBRARY_PATH
  - ./linuxdeployqt*.AppImage ./appdir/usr/bin/* -bundle-non-qt-libs -qmldir=$(readlink -f /opt/qt5*/qml/)
  - ./linuxdeployqt*.AppImage ./appdir/usr/bin/* -appimage -qmldir=$(readlink -f /opt/qt5*/qml/)
  - find ./appdir -executable -type f -exec ldd {} \; | grep " => /usr" | cut -d " " -f 2-3 | sort | uniq
  - curl --upload-file ./APPNAME*.AppImage https://transfer.sh/APPNAME-git.$(git rev-parse --short HEAD)-x86_64.AppImage 

We could, as part of linuxdeployqt and/or the underlying appimagetool,

In the current continuous build, the following is implemented:

language: cpp
compiler: gcc
sudo: require
dist: trusty

before_install:
    - sudo add-apt-repository ppa:beineri/opt-qt58-trusty -y
    - sudo apt-get update -qq

install: 
    - sudo apt-get -y install qt58base
    - source /opt/qt58/bin/qt58-env.sh

script:
  - qmake PREFIX=/usr
  - make -j4
  - sudo make INSTALL_ROOT=appdir install ; sudo chown -R $USER appdir ; find appdir/

after_success:
  - wget -c "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage" 
  - chmod a+x linuxdeployqt*.AppImage
  - unset QTDIR; unset QT_PLUGIN_PATH ; unset LD_LIBRARY_PATH
  - ./linuxdeployqt*.AppImage ./appdir/usr/share/applications/*.desktop -bundle-non-qt-libs
  - ./linuxdeployqt*.AppImage ./appdir/usr/share/applications/*.desktop -appimage
  - find ./appdir -executable -type f -exec ldd {} \; | grep " => /usr" | cut -d " " -f 2-3 | sort | uniq
  - curl --upload-file ./APPNAME*.AppImage https://transfer.sh/APPNAME-git.$(git rev-parse --short HEAD)-x86_64.AppImage

Note that if qmake does not allow for make install or does not install the desktop file and icon, then change it similar to https://github.com/probonopd/FeedTheMonkey/blob/master/FeedTheMonkey.pro.

probonopd commented 7 years ago

Similar build procedures used for

Attention: These might all suffer from https://github.com/probonopd/linuxdeployqt/issues/80 - to be fixed.

Once this is closed, should see if we can simplify their .travis.yml files.