Skip to content

Commit 23ba08c

Browse files
committed
Capability to deploy itself added
1 parent 70f8579 commit 23ba08c

File tree

7 files changed

+109
-10
lines changed

7 files changed

+109
-10
lines changed

.gitignore

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,78 @@ Thumbs.db
7272
# Build folder
7373
# --------
7474
build/*
75+
76+
77+
# .gitattributes snippet to force users to use same line endings for project.
78+
#
79+
# Handle line endings automatically for files detected as text
80+
# and leave all files detected as binary untouched.
81+
* text=auto eol=lf
82+
83+
# The above will handle all files NOT found below
84+
# https://help.github.com/articles/dealing-with-line-endings/
85+
# https://github.com/Danimoth/gitattributes/blob/master/Web.gitattributes
86+
87+
# These files are text and should be normalized (Convert crlf => lf)
88+
*.md text
89+
*.txt text
90+
*.cmake text
91+
*.pro text
92+
*.pri text
93+
*.c text
94+
*.m text
95+
*.mm text
96+
*.cpp text
97+
*.cxx text
98+
*.h text
99+
*.hpp text
100+
*.qml text
101+
*.java text
102+
*.desktop text
103+
*.conf text
104+
*.applescript text
105+
*.plist text
106+
*.properties text
107+
*.gradle text
108+
*.php text
109+
*.cs text
110+
*.css text
111+
*.js text
112+
*.json text
113+
*.htm text
114+
*.html text
115+
*.xml text
116+
*.svg text
117+
*.ini text
118+
*.inc text
119+
*.pl text
120+
*.rb text
121+
*.py text
122+
*.scm text
123+
*.sql text
124+
*.sh text
125+
.htaccess text
126+
.clang-format text
127+
128+
# These files are binary and should be left untouched
129+
# (binary is a macro for -text -diff)
130+
*.jar binary
131+
*.png binary
132+
*.jpg binary
133+
*.jpeg binary
134+
*.gif binary
135+
*.ico binary
136+
*.mov binary
137+
*.mp4 binary
138+
*.mp3 binary
139+
*.flv binary
140+
*.fla binary
141+
*.swf binary
142+
*.gz binary
143+
*.tar binary
144+
*.zip binary
145+
*.7z binary
146+
*.ttf binary
147+
*.pyc binary
148+
149+
*.bat text eol=crlf

CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ include(Options)
99

1010
project(linuxdeployqt
1111
LANGUAGES CXX
12-
VERSION 2.5.0
12+
VERSION 2.5.1
1313
HOMEPAGE_URL omergoktas.com
1414
DESCRIPTION "Qt dependency deployment tool for Linux."
1515
)
@@ -25,6 +25,13 @@ qt_add_executable(linuxdeployqt
2525
shared.cpp
2626
)
2727

28+
qt_add_resources(
29+
linuxdeployqt
30+
linuxdeployqt_assets
31+
FILES
32+
assets/AppRun
33+
)
34+
2835
install(TARGETS linuxdeployqt DESTINATION bin)
2936

3037
deploy(linuxdeployqt)

assets/AppRun

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/sh
2+
SELF=$(readlink -f "$0")
3+
HERE=${SELF%/*}
4+
export SYS_PATH="$PATH"
5+
export SYS_LD_LIBRARY_PATH="$LD_LIBRARY_PATH"
6+
export SYS_PYTHONPATH="$PYTHONPATH"
7+
export SYS_XDG_DATA_DIRS="$XDG_DATA_DIRS"
8+
export SYS_PERLLIB="$PERLLIB"
9+
export SYS_GSETTINGS_SCHEMA_DIR="$GSETTINGS_SCHEMA_DIR"
10+
export SYS_QT_PLUGIN_PATH="$QT_PLUGIN_PATH"
11+
export PATH="${HERE}/usr/bin/:${HERE}/usr/sbin/:${HERE}/usr/games/:${HERE}/bin/:${HERE}/sbin/${PATH:+:$PATH}"
12+
export LD_LIBRARY_PATH="${HERE}/usr/lib/:${HERE}/usr/lib/i386-linux-gnu/:${HERE}/usr/lib/x86_64-linux-gnu/:${HERE}/usr/lib32/:${HERE}/usr/lib64/:${HERE}/lib/:${HERE}/lib/i386-linux-gnu/:${HERE}/lib/x86_64-linux-gnu/:${HERE}/lib32/:${HERE}/lib64/${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
13+
export PYTHONPATH="${HERE}/usr/share/pyshared/${PYTHONPATH:+:$PYTHONPATH}"
14+
export XDG_DATA_DIRS="${HERE}/usr/share/${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}"
15+
export PERLLIB="${HERE}/usr/share/perl5/:${HERE}/usr/lib/perl5/${PERLLIB:+:$PERLLIB}"
16+
export GSETTINGS_SCHEMA_DIR="${HERE}/usr/share/glib-2.0/schemas/${GSETTINGS_SCHEMA_DIR:+:$GSETTINGS_SCHEMA_DIR}"
17+
export QT_PLUGIN_PATH="${HERE}/usr/lib/qt4/plugins/:${HERE}/usr/lib/i386-linux-gnu/qt4/plugins/:${HERE}/usr/lib/x86_64-linux-gnu/qt4/plugins/:${HERE}/usr/lib32/qt4/plugins/:${HERE}/usr/lib64/qt4/plugins/:${HERE}/usr/lib/qt5/plugins/:${HERE}/usr/lib/i386-linux-gnu/qt5/plugins/:${HERE}/usr/lib/x86_64-linux-gnu/qt5/plugins/:${HERE}/usr/lib32/qt5/plugins/:${HERE}/usr/lib64/qt5/plugins/${QT_PLUGIN_PATH:+:$QT_PLUGIN_PATH}"
18+
EXEC=$(grep -e '^Exec=.*' "${HERE}"/*.desktop | head -n 1 | cut -d "=" -f 2 | cut -d " " -f 1)
19+
exec "${EXEC}" "$@"

cmake/Deploy.cmake

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,14 @@ function(deploy TARGET)
2222
file(CHMOD ${APPIMAGETOOL_EXECUTABLE} PERMISSIONS OWNER_READ OWNER_EXECUTE)
2323
endif()
2424

25-
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/icon.desktop
25+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/deploy/icon.desktop
2626
${DEPLOY_PREFIX_PATH}/${TARGET}.desktop @ONLY)
2727

28+
add_custom_command(TARGET deploy VERBATIM
29+
COMMAND ${CMAKE_COMMAND} -E copy_if_different
30+
${CMAKE_CURRENT_SOURCE_DIR}/deploy/icon.svg ${DEPLOY_PREFIX_PATH}/${TARGET}.svg
31+
)
32+
2833
add_custom_command(TARGET deploy VERBATIM
2934
COMMAND ${CMAKE_COMMAND} -E make_directory
3035
${DEPLOY_PREFIX_PATH}/usr/bin
@@ -55,12 +60,6 @@ function(deploy TARGET)
5560
${PATCHELF_EXECUTABLE} $<TARGET_FILE:${TARGET}> ${DEPLOY_PREFIX_PATH}/usr/bin
5661
)
5762

58-
add_custom_command(TARGET deploy VERBATIM
59-
COMMAND ${CMAKE_COMMAND} -E copy_if_different
60-
icon.svg ${DEPLOY_PREFIX_PATH}/${TARGET}.svg
61-
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
62-
)
63-
6463
add_custom_command(TARGET deploy VERBATIM
6564
COMMAND ARCH=${CMAKE_SYSTEM_PROCESSOR} $<TARGET_FILE:${TARGET}>
6665
${DEPLOY_PREFIX_PATH}/usr/bin/$<TARGET_FILE_NAME:${TARGET}>
File renamed without changes.
File renamed without changes.

main.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,7 @@ int main(int argc, char* argv[])
398398
if (appRun.exists()) {
399399
qDebug() << "Keeping existing AppRun";
400400
} else {
401-
if (!QFile::copy(QCoreApplication::applicationDirPath() + "/../../AppRun",
402-
appDirPath + "/AppRun")) {
401+
if (!QFile::copy(":/assets/AppRun", appDirPath + "/AppRun")) {
403402
LogError() << "Could not copy AppRun";
404403
}
405404
}

0 commit comments

Comments
 (0)