2 Commits

Author SHA1 Message Date
Joakim Hulthe
ddb3ed3699 Add mullvad-vpn-slint APKBUILD 2026-03-28 19:32:23 +01:00
Joakim Hulthe
16c9d48541 add scripts to build alpine packages with podman 2026-03-28 19:31:56 +01:00
15 changed files with 120 additions and 268 deletions

4
.gitmodules vendored
View File

@@ -1,4 +0,0 @@
[submodule "mullvad-vpn-daemon/mullvadvpn-app"]
path = mullvad-vpn-daemon/mullvadvpn-app
url = git@github.com:mullvad/mullvadvpn-app-priv.git
branch = poc-slint

View File

@@ -1,21 +1,57 @@
FROM alpine:edge FROM alpine:3.21
# Install build dependencies # Install build dependencies
# TODO: trim dependencies? # TODO: trim dependencies?
RUN apk update && apk add \ RUN apk update && apk add \
build-base abuild \
rustup \
build-base \ build-base \
abuild \ musl-dev \
git \ gcc \
rust \ cmake \
cargo-auditable \ make \
pkgconfig \ pkgconfig \
perl \
python3 \
curl \
git \
llvm \
clang \
clang-libclang \
protobuf-dev \ protobuf-dev \
protobuf-dev \ libc-dev \
libmnl libmnl-dev \ linux-headers \
libnftnl libnftnl-dev \ freetype-dev \
dbus dbus-dev \ freetype-static \
fontconfig-dev \ fontconfig-dev \
wayland-dev fontconfig-static \
bzip2-dev \
bzip2-static \
brotli-dev \
brotli-static \
expat-dev \
expat-static \
libx11-dev \
libxcursor-dev \
libxkbcommon-dev \
libxkbcommon-static \
wayland-dev \
wayland-libs-client \
wayland-libs-server \
wayland-static \
openssl-dev \
openssl-libs-static \
zlib-dev \
zlib-static \
libpng-dev \
libpng-static \
libwebp-dev \
libwebp-static \
tiff-dev \
libjpeg-turbo-dev \
libjpeg-turbo-static
RUN rustup-init -y --default-toolchain stable
# Set pkg-config to use static libraries # Set pkg-config to use static libraries
ENV PKG_CONFIG_ALLOW_STATIC=1 ENV PKG_CONFIG_ALLOW_STATIC=1

View File

@@ -4,7 +4,7 @@
1. Install `abuild` 1. Install `abuild`
2. Create keys: `abuild-keygen` 2. Create keys: `abuild-keygen`
The keys will end up in ~/.abuild/, and will be mounted into the build container. The keys will end up in ~/.abuild/, and will be mounted into the build container by podma, and will be mounted into the build container.
3. Remember to keep keys around. 3. Remember to keep keys around.
## Building ## Building

View File

@@ -1,28 +0,0 @@
#!/bin/sh
set -ex
cd "$(dirname "$0")"
package="$1"
shift
builder_image="mullvad-slint-musl-builder"
cargo_home="${CARGO_HOME:-$HOME/.cargo}"
. "$HOME/.abuild/abuild.conf"
docker build . -f Dockerfile -t "$builder_image"
docker run --rm \
-v "./$package":/build \
-v ./abuild.conf:/root/.abuild/abuild.conf:ro \
-v "$PACKAGER_PRIVKEY":/key.rsa:ro \
-v "$PACKAGER_PRIVKEY.pub":/key.rsa.pub:ro \
-v "$PACKAGER_PRIVKEY.pub":/etc/apk/keys/key.rsa.pub:ro \
-v ./packages:/root/packages \
-v "$cargo_home":/cargo-home \
-e "CARGO_HOME=/cargo-home" \
-v ./target:/cargo-target \
-e "CARGO_TARGET_DIR=/cargo-target" \
-it \
"$builder_image" \
abuild -F "$@"

View File

@@ -1,93 +0,0 @@
maintainer="Joakim Hulthe <joakim@hulthe.net>"
pkgname=mullvad-vpn-daemon
pkgver=2026.2_beta1
pkgrel=0
pkgdesc="Mullvad VPN client (daemon and CLI)"
url="https://mullvad.net/"
# Mullvad depends on old versions of the `nix` library
# which are broken on on loongarch64 and s390x
arch="all !loongarch64 !s390x"
license="GPL-3.0-or-later"
makedepends="
cargo-auditable
git
protobuf-dev
dbus-dev
libmnl-dev
libnftnl-dev
"
install="
$pkgname.pre-upgrade
$pkgname.pre-deinstall
$pkgname-systemd.post-install
$pkgname-systemd.post-upgrade
$pkgname-systemd.pre-deinstall
"
subpackages="
$pkgname-systemd
$pkgname-suid
"
source="
https://github.com/mullvad/mullvadvpn-app/archive/refs/tags/${pkgver//_/-}.tar.gz
"
builddir="$srcdir/mullvadvpn-app-${pkgver//_/-}/"
options="net suid"
_cargo_target_dir="${CARGO_TARGET_DIR:-$builddir/target}"
_cargo_release_dir="$_cargo_target_dir/$CHOST/release"
prepare() {
default_prepare
cargo fetch --target "$CHOST" --locked
}
build() {
# Specify `--target` so that build artifacts will be in target/<target>/release
# This avoids clashes with host system when building in a container.
# Compile all binaries
cargo auditable build --release --frozen \
--target "$CHOST" \
-p mullvad-cli \
-p mullvad-daemon \
-p mullvad-exclude \
-p mullvad-problem-report \
-p mullvad-setup
}
check() {
cargo test --target "$CHOST" --frozen
}
package() {
install -m755 -Dt "$pkgdir/usr/bin/" \
"$_cargo_release_dir/mullvad" \
"$_cargo_release_dir/mullvad-daemon" \
"$_cargo_release_dir/mullvad-problem-report" \
"$_cargo_release_dir/mullvad-setup"
# TODO: Bundle a relay list.
# We can't generate one at build time since that would break build reproducibility.
# Once mullvad starts checking a relay list into their release branches, we can bundle that.
#install -m644 -D "$builddir/<todo>/relays.json" \
# "$pkgdir/usr/share/mullvad-vpn/relays.json"
# TODO: Copy relay list into /var/cache/ in post-upgrade/post-install
# files in /usr/lib/systemd/ are automatically put in systemd subpackage
install -m755 -Dt "$pkgdir/usr/lib/systemd/system/" \
"$builddir/dist-assets/linux/mullvad-daemon.service" \
"$builddir/dist-assets/linux/mullvad-early-boot-blocking.service"
}
suid() {
pkgdesc="mullvad-exclude cli for split tunneling"
depends="$pkgname=$pkgver-r$pkgrel"
install -m4755 -Dt "$subpkgdir/usr/bin/" \
"$_cargo_release_dir/mullvad-exclude"
}
sha512sums="
9af0c263f0e5985d7842099f50a5070da0b23691f08ffe57c3b6d239d2c1c9acea89c07890f31d89bd75448a2dd1fd3c878b85be458baba0bcd90760e714b032 2026.2-beta1.tar.gz
"

View File

@@ -1,9 +0,0 @@
#!/bin/sh
set -eu
# Enable and start systemd services
if which systemctl >/dev/null 2>&1 && systemctl is-system-running | grep -vq offline >/dev/null 2>&1; then
systemctl enable "/usr/lib/systemd/system/mullvad-daemon.service"
systemctl start mullvad-daemon.service || echo "Failed to start mullvad-daemon.service"
systemctl enable "/usr/lib/systemd/system/mullvad-early-boot-blocking.service"
fi

View File

@@ -1,9 +0,0 @@
#!/bin/sh
set -eu
# Enable and start systemd services
if which systemctl >/dev/null 2>&1 && systemctl is-system-running | grep -vq offline >/dev/null 2>&1; then
systemctl enable "/usr/lib/systemd/system/mullvad-daemon.service"
systemctl start mullvad-daemon.service || echo "Failed to start mullvad-daemon.service"
systemctl enable "/usr/lib/systemd/system/mullvad-early-boot-blocking.service"
fi

View File

@@ -1,8 +0,0 @@
#!/bin/sh
set -eu
# Stop and disable all mullvad services
systemctl stop mullvad-daemon.service || true
systemctl disable mullvad-daemon.service || true
systemctl stop mullvad-early-boot-blocking.service || true
systemctl disable mullvad-early-boot-blocking.service || true

View File

@@ -1,8 +0,0 @@
#!/bin/sh
set -eu
# TODO: see `package()` in APKBUILD
# Copy vendored relay list into place
# mkdir -p /var/cache/mullvad-vpn \
# && cp /usr/share/mullvad-vpn/relays.json /var/cache/mullvad-vpn/relays.json \
# || echo "failed to install /var/cache/mullvad-vpn/relays.json"

View File

@@ -1,8 +0,0 @@
#!/bin/sh
set -eu
# TODO: see `package()` in APKBUILD
# Overwrite the cached relay list with the vendored one.
# mkdir -p /var/cache/mullvad-vpn \
# && cp /usr/share/mullvad-vpn/relays.json /var/cache/mullvad-vpn/relays.json \
# || echo "failed to install /var/cache/mullvad-vpn/relays.json"

View File

@@ -1,6 +0,0 @@
#!/bin/sh
set -eu
# Log out and remove any firewall rules
mullvad-setup reset-firewall || echo "Failed to reset firewall"
mullvad-setup remove-device || echo "Failed to remove device from account"

View File

@@ -1,18 +0,0 @@
#!/bin/sh
set -eu
# Stop the daemon gracefully, and set up firewall rules to prevent network
# leaks during upgrade.
if which systemctl >/dev/null 2>&1 && systemctl is-system-running | grep -vq offline >/dev/null 2>&1; then
if systemctl status mullvad-daemon >/dev/null 2>&1; then
mullvad-setup prepare-restart || true
systemctl stop mullvad-daemon.service
systemctl disable mullvad-daemon.service
systemctl disable mullvad-early-boot-blocking.service || true
cp /var/log/mullvad-vpn/daemon.log /var/log/mullvad-vpn/old-install-daemon.log \
|| echo "Failed to copy old daemon log"
fi
fi
# Clear the cached API IP address.
rm -f /var/cache/mullvad-vpn/api-ip-address.txt

View File

@@ -1,85 +1,98 @@
# Contributor: # Contributor:
# Maintainer: Joakim Hulthe <joakim@hulthe.net> # Maintainer:
pkgname=mullvad-vpn-slint pkgname=mullvad-slint
pkgver=2026.1_git pkgver=2026.1_git
pkgrel=4 pkgrel=0
pkgdesc="Mullvad VPN GUI" pkgdesc="Mullvad VPN GUI"
url="https://mullvad.net/" url="https://mullvad.net/"
arch="all" arch="$(uname -m)"
license="GPL-3-or-later" license="GPL-3-or-later"
# TODO: maybe depend on mullvad-vpn-daemon? # TODO: maybe depend on mullvad-vpn-daemon?
depends=" depends="
freetype-dev
freetype-static
fontconfig-dev
fontconfig-static
bzip2-dev
bzip2-static
brotli-dev
brotli-static
expat-dev
expat-static
libx11-dev
libxcursor-dev
libxkbcommon-dev
libxkbcommon-static
wayland-dev
wayland-libs-client
wayland-libs-server
wayland-static
openssl-dev
openssl-libs-static
zlib-dev
zlib-static
libpng-dev
libpng-static
libwebp-dev
libwebp-static
tiff-dev
libjpeg-turbo-dev
libjpeg-turbo-static
" "
makedepends=" makedepends="
rustup
build-base build-base
cargo-auditable musl-dev
rust gcc
cmake
make
pkgconfig pkgconfig
perl
python3
curl
git
llvm
clang
clang-libclang
protobuf-dev protobuf-dev
fontconfig-dev libc-dev
dbus-dev linux-headers
wayland-dev
" "
checkdepends="" checkdepends=""
install="" install=""
subpackages="" subpackages=""
source="" source=""
builddir="$srcdir/" builddir="$srcdir/"
options="net !check" options="net"
_cargo_target_dir="${CARGO_TARGET_DIR:-$startdir/mullvadvpn-app/target}"
prepare() {
default_prepare
cd "$startdir/mullvadvpn-app"
cargo fetch --target "$CHOST" --locked
}
build() { build() {
# rustup-init -y --default-toolchain stable
source "$HOME/.cargo/env"
cd "$startdir/mullvadvpn-app" cd "$startdir/mullvadvpn-app"
# Specify `--target` so that the final binary ends up in target/<target>/release. # rustup default stable
cargo build --release --locked \ local target="$(rustup +stable show active-toolchain | sed 's/^[^-]*-//' | grep -o "^[^ ]*")"
--target "$CHOST" \
# * Force the `stable` toolchain since it's installed in the container.
# We don't wan't to needlessly download rust while building.
# * Disable `tray-icon` feature. (TODO: figure out how to compile with libdbus)
# * Specify `--target` so that the final binary ends up in target/<target>/release.
cargo +stable build --release --locked \
--target "$target" \
--no-default-features --features map \
-p mullvad-slint -p mullvad-slint
} }
package() { package() {
# Executable local cargo_target_dir="${CARGO_TARGET_DIR:-$startdir/mullvadvpn-app/target}"
install -m755 -D "$_cargo_target_dir/$CHOST/release/mullvad-slint" \ local target="$(rustup +stable show active-toolchain | sed 's/^[^-]*-//' | grep -o "^[^ ]*")"
"$pkgdir"/usr/bin/mullvad-slint
# .desktop file # TODO: .desktop
install -m644 -D "$startdir/mullvadvpn-app/dist-assets/linux/slint/mullvad-vpn-slint.desktop" \ # TODO: icon
"$pkgdir"/usr/share/applications/mullvad-vpn-slint.desktop
# Icons install -m755 -D "$cargo_target_dir/$target/release/$pkgname" \
install -m644 -D "$startdir/mullvadvpn-app/dist-assets/linux/slint/16x16/apps/mullvad.png" \ "$pkgdir"/usr/bin/"$pkgname"
"$pkgdir"/usr/share/icons/hicolor/16x16/apps/mullvad.png
install -m644 -D "$startdir/mullvadvpn-app/dist-assets/linux/slint/20x20/apps/mullvad.png" \
"$pkgdir"/usr/share/icons/hicolor/20x20/apps/mullvad.png
install -m644 -D "$startdir/mullvadvpn-app/dist-assets/linux/slint/24x24/apps/mullvad.png" \
"$pkgdir"/usr/share/icons/hicolor/24x24/apps/mullvad.png
install -m644 -D "$startdir/mullvadvpn-app/dist-assets/linux/slint/30x30/apps/mullvad.png" \
"$pkgdir"/usr/share/icons/hicolor/30x30/apps/mullvad.png
install -m644 -D "$startdir/mullvadvpn-app/dist-assets/linux/slint/32x32/apps/mullvad.png" \
"$pkgdir"/usr/share/icons/hicolor/32x32/apps/mullvad.png
install -m644 -D "$startdir/mullvadvpn-app/dist-assets/linux/slint/36x36/apps/mullvad.png" \
"$pkgdir"/usr/share/icons/hicolor/36x36/apps/mullvad.png
install -m644 -D "$startdir/mullvadvpn-app/dist-assets/linux/slint/40x40/apps/mullvad.png" \
"$pkgdir"/usr/share/icons/hicolor/40x40/apps/mullvad.png
install -m644 -D "$startdir/mullvadvpn-app/dist-assets/linux/slint/48x48/apps/mullvad.png" \
"$pkgdir"/usr/share/icons/hicolor/48x48/apps/mullvad.png
install -m644 -D "$startdir/mullvadvpn-app/dist-assets/linux/slint/64x64/apps/mullvad.png" \
"$pkgdir"/usr/share/icons/hicolor/64x64/apps/mullvad.png
install -m644 -D "$startdir/mullvadvpn-app/dist-assets/linux/slint/72x72/apps/mullvad.png" \
"$pkgdir"/usr/share/icons/hicolor/72x72/apps/mullvad.png
install -m644 -D "$startdir/mullvadvpn-app/dist-assets/linux/slint/96x96/apps/mullvad.png" \
"$pkgdir"/usr/share/icons/hicolor/96x96/apps/mullvad.png
install -m644 -D "$startdir/mullvadvpn-app/dist-assets/linux/slint/256x256/apps/mullvad.png" \
"$pkgdir"/usr/share/icons/hicolor/256x256/apps/mullvad.png
install -m644 -D "$startdir/mullvadvpn-app/dist-assets/linux/slint/512x512/apps/mullvad.png" \
"$pkgdir"/usr/share/icons/hicolor/512x512/apps/mullvad.png
} }

Submodule mullvad-vpn-slint/mullvadvpn-app deleted from 236bbc4c0e

9
podman-build.sh Executable file → Normal file
View File

@@ -4,10 +4,7 @@ set -ex
cd "$(dirname "$0")" cd "$(dirname "$0")"
package="$1" package="$1"
shift
builder_image="mullvad-slint-musl-builder" builder_image="mullvad-slint-musl-builder"
cargo_home="${CARGO_HOME:-$HOME/.cargo}"
. "$HOME/.abuild/abuild.conf" . "$HOME/.abuild/abuild.conf"
podman build . -f Dockerfile -t "$builder_image" podman build . -f Dockerfile -t "$builder_image"
@@ -17,12 +14,10 @@ podman run --rm \
-v "$PACKAGER_PRIVKEY":/key.rsa:ro \ -v "$PACKAGER_PRIVKEY":/key.rsa:ro \
-v "$PACKAGER_PRIVKEY.pub":/key.rsa.pub:ro \ -v "$PACKAGER_PRIVKEY.pub":/key.rsa.pub:ro \
-v "$PACKAGER_PRIVKEY.pub":/etc/apk/keys/key.rsa.pub:ro \ -v "$PACKAGER_PRIVKEY.pub":/etc/apk/keys/key.rsa.pub:ro \
-v ./packages:/root/packages \
-v "$cargo_home":/cargo-home \
-e "CARGO_HOME=/cargo-home" \
-v ./target:/cargo-target \ -v ./target:/cargo-target \
-v ./packages:/root/packages \
-e "CARGO_TARGET_DIR=/cargo-target" \ -e "CARGO_TARGET_DIR=/cargo-target" \
-it \ -it \
"$builder_image" \ "$builder_image" \
abuild -F "$@" abuild -F