-
-
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 1 commit
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
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,44 +8,66 @@ | |
|
|
||
| set -e | ||
|
|
||
| LINUXDEPLOYQT="$HOME/bin/linuxdeployqt" | ||
| VERBOSITY=2 # 3=debug | ||
| LOGFILE="@CMAKE_BINARY_DIR@/linuxdeployqt.log" | ||
| APPDIR="@CMAKE_BINARY_DIR@/@[email protected]/" | ||
| DESKTOPFILE="${APPDIR}usr/share/applications/lmms.desktop" | ||
| STRIP="" | ||
|
|
||
| # Don't strip for debug builds | ||
| if [[ "@CMAKE_BUILD_TYPE@" == *"Debug"* ]]; then | ||
| STRIP="-no-strip" | ||
| fi | ||
|
|
||
| # Console colors | ||
| RED="\\x1B[1;31m" | ||
| GREEN="\\x1B[1;32m" | ||
| YELLOW="\\x1B[1;33m" | ||
| PLAIN="\\x1B[0m" | ||
|
|
||
| LINUXDEPLOYQT="$HOME/bin/linuxdeployqt" | ||
| APPDIR="@CMAKE_BINARY_DIR@/@[email protected]/" | ||
| DESKTOPFILE="${APPDIR}usr/share/applications/lmms.desktop" | ||
| function error { | ||
| echo -e " ${PLAIN}[${RED}error${PLAIN}] ${1}" | ||
| return 1 | ||
| } | ||
|
|
||
| mkdir -p "$HOME/bin" | ||
| function success { | ||
| echo -e " ${PLAIN}[${GREEN}success${PLAIN}] ${1}" | ||
| } | ||
|
|
||
| function skipped { | ||
| echo -e " ${PLAIN}[${YELLOW}skipped${PLAIN}] ${1}" | ||
| } | ||
|
|
||
| echo -e "\nWriting verbose output to \"${LOGFILE}\"" | ||
|
|
||
| # Fetch portable linuxdeployqt if cache is older than $DAYSOLD | ||
| echo -e "${GREEN}Downloading linuxdeployqt to ${LINUXDEPLOYQT}${PLAIN}..." | ||
| echo -e "\nDownloading linuxdeployqt to ${LINUXDEPLOYQT}..." | ||
| mkdir -p "$HOME/bin" | ||
| DAYSOLD=2 | ||
| if which linuxdeployqt > /dev/null d2>&1; then | ||
| echo " [skipping] The system already provides this utility" | ||
| elif ! find "$LINUXDEPLOYQT" -mtime -$DAYSOLD|grep -q "." > /dev/null 2>&1; then | ||
| skipped "System already provides this utility" | ||
| elif ! find "$LINUXDEPLOYQT" -mtime -$DAYSOLD 2>/dev/null|grep -q "." > /dev/null 2>&1; then | ||
| url="https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-$(uname -p).AppImage" | ||
| echo " Couldn't find linuxdeployqt newer than $DAYSOLD days old" | ||
| echo " Downloading ($(uname -p)): ${url}" | ||
| echo " [.......] Couldn't find linuxdeployqt newer than $DAYSOLD days old" | ||
| echo " [.......] Downloading ($(uname -p)): ${url}" | ||
| wget "$url" -O "$LINUXDEPLOYQT" -q || (rm "$LINUXDEPLOYQT" && false) | ||
| chmod +x "$LINUXDEPLOYQT" | ||
| echo " [success]" | ||
| success "Downloaded $LINUXDEPLOYQT" | ||
| else | ||
| echo " [skipping] Downloaded version is less than $DAYSOLD days old" | ||
| skipped "$LINUXDEPLOYQT is less than $DAYSOLD days old" | ||
| fi | ||
|
|
||
| # Make skeleton AppDir | ||
| echo -e "${GREEN}Creating ${APPDIR}...${PLAIN}" | ||
| echo -e "\nCreating ${APPDIR}..." | ||
| rm -rf "$APPDIR" | ||
| mkdir -p "$APPDIR/usr" | ||
| echo " [success]" | ||
| success "Created ${APPDIR}" | ||
|
|
||
| # 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 @CMAKE_INSTALL_PREFIX@ to ${APPDIR}...${PLAIN}" | ||
| echo -e "\nCopying @CMAKE_INSTALL_PREFIX@ to ${APPDIR}..." | ||
| cp -R "@CMAKE_INSTALL_PREFIX@/." "$APPDIR/usr" | ||
| echo " [success]" | ||
| success "${APPDIR}" | ||
|
|
||
| # Create a wrapper script which calls the lmms executable | ||
| mv "$APPDIR/usr/bin/lmms" "$APPDIR/usr/bin/lmms.real" | ||
|
|
@@ -72,22 +94,25 @@ mv "$VSTLIB" "$VSTBIN" | |
| sed -i 's/.*Exec=.*/Exec=lmms.real/' "$DESKTOPFILE" | ||
|
|
||
| # Bundle both qt and non-qt dependencies into appimage format | ||
| echo -e "${GREEN}Bundling dependencies...${PLAIN}" | ||
| "$LINUXDEPLOYQT" "$DESKTOPFILE" -executable="$ZYNBIN" -executable="$VSTBIN" -bundle-non-qt-libs | ||
| echo " [success]" | ||
| echo -e "\nBundling and relinking system dependencies..." | ||
| echo -e "#### linuxdeployqt pass 1 ####" > "$LOGFILE" | ||
| "$LINUXDEPLOYQT" "$DESKTOPFILE" -executable="$ZYNBIN" -executable="$VSTBIN" -bundle-non-qt-libs -verbose=$VERBOSITY $STRIP >> "$LOGFILE" 2>&1 | ||
| success "Bundled and relinked dependencies" | ||
|
|
||
| # Move executables back to lib directory | ||
| mv "$ZYNBIN" "$ZYNLIB" | ||
| mv "$VSTBIN" "$VSTLIB" | ||
|
|
||
| # Run a second time to create AppImage | ||
| echo -e "${GREEN}Finishing the AppImage...${PLAIN}" | ||
| "$LINUXDEPLOYQT" "$DESKTOPFILE" -appimage | ||
| echo " [success]" | ||
| echo -e "${GREEN}Moving to @APPIMAGE_FILE@...${PLAIN}" | ||
| echo -e "\nFinishing the AppImage..." | ||
| echo -e "\n\n#### linuxdeployqt pass 2 ####" > "$LOGFILE" | ||
| "$LINUXDEPLOYQT" "$DESKTOPFILE" -appimage -verbose=$VERBOSITY $STRIP >> "$LOGFILE" 2>&1 | ||
| success "Created .AppImage" | ||
|
|
||
| echo -e "\nMoving to @APPIMAGE_FILE@..." | ||
| # FIXME | ||
| # Per https://github.com/probonopd/linuxdeployqt/issues/146 | ||
| #shellcheck disable=SC2203 | ||
| mv *.AppImage "@APPIMAGE_FILE@" | ||
| mv ./*.AppImage "@APPIMAGE_FILE@" | ||
| success "Created @APPIMAGE_FILE@" | ||
|
|
||
| echo -e "${GREEN}Finished${PLAIN}" | ||
| echo -e "\nFinished" | ||
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 do you think this is needed? When you install your build products with
make INSTALL_ROOT="$APPDIR" installthen they will end up there.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.
This is post-install step, so it's irrelevant.
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 don't understand this comment, why are you doing it when it is irrelevant?
Uh oh!
There was an error while loading. Please reload this page.
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.
Your comment is irrelevant. You're telling a project how to specify the
installtarget, which is too late when it's a post-install step. We can script the entire thing like we do for Windows, but then it takes away the granularity of developers specifying their own build environment.We copy the
installinstead of messing it all up. Ideally, the/usrmandate would be dropped and then we can use whatever folder we want. That's howmacdeployqtworks for us.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 comment
The 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
DCMAKE_INSTALL_PREFIXends up in the compiled binaries, which is what I generally want to avoid, hence recommending/usras the generic prefix. This is not a hard requirement though and you are free to use another prefix.Uh oh!
There was an error while loading. Please reload this page.
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.
Wherever the user says to, would be the ideal location. For our tutorials, this is usually
/home/user/lmms/target, but I often run a second copy from/home/user/Desktop/lmms/targetand others may prefer their own place.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. :)