summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7083d26968f601440b9d1a1a8ad249d532c1d104 (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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# Maintainer:  dreieck (https://aur.archlinux.org/account/dreieck)
# Contributor: Cory Sanin <corysanin@artixlinux.org>
# Contributor: Nafis <mnabid.25@outlook.com>
# Contributor: David P. <megver83@parabola.nu>
# Contributor: Felix Yan <felixonmars@archlinux.org>
# Contributor: Antonio Rojas <arojas@archlinux.org>
# Contributor: Andrea Scarpino <andrea@archlinux.org>

_pkgname=kate
pkgname="${_pkgname}-root"
pkgver=24.02.0
pkgrel=3
arch=(
  'x86_64'
  'i686'
  'armv7h'
  'armv6h'
  'aarch64'
  'pentium4'
  'riscv64'
)
license=(
  'CC0-1.0'
  'GFDL-1.3-or-later'  # Documentation is under "FDL" but I could not find out which version.
  'GPL-2.0-or-later'
  'LGPL-2.0-or-later'
  'LGPL-3.0-or-later'
  'MIT'
)
pkgdesc='Advanced Text Editor from the KDE project, patched to be able to run as root.'
groups=(
  'kde-applications'
  'kde-utilities'
)
url='https://apps.kde.org/kate/'
# url='https://download.kde.org/stable/release-service/' # To see latest available versions.
depends=(
  'hicolor-icon-theme'
  'gcc-libs'
  'glibc'
  # 'kactivities5>=5.90.0'
  'kcompletion>=6'
  'ki18n>=6'
  'kconfig>=6'
  'kconfigwidgets>=6'
  'kcoreaddons>=6'
  'kdbusaddons>=6'
  'kguiaddons>=6'
  'kio>=6'
  'kbookmarks>=6'
  'kcrash>=6'
  'kiconthemes>=6'
  # 'kjobwidgets>=6'
  'knewstuff>=6'
  'kparts>=6'
  'kservice>=6'
  'ktextwidgets>=6'
  'ktexteditor>=6'
  'kxmlgui>=6'
  'kwidgetsaddons>=6'
  'kwindowsystem>=6'
  # 'libx11'
  'qt6-base>=6.5.0'
  'syntax-highlighting>=6'
)
optdepends=(
  'bash: For migration script from kate session applet to kde plasma addon.'
  'clang: C and C++ LSP support.'
  'git: git-blame plugin.'
  'konsole: open a terminal in Kate.'
  'kuserfeedback>=6'
  'kwallet>=6'
  'markdownpart: Markdown preview.'
  'pkgconf: To use the pkg-config files.'
  'python-lsp-server: Python LSP support.'
  'rust: Rust LSP support.'
  'svgpart: SVG preview.'
  'texlab: LaTeX LSP support.'
)
makedepends=(
  'appstream'
  'attica>=6'
  'cmake>=3.16'
  'extra-cmake-modules>=6'
  'fontconfig'
  'freetype2'
  'gettext'
  'intltool'
  'kdoctools>=6'
  'kuserfeedback>=6'
  'kwallet>=6'
  # 'plasma-framework5>=5.90.0'
  'pkgconf'
  # 'python>=3.7' # Needed if `-DBUILD_python=ON`.
  # 'pyside2'     # Needed if `-DBUILD_python=ON`.
  # 'shiboken2'   # Needed if `-DBUILD_python=ON`.
)
checkdepends=(
  'appstream'
)
conflicts=(
  'kate'
  'kwrite'
)
provides=(
  "kate=${pkgver}"
  "kwrite=${pkgver}"
  "kate-kf6=${pkgver}"
  "kwrite-kf6=${pkgver}"
  "kate-qt6=${pkgver}"
  "kwrite-qt6=${pkgver}"
)
replaces=(
  'kwrite<=23.99'
  'kwrite-root'
)
source=(
  "https://download.kde.org/stable/release-service/${pkgver}/src/${_pkgname}-${pkgver}.tar.xz"{,.sig}
  "0001-Defuse-root-block.patch"
)
sha256sums=(
  '9b1efcccf4e36efcdbc2eada6399cd8128ce187a19182400313062f75ee35f48'  # ${_pkgname}-${pkgver}.tar.xz
  '87f291b7d75cd9db732eba60af5b355b3145b45fb9ce9d0cd194554988d4072a'  # ${_pkgname}-${pkgver}.tar.xz.sig
  'abc7a33c8e8cd3a79ea4699bca0086c4146a9a43771a10fc60b97dcf62faca44'  # 0001-Defuse-root-block.patch
)
validpgpkeys=(
  'CA262C6C83DE4D2FB28A332A3A6A4DB839EAA6D7'  # Albert Astals Cid <aacid@kde.org>
  'F23275E4BF10AFC1DF6914A6DBD2CE893E2D1C87'  # Christoph Feck <cfeck@kde.org>
  'D81C0CB38EB725EF6691C385BB463350D6EF31EF'  # Heiko Becker <heiko.becker@kde.org>
)

prepare() {
  cd "${srcdir}/${_pkgname}-${pkgver}"

  # root shall be allowed once again.
  for _patch in "${srcdir}/0001-Defuse-root-block.patch"; do
    msg2 "Applying patch $(basename "${_patch}") ..."
    patch -Np1 --follow-symlinks -i "${srcdir}/0001-Defuse-root-block.patch"
  done
}

build() {
  cd "${srcdir}"

  # 2023-10-31, pkgver=23.08.2: -DBUILD_python=ON would result in the following build error:  
  # ```
  # In file included from /usr/include/shiboken2/sbkpython.h:104,
  #                  from /usr/include/shiboken2/shiboken.h:43,
  #                  from /tmp/makepkg/build/kate-root/src/build/addons/python/PyKate/Kate/ktexteditor_application_wrapper.cpp:6:
  # /usr/include/shiboken2/pep384impl.h:337:3: error: #error Please check the buffer compatibility for this python version!
  #   337 | # error Please check the buffer compatibility for this python version!
  #       |   ^~~~~
  # ```

  cmake -B build -S "${_pkgname}-${pkgver}" \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_COVERAGE=OFF \
    -DBUILD_PCH=ON \
    -DBUILD_PYTHON_BINDINGS=ON \
    -DBUILD_SHARED_LIBS=ON \
    -DBUILD_TESTING=ON \
    -DBUILD_WITH_QT6=OFF \
    -DBUILD_addons=ON \
    -DBUILD_apps=ON \
    -DBUILD_backtracebrowser=ON \
    -DBUILD_close-except-like=ON \
    -DBUILD_cmake-tools=ON \
    -DBUILD_colorpicker=ON \
    -DBUILD_compiler-explorer=ON \
    -DBUILD_doc=ON \
    -DBUILD_eslint=ON \
    -DBUILD_externaltools=ON \
    -DBUILD_filebrowser=ON \
    -DBUILD_filetree=ON \
    -DBUILD_format=ON \
    -DBUILD_gdbplugin=ON \
    -DBUILD_git-blame=ON \
    -DBUILD_kate=ON \
    -DBUILD_kate-ctags=ON \
    -DBUILD_katebuild-plugin=ON \
    -DBUILD_katesql=ON \
    -DBUILD_keyboardmacros=ON \
    -DBUILD_konsole=ON \
    -DBUILD_kwrite=ON \
    -DBUILD_latexunicodecompletion=ON \
    -DBUILD_lspclient=ON \
    -DBUILD_openlink=ON \
    -DBUILD_preview=ON \
    -DBUILD_project=ON \
    -DBUILD_python=OFF \
    -DBUILD_rainbow-parens=ON \
    -DBUILD_replicode=ON \
    -DBUILD_search=ON \
    -DBUILD_sessionapplet=ON \
    -DBUILD_snippets=ON \
    -DBUILD_symbolviewer=ON \
    -DBUILD_tabswitcher=ON \
    -DBUILD_textfilter=ON \
    -DBUILD_xmlcheck=ON \
    -DBUILD_xmltools=ON \
    -DENABLE_BSYMBOLICFUNCTIONS=ON \
    -DKDE_INSTALL_PREFIX_SCRIPT=OFF \
    -DKDE_INSTALL_USE_QT_SYS_PATHS=ON \
    -DKDE_SKIP_UNINSTALL_TARGET=ON

  cmake --build build
}

check() {
  cd "${srcdir}/build"

  make test
}

package() {
  cd "${srcdir}"

  DESTDIR="${pkgdir}" cmake --install build

  cd "${_pkgname}-${pkgver}"

  install -Dvm644   README.md "${pkgdir}/usr/share/${_pkgname}/README.md"
  install -dvm755   "${pkgdir}/usr/share/${_pkgname}/LICENSES"

  for _license in LICENSES/*; do
    install -Dvm644 "${_license}" \
                    "${pkgdir}/usr/share/licenses/${pkgname}/$(basename "${_license}")"
    ln -srv "${pkgdir}/usr/share/licenses/${pkgname}/$(basename "${_license}")" \
            "${pkgdir}/usr/share/${_pkgname}/LICENSES/$(basename "${_license}")"
  done
}