/kde-git

Primary LanguageShellGNU General Public License v3.0GPL-3.0

About

This repository contains scripts to build and install KDE packages from source on Arch Linux, by automatically fetching and modifying the official PKGBUILDs.

The package names are the same as those in the official repos, and their versions are <arch-version>_<tag>.r<revision>.g<commit>_<yyyymmdd>. This ensures that the built packages are always newer than the official packages, and they automatically follow the versioning of the official packages.

WARNING: Always make backups before updating your system!

Preparation

Install dependencies

sudo pacman -S devtools parallel

Setting up chroot

Building the packages in a chroot is strongly recommended. The packages should be installed at the same time, when all of them have been built successfully.

source src/prefix.sh
mkarchroot -C <pacman.conf> -M <makepkg.conf> $CHROOT/root base-devel devtools parallel
arch-nspawn $CHROOT/root useradd $USER
sudo bash -c "echo '$USER ALL=(ALL) NOPASSWD: ALL' >> $CHROOT/root/etc/sudoers"
arch-nspawn $CHROOT/root bash -c "mkdir -p /home/$USER/build; chown -R $USER:$USER /home/$USER"
sudo cp -r src $CHROOT/root/home/$USER
arch-nspawn $CHROOT/root bash

Before you build, make sure the chroot is up to date:

arch-nspawn $CHROOT/root pacman -Syu

Setting up local repository

If you set up PKGDEST in makepkg.conf (in the chroot), you can also turn the directory into a local repository by running

repo-add $PKGDEST/<repo-name>.db.tar.gz $PKGDEST/*.pkg.tar.zst

Then, you can add the repository to /etc/pacman.conf by adding the following lines before all the other repositories:

[<repo-name>]
SigLevel = Optional TrustAll
Server = file://<path-to-pkgdest>

TIP: The old packages can be cleaned by running

paccache -c $PKGDEST -k 1 -r

Usage

Common usage

mkdir build; cd build
source ../src/prefix.sh

See all local packages that are available:

get_local_packages.sh | tee local_packages.txt

Find the correct order of building the packages:

get_build_order.sh $(cat local_packages.txt) | tee local_build_order.txt

Build all local packages:

build_install_all.sh $(cat local_build_order.txt)

It is recommended to use the environment variables documented below to perform the build process step by step.

TIP: You can use the environment variable CMAKE_BUILD_PARALLEL_LEVEL to control the number of parallel builds.

build_install_all.sh

This script will build and install all packages passed as arguments in the order they are passed. The following environment variables can be set to skip certain steps:

  • SKIP_FETCH: skip fetching the PKGBUILD
  • SKIP_PATCH: skip patching the PKGBUILD
  • SKIP_PREPARE: skip preparing the package sources
  • SKIP_BUILD: skip building and installing the package

Troubleshooting

If a package fails to build, you can manually edit the PKGBUILD to try to fix the issue. To share your solution, you can add a <package-name>.patch file to the src/patches directory. The patch will be applied after all the standard patches have been applied. Pull requests are welcome!