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: Daniel Bermond <dbermond@archlinux.org>
pkgbase=slint-git
pkgname=(
'python-slint-git'
'slint-cpp-git'
'slint-tools-git')
pkgver=1.14.1.r1577.g28f9fd710b
pkgrel=1
pkgdesc='Declarative GUI toolkit to build native user interfaces (git version)'
license=('GPL-3.0-or-later OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0')
arch=('x86_64')
url='https://github.com/slint-ui/slint/'
makedepends=(
'cargo'
'cmake'
'fontconfig'
'freetype2'
'git'
'gstreamer'
'libx11'
'libxcb'
'libxkbcommon'
'python'
'python-build'
'python-installer'
'python-maturin'
'python-setuptools'
'python-wheel'
'wayland')
source=('git+https://github.com/slint-ui/slint.git'
'010-slint-cpp-disable-jemalloc.patch')
sha256sums=('SKIP'
'ac0944396bb96413da23bfb9101e0d5555e9093b38fac19b33ce3642db48ab08')
prepare () {
cargo fetch --target "$(rustc --print host-tuple)" --manifest-path='slint/Cargo.toml'
cargo fetch --target "$(rustc --print host-tuple)" --manifest-path='slint/api/python/slint/Cargo.toml'
patch -d slint -Np1 -i "${srcdir}/010-slint-cpp-disable-jemalloc.patch"
cd slint
# The commands bellow remove jemalloc, as it causes build issues (avoid patching due to ever changing code from git repo)
# Remove jemalloc from the workspace entirely
find . -name "Cargo.toml" -exec sed -i '/tikv-jemallocator/d' {} +
# Remove any forced jemalloc features from tools
find . -name "Cargo.toml" -exec sed -i 's/"jemalloc"//g' {} +
find . -name "Cargo.toml" -exec sed -i 's/jemalloc = \[.*\]//g' {} +
# Remove the jemalloc block from tools/compiler/main.rs
sed -i '0,/static GLOBAL: Jemalloc = Jemalloc;/{ /#\[cfg(all(/,/static GLOBAL: Jemalloc = Jemalloc;/d }' tools/compiler/main.rs
# Remove the 'use' statements for jemalloc from tools
sed -i '/use tikv_jemallocator::Jemalloc;/d' tools/{compiler,lsp,viewer}/main.rs
# Remove the global_allocator static definitions from tools
# This looks for the #[global_allocator] line and the 'static GLOBAL' line following it
sed -i '/#\[global_allocator\]/,/static GLOBAL: Jemalloc = Jemalloc;/d' tools/{compiler,lsp,viewer}/main.rs
# Comment out the allocator usage in the entire tree
find . -name "*.rs" -exec sed -i 's/#!\[no_std\]//g' {} + # Ensure we stay in std mode
find . -name "*.rs" -exec sed -i 's/extern crate tikv_jemallocator;//g' {} +
find . -name "*.rs" -exec sed -i '/@\[global_allocator\]/,/;/ s/^/\/\//' {} +
}
pkgver() {
git -C slint describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/^v//'
}
build() {
export CARGO_TARGET_DIR="${srcdir}/cargo-target"
export RUSTUP_TOOLCHAIN='stable'
export SLINT_NO_QT='1'
local _features='backend-winit,gettext,renderer-femtovg,renderer-skia,renderer-skia-opengl,renderer-skia-vulkan,renderer-software'
# c++
printf '%s\n' ' -> building slint-cpp...'
cmake -S slint -B build-cpp \
-G 'Unix Makefiles' \
-DCMAKE_BUILD_TYPE:STRING='None' \
-DCMAKE_INSTALL_PREFIX:PATH='/usr' \
-DSLINT_FEATURE_BACKEND_QT:BOOL='OFF' \
-DSLINT_FEATURE_BACKEND_WINIT:BOOL='ON' \
-DSLINT_FEATURE_GETTEXT:BOOL='ON' \
-DSLINT_FEATURE_LIVE_PREVIEW:BOOL='ON' \
-DSLINT_FEATURE_RENDERER_FEMTOVG:BOOL='ON' \
-DSLINT_FEATURE_RENDERER_SKIA:BOOL='ON' \
-DSLINT_FEATURE_RENDERER_SKIA_OPENGL:BOOL='ON' \
-DSLINT_FEATURE_RENDERER_SKIA_VULKAN:BOOL='ON' \
-DSLINT_FEATURE_RENDERER_SOFTWARE:BOOL='ON'
cmake --build build-cpp
# tools
printf '%s\n' ' -> building tools...'
cargo build \
--features="$_features" \
--frozen \
--manifest-path='slint/Cargo.toml' \
--no-default-features \
--package='slint-lsp' \
--package='slint-tr-extractor' \
--package='slint-updater' \
--package='slint-viewer' \
--release
# python
printf '%s\n' ' -> building python-slint...'
cd "${srcdir}/slint/api/python/slint"
export MATURIN_SETUP_ARGS="--no-default-features --features ${_features}"
python -m build --wheel --no-isolation
}
# arguments: $1: $pkgdir, $2: $pkgname
_install_licenses() {
install -D -m644 slint/LICENSES/LicenseRef-Slint-Royalty-free-2.0.md -t "${1}/usr/share/licenses/${2}"
install -D -m644 slint/LICENSES/LicenseRef-Slint-Software-3.0.md -t "${1}/usr/share/licenses/${2}"
}
package_python-slint-git() {
pkgdesc='Declarative GUI toolkit to build native user interfaces for Python apps (git version)'
depends=(
'fontconfig'
'gcc-libs'
'glibc'
'libgcc'
'libx11'
'libxcb'
'libxkbcommon'
'python'
'wayland')
optdepends=(
'libgl: for Skia OpenGL renderer backend'
'vulkan-icd-loader: for Skia Vulkan renderer backend')
provides=(
'python-slint')
conflicts=(
'python-slint')
python -m installer --destdir="$pkgdir" slint/api/python/slint/dist/*.whl
_install_licenses "$pkgdir" "$pkgname"
}
package_slint-cpp-git() {
pkgdesc='Declarative GUI toolkit to build native user interfaces for C++ apps (git version)'
depends=(
'fontconfig'
'freetype2'
'glibc'
'libgcc'
'libx11'
'libxcb'
'libxkbcommon'
'wayland')
optdepends=(
'libgl: for Skia OpenGL renderer backend'
'vulkan-icd-loader: for Skia Vulkan renderer backend')
provides=(
'slint-cpp'
'slint-compiler')
conflicts=(
'slint-cpp'
'slint-compiler')
DESTDIR="$pkgdir" cmake --install build-cpp
_install_licenses "$pkgdir" "$pkgname"
}
package_slint-tools-git() {
pkgdesc='Tools for the Slint GUI toolkit (lsp, tr-extractor, updater and viewer) (git version)'
depends=(
'fontconfig'
'freetype2'
'glibc'
'libgcc'
'libx11'
'libxcb'
'libxkbcommon'
'wayland')
optdepends=(
'libgl: for Skia OpenGL renderer backend in slint-viewer'
'vulkan-icd-loader: for Skia Vulkan renderer backend in slint-viewer')
provides=(
'slint-lsp'
'slint-tools'
'slint-tr-extractor'
'slint-updater'
'slint-viewer')
conflicts=(
'slint-lsp'
'slint-tools'
'slint-tr-extractor'
'slint-updater'
'slint-viewer')
install -d -m755 "${pkgdir}/usr/lib"
find cargo-target/release -maxdepth 1 -type f \
-executable \
! -name '*.so*' \
! -name 'slint-compiler' \
-exec install -D -m755 -t "${pkgdir}/usr/bin" {} +
find cargo-target/release -maxdepth 1 -type f \
-name '*.so*' \
! -name 'libslint_cpp.so*' \
! -name 'libslint_node.so*' \
! -name 'libslint_python.so*' \
-exec cp -dr --no-preserve='ownership' {} "${pkgdir}/usr/lib/" \;
_install_licenses "$pkgdir" "$pkgname"
}
|