summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 629dcf4ab7bc3854239be2876d14b894c3c49dd1 (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
# Maintainer:  Iyán Méndez Veiga <me (at) iyanmv (dot) com>
# Contributor: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Filipe Laíns <lains@archlinux.org>
# Contributor: Timothy Redaelli <timothy.redaelli@gmail.com>
# Contributor: Guillaume ALAUX <guillaume@archlinux.org>
# Contributor: Florian Pritz <bluewind at jabber dot ccc dot de>
# Contributor: Peter Wu <peter@lekensteyn.nl>
_pkgbase=wireshark
pkgbase=wireshark-oqs
pkgname=(wireshark-oqs-cli wireshark-oqs-qt)
pkgver=4.6.5
pkgrel=1
_pkgver_oqs=0.11.0
_commit_oqs_demos=29d4dccbd547a62e8ba77d3fef1af5d6f8625d60
pkgdesc='Network traffic and protocol analyzer/sniffer'
url='https://www.wireshark.org/'
arch=(x86_64)
license=(GPL-2.0-only)
makedepends=(
  asciidoctor
  bcg729
  brotli
  c-ares
  cmake
  desktop-file-utils
  doxygen
  git
  glib2
  glibc
  gnutls
  hicolor-icon-theme
  krb5
  libcap
  libgcc
  libgcrypt
  libmaxminddb
  libnghttp2
  libnghttp3
  libpcap
  libssh
  libstdc++
  libxml2
  libxslt
  lua54
  lz4
  minizip
  ninja
  opus
  pcre2
  python
  python-jinja
  python-yaml
  qt6-5compat
  qt6-base
  qt6-multimedia
  qt6-svg
  qt6-tools
  sbc
  snappy
  spandsp
  speexdsp
  systemd-libs
  xxhash
  zlib-ng
  zstd
)
checkdepends=(
  python-pytest
  python-pytest-xdist
)
options=('!emptydirs')
source=(
  git+https://gitlab.com/wireshark/wireshark.git#tag=v${pkgver}
  git+https://github.com/open-quantum-safe/oqs-provider.git#tag=refs/tags/$_pkgver_oqs
  https://raw.githubusercontent.com/open-quantum-safe/oqs-demos/$_commit_oqs_demos/wireshark/qsc_template.jinja2
  https://raw.githubusercontent.com/open-quantum-safe/oqs-demos/$_commit_oqs_demos/wireshark/generate_qsc_header.py
  wireshark.sysusers
)
b2sums=('c1b853b3c30248086fd06bc2f50020a2be0edccf4be1559c70efb232963d709982c52495f8a73901fd6a087019c7fc9a24ae5944b5cd0aea1a7a006e6fc5da7f'
        'df5b81c3c4852de30878d4ea2fa0d9cec6d64a7527bd82523e1196d2df3952c05981d334f7472a369ab52f240f0321fb95130320de030d6c5846133fc49c76de'
        '8061cdb5ddce084be6566b57bf21f9281ff9cb7ffd986c1968d60e46624afb1a6e9aff02bf0cf065a89b868bc6ab5ceb5c222c1a7913d06db79ee778593a2997'
        '15e4cfa9626dc6f4b0dff7096f7610791ba9b186fa21855a5203bbeb03c27afbe86e876f3dd0a7f7b6f79cb221c896beec344de0701b6ecd86ad40f318bf9019'
        '3cebcc993f51eaf0e09673c77e0436598593ef5eff306d880415ccc8eecb32fee93c9a6986f1a7bb0835ab7f9732369d7c5a07e6c053d6293e73a1ea84c58a5c')

prepare() {
  # Generate header file
  # See https://github.com/open-quantum-safe/oqs-demos/blob/643ef99297fe8c6ebd3587b5dd238d5e7a457037/wireshark/Dockerfile
  cp oqs-provider/oqs-template/generate.yml .
  python generate_qsc_header.py


  # Patch wireshark
  cd $_pkgbase
  cp ../qsc.h epan/dissectors
  sed -i "s/#include \"config.h\"/#include \"config.h\"\n#include \"qsc.h\"/g" epan/dissectors/packet-pkixalgs.c && \
  sed -i "s/#include \"config.h\"/#include \"config.h\"\n#include \"qsc.h\"/g" epan/dissectors/packet-tls-utils.c && \
  sed -i "s/oid_add_from_string(\"sha224\", \"2.16.840.1.101.3.4.2.4\");/oid_add_from_string(\"sha224\", \"2.16.840.1.101.3.4.2.4\");\nQSC_SIGS/g" epan/dissectors/packet-pkixalgs.c && \
  sed -i "s/    { 260\, \"ffdhe8192\" }\, \/\* RFC 7919 \*\//    { 260\, \"ffdhe8192\" }\, \/\* RFC 7919 \*\/\nQSC_KEMS/g" epan/dissectors/packet-tls-utils.c
  sed -i "s/    { 0x080b\, \"rsa_pss_pss_sha512\" }\,/    { 0x080b\, \"rsa_pss_pss_sha512\" }\,\nQSC_KEMS/g" epan/dissectors/packet-tls-utils.c
}

build() {
  cd ${_pkgbase}
  cmake \
    -B build \
    -G Ninja \
    -DVCSVERSION_OVERRIDE="Git v${pkgver} packaged as ${pkgver}-${pkgrel}" \
    -DCMAKE_BUILD_TYPE=None \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=lib \
    -DCMAKE_INSTALL_LIBEXECDIR=lib \
    -DCMAKE_SKIP_INSTALL_RPATH=TRUE \
    -DENABLE_LUA=ON \
    -DENABLE_ZLIB=OFF \
    -Wno-dev
  ninja -C build -v
}

check() {
  cd ${_pkgbase}
  ninja -C build -v test
}

package_wireshark-oqs-cli() {
  pkgdesc+=' - CLI tools and data files'
  depends=(
    bcg729
    brotli
    c-ares
    glib2
    glibc
    gnutls
    krb5
    libbrotlidec.so
    libcap
    libcap.so
    libcares.so
    libgcc
    libgcrypt
    libk5crypto.so
    libkrb5.so
    libmaxminddb
    libnghttp2
    libnghttp3
    libnl
    libpcap
    libpcap.so
    libssh
    libxml2
    lua54
    lz4
    opencore-amr
    opus
    pcre2
    sbc
    snappy
    spandsp
    speexdsp
    systemd-libs
    xxhash
    zlib-ng
    zstd
  )
  install=wireshark.install
  conflicts=(wireshark-cli)
  provides=(wireshark-cli)

  cd ${_pkgbase}
  DESTDIR="${pkgdir}" ninja -C build install
  DESTDIR="${pkgdir}" cmake --install build --component Development

  # wireshark uid group is 150
  install -Dm 644 "${srcdir}"/wireshark.sysusers "${pkgdir}"/usr/lib/sysusers.d/wireshark.conf
  chgrp 150 "${pkgdir}"/usr/bin/dumpcap
  chmod 754 "${pkgdir}"/usr/bin/dumpcap

  cd "${pkgdir}"
  rm -r usr/share/mime \
    usr/share/icons \
    usr/share/man/man1/wireshark.1 \
    usr/bin/wireshark \
    usr/share/applications/org.wireshark.Wireshark.desktop \
    usr/share/metainfo/org.wireshark.Wireshark.metainfo.xml \
    usr/share/doc/wireshark/wireshark.html
}

package_wireshark-oqs-qt() {
  pkgdesc+=' - Qt GUI'
  depends=(
    desktop-file-utils
    glib2
    glibc
    hicolor-icon-theme
    libgcc
    libgcrypt
    libnl
    libpcap
    libpcap.so
    libstdc++
    minizip
    qt6-5compat
    qt6-base
    qt6-multimedia
    qt6-svg
    shared-mime-info
    speexdsp
    wireshark-oqs-cli
    xdg-utils
  )
  conflicts=(wireshark-qt)
  provides=(wireshark-qt)

  cd ${_pkgbase}
  install -d "${srcdir}/staging"
  DESTDIR="${srcdir}/staging" ninja -C build install

  install -Dm 755 build/run/wireshark -t "${pkgdir}"/usr/bin
  install -Dm 644 build/doc/man_pages/wireshark.1 -t "${pkgdir}"/usr/share/man/man1
  install -Dm 644 build/doc/man_pages/wireshark.html -t "${pkgdir}"/usr/share/doc/wireshark

  cd "${srcdir}"/staging/usr/share
  install -Dm 644 applications/org.wireshark.Wireshark.desktop -t "${pkgdir}"/usr/share/applications
  install -Dm 644 mime/packages/org.wireshark.Wireshark.xml -t "${pkgdir}"/usr/share/mime/packages
  install -Dm 644 metainfo/org.wireshark.Wireshark.metainfo.xml -t "${pkgdir}"/usr/share/metainfo
  mv icons "${pkgdir}"/usr/share/icons
}

# vim: ts=2 sw=2 et: