Skip to content
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

add appimage support to packaging #1270

Merged
merged 11 commits into from
Oct 2, 2024
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt update
sudo apt install -y rpm
sudo apt install -y rpm fuse
- name: Install WiX Toolset
if: ${{ matrix.os == 'windows-latest' }}
run: |
Expand All @@ -59,6 +59,7 @@ jobs:
if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then
mv desktop/build/temp-*/binaries/haveno-*.rpm ${{ github.workspace }}/release
mv desktop/build/temp-*/binaries/haveno_*.deb ${{ github.workspace }}/release
mv desktop/build/temp-*/binaries/haveno_*.AppImage ${{ github.workspace }}/release
else
mv desktop/build/temp-*/binaries/Haveno-*.dmg ${{ github.workspace }}/release
fi
Expand Down
Binary file added desktop/package/linux/Haveno.AppDir/.DirIcon
TheTollingBell marked this conversation as resolved.
Show resolved Hide resolved
Binary file not shown.
16 changes: 16 additions & 0 deletions desktop/package/linux/Haveno.AppDir/Haveno.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# If you want Haveno to appear in a Linux app launcher ("start menu"), install this by doing:
TheTollingBell marked this conversation as resolved.
Show resolved Hide resolved
# sudo desktop-file-install electrum-ltc.desktop

[Desktop Entry]
Comment=A decentralized, Tor-based, P2P Monero exchange network.
Exec=sh -c "PATH=\"\\$HOME/.local/bin:\\$PATH\"; bin/Haveno %u"
GenericName[en_US]=Monero Exchange
GenericName=Monero Exchange
Icon=haveno
TheTollingBell marked this conversation as resolved.
Show resolved Hide resolved
Categories=Office;Finance;Java;P2P;
Name[en_US]=Haveno
Name=Haveno
Terminal=false
Type=Application
MimeType=
X-AppImage-Name=Haveno
1 change: 1 addition & 0 deletions desktop/package/linux/Haveno.AppDir/haveno.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
66 changes: 66 additions & 0 deletions desktop/package/package.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ task getJavaBinariesDownloadURLs {
}
}

ext.osKey = osKey
TheTollingBell marked this conversation as resolved.
Show resolved Hide resolved

ext.jdk21Binary_DownloadURL = jdk21Binaries[osKey]
ext.jdk21Binary_SHA256Hash = jdk21Binaries[osKey + '-sha256']
}
Expand Down Expand Up @@ -321,6 +323,69 @@ task packageInstallers {
" --linux-deb-maintainer [email protected]" +
" --type deb")

// Clean jpackage temp folder, needs to be empty for the next packaging step (AppImage)
jpackageTempDir.deleteDir()
jpackageTempDir.mkdirs()

executeCmd(jPackageFilePath + commonOpts +
" --dest \"${jpackageTempDir}\"" +
" --type app-image")

// Path to the app-image directory: THIS IS NOT THE ACTUAL .AppImage FILE.
// See JPackage documentation on --type app-image for more.
String appImagePath = new String(
"\"${binariesFolderPath}/${appNameAndVendor}\""
)

// Which version of AppImageTool to use
String AppImageToolVersion = "13";

// Download AppImageTool
Map AppImageToolBinaries = [
'linux' : "https://github.com/AppImage/AppImageKit/releases/download/${AppImageToolVersion}/appimagetool-x86_64.AppImage",
'linux-aarch64' : "https://github.com/AppImage/AppImageKit/releases/download/${AppImageToolVersion}/appimagetool-aarch64.AppImage",
]

String osKey = getJavaBinariesDownloadURLs.property('osKey')

File appDir = new File("${jpackageTempDir}/Haveno")
File templateAppDir = new File("${project(':desktop').projectDir}/package/linux/Haveno.AppDir")
File jpackDir = appDir

appDir.mkdirs()

File AppImageToolBinary = new File("${jpackageTempDir}/appimagetool.AppImage")

// Adding a platform to the AppImageToolBinaries essentially adds it to the "supported" list of platforms able to make AppImages
// However, be warned that any platform that doesn't support unix `ln` and `chmod` will not work with the current method.
if (AppImageToolBinaries.containsKey(osKey)) {
println "Downloading ${AppImageToolBinaries[osKey]}"
ant.get(src: AppImageToolBinaries[osKey], dest: AppImageToolBinary)
println 'Download saved to ' + jpackageTempDir

project.exec {
commandLine('chmod', '+x', AppImageToolBinary)
}

copy {
from templateAppDir
into appDir
boolean includeEmptyDirs = true
}

project.exec {
workingDir appDir
commandLine 'ln', '-s', 'bin/Haveno', 'AppRun'
}

project.exec {
commandLine "${AppImageToolBinary}", appDir, "${binariesFolderPath}/haveno_${appVersion}.AppImage"
}
} else {
println "Your platform does not support AppImageTool ${AppImageToolVersion}"
}


// Clean jpackage temp folder, needs to be empty for the next packaging step (rpm)
jpackageTempDir.deleteDir()
jpackageTempDir.mkdirs()
Expand All @@ -345,6 +410,7 @@ task packageInstallers {
from binariesFolderPath
into envVariableSharedFolder
}

executeCmd("open " + envVariableSharedFolder)
}
}
Expand Down
Loading