refract icon indicating copy to clipboard operation
refract copied to clipboard

Package for flathub

Open EpocSquadron opened this issue 3 years ago • 5 comments

Reach across Linux distros could be increased by packaging as a flatpak. If there's appetite for it, there is a guide here for the nitty gritty of how to do it.

I may try my hand at this, but it won't be quickly as I'm both new to flatpak building and a bit busy.

EpocSquadron avatar Mar 25 '22 18:03 EpocSquadron

I don't use flatpak myself, but if you or anybody else wants to write a github action to automatically generate any non-Debian packages whenever a new release is tagged, I'd happily accept the pull request. :wink:

Similarly if anybody wants to maintain refract builds for a given distribution, I'd be happy to add links or whatever to the documentation.

The more the merrier! Haha.

joshstoik1 avatar Mar 25 '22 19:03 joshstoik1

@joshstoik1 I've almost got this packaging working locally, but I'm running into a problem with CMake erroring on being unable to find Thread during the compilation of jpegxl-sys crate. I couldn't find anything about what system dependencies are needed for that crate on its readme, and I really have no experience with c/c++ toolchain. Can you help me figure out what I need to bundle into the flatpak build runtime to make it complete compilation?

Also, what does the '-C link-arg=s' in RUSTFLAGS do, and why emit to asm? Trying to figure out if i can skip those in the flatpak builder.

EpocSquadron avatar Apr 03 '22 14:04 EpocSquadron

Hey @EpocSquadron,

Thank you for your work!

You can ignore all the RUSTFLAGS.

  • -C link-arg=-s can now be set from the manifest directly via strip (I pushed this change a few minutes ago).
  • --emit asm creates extra objects that can be inspected afterwards, but isn't necessary for a straight build.

There are a lot of build dependencies, but not too many runtime dependencies. I generally recommend building Rust programs inside Docker containers so as not to pollute the host system with all that nonsense.

Minimal Debian Bullseye Docker build

First, clone Refract and launch Docker from the root folder of its repository:

git clone https://github.com/Blobfolio/refract.git refract
cd refract
docker run --rm -v "$PWD":/mnt -it debian:bullseye /bin/bash

Then from the Docker container's shell:

# Add wget to make life easier.
apt-get update
apt-get install -y wget

# Install the latest stable Rust. Refract requires 1.59+
wget -q -O /tmp/rustup.sh https://sh.rustup.rs
chmod +x /tmp/rustup.sh
/tmp/rustup.sh -y --profile minimal --default-toolchain stable
exec bash
rustup component add clippy
rm /tmp/rustup.sh

# Install the build dependencies.
apt-get install -y \
	cmake \
	g++ \
	gcc \
	git \
	librust-gdk-dev \
	librust-gtk-dev \
	make \
	nasm \
	ninja-build

# Pop into the /mnt directory and build!
cd /mnt
cargo test
cargo build --release

Post-Build/Runtime

The binary should be in the target folder afterwards, likely at target/release/refract. For "installation" purposes, that file is the only one you actually need. It should be moved to somewhere like /usr/bin/refract.

According to dpkg-shlibdeps, the actual runtime dependencies from a Bullseye build are simply:

  • libc6 (>= 2.29)
  • libgdk-pixbuf-2.0-0 (>= 2.25.2)
  • libglib2.0-0 (>= 2.31.18)
  • libgtk-3-0 (>= 3.16.2)
  • libstdc++6 (>= 6)

(The versions and packages may vary if an older or newer distribution is used for building.)

joshstoik1 avatar Apr 03 '22 18:04 joshstoik1

thanks

convert-apps avatar Mar 06 '25 07:03 convert-apps

@convert-apps The references in this thread — starting with Bullseye, haha — had become outdated. Thanks for the poke!

On the bright side, the changes are all for the fewer.

Build-wise, the librust- stuff is no longer needed:

# Install the build dependencies.
apt-get install -y \
	cmake \
	g++ \
	gcc \
	git \
	make \
	nasm \
	ninja-build

The runtime dependencies are even leaner (and multi-choice!):

  • libc6 (>= 2.35)
  • libstdc++6 (>= 12)
  • One of:
    • xdg-desktop-portal-gnome
    • xdg-desktop-portal-gtk
    • xdg-desktop-portal-kde
    • zenity

I think those lists are complete, but if you take a stab and find you need something else please let me know.

joshstoik1 avatar Mar 06 '25 07:03 joshstoik1