Skip to content

Commit c018349

Browse files
committed
Merge branch 'master' into find_qmake_in_exepath
2 parents 98f537a + bba42c7 commit c018349

File tree

17 files changed

+710
-161
lines changed

17 files changed

+710
-161
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,4 @@ Makefile*
3636
# QtCtreator CMake
3737
CMakeLists.txt.user
3838

39+
.idea

.travis.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,18 @@ env:
1111
before_install:
1212
- ./tests/tests-environment.sh
1313

14+
before_script:
15+
# fetch all tags
16+
- git fetch --unshallow
17+
1418
script:
1519
- ./tests/tests-ci.sh
1620

1721
after_success:
1822
- wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh
19-
- bash ./upload.sh ./linuxdeployqt-*.AppImage
23+
# quick fix for issue 223
24+
- if [ "$TRAVIS_BRANCH" != "master" ]; then export TRAVIS_EVENT_TYPE=pull_request; fi
25+
- bash ./upload.sh ./linuxdeployqt-*.AppImage*
2026

2127
after_script:
2228
- "xpra stop :99"

CMakeLists.txt

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# CMake configuration for linuxdeployqt
2+
# Not meant to replace the qmake build system, but for use with CMake based IDEs.
3+
4+
cmake_minimum_required(VERSION 3.2)
5+
6+
project(linuxdeployqt)
7+
8+
find_program(GIT git)
9+
10+
# make sure Git revision ID and latest tag is not stored in the CMake cache
11+
# otherwise, one would have to reset the CMake cache on every new commit to make sure the Git commit ID is up to date
12+
unset(GIT_COMMIT CACHE)
13+
unset(GIT_LATEST_TAG CACHE)
14+
15+
if("${GIT}" STREQUAL "GIT-NOTFOUND")
16+
message(FATAL_ERROR "Could not find git")
17+
endif()
18+
19+
# read Git revision ID and latest tag number
20+
execute_process(
21+
COMMAND "${GIT}" rev-parse --short HEAD
22+
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
23+
OUTPUT_VARIABLE GIT_COMMIT
24+
OUTPUT_STRIP_TRAILING_WHITESPACE
25+
RESULT_VARIABLE GIT_COMMIT_RESULT
26+
)
27+
if(NOT GIT_COMMIT_RESULT EQUAL 0)
28+
message(FATAL_ERROR "Failed to determine git commit ID")
29+
endif()
30+
mark_as_advanced(GIT_COMMIT GIT_COMMIT_RESULT)
31+
32+
execute_process(
33+
COMMAND "${GIT}" rev-list --tags --skip=1 --max-count=1
34+
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
35+
OUTPUT_VARIABLE GIT_TAG_ID
36+
OUTPUT_STRIP_TRAILING_WHITESPACE
37+
RESULT_VARIABLE GIT_TAG_ID_RESULT
38+
)
39+
if(NOT GIT_TAG_ID_RESULT EQUAL 0)
40+
message(FATAL_ERROR "Failed to determine git tag ID")
41+
endif()
42+
mark_as_advanced(GIT_TAG_ID GIT_TAG_ID_RESULT)
43+
44+
execute_process(
45+
COMMAND "${GIT}" describe --tags ${GIT_TAG_ID} --abbrev=0
46+
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
47+
OUTPUT_VARIABLE GIT_TAG_NAME
48+
OUTPUT_STRIP_TRAILING_WHITESPACE
49+
RESULT_VARIABLE GIT_TAG_NAME_RESULT
50+
)
51+
if(NOT GIT_TAG_NAME_RESULT EQUAL 0)
52+
message(FATAL_ERROR "Failed to determine git tag name")
53+
endif()
54+
mark_as_advanced(GIT_TAG_NAME GIT_TAG_NAME_RESULT)
55+
56+
# set version and build number
57+
set(VERSION 1-alpha)
58+
if("$ENV{TRAVIS_BUILD_NUMBER}" STREQUAL "")
59+
set(BUILD_NUMBER "<local dev build>")
60+
else()
61+
set(BUILD_NUMBER "$ENV{TRAVIS_BUILD_NUMBER}")
62+
endif()
63+
64+
# get current date
65+
execute_process(
66+
COMMAND env LC_ALL=C date -u "+%Y-%m-%d %H:%M:%S %Z"
67+
OUTPUT_VARIABLE DATE
68+
OUTPUT_STRIP_TRAILING_WHITESPACE
69+
RESULT_VARIABLE DATE_RESULT
70+
)
71+
if(NOT DATE_RESULT EQUAL 0)
72+
message(FATAL_ERROR "Failed to determine date string")
73+
endif()
74+
mark_as_advanced(DATE DATE_RESULT)
75+
76+
add_subdirectory(tools/linuxdeployqt)

LICENSE.GPLv3

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
GNU GENERAL PUBLIC LICENSE
22

3-
The Qt Toolkit is Copyright (C) 2016 The Qt Company Ltd.
3+
The Qt Toolkit is Copyright (C) 2016-18 The Qt Company Ltd.
44
Contact: http://www.qt.io/licensing/
55

66
You may use, distribute and copy the Qt Toolkit under the terms of

LICENSE.LGPLv3

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
GNU LESSER GENERAL PUBLIC LICENSE
22

3-
The Qt Toolkit is Copyright (C) 2016 The Qt Company Ltd.
3+
The Qt Toolkit is Copyright (C) 2016-18 The Qt Company Ltd.
44
Contact: http://www.qt.io/licensing/
55

66
You may use, distribute and copy the Qt Toolkit under the terms of

README.md

Lines changed: 94 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# linuxdeployqt [![Build Status](https://travis-ci.org/probonopd/linuxdeployqt.svg?branch=master)](https://travis-ci.org/probonopd/linuxdeployqt) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/93b4a359057e412b8a7673b4b61d7cb7)](https://www.codacy.com/app/probonopd/linuxdeployqt?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=probonopd/linuxdeployqt&amp;utm_campaign=Badge_Grade) [![discourse](https://img.shields.io/badge/forum-discourse-orange.svg)](http://discourse.appimage.org/t/linuxdeployqt-new-linux-deployment-tool-for-qt/57) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/probonopd/AppImageKit?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![irc](https://img.shields.io/badge/IRC-%23AppImage%20on%20freenode-blue.svg)](https://webchat.freenode.net/?channels=AppImage)
22

3-
This Linux Deployment Tool for Qt, `linuxdeployqt`, takes an application as input and makes it self-contained by copying in the Qt libraries and plugins that the application uses into a bundle. This can optionally be put into an [AppImage](http://appimage.org/), and, using [fpm](https://github.com/probonopd/linuxdeployqt/issues/9), into cross-distro deb and rpm packages.
3+
This Linux Deployment Tool, `linuxdeployqt`, takes an application as input and makes it self-contained by copying in the resources that the application uses (like libraries, graphics, and plugins) into a bundle. The resulting bundle can be distributed as an AppDir or as an [AppImage](https://appimage.org/) to users, or can be put into cross-distribution packages. It can be used as part of the build process to deploy applications written in C, C++, and other compiled languages with systems like `CMake`, `qmake`, and `make`. When used on Qt-based applications, it can bundle a specific minimal subset of Qt required to run the application.
4+
5+
![](https://user-images.githubusercontent.com/2480569/34471167-d44bd55e-ef41-11e7-941e-e091a83cae38.png)
46

57
## Differences to macdeployqt
68
This tool is conceptually based on the [Mac Deployment Tool](http://doc.qt.io/qt-5/osx-deployment.html), `macdeployqt` in the tools applications of the Qt Toolkit, but has been changed to a slightly different logic and other tools needed for Linux.
@@ -22,16 +24,17 @@ Please download __linuxdeployqt-x86_64.AppImage__ from the [Releases](https://gi
2224
Usage: linuxdeployqt app-binary [options]
2325
2426
Options:
25-
-verbose=<0-3> : 0 = no output, 1 = error/warning (default), 2 = normal, 3 = debug
26-
-no-plugins : Skip plugin deployment
27-
-appimage : Create an AppImage
28-
-no-strip : Don't run 'strip' on the binaries
29-
-bundle-non-qt-libs : Also bundle non-core, non-Qt libraries
30-
-executable=<path> : Let the given executable use the deployed libraries too
31-
-qmldir=<path> : Scan for QML imports to bundle from the given directory, determined by Qt's qmlimportscanner
32-
-always-overwrite : Copy files even if the target file exists
33-
-qmake=<path> : The qmake executable to use
34-
-no-translations : Skip deployment of translations
27+
-verbose=<0-3> : 0 = no output, 1 = error/warning (default), 2 = normal, 3 = debug
28+
-no-plugins : Skip plugin deployment
29+
-appimage : Create an AppImage
30+
-no-strip : Don't run 'strip' on the binaries
31+
-bundle-non-qt-libs : Also bundle non-core, non-Qt libraries
32+
-executable=<path> : Let the given executable use the deployed libraries too
33+
-qmldir=<path> : Scan for QML imports to bundle from the given directory, determined by Qt's qmlimportscanner
34+
-always-overwrite : Copy files even if the target file exists
35+
-qmake=<path> : The qmake executable to use
36+
-no-translations : Skip deployment of translations
37+
-extra-plugins=<list> : List of extra plugins which should be deployed, separated by comma
3538
3639
linuxdeployqt takes an application as input and makes it
3740
self-contained by copying in the Qt libraries and plugins that
@@ -40,12 +43,43 @@ the application uses.
4043

4144
#### Simplest example
4245

43-
Given that a desktop file should be provided with an AppImage, `linuxdeployqt` can use that to determine the parameters of the build.
46+
You'll need to provide the basic structure of an `AppDir` which should look something like this:
47+
```
48+
└── usr
49+
├── bin
50+
│   └── your_app
51+
├── lib
52+
└── share
53+
├── applications
54+
│   └── your_app.desktop
55+
└── icons
56+
└── <theme>
57+
└── <resolution>
58+
└── apps
59+
└── your_app.png
60+
```
61+
Replace `<theme>` and `<resolution>` with (for example) `hicolor` and `256x256` respectively; see [icon theme spec](https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html) for more details.
62+
63+
64+
Using the desktop file `linuxdeployqt` can determine the parameters of the build.
4465

45-
`linuxdeployqt ./path/to/appdir/usr/share/application_name.desktop`
66+
Where your desktop file would look something like:
67+
```
68+
[Desktop Entry]
69+
Type=Application
70+
Name=Amazing Qt App
71+
Comment=The best Qt Application Ever
72+
Exec=your_app
73+
Icon=your_app
74+
Categories=Office;
75+
```
76+
77+
* Notice that both `Exec` and `Icon` only have file names.
78+
* Also Notice that the `Icon` entry does not include an extension.
4679

47-
Where the _desktop_ file specifies the executable to be run (with `EXEC=`), the name of the applications and an icon.
48-
See [desktop file specification](https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html).
80+
Read more about desktop files in the [freedesktop specification here](https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html).
81+
82+
Now you can say: `linuxdeployqt-continuous-x86_64.AppImage path/to/AppDir/usr/share/applications/your_app.desktop`
4983

5084
For a more detailed example, see "Using linuxdeployqt with Travis CI" below.
5185

@@ -78,6 +112,18 @@ find $HOME/build-*-*_Qt_* \( -name "moc_*" -or -name "*.o" -or -name "qrc_*" -or
78112

79113
Alternatively, you could use `$DESTDIR`.
80114

115+
#### Adding extra Qt plugins
116+
117+
If you want aditional plugins which the tool doesn't deploy, for a variety of reasons, you can use the -extra-plugins argument and include a list of plugins separated by a comma.
118+
The plugins deployed are from the Qt installation pointed out by `qmake -v`.
119+
You can deploy entire plugin directories, a specific directory or a mix of both.
120+
121+
Usage examples:
122+
123+
1. `-extra-plugins=sqldrivers/libqmsql.so,iconengines/libqsvgicon.so`
124+
2. `-extra-plugins=sqldrivers,iconengines/libqsvgicon.so`
125+
3. `-extra-plugins=sqldrivers,iconengines,mediaservice,gamepads`
126+
81127
## Using linuxdeployqt with Travis CI
82128

83129
A common use case for `linuxdeployqt` is to use it on Travis CI after the `make` command. The following example illustrates how to use `linuxdeployqt` with Travis CI. Create a `.travis.yml` file similar to this one (be sure to customize it, e.g., change `APPNAME` to the name of your application as it is spelled in the `Name=` entry of the `.desktop` file):
@@ -89,26 +135,34 @@ sudo: require
89135
dist: trusty
90136
91137
before_install:
92-
- sudo add-apt-repository ppa:beineri/opt-qt59-trusty -y
93-
- sudo apt-get update -qq
138+
- sudo add-apt-repository ppa:beineri/opt-qt593-trusty -y
139+
- sudo apt-get update -qq
94140
95141
install:
96-
- sudo apt-get -y install qt59base
97-
- source /opt/qt*/bin/qt*-env.sh
142+
- sudo apt-get -y install qt59base
143+
- source /opt/qt*/bin/qt*-env.sh
98144
99145
script:
100146
- qmake CONFIG+=release PREFIX=/usr
101147
- make -j$(nproc)
102148
- make INSTALL_ROOT=appdir -j$(nproc) install ; find appdir/
103-
- wget -c "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage"
104-
- chmod a+x linuxdeployqt*.AppImage
149+
- wget -c -nv "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage"
150+
- chmod a+x linuxdeployqt-continuous-x86_64.AppImage
105151
- unset QTDIR; unset QT_PLUGIN_PATH ; unset LD_LIBRARY_PATH
106-
- ./linuxdeployqt*.AppImage ./appdir/usr/share/applications/*.desktop -bundle-non-qt-libs
107-
- ./linuxdeployqt*.AppImage ./appdir/usr/share/applications/*.desktop -appimage
152+
- export VERSION=$(git rev-parse --short HEAD) # linuxdeployqt uses this for naming the file
153+
- ./linuxdeployqt-continuous-x86_64.AppImage appdir/usr/share/applications/*.desktop -bundle-non-qt-libs
154+
- ./linuxdeployqt-continuous-x86_64.AppImage appdir/usr/share/applications/*.desktop -appimage
108155
109156
after_success:
110-
- find ./appdir -executable -type f -exec ldd {} \; | grep " => /usr" | cut -d " " -f 2-3 | sort | uniq
111-
- curl --upload-file ./APPNAME*.AppImage https://transfer.sh/APPNAME-git.$(git rev-parse --short HEAD)-x86_64.AppImage
157+
- find appdir -executable -type f -exec ldd {} \; | grep " => /usr" | cut -d " " -f 2-3 | sort | uniq
158+
- # curl --upload-file APPNAME*.AppImage https://transfer.sh/APPNAME-git.$(git rev-parse --short HEAD)-x86_64.AppImage
159+
- wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh
160+
- bash upload.sh APPNAME*.AppImage*
161+
162+
branches:
163+
except:
164+
- # Do not build tags that we create when we upload to GitHub Releases
165+
- /^(?i:continuous)/
112166
```
113167

114168
When you save your change, then Travis CI should build and upload an AppImage for you. More likely than not, some fine-tuning will still be required.
@@ -124,6 +178,10 @@ find: `appdir/': No such file or directory
124178

125179
If `qmake` does not allow for `make install` or does not install the desktop file and icon, then you need to change your `.pro` file it similar to https://github.com/probonopd/FeedTheMonkey/blob/master/FeedTheMonkey.pro.
126180

181+
It is common on Unix to also use the build tool to install applications and libraries; for example, by invoking `make install`. For this reason, `qmake` has the concept of an install set, an object which contains instructions about the way a part of a project is to be installed.
182+
183+
Please see the section "Installing Files" on http://doc.qt.io/qt-5/qmake-advanced-usage.html.
184+
127185
```
128186
- make INSTALL_ROOT=appdir install ; find appdir/
129187
```
@@ -139,9 +197,9 @@ __CMake__ wants `DESTDIR` instead:
139197
__autotools__ (the dinosaur that spends precious minutes "checking...") wants `DESTDIR` too but insists on an absolute link which we can feed it using readlink:
140198

141199
```
142-
- ./configure --prefix=/usr
143-
- make -j$(nproc)
144-
- make install DESTDIR=$(readlink -f appdir) ; find appdir/
200+
- ./configure --prefix=/usr
201+
- make -j$(nproc)
202+
- make install DESTDIR=$(readlink -f appdir) ; find appdir/
145203
```
146204

147205
Caution if you encounter
@@ -159,9 +217,7 @@ The exception is that you are building Qt libraries that _should_ be installed t
159217
`linuxdeployqt` is great for upstream application projects that want to release their software in binary form to Linux users quickly and without much overhead. If you would like to see a particular application use `linuxdeployqt`, then sending a Pull Request may be an option to get the upstream application project to consider it. You can use the following template text for Pull Requests but make sure to customize it to the project in question.
160218

161219
```
162-
This PR, when merged, will compile this application on [Travis CI](https://travis-ci.org/) upon each `git push`, and upload an [AppImage](http://appimage.org/) to a temporary download URL on transfer.sh (available for 14 days). The download URL is toward the end of each Travis CI build log of each build (see below for how to set up automatic uploading to your GitHub Releases page).
163-
164-
For this to work, you need to enable Travis CI for your repository as [described here](https://travis-ci.org/getting_started) __prior to merging this__, if you haven't already done so.
220+
This PR, when merged, will compile this application on [Travis CI](https://travis-ci.org/) upon each `git push`, and upload an [AppImage](http://appimage.org/) to your GitHub Releases page.
165221
166222
Providing an [AppImage](http://appimage.org/) would have, among others, these advantages:
167223
- Applications packaged as an AppImage can run on many distributions (including Ubuntu, Fedora, openSUSE, CentOS, elementaryOS, Linux Mint, and others)
@@ -175,12 +231,12 @@ Providing an [AppImage](http://appimage.org/) would have, among others, these ad
175231
- Can optionally GPG2-sign your AppImages (inside the file)
176232
- Works on Live ISOs
177233
- Can use the same AppImages when dual-booting multiple distributions
178-
- Can be listed in the [AppImageHub](https://appimage.github.io/) central directory of available AppImages
179-
180-
[Here is an overview](https://github.com/probonopd/AppImageKit/wiki/AppImages) of projects that are already distributing upstream-provided, official AppImages.
234+
- Can be listed in the [AppImageHub](https://appimage.github.io/apps) central directory of available AppImages
235+
- Can double as a self-extracting compressed archive with the `--appimage-extract` parameter
181236
182-
__Please note:__ Instead of storing AppImage builds temporarily for 14 days each on transfer.sh, you could use GitHub Releases to store the binaries permanently. This way, they would be visible on the Releases page of your project. This is what I recommend. See https://docs.travis-ci.com/user/deployment/releases/. If you want to do this for continuous builds, also see https://github.com/probonopd/uploadtool.
237+
[Here is an overview](https://appimage.github.io/apps) of projects that are already distributing upstream-provided, official AppImages.
183238
239+
__PLEASE NOTE:__ For this to work, you need to enable Travis CI for your repository as [described here](https://travis-ci.org/getting_started) __prior to merging this__, if you haven't already done so. Also, You need to set up `GITHUB_TOKEN` in Travis CI for this to work; please see https://github.com/probonopd/uploadtool.
184240
If you would like to see only one entry for the Pull Request in your project's history, then please enable [this GitHub functionality](https://help.github.com/articles/configuring-commit-squashing-for-pull-requests/) on your repo. It allows you to squash (combine) the commits when merging.
185241
186242
If you have questions, AppImage developers are on #AppImage on irc.freenode.net.
@@ -189,6 +245,8 @@ If you have questions, AppImage developers are on #AppImage on irc.freenode.net.
189245
## Projects using linuxdeployqt
190246

191247
These projects are already using [Travis CI](http://travis-ci.org/) and linuxdeployqt to provide AppImages of their builds:
248+
- https://github.com/probonopd/ImageMagick
249+
- https://github.com/Subsurface-divelog/subsurface/
192250
- https://github.com/jimevins/glabels-qt
193251
- https://travis-ci.org/NeoTheFox/RepRaptor
194252
- https://github.com/electronpass/electronpass-desktop
@@ -211,6 +269,7 @@ These projects are already using [Travis CI](http://travis-ci.org/) and linuxdep
211269
- https://github.com/probonopd/linuxdeployqt/ obviously ;-)
212270
- https://github.com/xdgurl/xdgurl
213271
- https://github.com/QNapi/qnapi
272+
- https://github.com/m-o-s-t-a-f-a/dana
214273

215274
This project is already using linuxdeployqt in a custom Jenkins workflow:
216275
- https://github.com/appimage-packages/

tests/QtWebEngineApplication/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/****************************************************************************
22
**
3-
** Copyright (C) 2016 The Qt Company Ltd.
3+
** Copyright (C) 2016-18 The Qt Company Ltd.
44
** Contact: http://www.qt.io/licensing/
55
**
66
** This file is part of the examples of the Qt Toolkit.

tests/QtWebEngineApplication/main.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/****************************************************************************
22
**
3-
** Copyright (C) 2016 The Qt Company Ltd.
3+
** Copyright (C) 2016-18 The Qt Company Ltd.
44
** Contact: http://www.qt.io/licensing/
55
**
66
** This file is part of the examples of the Qt Toolkit.

0 commit comments

Comments
 (0)