Package Details: plasma-desktop-git 6.0.80_r11524.gf3a8cd50e-1

Git Clone URL: https://aur.archlinux.org/plasma-desktop-git.git (read-only, click to copy)
Package Base: plasma-desktop-git
Description: KDE Plasma Desktop
Upstream URL: https://kde.org/plasma-desktop/
Licenses: LGPL-2.0-or-later
Groups: plasma-git
Conflicts: knetattach, knetattach-git, plasma-desktop, user-manager, user-manager-git
Provides: knetattach, knetattach-git, plasma-desktop, user-manager, user-manager-git
Replaces: knetattach-git, user-manager-git
Submitter: arojas
Maintainer: IslandC0der (chaotic-aur)
Last Packager: IslandC0der
Votes: 9
Popularity: 0.000001
First Submitted: 2014-03-31 06:31 (UTC)
Last Updated: 2024-03-02 13:37 (UTC)

Required by (46)

Sources (1)

Latest Comments

« First ‹ Previous 1 2 3 4 5 6 7 8 9 10 .. 12 Next › Last »

Neko-san commented on 2021-08-13 23:14 (UTC)

@IslandC0der Okay, I have new issue now?

neko-san@ARCH ~/asp> asp checkout mgba xorg-xsetroot xorg-xmessage xorg-server xonotic wayland-protocols wayland systemsettings sddm-kcm sddm plasma-workspace plasma-wayland-protocols plasma-nm plasma-framework plasma-desktop phonon-gstreamer pcsx2 openmw networkmanager-qt milou libksysguard libkscreen layer-shell-qt kwin kwayland-server kwayland-integration kwayland kuserfeedback ktexteditor ksysguard kscreen kquickcharts knotifyconfig kmenuedit kinit kholidays kdelibs4support kactivitymanagerd kactivities-stats doxygen dolphin-emu appstream yakuake spectacle konsole kaccounts-integration dolphin xorg-xrdb
Cloning into 'mgba'...
done.
Cloning into 'xorg-xsetroot'...
done.
Cloning into 'xorg-xmessage'...
done.
Cloning into 'xorg-server'...
done.
Cloning into 'xonotic'...
done.
Cloning into 'wayland-protocols'...
done.
Cloning into 'wayland'...
done.
Cloning into 'systemsettings'...
done.
Cloning into 'sddm-kcm'...
done.
Cloning into 'sddm'...
done.
Cloning into 'plasma-workspace'...
done.
Cloning into 'plasma-wayland-protocols'...
done.
Cloning into 'plasma-nm'...
done.
Cloning into 'plasma-framework'...
done.
Cloning into 'plasma-desktop'...
done.
Cloning into 'phonon-gstreamer'...
done.
Cloning into 'pcsx2'...
done.
Cloning into 'openmw'...
done.
Cloning into 'networkmanager-qt'...
done.
Cloning into 'milou'...
done.
Cloning into 'libksysguard'...
done.
Cloning into 'libkscreen'...
done.
Cloning into 'layer-shell-qt'...
done.
Cloning into 'kwin'...
done.
Cloning into 'kwayland-server'...
done.
Cloning into 'kwayland-integration'...
done.
Cloning into 'kwayland'...
done.
Cloning into 'kuserfeedback'...
done.
Cloning into 'ktexteditor'...
done.
Cloning into 'ksysguard'...
done.
Cloning into 'kscreen'...
done.
Cloning into 'kquickcharts'...
done.
Cloning into 'knotifyconfig'...
done.
Cloning into 'kmenuedit'...
done.
Cloning into 'kinit'...
done.
Cloning into 'kholidays'...
done.
Cloning into 'kdelibs4support'...
done.
Cloning into 'kactivitymanagerd'...
done.
Cloning into 'kactivities-stats'...
done.
Cloning into 'doxygen'...
done.
Cloning into 'dolphin-emu'...
done.
Cloning into 'appstream'...
done.
Cloning into 'yakuake'...
done.
Cloning into 'spectacle'...
done.
Cloning into 'konsole'...
done.
Cloning into 'kaccounts-integration'...
done.
Cloning into 'dolphin'...
done.
Cloning into 'xorg-xrdb'...
done.
neko-san@ARCH ~/asp> ./aspUpdate.sh
==> updating remote 'packages'
From https://github.com/archlinux/svntogit-packages
 * branch              packages/appstream -> FETCH_HEAD
 * branch              packages/dolphin -> FETCH_HEAD
 * branch              packages/doxygen -> FETCH_HEAD
 * branch              packages/kaccounts-integration -> FETCH_HEAD
 * branch              packages/kactivities-stats -> FETCH_HEAD
 * branch              packages/kactivitymanagerd -> FETCH_HEAD
 * branch              packages/kdelibs4support -> FETCH_HEAD
 * branch              packages/kholidays -> FETCH_HEAD
 * branch              packages/kinit -> FETCH_HEAD
 * branch              packages/kmenuedit -> FETCH_HEAD
 * branch              packages/knotifyconfig -> FETCH_HEAD
 * branch              packages/konsole -> FETCH_HEAD
 * branch              packages/kquickcharts -> FETCH_HEAD
 * branch              packages/kscreen -> FETCH_HEAD
 * branch              packages/ksysguard -> FETCH_HEAD
 * branch              packages/ktexteditor -> FETCH_HEAD
 * branch              packages/kuserfeedback -> FETCH_HEAD
 * branch              packages/kwayland -> FETCH_HEAD
 * branch              packages/kwayland-integration -> FETCH_HEAD
 * branch              packages/kwayland-server -> FETCH_HEAD
 * branch              packages/kwin -> FETCH_HEAD
 * branch              packages/layer-shell-qt -> FETCH_HEAD
 * branch              packages/libkscreen -> FETCH_HEAD
 * branch              packages/libksysguard -> FETCH_HEAD
 * branch              packages/milou -> FETCH_HEAD
 * branch              packages/networkmanager-qt -> FETCH_HEAD
 * branch              packages/phonon-gstreamer -> FETCH_HEAD
 * branch              packages/plasma-desktop -> FETCH_HEAD
 * branch              packages/plasma-framework -> FETCH_HEAD
 * branch              packages/plasma-nm -> FETCH_HEAD
 * branch              packages/plasma-wayland-protocols -> FETCH_HEAD
 * branch              packages/plasma-workspace -> FETCH_HEAD
 * branch              packages/sddm -> FETCH_HEAD
 * branch              packages/sddm-kcm -> FETCH_HEAD
 * branch              packages/spectacle -> FETCH_HEAD
 * branch              packages/systemsettings -> FETCH_HEAD
 * branch              packages/wayland -> FETCH_HEAD
 * branch              packages/wayland-protocols -> FETCH_HEAD
 * branch              packages/xorg-server -> FETCH_HEAD
 * branch              packages/xorg-xmessage -> FETCH_HEAD
 * branch              packages/xorg-xrdb -> FETCH_HEAD
 * branch              packages/xorg-xsetroot -> FETCH_HEAD
 * branch              packages/yakuake -> FETCH_HEAD
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
warning: The last gc run reported the following. Please correct the root cause
and remove /home/neko-san/.cache/asp/.git/gc.log.
Automatic cleanup will not be performed until the file is removed.

warning: There are too many unreachable loose objects; run 'git prune' to remove them.

==> updating remote 'community'
From https://github.com/archlinux/svntogit-community
 * branch              packages/dolphin-emu -> FETCH_HEAD
 * branch              packages/mgba -> FETCH_HEAD
 * branch              packages/openmw -> FETCH_HEAD
 * branch              packages/pcsx2 -> FETCH_HEAD
 * branch              packages/xonotic -> FETCH_HEAD
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
warning: The last gc run reported the following. Please correct the root cause
and remove /home/neko-san/.cache/asp/.git/gc.log.
Automatic cleanup will not be performed until the file is removed.

warning: There are too many unreachable loose objects; run 'git prune' to remove them.

neko-san@ARCH ~/asp> 

IslandC0der commented on 2021-08-13 23:03 (UTC) (edited on 2021-08-13 23:04 (UTC) by IslandC0der)

@Neko-san Yeah, try re-initializing them with asp checkout. git remote says origin exists... So strange.

Well, $dir is set by the for loop on each iteration, so just changing the working directory wouldn't mess with that variable. The reason why you need to go to trunk is that that's where the PKGBUILD is, which is where you will want to append your changes.

Neko-san commented on 2021-08-13 22:37 (UTC) (edited on 2021-08-13 22:47 (UTC) by Neko-san)

@IslandC0der It was before but I'm not sure if any of these actually got an update recently and I haven't seen the script build any packages :/

I had moved some of them to ~/asp/ because it didn't occur to me at first to have a dedicated folder for it

Should I just collect all the package names and make a one-liner to re-initialize all of them or no?

Also, wouldn't going to trunk after git reset change $dir and cause all of the if checks to fail?

neko-san@ARCH ~/asp> cd ./dolphin/
neko-san@ARCH ~/a/dolphin (packages/packages/dolphin)> git remote
origin
neko-san@ARCH ~/a/dolphin (packages/packages/dolphin)> 

IslandC0der commented on 2021-08-13 22:07 (UTC) (edited on 2021-08-13 22:10 (UTC) by IslandC0der)

@Neko-san This is really weird because it was working before, right? Did you change anything (e.g. move all the folders to a different location)?

If you go into one of those dirs and run git remote, what's the output?

Also, extremely important: in the script, cd trunk must come before the if clauses (right after git reset).

Neko-san commented on 2021-08-13 21:39 (UTC)

@IslandC0der Same result

IslandC0der commented on 2021-08-13 21:05 (UTC)

@Neko-san What if you replace origin with origin/master?

Neko-san commented on 2021-08-13 20:54 (UTC)

@IslandC0der It didn't even drop an error text file; it just spat a bunch of fatal errors in the terminal:

neko-san@ARCH ~/asp> sh -c 'for dir in */; do (
                       cd $dir
                       git reset --hard origin || echo "$dir - $(git remote)" >> errors.txt
                     ) done'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

IslandC0der commented on 2021-08-13 20:38 (UTC) (edited on 2021-08-13 20:39 (UTC) by IslandC0der)

@Neko-san Try running something like this:

for dir in */; do (
  cd $dir
  git reset --hard origin || echo "$dir - $(git remote)" >> errors.txt
) done

It will show us which are the problematic dirs (just check errors.txt after it's done)

Neko-san commented on 2021-08-13 02:46 (UTC)

@IslandC0der I have an issue now where it throws errors about "origin"?

==> updating remote 'packages'
From https://github.com/archlinux/svntogit-packages
 * branch              packages/appstream -> FETCH_HEAD
 * branch              packages/dolphin -> FETCH_HEAD
 * branch              packages/doxygen -> FETCH_HEAD
 * branch              packages/kaccounts-integration -> FETCH_HEAD
 * branch              packages/kactivities-stats -> FETCH_HEAD
 * branch              packages/kactivitymanagerd -> FETCH_HEAD
 * branch              packages/kdelibs4support -> FETCH_HEAD
 * branch              packages/kholidays -> FETCH_HEAD
 * branch              packages/kinit -> FETCH_HEAD
 * branch              packages/kmenuedit -> FETCH_HEAD
 * branch              packages/knotifyconfig -> FETCH_HEAD
 * branch              packages/konsole -> FETCH_HEAD
 * branch              packages/kquickcharts -> FETCH_HEAD
 * branch              packages/kscreen -> FETCH_HEAD
 * branch              packages/ksysguard -> FETCH_HEAD
 * branch              packages/ktexteditor -> FETCH_HEAD
 * branch              packages/kuserfeedback -> FETCH_HEAD
 * branch              packages/kwayland -> FETCH_HEAD
 * branch              packages/kwayland-integration -> FETCH_HEAD
 * branch              packages/kwayland-server -> FETCH_HEAD
 * branch              packages/kwin -> FETCH_HEAD
 * branch              packages/layer-shell-qt -> FETCH_HEAD
 * branch              packages/libkscreen -> FETCH_HEAD
 * branch              packages/libksysguard -> FETCH_HEAD
 * branch              packages/milou -> FETCH_HEAD
 * branch              packages/networkmanager-qt -> FETCH_HEAD
 * branch              packages/phonon-gstreamer -> FETCH_HEAD
 * branch              packages/plasma-desktop -> FETCH_HEAD
 * branch              packages/plasma-framework -> FETCH_HEAD
 * branch              packages/plasma-nm -> FETCH_HEAD
 * branch              packages/plasma-wayland-protocols -> FETCH_HEAD
 * branch              packages/plasma-workspace -> FETCH_HEAD
 * branch              packages/sddm -> FETCH_HEAD
 * branch              packages/sddm-kcm -> FETCH_HEAD
 * branch              packages/spectacle -> FETCH_HEAD
 * branch              packages/systemsettings -> FETCH_HEAD
 * branch              packages/wayland -> FETCH_HEAD
 * branch              packages/wayland-protocols -> FETCH_HEAD
 * branch              packages/xorg-server -> FETCH_HEAD
 * branch              packages/xorg-xmessage -> FETCH_HEAD
 * branch              packages/xorg-xrdb -> FETCH_HEAD
 * branch              packages/xorg-xsetroot -> FETCH_HEAD
 * branch              packages/yakuake -> FETCH_HEAD
==> updating remote 'community'
From https://github.com/archlinux/svntogit-community
 * branch              packages/dolphin-emu -> FETCH_HEAD
 * branch              packages/openmw -> FETCH_HEAD
 * branch              packages/pcsx2 -> FETCH_HEAD
 * branch              packages/xonotic -> FETCH_HEAD
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

This is the script now:

#!/usr/bin/env bash

if [[ ./ != ~/asp/ ]]; then
cd ~/asp/
fi

asp update

for dir in */; do (
  cd $dir
  git fetch

  ## If there are upstream changes, apply them, apply ours and rebuild
  if [[ $(git rev-parse HEAD) != $(git rev-parse HEAD@{upstream}) ]]; then
    git reset --hard origin
    ## sed or EOF cat commands go here

      if [ $dir == "kdelibs4support" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cmake -B build -S $pkgname-$pkgver \
          -DCMAKE_INSTALL_LIBEXECDIR=lib \
          -DBUILD_TESTING=OFF \
          -DCMAKE_CXX_COMPILER=clang++ \
          -DCMAKE_C_COMPILER=clang \
          -DUSE_NATIVE_INSTRUCTIONS=ON
        sed -i 's/O2/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/O1/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/build/CMakeCache.txt"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19 -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19"
        cmake --build build -j 16
      }
EOF

    elif [ $dir ==  "plasma-desktop" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cmake -B build -S $pkgname-$pkgver \
          -DCMAKE_INSTALL_LIBEXECDIR=lib \
          -DBUILD_TESTING=OFF \
          -DCMAKE_CXX_COMPILER=clang++ \
          -DCMAKE_C_COMPILER=clang \
          -DUSE_NATIVE_INSTRUCTIONS=ON \
          -DCMAKE_BUILD_TYPE=Release
        sed -i 's/O2/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/O1/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/build/CMakeCache.txt"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -flto-compression-level=19 -fuse-linker-plugin -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -flto-compression-level=19 -fuse-linker-plugin"
        cmake --build build -j 16
      }
EOF

      elif [ $dir == "plasma-workspace" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cmake -B build -S $pkgbase-$pkgver \
          -DCMAKE_INSTALL_LIBEXECDIR=lib \
          -DBUILD_TESTING=OFF \-DCMAKE_CXX_COMPILER=clang++ \
          -DCMAKE_C_COMPILER=clang \
          -DUSE_NATIVE_INSTRUCTIONS=ON
        sed -i 's/O2/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/O1/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/build/CMakeCache.txt"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19 -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19"

        cmake --build build -j 16
      }
EOF

      elif [ $dir ==  "systemsetings" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
      cmake -B build -S $pkgname-$pkgver \
        -DBUILD_TESTING=OFF \
        -DCMAKE_CXX_COMPILER=clang++ \
        -DCMAKE_C_COMPILER=clang \
        -DUSE_NATIVE_INSTRUCTIONS=ON \
        -DCMAKE_BUILD_TYPE=Release
      sed -i 's/O2/O3/g' "$srcdir/build/CMakeCache.txt"
      sed -i 's/O1/O3/g' "$srcdir/build/CMakeCache.txt"
      sed -i 's/-march=x86-64/-march=native/g' "$srcdir/build/CMakeCache.txt"
      sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/build/CMakeCache.txt"
      CXXFLAGS+=" -minline-all-stringops -flto=16 -flto-compression-level=19 -fuse-linker-plugin -stdlib=libc++ -lstdc++"
      CFLAGS+=" -minline-all-stringops -flto=16 -flto-compression-level=19 -fuse-linker-plugin"
      cmake --build build -j 16
    }
EOF

      elif [ $dir ==  "networkmanager-qt" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cmake -B build -S $pkgname-$pkgver \
          -DBUILD_TESTING=OFF \
          -DBUILD_QCH=ON \
          -DCMAKE_CXX_COMPILER=clang++ \
          -DCMAKE_C_COMPILER=clang \
          -DUSE_NATIVE_INSTRUCTIONS=ON
        sed -i 's/O2/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/O1/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/build/CMakeCache.txt"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -flto-compression-level=19 -fuse-linker-plugin -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -flto-compression-level=19 -fuse-linker-plugin"

        cmake --build build -j 16
      }
EOF

      elif [ $dir ==  "knotifyconfig" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cmake -B build -S $pkgname-$pkgver \
          -DBUILD_TESTING=OFF \
          -DBUILD_QCH=ON \
          -DCMAKE_CXX_COMPILER=clang++ \
          -DCMAKE_C_COMPILER=clang \
          -DUSE_NATIVE_INSTRUCTIONS=ON
        sed -i 's/O2/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/O1/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/build/CMakeCache.txt"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19 -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19"

        cmake --build build -j 16
      }
EOF

    elif [ $dir ==  "plasma-nm" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cmake -B build -S $pkgname-$pkgver \
          -DBUILD_TESTING=OFF \
          -DCMAKE_CXX_COMPILER=clang++ \
          -DCMAKE_C_COMPILER=clang \
          -DUSE_NATIVE_INSTRUCTIONS=ON \
          -DCMAKE_BUILD_TYPE=Release
        sed -i 's/O2/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/O1/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/build/CMakeCache.txt"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -flto-compression-level=19 -fuse-linker-plugin -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -flto-compression-level=19 -fuse-linker-plugin"
        cmake --build build -j 16
      }
EOF

    elif [ $dir == "kuserfeedback" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cd build
        cmake ../$pkgname-$pkgver \
          -DCMAKE_CXX_COMPILER=clang++ \
            -DCMAKE_C_COMPILER=clang \
          -DUSE_NATIVE_INSTRUCTIONS=ON
        sed -i 's/O2/O3/g' "$srcdir/build/Makefile"
        sed -i 's/O1/O3/g' "$srcdir/build/Makefile"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/build/Makefile"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/build/Makefile"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19 -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19"
        make -j 16 -C build
      }
EOF

    elif [ $dir ==  "kmenuedit" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
      cmake -B build -S $pkgname-$pkgver \
        -DBUILD_TESTING=OFF \
        -DCMAKE_CXX_COMPILER=clang++ \
        -DCMAKE_C_COMPILER=clang \
        -DUSE_NATIVE_INSTRUCTIONS=ON \
        -DCMAKE_BUILD_TYPE=Release
      sed -i 's/O2/O3/g' "$srcdir/build/CMakeCache.txt"
      sed -i 's/O1/O3/g' "$srcdir/build/CMakeCache.txt"
      sed -i 's/-march=x86-64/-march=native/g' "$srcdir/build/CMakeCache.txt"
      sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/build/CMakeCache.txt"
      CXXFLAGS+=" -minline-all-stringops -flto=16 -flto-compression-level=19 -fuse-linker-plugin -stdlib=libc++ -lstdc++"
      CFLAGS+=" -minline-all-stringops -flto=16 -flto-compression-level=19 -fuse-linker-plugin"
      cmake --build build -j 16
    }
EOF

    elif [ $dir == "plasma-framework" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cmake -B build -S $pkgname-$pkgver \
          -DCMAKE_BUILD_TYPE=Release \
          -DBUILD_TESTING=OFF \
          -DBUILD_QCH=ON \
          -DCMAKE_CXX_COMPILER=clang++ \
          -DCMAKE_C_COMPILER=clang \
          -DUSE_NATIVE_INSTRUCTIONS=ON
        sed -i 's/O2/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/O1/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/build/CMakeCache.txt"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19 -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19"
        cmake --build build -j 16
      }
EOF

      elif [ $dir == "kinit" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cmake -B build -S $pkgname-$pkgver \
          -DCMAKE_INSTALL_LIBEXECDIR=lib \
          -DBUILD_TESTING=OFF \
          -DCMAKE_CXX_COMPILER=clang++ \
          -DCMAKE_C_COMPILER=clang \
          -DUSE_NATIVE_INSTRUCTIONS=ON
        sed -i 's/O2/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/O1/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/build/CMakeCache.txt"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19 -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19"
        cmake --build build -j 16
      }
EOF

    elif [ $dir == "kwin" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cmake -B build -S $pkgname-$pkgver \
          -DCMAKE_INSTALL_LIBEXECDIR=lib \
          -DBUILD_TESTING=OFF \
          -DCMAKE_BUILD_TYPE=Release \
          -DCMAKE_CXX_COMPILER=clang++ \
          -DCMAKE_C_COMPILER=clang \
          -DUSE_NATIVE_INSTRUCTIONS=ON
        sed -i 's/O2/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/O1/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/build/CMakeCache.txt"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19 -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19"

        cmake --build build -j 16
      }
EOF

    elif [ $dir == "kwayland" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cmake -B build -S $pkgname-$pkgver \
          -DCMAKE_INSTALL_LIBEXECDIR=lib \
          -DBUILD_TESTING=OFF \
          -DBUILD_QCH=ON \
          -DCMAKE_CXX_COMPILER=clang++ \
          -DCMAKE_C_COMPILER=clang \
          -DUSE_NATIVE_INSTRUCTIONS=ON
        sed -i 's/O2/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/O1/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/build/CMakeCache.txt"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19 -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19"

        cmake --build build -j 16
      }
EOF

    elif [ $dir == "kwayland-integration" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cmake -B build -S $pkgname-$pkgver \
          -DBUILD_TESTING=OFF \
          -DCMAKE_CXX_COMPILER=clang++ \
          -DCMAKE_C_COMPILER=clang \
          -DUSE_NATIVE_INSTRUCTIONS=ON
        sed -i 's/O2/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/O1/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/build/CMakeCache.txt"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19 -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19"

        cmake --build build -j 16
      }
EOF

    elif [ $dir == "kwayland-server" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cmake -B build -S $pkgname-$pkgver \
          -DBUILD_TESTING=OFF \
          -DBUILD_QCH=ON \
          -DCMAKE_CXX_COMPILER=clang++ \
          -DCMAKE_C_COMPILER=clang \
          -DUSE_NATIVE_INSTRUCTIONS=ON
        sed -i 's/O2/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/O1/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/build/CMakeCache.txt"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19 -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19"

        cmake --build build -j 16
      }
EOF

    elif [ $dir == "plasma-wayland-protocols" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cmake -B build -S $pkgname-$pkgver \
          -DCMAKE_CXX_COMPILER=clang++ \
          -DCMAKE_C_COMPILER=clang \
          -DUSE_NATIVE_INSTRUCTIONS=ON
        sed -i 's/O2/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/O1/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/build/CMakeCache.txt"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19 -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19"

        cmake --build build -j 16
      }
EOF

    elif [ $dir == "sddm" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cmake -B build -S $pkgname-$pkgver \
          -DCMAKE_INSTALL_PREFIX=/usr \
          -DCMAKE_INSTALL_LIBEXECDIR=/usr/lib/sddm \
          -DDBUS_CONFIG_DIR=/usr/share/dbus-1/system.d \
          -DDBUS_CONFIG_FILENAME=sddm_org.freedesktop.DisplayManager.conf \
          -DBUILD_MAN_PAGES=ON \
          -DCMAKE_CXX_COMPILER=clang++ \
          -DCMAKE_C_COMPILER=clang \
          -DUSE_NATIVE_INSTRUCTIONS=ON
        sed -i 's/O2/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/O1/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/build/CMakeCache.txt"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19 -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19"

        cmake --build build -j 16
      }
EOF

    elif [ $dir == "sddm-kcm" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cmake -B build -S $pkgname-$pkgver \
          -DBUILD_TESTING=OFF \
          -DCMAKE_CXX_COMPILER=clang++ \
          -DCMAKE_C_COMPILER=clang \
          -DUSE_NATIVE_INSTRUCTIONS=ON
        sed -i 's/O2/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/O1/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/build/CMakeCache.txt"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19 -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19"

        cmake --build build -j 16
      }
EOF

    elif [ $dir == "wayland" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        meson build $pkgbase-$pkgver \
          --buildtype=release \
          --prefix=/usr\
          -Dqt=true \
          -Dvapi=true \
          -Dc_args='-minline-all-stringops -D_FORTIFY_SOURCE=2 -march=native -march=native -mtune=native' \
          -Dcompose=true
        meson compile -j 16 -C build
      }

      check() {
        ninja -j 16 -C build test
      }
EOF

    elif [ $dir == "wayland-protocols" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cd $pkgname-$pkgver

        ./configure --prefix=/usr
        sed -i 's/O2/O3/g' "$srcdir/wayland-protocols-$pkgver/Makefile"
        sed -i 's/O1/O3/g' "$srcdir/wayland-protocols-$pkgver/Makefile"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/wayland-protocols-$pkgver/Makefile"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/wayland-protocols-$pkgver/Makefile"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19 -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19"
        make -j 16
      }

      check() {
        cd $pkgname-$pkgver

        make -j 16 check
      }
EOF


      elif [ $dir == "libkscreen" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cmake -B build -S $pkgname-$pkgver \
          -DCMAKE_INSTALL_LIBEXECDIR=lib \
          -DBUILD_TESTING=OFF \
          -DBUILD_QCH=ON \
          -DCMAKE_CXX_COMPILER=clang++ \
          -DCMAKE_C_COMPILER=clang \
          -DUSE_NATIVE_INSTRUCTIONS=ON
        sed -i 's/O2/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/O1/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/build/CMakeCache.txt"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19 -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19"

        cmake --build build -j 16
      }
EOF

      elif [ $dir == "kscreen" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cmake -B build -S $pkgname-$pkgver \
          -DBUILD_TESTING=OFF \
          -DBUILD_QCH=ON \
          -DCMAKE_CXX_COMPILER=clang++ \
          -DCMAKE_C_COMPILER=clang \
          -DUSE_NATIVE_INSTRUCTIONS=ON
        sed -i 's/O2/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/O1/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/build/CMakeCache.txt"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19 -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19"

        cmake --build build -j 16
      }
EOF

      elif [ $dir == "kaccounts-integration" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cmake -B build -S $pkgname-$pkgver \
          -DBUILD_TESTING=OFF \
          -DCMAKE_CXX_COMPILER=clang++ \
          -DCMAKE_C_COMPILER=clang \
          -DUSE_NATIVE_INSTRUCTIONS=ON
        sed -i 's/O2/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/O1/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/build/CMakeCache.txt"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19 -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19"

        cmake --build build -j 16
      }
EOF

      elif [ $dir == "kactivities-stats" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cmake -B build -S $pkgname-$pkgver \
          -DBUILD_TESTING=OFF \
          -DBUILD_QCH=ON \
          -DCMAKE_CXX_COMPILER=clang++ \
          -DCMAKE_C_COMPILER=clang \
          -DUSE_NATIVE_INSTRUCTIONS=ON
        sed -i 's/O2/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/O1/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/build/CMakeCache.txt"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19 -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19"

        cmake --build build -j 16
      }
EOF

      elif [ $dir == "kactivitymanagerd" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cmake -B build -S $pkgname-$pkgver \
          -DCMAKE_INSTALL_LIBEXECDIR=lib \
          -DBUILD_TESTING=OFF \
          -DCMAKE_CXX_COMPILER=clang++ \
          -DCMAKE_C_COMPILER=clang \
          -DUSE_NATIVE_INSTRUCTIONS=ON
        sed -i 's/O2/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/O1/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/build/CMakeCache.txt"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19 -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19"

        cmake --build build -j 16
      }
EOF

      elif [ $dir == "ktexteditor" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cmake -B build -S $pkgname-$pkgver \
          -DBUILD_TESTING=OFF \
          -DBUILD_QCH=ON \
          -DCMAKE_CXX_COMPILER=clang++ \
          -DCMAKE_C_COMPILER=clang \
          -DUSE_NATIVE_INSTRUCTIONS=ON
        sed -i 's/O2/O3/g' "$srcdir/build/Makefile"
        sed -i 's/O1/O3/g' "$srcdir/build/Makefile"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/build/Makefile"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/build/Makefile"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19 -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19"

        cmake --build build -j 16
      }
EOF

      elif [ $dir == "kholidays" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cmake -B build -S $pkgname-$pkgver \
          -DBUILD_TESTING=OFF \
          -DBUILD_QCH=ON \
          -DCMAKE_CXX_COMPILER=clang++ \
          -DCMAKE_C_COMPILER=clang \
          -DUSE_NATIVE_INSTRUCTIONS=ON
        sed -i 's/O2/O3/g' "$srcdir/build/Makefile"
        sed -i 's/O1/O3/g' "$srcdir/build/Makefile"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/build/Makefile"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/build/Makefile"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19 -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19"

        cmake --build build -j 16
      }
EOF

      elif [ $dir == "milou" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cmake -B build -S $pkgname-$pkgver \
          -DBUILD_TESTING=OFF \
          -DCMAKE_CXX_COMPILER=clang++ \
          -DCMAKE_C_COMPILER=clang \
          -DUSE_NATIVE_INSTRUCTIONS=ON
        sed -i 's/O2/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/O1/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/build/CMakeCache.txt"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19 -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19"

        cmake --build build -j 16
      }
EOF

    elif [ $dir == "appstream-qt" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        meson build AppStream-$pkgver \
          --prefix=/usr \
          -Dqt=true \
          -Dvapi=true \
          -Dc_args='-minline-all-stringops -D_FORTIFY_SOURCE=2 -march=native -march=native -mtune=native' \
          -Dcompose=true
        meson compile -j 16 -C build
      }
EOF

    elif [ $dir == "phonon-gstreamer" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cd build
        cmake ../phonon-backend-gstreamer-$pkgver \
          -DCMAKE_CXX_COMPILER=clang++ \
          -DCMAKE_C_COMPILER=clang \
          -DUSE_NATIVE_INSTRUCTIONS=ON
        sed -i 's/O2/O3/g' "$srcdir/build/Makefile"
        sed -i 's/O1/O3/g' "$srcdir/build/Makefile"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/build/Makefile"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/build/Makefile"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19 -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19"

        make -j 16
      }
EOF

    elif [ $dir == "kquickcharts" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cmake -B build -S $pkgname-$pkgver \
          -DBUILD_TESTING=OFF \
          -DCMAKE_CXX_COMPILER=clang++ \
          -DCMAKE_C_COMPILER=clang \
          -DUSE_NATIVE_INSTRUCTIONS=ON
        sed -i 's/O2/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/O1/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/build/CMakeCache.txt"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19 -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19"

        cmake --build build -j 16
      }
EOF

      elif [ $dir == "yakuake" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cmake -B build -S $pkgname-$pkgver \
          -DBUILD_TESTING=OFF \
          -DCMAKE_CXX_COMPILER=clang++ \
          -DCMAKE_C_COMPILER=clang \
          -DUSE_NATIVE_INSTRUCTIONS=ON
        sed -i 's/O2/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/O1/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/build/CMakeCache.txt"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19 -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19"

        cmake --build build -j 16
      }
EOF

      elif [ $dir == "konsole" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cmake -B build -S $pkgname-$pkgver \
          -DBUILD_TESTING=OFF \
          -DCMAKE_CXX_COMPILER=clang++ \
          -DCMAKE_C_COMPILER=clang \
          -DUSE_NATIVE_INSTRUCTIONS=ON
        sed -i 's/O2/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/O1/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/build/CMakeCache.txt"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19 -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19"

        cmake --build build -j 16
      }
EOF

      elif [ $dir == "dolphin" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cmake -B build -S $pkgname-$pkgver \
          -DBUILD_TESTING=OFF \
          -DCMAKE_CXX_COMPILER=clang++ \
          -DCMAKE_C_COMPILER=clang \
          -DUSE_NATIVE_INSTRUCTIONS=ON
        sed -i 's/O2/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/O1/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/build/CMakeCache.txt"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19 -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19"

        cmake --build build -j 16
      }
EOF

      elif [ $dir == "libksysguard" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cmake -B build -S $pkgname-$pkgver \
          -DCMAKE_INSTALL_LIBEXECDIR=lib \
          -DBUILD_TESTING=OFF \
          -DCMAKE_CXX_COMPILER=clang++ \
          -DCMAKE_C_COMPILER=clang \
          -DUSE_NATIVE_INSTRUCTIONS=ON
        sed -i 's/O2/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/O1/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/build/CMakeCache.txt"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19 -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19"

        cmake --build build -j 16
      }
EOF

      elif [ $dir == "ksysguard" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cmake -B build -S $pkgname-$pkgver \
          -DBUILD_TESTING=OFF \
          -DCMAKE_CXX_COMPILER=clang++ \
          -DCMAKE_C_COMPILER=clang \
          -DUSE_NATIVE_INSTRUCTIONS=ON
        sed -i 's/O2/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/O1/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/build/CMakeCache.txt"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19 -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19"

        cmake --build build -j 16
      }
EOF

    elif [ $dir == "spectacle" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cmake -B build -S $pkgname-$pkgver \
          -DBUILD_TESTING=OFF \
          -DCMAKE_CXX_COMPILER=clang++ \
          -DCMAKE_C_COMPILER=clang \
          -DUSE_NATIVE_INSTRUCTIONS=ON
        sed -i 's/O2/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/O1/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/build/CMakeCache.txt"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19 -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19"

        cmake --build build -j 16
      }
EOF

      elif [ $dir == "layer-shell-qt" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cmake -B build -S $pkgname-$pkgver \
          -DCMAKE_CXX_COMPILER=clang++ \
          -DCMAKE_C_COMPILER=clang \
          -DUSE_NATIVE_INSTRUCTIONS=ON
        sed -i 's/O2/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/O1/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/build/CMakeCache.txt"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19 -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19"

        cmake --build build -j 16
      }
EOF

    elif [ $dir == "doxygen" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cd ${pkgbase}-Release_${pkgver//./_}

        cmake -B build \
          -DCMAKE_INSTALL_PREFIX:PATH=/usr \
          -DDOC_INSTALL_DIR:PATH=share/doc/doxygen \
          -DPYTHON_EXECUTABLE:FILE=/usr/bin/python \
          -Dbuild_doc:BOOL=ON \
          -Dbuild_wizard:BOOL=ON \
          -DCMAKE_CXX_COMPILER=clang++ \
          -DCMAKE_C_COMPILER=clang \
          -DUSE_NATIVE_INSTRUCTIONS=ON
        sed -i 's/O2/O3/g' "$srcdir/${pkgbase}-Release_${pkgver//./_}/build/CMakeCache.txt"
        sed -i 's/O1/O3/g' "$srcdir/${pkgbase}-Release_${pkgver//./_}/build/CMakeCache.txt"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/${pkgbase}-Release_${pkgver//./_}/build/CMakeCache.txt"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/${pkgbase}-Release_${pkgver//./_}/build/CMakeCache.txt"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19 -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19"

        make -j 16 -C build
        make -j 16 -C build docs
      }

      check() {
        cd ${pkgbase}-Release_${pkgver//./_}
        make -j 16 -C build tests
      }
EOF

    elif [ $dir == "openmw" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cd openmw
        cmake . \
          -DCMAKE_INSTALL_PREFIX=/usr \
          -DCMAKE_BUILD_TYPE=Release \
          -DDESIRED_QT_VERSION=5 \
          -GNinja \
          -Bbuild \
          -DCMAKE_CXX_COMPILER=clang++ \
          -DCMAKE_C_COMPILER=clang \
          -DUSE_NATIVE_INSTRUCTIONS=ON
        sed -i 's/O2/O3/g' "$srcdir/$pkgname/build/CMakeCache.txt"
        sed -i 's/O1/O3/g' "$srcdir/$pkgname/build/CMakeCache.txt"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/$pkgname/build/CMakeCache.txt"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/$pkgname/build/CMakeCache.txt"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19 -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19"

        ninja -j 16 -C build
      }
EOF

    elif [ $dir == "xonotic" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        CXXFLAGS+=" -minline-all-stringops -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops"

        # compile engine
        make -j 16 -C Xonotic/source/darkplaces CPUOPTIMIZATIONS="${CFLAGS}" DP_FS_BASEDIR=/usr/share/xonotic/ DP_LINK_TO_LIBJPEG=1 cl-release
        make -j 16 -C Xonotic/source/darkplaces CPUOPTIMIZATIONS="${CFLAGS}" DP_FS_BASEDIR=/usr/share/xonotic/ DP_LINK_TO_LIBJPEG=1 sdl-release
        make -j 16 -C Xonotic/source/darkplaces CPUOPTIMIZATIONS="${CFLAGS}" DP_FS_BASEDIR=/usr/share/xonotic/ DP_LINK_TO_LIBJPEG=1 sv-release

        cd "$srcdir"/Xonotic/source/d0_blind_id
        sh autogen.sh
        ./configure --prefix=/usr
        make -j 16
      }
EOF

    elif [ $dir == "dolphin-emu" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cmake -S dolphin-emu -B build \
          -DCMAKE_BUILD_TYPE=Release \
          -DCMAKE_INSTALL_PREFIX=/usr \
          -DUSE_SHARED_ENET=ON \
          -DCMAKE_CXX_COMPILER=clang++ \
            -DCMAKE_C_COMPILER=clang \
          -DUSE_NATIVE_INSTRUCTIONS=ON \
          -DDISTRIBUTOR=archlinux.org
        sed -i 's/O2/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/O1/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/build/CMakeCache.txt"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19 -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19"
        make -j 16 -C build
      }
EOF

    elif [ $dir == "pcsx2" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cmake -S pcsx2 -B build -G Ninja \
          -DCMAKE_BUILD_TYPE=Release \
          -DCMAKE_INSTALL_PREFIX=/usr \
          -DDISABLE_ADVANCE_SIMD=ON \
          -DDISABLE_BUILD_DATE=OFF \
          -DDISABLE_PCSX2_WRAPPER=ON \
          -DENABLE_TESTS=OFF \
          -DSDL2_API=ON \
          -DPACKAGE_MODE=ON \
          -DREBUILD_SHADER=ON \
          -DUSE_LTO=ON \
          -DUSE_SYSTEM_YAML=OFF \
          -DUSE_VTUNE=OFF \
          -DXDG_STD=ON \
          -DwxWidgets_CONFIG_EXECUTABLE=/usr/bin/wx-config-gtk3 \
          -Wno-dev \
          -DCMAKE_CXX_COMPILER=clang++ \
          -DCMAKE_C_COMPILER=clang \
          -DUSE_NATIVE_INSTRUCTIONS=ON
        sed -i 's/O2/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/O1/O3/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/build/CMakeCache.txt"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/build/CMakeCache.txt"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19 -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19"
        ninja -j 16 -C build
      }
EOF

## This doesn't work for some reason; maybe a Clang incompatibility?
#     elif [ $dir == "desmume" ]; then
#       cat <<- \EOF >> PKGBUILD
#       build() {
#         cd "$srcdir/$pkgname-$pkgver"

#         ./configure --prefix=/usr --enable-wifi --enable-openal --enable-glx --enable-hud --enable-hardcore
#         make -j 16
#       }
# EOF

    ## I followed the Clang instructions for makepkg.conf here:
    ## https://wiki.archlinux.org/title/Clang

    elif [ $dir == "xorg-server" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        # Since pacman 5.0.2-2, hardened flags are now enabled in makepkg.conf
        # With them, module fail to load with undefined symbol.
        # See https://bugs.archlinux.org/task/55102 / https://bugs.archlinux.org/task/54845
        export CFLAGS=${CFLAGS/-fno-plt}
        export CXXFLAGS=${CXXFLAGS/-fno-plt}
        export LDFLAGS=${LDFLAGS/,-z,now}

        arch-meson ${pkgbase}-$pkgver build \
          -D os_vendor="Archlinux" \
          -D ipv6=true \
          -D xvfb=true \
          -D xnest=true \
          -D xcsecurity=true \
          -D xorg=true \
          -D xephyr=true \
          -D xwayland=true \
          -D xwayland_eglstream=true \
          -D glamor=true \
          -D udev=true \
          -D systemd_logind=true \
          -D suid_wrapper=true \
          -D xkb_dir=/usr/share/X11/xkb \
          -D xkb_output_dir=/var/lib/xkb

        # Print config
        CXXFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19 -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19"
        meson configure build
        ninja -j 16 -C build

        # fake installation to be seperated into packages
        DESTDIR="${srcdir}/fakeinstall" ninja -C build install
      }
EOF

    elif [ $dir == "xorg-xsetroot" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cd xsetroot-${pkgver}
        ./configure --prefix=/usr
        make -j 16
      }
EOF

    elif [ $dir == "xorg-xrdb" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cd xrdb-${pkgver}
        # --with-cpp=path       comma-separated list of paths to cpp command for xrdb to use at runtime
        # mcpp is small but can fail, FS#46934
        ./configure --prefix=/usr --with-cpp=/usr/bin/clang,/usr/bin/mcpp
        make -j 16
      }
EOF

    elif [ $dir == "xorg-xmessage" ]; then
      cat <<- \EOF >> PKGBUILD
      build() {
        cd xmessage-${pkgver}
        ./configure --prefix=/usr
        sed -i 's/O2/O3/g' "$srcdir/xmessage-$pkgver/Makefile"
        sed -i 's/O1/O3/g' "$srcdir/xmessage-$pkgver/Makefile"
        sed -i 's/-march=x86-64/-march=native/g' "$srcdir/xmessage-$pkgver/Makefile"
        sed -i 's/-mtune=generic/-mtune=native/g' "$srcdir/xmessage-$pkgver/Makefile"
        CXXFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19 -stdlib=libc++ -lstdc++"
        CFLAGS+=" -minline-all-stringops -flto=16 -fuse-linker-plugin -flto-compression-level=19"
        make -j 16
      }
EOF

      cd trunk
      rm -f *.tar*
      rm -f *.xz*
      rm -f *.zip
      makepkg -sfcCri --noconfirm

      sh -c 'if [ -f kwin*.pkg.tar.zst ]; then
        notify-send "AUTHENTICATION: Kwin ASP post-install/upgrade setup" --app-name=Authentication --icon=stock_keyring --urgency=critical;
        sudo setcap CAP_SYS_NICE=+ep /usr/bin/kwin_wayland

        elif [ -f kinit*.pkg.tar.zst ]; then
        notify-send "AUTHENTICATION: Kinit ASP post-install/upgrade setup" --app-name=Authentication --icon=stock_keyring --urgency=critical;
        sudo setcap CAP_SYS_RESOURCE=+ep /usr/lib/kf5/start_kdeinit

        elif [ -f libksysguard*.pkg.tar.zst ]; then
        notify-send "AUTHENTICATION: Kinit ASP post-install/upgrade setup" --app-name=Authentication --icon=stock_keyring --urgency=critical;
        sudo setcap CAP_NET_RAW=+ep /usr/lib/ksysguard/ksgrd_network_helper

        elif [ -f pcsx2*.pkg.tar.zst ]; then
        rm -rf ./yaml-cpp ./libchdr ./pcsx2

        elif [ -f openmw*.pkg.tar.zst ]; then
        rm -rf ./openmw

      fi'

## Xorg post-install message (doesn't work as-is in this script):
#       sh -c 'if [ -f xorg-server*.pkg.tar.zst ]; then
#         if (( $(vercmp $2 1.16.0-3) < 0 )); then
#           cat <<MSG
# >>> xorg-server has now the ability to run without root rights with
#     the help of systemd-logind. xserver will fail to run if not launched
#     from the same virtual terminal as was used to log in.
#     Without root rights, log files will be in ~/.local/share/xorg/ directory.

#     Old behavior can be restored through Xorg.wrap config file.
#     See Xorg.wrap man page (man xorg.wrap).
# MSG
#         fi
#       fi'

      rm -f *.tar*
      rm -f *.xz*
      rm -f *.zip
    fi
  fi
) done