Skip to content

Commit

Permalink
refactor(bundler): use linuxdeploy instead of appimagetool, closes #1986
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog authored Aug 15, 2021
1 parent 12642a1 commit 397710b
Show file tree
Hide file tree
Showing 16 changed files with 42 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .changes/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"getPublishedVersion": "cargo search ${ pkgFile.pkg.package.name } --limit 1 | sed -nE \"s/^[^\\\"]*\\\"//; s/\\\".*//1p\"",
"prepublish": [
"sudo apt-get update",
"sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev",
"sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf",
"cargo install cargo-audit --features=fix",
{
"command": "cargo generate-lockfile",
Expand Down
5 changes: 5 additions & 0 deletions .changes/linuxdeploy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tauri-bundler": patch
---

Use `linuxdeploy` instead of `appimagetool` for `AppImage` bundling.
2 changes: 1 addition & 1 deletion .github/workflows/artifacts-updater.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- name: Get current date
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
run: |
python -m pip install --upgrade pip
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0 libappindicator3-dev xvfb
sudo apt-get install -y webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf xvfb
wget https://github.com/sharkdp/hyperfine/releases/download/v1.11.0/hyperfine_1.11.0_amd64.deb
sudo dpkg -i hyperfine_1.11.0_amd64.deb
pip install memory_profiler
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-smoke-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- name: yarn install for cli
working-directory: tauri/tooling/cli.js
run: yarn
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/core-lint-fmt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: install webkit2gtk
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- uses: actions-rs/toolchain@v1
with:
Expand Down Expand Up @@ -151,7 +151,7 @@ jobs:
- name: install webkit2gtk
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- uses: actions-rs/toolchain@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/covector-version-or-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
- name: install webkit2gtk
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
# Rust
- name: generate rust docs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/smoke-test-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- name: cache rust bin
id: cache_rust_bin
uses: actions/cache@v1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-bundler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- name: Get current date
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
Expand Down Expand Up @@ -100,7 +100,7 @@ jobs:
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- name: clippy check
uses: actions-rs/clippy-check@v1
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- name: Get current date
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
Expand Down Expand Up @@ -161,7 +161,7 @@ jobs:
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- name: Get current date
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-cta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
if: (github.event.inputs.platform || 'ubuntu') == 'ubuntu'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- run: yarn
working-directory: tooling/cli.js
- run: yarn build
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
# if: (github.event.inputs.platform || 'ubuntu') == 'ubuntu'
# run: |
# sudo apt-get update
# sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev
# sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
# - run: yarn
# working-directory: tooling/create-tauri-app
# - run: yarn build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/udeps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ jobs:
- name: Install required packages
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- uses: actions-rs/cargo@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- name: install webkit2gtk
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
# Rust
- name: generate rust docs
Expand Down
17 changes: 14 additions & 3 deletions docs/getting-started/setup-linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ $ sudo apt update && sudo apt install libwebkit2gtk-4.0-dev \
wget \
libssl-dev \
libgtk-3-dev \
squashfs-tools
libappindicator3-dev \
patchelf \
librsvg2-dev
```

</TabItem>
Expand All @@ -42,7 +44,9 @@ $ sudo pacman -Syy && sudo pacman -S webkit2gtk \
openssl \
appmenu-gtk-module \
gtk3 \
squashfs-tools \
libappindicator-gtk3 \
patchelf \
librsvg \
libvips
```

Expand All @@ -54,13 +58,20 @@ $ sudo dnf check-update && sudo dnf install webkit2gtk3-devel.x86_64 \
openssl-devel \
curl \
wget \
squashfs-tools \
libappindicator-gtk3 \ #
patchelf \
librsvg2-devel \
&& sudo dnf group install "C Development Tools and Libraries"
```

</TabItem>
</Tabs>

### Optional dependencies:

- `libappindicator`: needed to use the system tray feature.
- `patchelf` and `librsvg`: needed to bundle `AppImage`.

## 2. Node.js Runtime and Package Manager&nbsp;<Icon title="control-skip-forward" color="warning"/>

### Node.js (npm included)
Expand Down
8 changes: 0 additions & 8 deletions tooling/bundler/src/bundle/linux/appimage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@ use std::{
/// Bundles the project.
/// Returns a vector of PathBuf that shows where the AppImage was created.
pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
// prerequisite: check if mksquashfs (part of squashfs-tools) is installed
Command::new("mksquashfs")
.arg("-version")
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.status()
.expect("mksquashfs is not installed. Please install squashfs-tools and try again.");

// generate the deb binary name
let arch = match settings.binary_arch() {
"x86" => "i386",
Expand Down
18 changes: 7 additions & 11 deletions tooling/bundler/src/bundle/linux/templates/appimage
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,10 @@ ln -s "usr/share/applications/{{app_name}}.desktop" "{{app_name}}.desktop"

cd ..

mksquashfs "{{app_name}}.AppDir" "{{app_name}}.squashfs" -root-owned -noappend

wget -q -4 -O appimagetool https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage || wget -q -4 -O appimagetool https://github.com/AppImage/AppImageKit/releases/download/12/appimagetool-x86_64.AppImage
chmod +x appimagetool
if lsmod | grep -q fuse; then
./appimagetool "{{app_name}}.AppDir" "{{appimage_filename}}"
else
./appimagetool --appimage-extract
./squashfs-root/AppRun "{{app_name}}.AppDir" "{{appimage_filename}}"
rm -rf ./squashfs-root
fi
wget -q -4 -O linuxdeploy-plugin-gtk.sh "https://raw.githubusercontent.com/linuxdeploy/linuxdeploy-plugin-gtk/master/linuxdeploy-plugin-gtk.sh"
wget -q -4 -O linuxdeploy-x86_64.AppImage https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage

chmod +x linuxdeploy-plugin-gtk.sh
chmod +x linuxdeploy-x86_64.AppImage

OUTPUT="{{appimage_filename}}" ./linuxdeploy-x86_64.AppImage --appdir "{{app_name}}.AppDir" --plugin gtk --output appimage

0 comments on commit 397710b

Please sign in to comment.