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.000000
First Submitted: 2014-03-31 06:31 (UTC)
Last Updated: 2024-03-02 13:37 (UTC)

Dependencies (85)

Required by (46)

Sources (1)

Latest Comments

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

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

IslandC0der commented on 2021-08-10 16:44 (UTC)

Awesome! :D

Neko-san commented on 2021-08-10 07:05 (UTC)

@IslandC0der That works, thanks!

IslandC0der commented on 2021-08-09 22:18 (UTC)

@Neko-san Ahhh, I see the issue:

Replace $(git rev-parse master) != $(git rev-parse master@{upstream}) with $(git rev-parse HEAD) != $(git rev-parse HEAD@{upstream})

Neko-san commented on 2021-08-09 21:55 (UTC) (edited on 2021-08-09 22:15 (UTC) by Neko-san)

@IslandC0der I had wrote it in CodeOSS (VS Code), so Idk I did as you suggested and just floored it out of the bracket scope, and it seemed to have worked, but now it's throwing fatal errors:

==> updating remote 'packages'
From https://github.com/archlinux/svntogit-packages
 * branch            packages/plasma-desktop -> FETCH_HEAD
==> updating remote 'community'
From https://github.com/archlinux/svntogit-community
 * branch            packages/dolphin-emu -> FETCH_HEAD
fatal: ambiguous argument 'master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: no such branch: 'master'
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 'master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: no such branch: 'master'
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-09 21:49 (UTC)

@Neko-san Hmm, is EOF indented with spaces? Doing a hexdump of what you sent, it says there are 6 spaces before it (but maybe you were using tabs and it automatically converts to spaces).

You have to either use tabs, or not indent it at all (i.e. have EOF at the very beginning of the line).

Neko-san commented on 2021-08-09 21:33 (UTC)

@IslandC0der This still didn't work for me for some reason :/

#!/usr/bin/env bash

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 master) != $(git rev-parse master@{upstream}) ]]; then
    git reset --hard origin
    ## sed or EOF cat commands go here
    if [ $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 == "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

    cd trunk
    makepkg -sfcCri --noconfirm
    rm -rf ../*.pkg.tar.zst
    fi
  fi
) done

IslandC0der commented on 2021-08-08 21:04 (UTC) (edited on 2021-08-08 21:04 (UTC) by IslandC0der)

@Neko-san Ohh, you cannot indent the EOF token (otherwise it doesn't recognize it).

You have to either remove the indentation on that line, or use cat <<- \EOF >> PKGBUILD instead of cat << \EOF >> PKGBUILD, which will make it ignore tab indentation (but not spaces).

Neko-san commented on 2021-08-08 01:32 (UTC)

@IslandC0der Yeah, sorry, here:

./aspUpdate.sh: line 58: warning: here-document at line 13 delimited by end-of-file (wanted `EOF')
./aspUpdate.sh: line 59: syntax error: unexpected end of file