forked from flxzt/rnote
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
269 lines (232 loc) · 10.3 KB
/
justfile
File metadata and controls
269 lines (232 loc) · 10.3 KB
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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# justfile for Rnote
# Either 'true' or 'false'
ci := "false"
log_level := "debug"
build_folder := "_mesonbuild"
flatpak_app_folder := "_flatpak_app"
flatpak_repo_folder := "_flatpak_repo"
mingw64_prefix_path := "C:/msys64/mingw64"
[private]
linux_distr := `lsb_release -ds | tr '[:upper:]' '[:lower:]'`
[private]
sudo_cmd := "sudo"
export LANG := "C"
export RUST_BACKTRACE := "1"
export RUST_LOG := \
"rnote=" + log_level + "," + \
"rnote-cli=" + log_level + "," + \
"rnote-engine=" + log_level + "," + \
"rnote-compose=" + log_level
#export G_MESSAGES_DEBUG := "all"
default:
just --list
prerequisites:
#!/usr/bin/env bash
set -euxo pipefail
if [[ ('{{linux_distr}}' =~ 'fedora') ]]; then
{{sudo_cmd}} dnf install -y \
gcc gcc-c++ clang clang-devel python3 make cmake meson just git appstream gettext desktop-file-utils \
shared-mime-info kernel-devel gtk4-devel libadwaita-devel alsa-lib-devel appstream-devel
elif [[ '{{linux_distr}}' =~ 'debian' || '{{linux_distr}}' =~ 'ubuntu' ]]; then
{{sudo_cmd}} apt-get update
{{sudo_cmd}} apt-get install -y \
build-essential clang libclang-dev python3 make cmake meson just git appstream gettext desktop-file-utils \
shared-mime-info libgtk-4-dev libadwaita-1-dev libasound2-dev libappstream-dev
else
echo "Unable to install system dependencies, unsupported distro."
exit 1
fi
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
export PATH="$HOME/.cargo/bin:$PATH"
prerequisites-flatpak: prerequisites
#!/usr/bin/env bash
set -euxo pipefail
if [[ ('{{linux_distr}}' =~ 'fedora') ]]; then
{{sudo_cmd}} dnf install -y \
flatpak flatpak-builder
elif [[ '{{linux_distr}}' =~ 'debian' || '{{linux_distr}}' =~ 'ubuntu' ]]; then
{{sudo_cmd}} apt-get update
{{sudo_cmd}} apt-get install -y \
flatpak flatpak-builder
else
echo "Unable to install system dependencies, unsupported distro."
exit 1
fi
flatpak remote-add --user --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
flatpak install --user -y org.gnome.Platform//50 org.gnome.Sdk//50 org.freedesktop.Sdk.Extension.rust-stable//25.08
prerequisites-dev: prerequisites
#!/usr/bin/env bash
set -euxo pipefail
if [[ ('{{linux_distr}}' =~ 'fedora') ]]; then
{{sudo_cmd}} dnf install -y \
yamllint yq opencc-tools
elif [[ '{{linux_distr}}' =~ 'debian' || '{{linux_distr}}' =~ 'ubuntu' ]]; then
{{sudo_cmd}} apt-get update
{{sudo_cmd}} apt-get install -y \
yamllint yq opencc
else
echo "Unable to install system dependencies, unsupported distro."
exit 1
fi
if [[ "{{ci}}" != "true" ]]; then
ln -sf ../../build-aux/git-hooks/pre-commit.hook .git/hooks/pre-commit
fi
curl -L --proto '=https' --tlsv1.2 -sSf \
https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
cargo binstall -y cargo-nextest cargo-edit cargo-deny
# in MSYS2 shell
prerequisites-win:
pacman -S --noconfirm \
unzip git mingw-w64-x86_64-xz mingw-w64-x86_64-pkgconf mingw-w64-x86_64-gcc mingw-w64-x86_64-clang \
mingw-w64-x86_64-toolchain mingw-w64-x86_64-autotools mingw-w64-x86_64-make mingw-w64-x86_64-cmake \
mingw-w64-x86_64-meson mingw-w64-x86_64-diffutils mingw-w64-x86_64-desktop-file-utils \
mingw-w64-x86_64-appstream mingw-w64-x86_64-gtk4 mingw-w64-x86_64-libadwaita mingw-w64-x86_64-angleproject
mv /mingw64/lib/libpthread.dll.a /mingw64/lib/libpthread.dll.a.bak
# We need to pin version : cairo before dwrite, gtk before dcomp
# cairo : before
# https://github.com/msys2/MINGW-packages/commit/305ebda98c3041d9986d6fae498b45d2b2b9f4e8
# Because the Dwrite win32 backend can't be used for text in multithreaded
# context (see issue #1536 and upstream issues
# on mingw : https://github.com/msys2/MINGW-packages/issues/26222#issuecomment-3506563048
# and on cairo's gitlab : https://gitlab.freedesktop.org/cairo/cairo/-/issues/886
#
# And because this also means that cairo will depend on the DLLmain
# symbol being exported from gettext (removed in
# https://github.com/msys2/MINGW-packages/commit/3756eb5ceba81861751d26161a2ae6d980f715d3
# with follow-up in
# https://github.com/msys2/MINGW-packages/commit/83eed715521d7d7c292d34fb80c29a720b534769#diff-a1d3a07941f44098abaaeef3440e303f11280e2165ff7e805fd50c7c38e8af13)
#
# So
# - we download the gettext runtime WITH the DLLmain symbol
# - we install cairo/gtk4 with the pinned version. It will depend on DLLmain being
# present pulling from the (now installed) version that includes i
# - the rest (hopefully) will still work (if not, need to pin all dependencies in
# https://github.com/msys2/MINGW-packages/commit/83eed715521d7d7c292d34fb80c29a720b534769#diff-a1d3a07941f44098abaaeef3440e303f11280e2165ff7e805fd50c7c38e8af13
# that we also use : which is a pretty long list !)
#
# 1 : Get gettext before DLLmain removal
wget -q https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-gettext-libtextstyle-0.26-1-any.pkg.tar.zst
wget -q https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-gettext-runtime-0.26-1-any.pkg.tar.zst
wget -q https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-gettext-tools-0.26-1-any.pkg.tar.zst
pacman -U --noconfirm mingw-w64-x86_64-gettext-libtextstyle-0.26-1-any.pkg.tar.zst \
mingw-w64-x86_64-gettext-runtime-0.26-1-any.pkg.tar.zst \
mingw-w64-x86_64-gettext-tools-0.26-1-any.pkg.tar.zst
# 2 : Get cairo and gtk4 pinned version
# Also use a libadwaita version matching the gtk4 one
wget -q https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-cairo-1.18.4-1-any.pkg.tar.zst
wget -q https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-gtk4-4.18.6-3-any.pkg.tar.zst
wget -q https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-libadwaita-1.7.7-1-any.pkg.tar.zst
pacman -U --noconfirm mingw-w64-x86_64-cairo-1.18.4-1-any.pkg.tar.zst \
mingw-w64-x86_64-gtk4-4.18.6-3-any.pkg.tar.zst \
mingw-w64-x86_64-libadwaita-1.7.7-1-any.pkg.tar.zst
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
export PATH="$HOME/.cargo/bin:$PATH"
setup-dev *MESON_ARGS:
meson setup \
--prefix=/usr \
-Dprofile=devel \
-Dci={{ ci }} \
{{ MESON_ARGS }} \
{{ build_folder }}
setup-release *MESON_ARGS:
meson setup \
--prefix=/usr \
-Dci={{ ci }} \
{{ MESON_ARGS }} \
{{ build_folder }}
# in MINGW64 shell
setup-win-installer installer_name="rnote-win-installer":
meson setup \
--prefix={{ mingw64_prefix_path }} \
-Dprofile=default \
-Dcli=true \
-Dwin-installer-name={{ installer_name }} \
-Dci={{ ci }} \
{{ build_folder }}
clean:
rm -rf {{ build_folder }}
configure *MESON_ARGS:
meson configure {{ MESON_ARGS }} {{ build_folder }}
fmt-check:
meson compile cargo-fmt-check -C {{ build_folder }}
find . -name 'meson.build' | xargs meson format -q
fmt:
cargo fmt
find . -name 'meson.build' | xargs meson format -i
check:
meson compile ui-cargo-check -C {{ build_folder }}
meson compile cli-cargo-check -C {{ build_folder }}
lint:
meson compile ui-cargo-clippy -C {{ build_folder }}
meson compile cli-cargo-clippy -C {{ build_folder }}
yamllint .
lint-dependencies:
cargo deny check
build:
meson compile ui-cargo-build -C {{ build_folder }}
meson compile cli-cargo-build -C {{ build_folder }}
build-flatpak:
flatpak-builder \
--user \
--repo={{ flatpak_repo_folder }} \
--force-clean \
{{ flatpak_app_folder}} \
build-aux/com.github.flxzt.rnote.Devel.yaml
build-flatpak-bundle:
flatpak build-bundle \
{{ flatpak_repo_folder }} \
com.github.flxzt.rnote.Devel.flatpak \
com.github.flxzt.rnote.Devel \
--runtime-repo=https://flathub.org/repo/flathub.flatpakrepo
build-win-installer: build
meson compile rnote-gmo -C {{ build_folder }}
meson compile build-installer -C {{ build_folder }}
install:
meson install -C {{ build_folder }}
install-flatpak:
flatpak-builder --user --install {{ flatpak_app_folder }} build-aux/com.github.flxzt.rnote.Devel.yaml
run-ui *ARGS:
{{ build_folder }}/target/debug/rnote {{ARGS}}
run-cli *ARGS:
{{ build_folder }}/target/debug/rnote-cli {{ARGS}}
run-flatpak:
flatpak-builder --run {{ flatpak_app_folder }} build-aux/com.github.flxzt.rnote.Devel.yaml rnote
test:
meson test -C {{ build_folder }}
meson compile cargo-test -C {{ build_folder }}
test-file-compatibility:
{{ build_folder }}/target/debug/rnote-cli test \
misc/file-tests/v0-5-5-test.rnote \
misc/file-tests/v0-5-13-test.rnote \
misc/file-tests/v0-6-0-test.rnote \
misc/file-tests/v0-9-0-test.rnote
generate-docs:
meson compile ui-cargo-doc -C {{ build_folder }}
meson compile cli-cargo-doc -C {{ build_folder }}
check-outdated-dependencies:
cargo upgrade --dry-run -vv
[doc('Regenerates the .pot file in the translations folder.
Note that all entries with strings starting and ending like this "@<..>@" must be removed,
they are templated variables and will be replaced in the build process of the app.
All changelog entries should be removed as well.')]
update-translations-template:
meson compile rnote-pot -C {{ build_folder }}
update-translations:
#!/usr/bin/env bash
set -euxo pipefail
# Regenerate 'zh_Hant' translation from 'zh_Hans'
sed \
-e 's|zh_Hans|zh_Hans\nzh_CN\nzh_SG|' \
-e 's|zh_Hant|zh_Hant\nzh_HK\nzh_TW|' \
"./crates/rnote-ui/po/LINGUAS" \
| sort -uo "./crates/rnote-ui/po/LINGUAS"
sed \
-e 's|Language: zh_Hans|Language: zh_Hant|' \
-e 's|Last-Translator:|Last-Translator: openCC converted|' \
"./crates/rnote-ui/po/zh_Hans.po" \
| opencc -c /usr/share/opencc/s2twp.json \
-o "./crates/rnote-ui/po/zh_Hant.po"
create-tarball *MESON_DIST_ARGS:
meson dist {{ MESON_DIST_ARGS }} -C {{ build_folder }}
generate-json-flatpak-manifest:
yq -o=json build-aux/com.github.flxzt.rnote.Devel.yaml > build-aux/com.github.flxzt.rnote.Devel.json