Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package for flathub #3

Open
EpocSquadron opened this issue Mar 25, 2022 · 3 comments
Open

Package for flathub #3

EpocSquadron opened this issue Mar 25, 2022 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@EpocSquadron
Copy link

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.

@joshstoik1
Copy link
Member

joshstoik1 commented Mar 25, 2022

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. 😉

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 joshstoik1 added enhancement New feature or request help wanted Extra attention is needed labels Mar 25, 2022
@EpocSquadron
Copy link
Author

@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.

@joshstoik1
Copy link
Member

joshstoik1 commented Apr 3, 2022

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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants