How do i package KDE apps into .rpm?

i’m affected by the bug 503578 – Allow Ctrl+C to send SIGINT OR Copy text, which is solved in recent commit. since it affected my workflow a lot, i decided to manually build konsole. i’ve successfully built konsole following guide with Building KDE software with kde-builder | Developer. i can launch konsole with kde-builder --run konsole. but the problem is i’m building it inside distrobox container, so it cannot be used on host system directly (e.g it cannot access system headers outside the container). this is because i’m using kinoite, an immutable OS, and it’s discouraged to install system packages on host system.
thus, the only viable way seems to be to locally package konsole binary into .rpm and install it on rpm-ostree, but it seems that there aren’t guide on packaging KDE apps. what should i do?

I’m not a developer but I do build Dolphin to change a few things.

I’m using Fedora Workstation.

I do it by grabbing the source rpm

dnf download --source dolphin

then I unzip it and make my changes and test it with an ordinary cmake .. make etc.

then I just build it using rpmbuild

rpmbuild -ba dolphin.spec

which spits out an rpm

I just followed a fedora tutorial on how to set up rpmbuild, it’s like 2 minutes work.

1 Like

Using a source RPM (SRPM) on Red Hat Enterprise Linux (RHEL) to compile and install a program involves several steps. This process allows you to customize the compilation and installation of the software. Here’s a step-by-step guide:

1. Install Required Tools

First, ensure that you have the necessary tools and dependencies to work with SRPMs:

sudo yum groupinstall "Development Tools" sudo yum install rpm-build redhat-rpm-config

2. Download the Source RPM

You can download the SRPM using a command like yumdownloader. Install yum-utils if you don’t have it installed:

sudo yum install yum-utils yumdownloader --source <package_name>

Alternatively, you might find the SRPM on a website or through another method. It will usually have a .src.rpm extension.

3. Install the Source RPM

When you “install” an SRPM, it doesn’t actually install the software; instead, it extracts the source files and the spec file to your system:

rpm -ivh <package_name>.src.rpm

This command extracts the source RPM to your ~/rpmbuild/SOURCES and ~/rpmbuild/SPECS directories by default.

4. Install Build Dependencies

Next, install the necessary build dependencies listed in the spec file:

sudo yum-builddep ~/rpmbuild/SPECS/<package_name>.spec

This command reads the spec file and installs all the required packages needed to build the software.

5. Build the Binary RPM

Now, build the binary RPM from the source RPM:

rpmbuild -bb ~/rpmbuild/SPECS/<package_name>.spec

This command compiles the software and generates a binary RPM in ~/rpmbuild/RPMS/.

6. Install the Binary RPM

Once the binary RPM is built, you can install it using:

sudo rpm -ivh ~/rpmbuild/RPMS/<architecture>/<package_name>.rpm

Replace <architecture> with your system architecture (e.g., x86_64).

7. Clean Up (Optional)

After installation, you can clean up the build files if you don’t need them anymore:

Additional Tips:

  • Customizing the Build: You can modify the .spec file in ~/rpmbuild/SPECS/ to change build options, configure paths, or adjust other settings before running the rpmbuild command.
  • Debugging: If the build fails, check the log files generated during the build process, typically found in ~/rpmbuild/BUILD/.

Following these steps should allow you to successfully compile and install a program from a source RPM on RHEL.