Skip to content

Commit 8dd03e6

Browse files
Beanowlucasfernog
andauthored
fix(bundler): Build AppImages inside the target folder (#4521)
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
1 parent 573b4c0 commit 8dd03e6

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

.changes/appimage-bundle-in-target.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri-bundler": patch
3+
---
4+
5+
Build AppImages inside the `src-tauri/target` folder rather than `~/.cache/tauri`. Making it easier to clean and rebuild from scratch.

tooling/bundler/src/bundle/linux/templates/appimage

+13-17
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,8 @@ else
1616
linuxdeploy_arch="$ARCH"
1717
fi
1818

19-
OUTDIR="${PWD}"
20-
21-
cd "{{tauri_tools_path}}"
22-
23-
# remove the folder if it exists - the rest of the script fails if it does
24-
rm -rf "{{app_name}}.AppDir"
2519
mkdir -p "{{app_name}}.AppDir"
26-
cp -r "${OUTDIR}/../appimage_deb/data/usr" "{{app_name}}.AppDir"
20+
cp -r ../appimage_deb/data/usr "{{app_name}}.AppDir"
2721

2822
cd "{{app_name}}.AppDir"
2923
mkdir -p "usr/bin"
@@ -53,8 +47,12 @@ find /usr/lib* -name WebKitNetworkProcess -exec mkdir -p "$(dirname '{}')" \; -e
5347
find /usr/lib* -name WebKitWebProcess -exec mkdir -p "$(dirname '{}')" \; -exec cp --parents '{}' "." \; || true
5448
find /usr/lib* -name libwebkit2gtkinjectedbundle.so -exec mkdir -p "$(dirname '{}')" \; -exec cp --parents '{}' "." \; || true
5549

56-
wget -q -4 -N -O AppRun https://github.com/AppImage/AppImageKit/releases/download/continuous/AppRun-${ARCH} || wget -q -4 -N -O AppRun https://github.com/AppImage/AppImageKit/releases/download/12/AppRun-${ARCH}
57-
chmod +x AppRun
50+
wget -q -4 -N -O "{{tauri_tools_path}}/AppRun" https://github.com/AppImage/AppImageKit/releases/download/continuous/AppRun-${ARCH} || wget -q -4 -N -O "{{tauri_tools_path}}/AppRun" https://github.com/AppImage/AppImageKit/releases/download/12/AppRun-${ARCH}
51+
chmod +x "{{tauri_tools_path}}/AppRun"
52+
53+
# We need AppRun to be installed as {{app_name}}.AppDir/AppRun.
54+
# Otherwise the linuxdeploy scripts will default to symlinking our main bin instead and will crash on trying to launch.
55+
cp "{{tauri_tools_path}}/AppRun" .
5856

5957
cp "{{icon_path}}" .DirIcon
6058
ln -s "{{icon_path}}" "{{app_name}}.png"
@@ -71,14 +69,12 @@ else
7169
gst_plugin=""
7270
fi
7371

74-
wget -q -4 -N -O linuxdeploy-plugin-gtk.sh https://raw.githubusercontent.com/tauri-apps/linuxdeploy-plugin-gtk/master/linuxdeploy-plugin-gtk.sh
75-
wget -q -4 -N -O linuxdeploy-${ARCH}.AppImage https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-${linuxdeploy_arch}.AppImage
72+
wget -q -4 -N -O "{{tauri_tools_path}}/linuxdeploy-plugin-gtk.sh" https://raw.githubusercontent.com/tauri-apps/linuxdeploy-plugin-gtk/master/linuxdeploy-plugin-gtk.sh
73+
wget -q -4 -N -O "{{tauri_tools_path}}/linuxdeploy-${ARCH}.AppImage" https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-${linuxdeploy_arch}.AppImage
7674

77-
chmod +x linuxdeploy-plugin-gtk.sh
78-
chmod +x linuxdeploy-${ARCH}.AppImage
75+
chmod +x "{{tauri_tools_path}}/linuxdeploy-plugin-gtk.sh"
76+
chmod +x "{{tauri_tools_path}}/linuxdeploy-${ARCH}.AppImage"
7977

80-
dd if=/dev/zero bs=1 count=3 seek=8 conv=notrunc of=linuxdeploy-${ARCH}.AppImage
78+
dd if=/dev/zero bs=1 count=3 seek=8 conv=notrunc of="{{tauri_tools_path}}/linuxdeploy-${ARCH}.AppImage"
8179

82-
OUTPUT="{{appimage_filename}}" ./linuxdeploy-${ARCH}.AppImage --appimage-extract-and-run --appdir "{{app_name}}.AppDir" --plugin gtk ${gst_plugin} --output appimage
83-
rm -r "{{app_name}}.AppDir"
84-
mv "{{appimage_filename}}" "$OUTDIR"
80+
OUTPUT="{{appimage_filename}}" "{{tauri_tools_path}}/linuxdeploy-${ARCH}.AppImage" --appimage-extract-and-run --appdir "{{app_name}}.AppDir" --plugin gtk ${gst_plugin} --output appimage

0 commit comments

Comments
 (0)