-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add AppImage support to Linux builds #3688
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
92eae8f
8dcbd19
5004eb7
74db001
91a000b
84de8cd
2b7dead
0e5ef88
62eea51
9beb316
0f99d4e
040cc3c
d4fe98a
8bea395
62a57ff
31fb899
fc9f0f1
6141c4d
c33c4e5
bf9d74b
eb5e819
803b3a0
8d89fd7
0da1e6b
b301b04
2982940
7207675
1cf825e
cea0622
45a9c43
ee7b988
064beb5
dca8f97
22b88a0
d923fe6
64e04d1
04a42f7
350c4d7
4271498
7f5a9f6
408a08e
4b4e754
752b7fa
43f9850
2552305
208575b
33647a0
0fed492
8241043
4a1ec1b
c5cc585
2c06b0d
a5ea5e9
720a637
762e35b
c727d9d
0382b69
8bc9e9d
a553aac
596c776
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| #!/usr/bin/env bash | ||
| # Creates Linux ".AppImage" for @PROJECT_NAME_UCASE@ | ||
|
|
||
| set -e | ||
|
|
||
| # Console colors | ||
| RED="\\x1B[1;31m" | ||
| GREEN="\\x1B[1;32m" | ||
| YELLOW="\\x1B[1;33m" | ||
| PLAIN="\\x1B[0m" | ||
|
|
||
| USERBIN="$HOME/bin" | ||
| LINUXDEPLOYQT="$USERBIN/linuxdeployqt" | ||
| APPDIR="@CMAKE_BINARY_DIR@/@[email protected]/" | ||
|
|
||
| # TODO: Since DESTDIR is set at build time, the true install location is unknown. | ||
| INSTALL="@CMAKE_BINARY_DIR@/../target" | ||
|
|
||
| # linuxdeployqt assumes installations contain /usr/ prefixes. | ||
| # 1. Make a directory containing /usr | ||
|
||
| # > mkdir -p ../target/usr | ||
| # 2. Configure the install prefix for /usr only without "target" | ||
| # > cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DWANT_QT5=True | ||
| # 3. Use the DESTDIR variables to install to "target" instead | ||
| # > make DESTDIR=../target/ -j4 install | ||
| make DESTDIR=../target/ -j4 install | ||
| case "@CMAKE_INSTALL_PREFIX@" in | ||
| */usr);; | ||
| *) echo -e "${RED}ERROR: linuxdeployqt requires install prefix of /usr: | ||
| Needs: mkdir ../target/usr | ||
| Needs: CMAKE_INSTALL_PREFIX=/usr | ||
| Needs: make DESTDIR=../target | ||
|
|
||
| Wrong: CMAKE_INSTALL_PREFIX=@CMAKE_INSTALL_PREFIX@ | ||
| ${PLAIN}"; exit 1;; | ||
| esac | ||
|
|
||
| mkdir -p "$USERBIN" | ||
|
|
||
| # Fetch portable linuxdeployqt | ||
| # TODO: Cache and only updated as needed | ||
| echo -e "${GREEN}Downloading linuxdeployqt to ${LINUXDEPLOYQT}${PLAIN}..." | ||
| wget https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage -O "$LINUXDEPLOYQT" -q | ||
| chmod +x "$LINUXDEPLOYQT" | ||
| echo " [success]" | ||
|
|
||
| # Make skeleton AppDir | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you think this is needed? When you install your build products with
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is post-install step, so it's irrelevant. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand this comment, why are you doing it when it is irrelevant?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Your comment is irrelevant. You're telling a project how to specify the We copy the It's really not your place to tell a project, or a user for that matter where to drop an install target. This may make sense for a small project. But (I feel) for large, complex projects, it's presumptuous. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So where would you ideally like to install? The reasonis that (at least for some software), the path specified with
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Wherever the user says to, would be the ideal location. For our tutorials, this is usually
This is the part that confuses me... I would expect a relinking tool to be agnostic of the prefix, but to be fair, I've also never written one. :) |
||
| echo -e "${GREEN}Creating ${APPDIR}...${PLAIN}" | ||
| rm -rf "$APPDIR" | ||
| mkdir -p "$APPDIR" | ||
| echo " [success]" | ||
|
|
||
| # Clone install to AppDir | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you think this is needed? When you install your build products with
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a post-install step, so it's irrelevant. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand this comment, why are you doing it when it is irrelevant? |
||
| echo -e "${GREEN}Copying ${INSTALL} to ${APPDIR}...${PLAIN}" | ||
| cp -R "$INSTALL/usr" "$APPDIR" | ||
| echo " [success]" | ||
|
|
||
| # Prepare the launcher | ||
|
||
| echo -e "${GREEN}Setting up shortcuts...${PLAIN}" | ||
| mv "$APPDIR/usr/share/applications/@[email protected]" "$APPDIR" | ||
| mv "$APPDIR/usr/share/pixmaps/@[email protected]" "$APPDIR" | ||
| echo " [success]" | ||
|
|
||
| echo -e "${GREEN}Cleaning up...${PLAIN}" | ||
|
||
| # Cleanup orphaned directories | ||
| rmdir "$APPDIR/usr/share/applications/" | ||
| rmdir "$APPDIR/usr/share/pixmaps/" | ||
| echo " [success]" | ||
|
|
||
| # Workaround per https://github.com/probonopd/linuxdeployqt/issues/52 | ||
| # export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/pulseaudio/:$LD_LIBRARY_PATH | ||
| # ^--- Shouldn't be needed anymore via https://github.com/probonopd/linuxdeployqt/commit/9a93e030cff2cb10e9e672ebb3360d30b3099c6d | ||
| export LD_LIBRARY_PATH="$APPDIR/usr/lib/lmms/":$LD_LIBRARY_PATH | ||
|
||
|
|
||
| echo -e "${GREEN}Bundling dependencies...${PLAIN}" | ||
| # Bundle both qt and non-qt dependencies into appimage format | ||
| "$LINUXDEPLOYQT" "$APPDIR/usr/bin/@CMAKE_PROJECT_NAME@" -executable="$APPDIR/usr/lib/@CMAKE_PROJECT_NAME@/RemoteZynAddSubFx" -bundle-non-qt-libs | ||
|
||
| echo " [success]" | ||
|
|
||
| echo -e "${GREEN}Finishing the AppImage...${PLAIN}" | ||
| # Run a second time with appimage flag to fix liking | ||
| # TODO: This was reported as a linuxdeployqt "known issue" and can be removed once fixed | ||
| # https://github.com/probonopd/lmms/commit/dc9fd086e344e842613ab45623ed96246ab58e77#commitcomment-22187275 | ||
| "$LINUXDEPLOYQT" "$APPDIR/usr/bin/@CMAKE_PROJECT_NAME@" -executable="$APPDIR/usr/lib/@CMAKE_PROJECT_NAME@/RemoteZynAddSubFx" -appimage | ||
| echo " [success]" | ||
|
|
||
|
|
||
| echo -e "${GREEN}Moving to @APPIMAGE_FILE@...${PLAIN}" | ||
| mv *.AppImage "@APPIMAGE_FILE@" | ||
|
|
||
| # Manually fix RemoteZynAddSubFx Qt5 linking | ||
| # FIXME: RemoteZynAddSubFx will still be linked to the system version e.g. /opt/qt5 | ||
| # and will crash if launched on system without Qt5 natively installed. | ||
|
|
||
| echo -e "${GREEN}Finished${PLAIN}" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you going through all the hassle of making this part of CMake when a few lines of
.travis.ymlor shell script would do? Just curious. Do you think it would be possible/advantageous to have a generic CMake AppImage module/plugin? If so, would you know where to start?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope I explained this (same?) question properly in #3688 (comment).
Hesitant "yes" to "advantageous ... cmake module" question.
A "no" to knowing where to start. The first that comes to mind is CMake's NSIS integration, but it's really ugly to use.
CMake also offers
CPackDMGfor Mac, but it wasn't really useful for us. Our project requiresmacdeployqtcombined with manual relinking. So from my perspective it's much easier to test, troubleshoot and patch in a common scripting language (which isbashfor the time being)