Skip to content

Add Linux port: GTK 4 GUI with MuPDF rendering engine#5631

Open
iqbaljunaid wants to merge 3 commits into
sumatrapdfreader:masterfrom
iqbaljunaid:master
Open

Add Linux port: GTK 4 GUI with MuPDF rendering engine#5631
iqbaljunaid wants to merge 3 commits into
sumatrapdfreader:masterfrom
iqbaljunaid:master

Conversation

@iqbaljunaid
Copy link
Copy Markdown

Summary

This PR adds a native Linux port of SumatraPDF using GTK 4 for the UI and MuPDF for PDF rendering.

What's included

  • Meson build system for Linux (compiles all dependencies from source: zlib, brotli, freetype, harfbuzz, libjpeg-turbo, openjpeg, jbig2dec, lcms2, extract, gumbo-parser, libwebp, mujs, libdjvu, MuPDF)
  • GTK 4 GUI application with:
    • Header bar with open/navigation/zoom controls
    • Keyboard shortcuts (j/k, PgUp/PgDn, Home/End, Ctrl+O, Ctrl+scroll zoom, F11 fullscreen)
    • Drag-and-drop file opening
    • Cairo-based page rendering from MuPDF pixmaps
    • GApplication file handling (open files from command line or file manager)
  • GitHub Actions CI/CD pipeline (builds on ubuntu-24.04, publishes releases on tags)
  • Packaging (tar.gz distribution with .desktop file, AppStream metadata, icons)

Build instructions

sudo apt-get install -y meson ninja-build gcc g++ libgtk-4-dev
meson setup linux/builddir
meson compile -C linux/builddir
./linux/builddir/linux/src/sumatrapdf

Files added

  • linux/src/main_gtk.c — GTK 4 GUI application
  • linux/src/meson.build — Build targets
  • linux/ext/*/meson.build — Build files for each dependency
  • linux/dist/ — Packaging files (.desktop, metainfo, package.sh)
  • .github/workflows/linux-package.yml — CI/CD
  • meson.build, meson.options — Root build configuration

No existing Windows code is modified.

Phase 1 of the Linux port. Builds MuPDF and all dependencies from source
using Meson/Ninja on x86_64 Linux.

- Meson build system with all 14 external libraries compiled from source
- MuPDF renders PDF, XPS, SVG, CBZ, IMG, HTML, EPUB formats
- Font resources embedded via ld -r -b binary (HAVE_OBJCOPY)
- FreeType uses MuPDF's slim module config
- CI workflow for automated builds and GitHub Releases
- Packaging script producing distributable tar.gz + AppImage support
- main_gtk.c: Full PDF viewer with GTK 4 header bar, page navigation,
  zoom controls, keyboard shortcuts, drag-and-drop, fullscreen support
- Renders pages via MuPDF to Cairo surfaces
- Handles file opening via GApplication open signal
- meson.build: Add sumatrapdf GUI target with gtk4 dependency,
  rename old test binary to test-mupdf
- CI: Add libgtk-4-dev to build dependencies
@koppor
Copy link
Copy Markdown

koppor commented May 20, 2026

Wow! Looks simpler than expected. Thank you!

Relattion to issue:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants