blob: e8090456fe1ea446fe6843a7709fcd7a7719171e (
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
|
# Maintainer: Claudia Pellegrino <aur ät cpellegrino.de>
pkgname=packetry-git
pkgver=0.2.2.r765.282b54e
pkgrel=1
pkgdesc='USB 2.0 protocol analysis app for use with Cynthion'
arch=('x86_64')
url='https://github.com/greatscottgadgets/packetry'
license=('BSD-3-Clause')
depends=(
'cairo'
'gcc-libs'
'gdk-pixbuf2'
'glibc'
'glib2'
'gtk4'
'hicolor-icon-theme'
'pango'
)
makedepends=(
'cargo'
'git'
'inkscape'
'libgit2'
'python-sphinx'
'python-sphinx-inline-tabs'
'python-sphinx_rtd_theme'
)
checkdepends=('at-spi2-core' 'xorg-server-xvfb')
provides=("packetry=${pkgver%.r*}")
conflicts=('packetry')
options=('!debug')
source=(
"${pkgname}::git+https://github.com/greatscottgadgets/packetry.git"
'icon.svg' # From https://github.com/greatscottgadgets/packetry/pull/95
'packetry.desktop'
)
sha512sums=(
'SKIP'
'1ab20c64195fb67204d1b0aab17e5f1d54b9d0b416074eb32fa5806a4618d0c6d3b5beb54473160690f56f969598b5d1c2de0eaaa5c87f43c14e18059d259212'
'92b735f7cdd5c07797bd48cdffc4cef2218df1a0d0517a8acb6813e41a972a0881eadf617dfe7524f4ed48e5e14fd55743a986f50a707bfca0f279068f46e410'
)
pkgver() {
printf "%s.r%s.%s" \
"$(cargo pkgid --manifest-path "${pkgname}/Cargo.toml" | sed "s/^.*${pkgname%-git}@//")" \
"$(git -C "${pkgname}" rev-list --count HEAD)" \
"$(git -C "${pkgname}" rev-parse --short HEAD)"
}
prepare() {
cd "${pkgname}"
echo >&2 'Applying Sphinx compatibility fix'
# See also:
# https://github.com/sphinx-doc/sphinx/issues/10474#issuecomment-1140389657
sed -i -e 's/^\(language =\).*/\1 "en"/' docs/source/conf.py
echo >&2 'Downloading dependencies'
export RUSTUP_TOOLCHAIN=stable
# For some reason, `cargo test --frozen` wants dependencies for
# unrelated targets, e.g. `cfg(target_os = "macos")`, too.
# To work around that, run `cargo fetch` without `--target`.
cargo fetch --locked
}
build() {
cd "${pkgname}"
export RUSTUP_TOOLCHAIN=stable
export CARGO_TARGET_DIR=target
echo >&2 'Building executable'
# The `step-decoder`, `record-ui-test`, and `debug-region-map`
# features are only for debugging.
cargo build --frozen --release
echo >&2 'Generating documentation'
make -C docs man singlehtml
echo >&2 'Generating application icons'
for resolution in 16 22 32 48 64 256; do
mkdir -p \
"assets/icon-generated/${resolution}x${resolution}" \
"assets/icon-generated/${resolution}x${resolution}@2"
inkscape -w "${resolution}" --export-background-opacity=0 \
--export-filename="assets/icon-generated/${resolution}x${resolution}/icon.png" \
../icon.svg
inkscape -w "$((resolution * 2))" --export-background-opacity=0 \
--export-filename="assets/icon-generated/${resolution}x${resolution}@2/icon.png" \
../icon.svg
done
}
check() {
cd "${pkgname}"
export RUSTUP_TOOLCHAIN=stable
echo >&2 'Running cargo tests'
dbus-run-session xvfb-run -s '-nolisten local' \
cargo test --frozen
echo >&2 'Testing the executable'
"target/release/${pkgname%-git}" --version > actual.txt
if ! grep -q 'Packetry version \S* (git '"$(
git -C "${pkgname}" rev-parse --short HEAD)" actual.txt
then
printf >&2 '%s\n' 'Unexpected test output:' '==='
cat >&2 actual.txt
printf >&2 '\n%s\n' '==='
exit 1
fi
}
package() {
cd "${pkgname}"
echo >&2 'Packaging the executable'
install -D -m 755 -t "${pkgdir}/usr/bin/" \
"target/release/${pkgname%-git}"
echo >&2 'Packaging the documentation'
install -D -m 644 -t "${pkgdir}/usr/share/doc/${pkgname}" \
README.md
cp -R --preserve=mode -t "${pkgdir}/usr/share/doc/${pkgname}" \
docs/build/singlehtml/{index.html,_static}
install -D -m 644 -t "${pkgdir}/usr/share/man/man1" \
docs/build/man/*.1
echo >&2 'Packaging the icons'
for resolution in 16 22 32 48 64 256; do
install -D -m 644 -T \
"assets/icon-generated/${resolution}x${resolution}/icon.png" \
"${pkgdir}/usr/share/icons/hicolor/${resolution}x${resolution}/apps/packetry.png"
install -D -m 644 -T \
"assets/icon-generated/${resolution}x${resolution}@2/icon.png" \
"${pkgdir}/usr/share/icons/hicolor/${resolution}x${resolution}@2/apps/packetry.png"
done
echo >&2 'Packaging the desktop entry'
install -D -m 644 -t "${pkgdir}/usr/share/applications" \
../packetry.desktop
echo >&2 'Packaging the license'
install -D -m 644 -t "${pkgdir}/usr/share/licenses/${pkgname}" \
LICENSE
}
|