summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 6b4fb63388d949b98afc77d0f59048c0c77d9e9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Andrea Scarpino <andrea@archlinux.org>
# Patches applied by: Lito Parra <lito.15@proton.me>

# Change this value to an interval shorter than
# your monitor's max refresh rate, perhaps
# the floored result of 1000 / your_monitor_refresh_rate
# 4 ms smooths up to 240 Hz animations, balanced default
HIFPS_TARGET_TIMER_INTERVAL=4

pkgbase=qt6-base-hifps
pkgname=(qt6-base-hifps
         qt6-xcb-private-headers-hifps)
_pkgver=6.10.2
pkgver=${_pkgver/-/}
pkgrel=1
pkgdesc='A cross-platform application and UI framework - patched for high refresh rates for animations'
arch=(x86_64)
url='https://www.qt.io'
license=(GPL-3.0-only
         LGPL-3.0-only
         LicenseRef-Qt-Commercial
         Qt-GPL-exception-1.0)
depends=(brotli
         dbus
         double-conversion
         fontconfig
         freetype2
         gcc-libs
         glib2
         glibc
         harfbuzz
         icu
         krb5
         libb2
         libcups
         libdrm
         libgl
         libice
         libinput
         libjpeg-turbo
         libpng
         libproxy
         libsm
         libx11
         libxcb
         libxkbcommon
         libxkbcommon-x11
         md4c
         mesa
         mtdev
         openssl
         pcre2
         shared-mime-info
         sqlite
         systemd-libs
         tslib
         wayland
         xcb-util-cursor
         xcb-util-image
         xcb-util-keysyms
         xcb-util-renderutil
         xcb-util-wm
         xdg-utils
         zlib
         zstd)
makedepends=(alsa-lib
             cmake
             cups
             freetds
             git
             gst-plugins-base-libs
             gtk3
             jemalloc
             libfbclient
             libpulse
             mariadb-libs
             ninja
             postgresql
             renderdoc
	     rsync
	     sed
             unixodbc
             vulkan-headers
             xmlstarlet)
optdepends=('freetds: MS SQL driver'
            'gdk-pixbuf2: GTK platform plugin'
            'gtk3: GTK platform plugin'
            'libfbclient: Firebird/iBase driver'
            'mariadb-libs: MariaDB driver'
            'pango: GTK platform plugin'
            'perl: for syncqt'
            'postgresql-libs: PostgreSQL driver'
            'unixodbc: ODBC driver')
groups=(qt6)
_pkgfn=${pkgbase/6-/}
_pkgfn=${_pkgfn/-hifps/}
source=(git+https://code.qt.io/qt/$_pkgfn.git
        sync_official.sh
        0005-low-timer.patch)
sha256sums=('SKIP'
            '56510cbf9141185f6b2f6e8048c64ab0368e4288884fd538baf388555df29496'
            'SKIP')

prepare() {
  echo ">>> Syncing official Arch qt6-base repo files..."
  bash "$srcdir/sync_official.sh" "$PWD"

  echo ">>> Checking out $pkgname source at tag v${pkgver}..."

  pushd "$srcdir/$_pkgfn"

  # Checkout exact tag
  if git rev-parse "v${pkgver}" >/dev/null 2>&1; then
    git checkout "v${pkgver}"
  else
    echo ">>> WARNING: tag v${pkgver} not found; using master branch as fallback."
    git checkout master
  fi

  # sanity check
  if [ ! -f CMakeLists.txt ]; then
    echo ">>> ERROR: CMakeLists.txt not found after checkout!"
    ls -la
    return 1
  fi

  echo ">>> Applying default Arch patches..."
  patch -Np1 -i "${srcdir}/qt6-base-cflags.patch"  # Use system CFLAGS
  patch -Np1 -i "${srcdir}/qt6-base-nostrip.patch" # Don't strip binaries with qmake

  echo ">>> Applying scroll fixing patches..."
    # GG: fix scrolling in libreoffice on wayland
  echo "Apply additional patches for optimizing scrolling ..."
  git cherry-pick -n 095759818854e5a011aa8f859e566bbc6368ab76 # wayland: Compress high frequency mouse events
  git cherry-pick -n 6f25f703fd37a900c139e14a33a4639502bfeae7 # wayland: Optimize scroll operation
  git cherry-pick -n 9dd0d936d6691904a4bb212dcf48999a5228b84f # wayland: Enable event compression and fix scroll end event

  echo ">>> Reducing Qt animation timer interval down to ${HIFPS_TARGET_TIMER_INTERVAL} ms to smooth out animations..."
  tmpfile=$(mktemp)

  sed -E "s|^\+#define DEFAULT_TIMER_INTERVAL .*|+#define DEFAULT_TIMER_INTERVAL ${HIFPS_TARGET_TIMER_INTERVAL}|" \
  "$srcdir/0005-low-timer.patch" > "$tmpfile"

  mv "$tmpfile" "$srcdir/0005-low-timer.patch"

  patch -Np1 -i "${srcdir}/0005-low-timer.patch" # apply 1 ms timing patch to make animations smoother

  echo ">>> Applying additional quality of life patches..."
  git cherry-pick -n a374ab6ce9f01f1f559403ec377cde990a689890 # Fix yakuake

  echo ">>> Patches applied"

  popd
}

build() {
  cd "${srcdir}"
  cmake -B build -S $_pkgfn -G Ninja \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_BUILD_TYPE=RelWithDebInfo \
    -DINSTALL_BINDIR=lib/qt6/bin \
    -DINSTALL_PUBLICBINDIR=usr/bin \
    -DINSTALL_LIBEXECDIR=lib/qt6 \
    -DINSTALL_DOCDIR=share/doc/qt6 \
    -DINSTALL_ARCHDATADIR=lib/qt6 \
    -DINSTALL_DATADIR=share/qt6 \
    -DINSTALL_INCLUDEDIR=include/qt6 \
    -DINSTALL_MKSPECSDIR=lib/qt6/mkspecs \
    -DINSTALL_EXAMPLESDIR=share/doc/qt6/examples \
    -DFEATURE_journald=ON \
    -DFEATURE_libproxy=ON \
    -DFEATURE_openssl_linked=ON \
    -DFEATURE_system_sqlite=ON \
    -DFEATURE_system_xcb_xinput=ON \
    -DFEATURE_no_direct_extern_access=ON \
    -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
    -DCMAKE_MESSAGE_LOG_LEVEL=STATUS
  cmake --build build
}

package_qt6-base-hifps() {
  pkgdesc='A cross-platform application and UI framework - patched for high refresh rates for animations'
  depends+=(qt6-translations)
  conflicts=('qt6-base')
  provides=('qt6-base')
  DESTDIR="$pkgdir" cmake --install build

  install -Dm644 "$srcdir"/LICENSES/* -t "$pkgdir"/usr/share/licenses/$pkgbase

# Install symlinks for user-facing tools
  cd "$pkgdir"
  mkdir usr/bin
  while read _line; do
    ln -s $_line
  done < "$srcdir"/build/user_facing_tool_links.txt
}

package_qt6-xcb-private-headers-hifps() {
  pkgdesc='Private headers for Qt6 Xcb - patched for high refresh rates for animations'

  depends=("qt6-base-hifps=$pkgver")
  optdepends=()
  groups=()
  conflicts=('qt6-xcb-private-headers')
  provides=('qt6-xcb-private-headers')

  cd "$srcdir/$_pkgfn"
  install -d -m755 "$pkgdir"/usr/include/qt6xcb-private/{gl_integrations,nativepainting}
  cp -r src/plugins/platforms/xcb/*.h "$pkgdir"/usr/include/qt6xcb-private/
  cp -r src/plugins/platforms/xcb/gl_integrations/*.h "$pkgdir"/usr/include/qt6xcb-private/gl_integrations/
  cp -r src/plugins/platforms/xcb/nativepainting/*.h "$pkgdir"/usr/include/qt6xcb-private/nativepainting/
}