summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 3c6f612f5ffe8c770419b802877f0308cf656660 (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
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
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
# Maintainer:  dreieck (https://aur.archlinux.org/account/dreieck)
# Contributor: Christian Hesse

_USE_CCACHE=false
if which ccache > /dev/null 2>&1; then
  _USE_CCACHE=true
fi
_WITH_NETWORKMANAGER=false
# _WITH_NETWORKMANAGER=true
_WITH_VALGRIND=false
# _WITH_VALGRIND=true
# _TOOLKIT='gtk2'
_TOOLKIT='gtk3'
# _PROTECTEDHEADERSPATCHVARIANT=nopicturesplease # Use the patch from https://www.thewildbeast.co.uk/claws-mail/bugzilla/show_bug.cgi?id=4426#c39.
_PROTECTEDHEADERSPATCHVARIANT=filippo          # Use the patch from https://www.thewildbeast.co.uk/claws-mail/bugzilla/show_bug.cgi?id=4007#c4.

_pkgname='claws-mail'
case "${_TOOLKIT}" in
  'gtk2')
    _pkgvariant="${_TOOLKIT}"
    _gitbranch="${_TOOLKIT}"
  ;;
  'gtk3')
    _pkgvariant="protectedheaders"
    _gitbranch='master'
  ;;
  *)
    _pkgvariant="${_TOOLKIT}-protectedheaders"
    _gitbranch="${_TOOLKIT}"
  ;;
esac

pkgname="${_pkgname}-${_pkgvariant}-git"
epoch=0
pkgver=4.2.0+90.r13373.20240423.59d1aa181
pkgrel=1
pkgdesc="A GTK based e-mail client. Latest git checkout, built against '${_TOOLKIT}'. Patched to use charset supersets to decode titles and to display protected headers."
arch=(
  'i686'
  'x86_64'
)
license=('GPL-3.0-or-later')
url='https://www.claws-mail.org/'
depends=(
  'cairo'
  'compface'
  'dbus-glib'
  'enchant'
  'gdk-pixbuf2'
  'glib2'
  'glibc'
  'gnutls'
  'gpgme'
  "${_TOOLKIT}"
  'hicolor-icon-theme'
  'libice'
  'libetpan'
  'libsm'
  'libldap'
  'librsvg'
  'nettle'
  'pango'
  'startup-notification'
)
makedepends=(
  'git'
  'python>=3'
  'spamassassin'
  # dependencies for plugins:
  'bogofilter'
  'dillo'
  'gumbo-parser>=0.12'
  'libcanberra'
  'libgdata'
  'libical'
  'libnotify'
  'libytnef'
  'poppler-glib'
  'pygtk'
  # dependencies to build the docs:
  'docbook-utils'
  'lynx'
  'texlive-core'
  'texlive-formatsextra'
)
optdepends=(
  'claws-mail-theme-basicsvg: BasicSVG icon theme for Claws Mail.'
  'claws-mail-tango-theme: Tango icon theme for Claws Mail.'
  'papirus-claws-mail-theme: Papirus icon theme for Claws Mail.'
  "claws-mail-plugin-reloader: Reload plugins from the 'tools' menu (for development)."
  'bash:              for some extra tools.'
  'at-spi2-core:      for many plugins.'
  'bogofilter:        for bogofilter plugin.'
  'curl:              for vcalendar, rssyl and spamreport plugins.'
  'dbus:              for notification plugin.'
  'libx11:            for notification plugin.'
  'dillo:             for dillo html viewer plugin.'
  'expat:             for rssyl plugin.'
  'fontconfig:        for litehtml_viewer plugin.'
  'freetype2:         for litehtml_viewer plugin.'
  'gcc-libs:          for litehtml_viewer plugin.'
  'gumbo-parser>=0.12: for litehtml_viewer plugin.'
  'ghostscript:       for pdf viewer plugin.'
  'harfbuzz:          for many plugins'
  'jpilot:            for jpilot (palm pilot connection) plugin.'
  'libarchive:        for archive plugin and various other plugins.'
  'libcanberra:       for notification plugin.'
  'libgpg-error:      for GPG and S-MIME plugins.'
  'libical:           for vcalendar plugin.'
  'libnotify:         for notification plugin.'
  'libytnef:          for tnef_parse plugin.'
  'libxcrypt:         for perl plugin.'
  'perl:              needed for some tools and perl plugin.'
  'poppler-glib:      for pdf viewer plugin.'
  'python2:           needed for some tools and python plugin.'
  'python>=3:         for some tools/ plugins.'
  'spamassassin:      for spamassassin plugin.'
  'zlib:              for many plugins.'
  'json-glib:         for gdata plugin.'
  'libgdata:          for gdata plugin.'
  'libgoa:            for gdata plugin.'
  'libxml2:           for gdata plugin.'
  'libsoup:           for gdata and fancy html viewer plugins.'
)
replaces=(
  'claws-mail-extra-plugins'
  'sylpheed-claws'
)
conflicts=(
  'claws'
  "${_pkgname}"
  "${_pkgname}-${_pkgvariant}"
  "${_pkgname}-bash-completion"
  'claws-mail-extra-plugins'
  'sylpheed-claws'
)
provides=(
  "claws=${pkgver}"
  "${_pkgname}=${pkgver}"
  "${_pkgname}-${_TOOLKIT}=${pkgver}"
  "${_pkgname}-title-superset=${pkgver}"
  "${_pkgname}-protectedheaders=${pkgver}"
  "${_pkgname}-bash-completion"
  "claws-mail-extra-plugins=${pkgver}"
)
source=(
  "${_pkgname}::git://git.claws-mail.org/claws.git#branch=${_gitbranch}"
  "0000_encoding.diff::https://aur.archlinux.org/cgit/aur.git/plain/0001_encoding.diff?h=claws-mail-title-superset" ## NOTE!, if this gets removed, adapt the `provides` array and the `$pkgdesc`!
)
sha256sums=(
  'SKIP'
  '79e2b664d039f5cc0cf642359923e3d100ffc4ab070fc54c02d5792b624e26f6'
)
case "${_PROTECTEDHEADERSPATCHVARIANT}" in
  'nopicturesplease')
    source+=("0002_protectedheaders.patch::https://www.thewildbeast.co.uk/claws-mail/bugzilla/attachment.cgi?id=2331")
    sha256sums+=('383f4ea03102ed2c8f19365b9bf2b757969d1617fcfd0a8375126f388cc60301')
    if [ "${_TOOLKIT}" == "gtk2" ]; then
      source+=("protectedheaders.patch.for-gtk2.patch")
      sha256sums+=('3b1e568398950eb93d879353cfd6d49d81f7e1790c24972f36846f22ef4106cb')
    fi
  ;;
  'filippo')
    source+=("read_enc_subject.tar.gz::https://www.thewildbeast.co.uk/claws-mail/bugzilla/attachment.cgi?id=2350")
    sha256sums+=('70b2595830dce73d85600190258389216b4aa613f88ebbedc6088a806c7b01f1')
  ;;
  *)
    error "Please edit the 'PKGBUILD' to specify a valid provider of the protected headers patch (variable '_PROTECTEDHEADERSPATCHVARIANT' at the beginning of the 'PKGBUILD')."
    exit 1
  ;;
esac


if "${_USE_CCACHE}"; then
  makedepends+=('ccache')
  options+=('ccache')
fi
if [ "${_TOOLKIT}" == "gtk2" ]; then
  _fancy_config_opts=('--disable-fancy-plugin')
else
  makedepends+=('webkit2gtk')
  optdepends+=('webkit2gtk:        for fancy webkit html viewer plugin')
  _fancy_config_opts=('--enable-fancy-plugin')
fi
if "${_WITH_NETWORKMANAGER}"; then
  makedepends+=('networkmanager')
  optdepends+=('networkmanager:    for NetworkManager network connection query.')
  _networkmanager_config_opts=('--enable-networkmanager')
else
  _networkmanager_config_opts=('--disable-networkmanager')
fi
if "${_WITH_VALGRIND}"; then
  makedepends+=('valgrind')
  _valgrind_config_opts=('--enable-valgrind')
else
  _valgrind_config_opts=('--disable-valgrind')
fi


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

  for _patch in "${srcdir}/0000_encoding.diff"; do
   msg2 "Applying patch '${_patch}' ..."
   patch -N -p1 --follow-symlinks -i "${_patch}"
  done

  case "${_PROTECTEDHEADERSPATCHVARIANT}" in
   'nopicturesplease')
     if [ "${_TOOLKIT}" == "gtk2" ]; then
       msg2 "Patching '0002_protectedheaders.patch' for GTK2 ..."
       patch -N --follow-symlinks -i "${srcdir}/protectedheaders.patch.for-gtk2.patch" -o "${srcdir}/0002_protectedheaders-${_TOOLKIT}.patch" "${srcdir}/0002_protectedheaders.patch"
     else
       cp "${srcdir}/0002_protectedheaders.patch" "${srcdir}/0002_protectedheaders-${_TOOLKIT}.patch"
     fi
     for _patch in "${srcdir}/0002_protectedheaders-${_TOOLKIT}.patch"; do
       msg2 "Applying patch '${_patch}' ..."
       patch -N -p1 --follow-symlinks -i "${_patch}"
     done
   ;;
   'filippo')
     for _patch in "${srcdir}"/{0001-PGP-MIME-fix-leak-of-MimeInfo-if-parsing-fails,0002-Substitute-Subject-header-when-decrypting,0003-TextView-move-header-extraction-to-textview_process_,0004-PGPMime-return-full-decrypted-message-instead-of-fir}.patch; do
       msg2 "Applying patch '${_patch}' ..."
       patch -N -p1 --follow-symlinks -i "${_patch}"
     done
   ;;
   *)
     error "Please edit the 'PKGBUILD' to specify a valid provider of the protected headers patch (variable '_PROTECTEDHEADERSPATCHVARIANT' at the beginning of the 'PKGBUILD')."
     return 1
   ;;
  esac

  msg2 "Generating git log ..."
  git log > "${srcdir}/git.log"

  # Generate ./configure
  # if [ ! -e configure ]; then
  msg2 "Generating './configure' ..."
  NOCONFIGURE=1 ./autogen.sh
  # fi
}

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

  _ver="$(git describe --tags | sed -E -e 's|^[vV]||' -e 's|\-g[0-9a-f]*$||' | tr '-' '+')"
  _rev="$(git rev-list --count HEAD)"
  _date="$(git log -1 --date=format:"%Y%m%d" --format="%ad")"
  _hash="$(git rev-parse --short HEAD)"

  if [ -z "${_ver}" ]; then
    error "Could not determine version."
    return 1
  else
    printf '%s' "${_ver}.r${_rev}.${_date}.${_hash}"
  fi
}

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

  _configure_opts=(
    --prefix=/usr
    --disable-static
    --enable-shared
    --enable-nls
    --enable-manual
    --enable-libsm
    --enable-ipv6
    --enable-gnutls
    --enable-enchant
    --enable-crash-dialog
    --disable-generic-umpc
    --enable-compface
    --enable-pthread
    --enable-startup-notification
    --enable-dbus
    --enable-ldap
    --enable-jpilot
    "${_networkmanager_config_opts[@]}"
    --enable-libetpan
    "${_valgrind_config_opts[@]}"
    --disable-alternate-addressbook # add --enable-alternate-addressbook to the options to use the new/alternate address book (which could break things!). Do not forget to add claws-contacts to the dependencies then
    --enable-svg
    --enable-deprecated
    --enable-acpi_notifier-plugin
    --enable-address_keeper-plugin
    --enable-archive-plugin
    --enable-att_remover-plugin
    --enable-attachwarner-plugin
    --enable-bogofilter-plugin
    --enable-bsfilter-plugin
    --enable-clamd-plugin
    --enable-dillo-plugin
    "${_fancy_config_opts[@]}"
    --enable-fetchinfo-plugin
    --enable-gdata-plugin
    --enable-libravatar-plugin
    --enable-litehtml_viewer-plugin
    --enable-mailmbox-plugin
    --enable-managesieve-plugin
    --enable-newmail-plugin
    --enable-notification-plugin
    --enable-pdf_viewer-plugin
    --enable-perl-plugin
    --enable-python-plugin
    --enable-pgpcore-plugin
    --enable-pgpmime-plugin
    --enable-pgpinline-plugin
    --enable-rssyl-plugin
    --enable-smime-plugin
    --enable-spamassassin-plugin
    --enable-spam_report-plugin
    --enable-tnef_parse-plugin
    --enable-vcalendar-plugin
    --enable-demo-plugin
  )

  msg2 "Running './configure <options>' ..."
  ./configure "${_configure_opts[@]}"
  msg2 "Running 'make' ..."
  make

  # build extra tools
  pushd tools 2>/dev/null
  msg2 "Running 'make' in './tools/' ..."
  make
  popd 2>/dev/null
}

package() {
  cd "${srcdir}/${_pkgname}"

  msg2 "Runnung 'make install' ..."
  make DESTDIR="${pkgdir}" install

  # install extra tools
  msg2 "Installing extra tools ..."
  # all executables and .conf files; only top directory
  pushd tools 2>/dev/null
  for _file in *.pl *.sh *.py tb2claws-mail update-po uudec uuooffice; do
    install -D -v -m755 "${_file}" "${pkgdir}/usr/lib/${_pkgname}/tools/${_file}"
  done
  for _file in *.txt *.conf README; do
    install -D -v -m644 "${_file}" "${pkgdir}/usr/lib/${_pkgname}/tools/${_file}"
  done
  for _dir in kdeservicemenu; do
    cp -arv "${_file}" "${pkgdir}/usr/lib/${_pkgname}"/tools/
  done
  popd 2>/dev/null

  # Install more information
  msg2 "Installing extra documentation and license ..."
  for _docfile in ABOUT-NLS AUTHORS ChangeLog* INSTALL NEWS README RELEASE_NOTES version; do
      install -D -v -m644 "${_docfile}" "${pkgdir}/usr/share/doc/${_pkgname}/${_docfile}"
  done
  install -D -v -m644 "${srcdir}/git.log" "${pkgdir}/usr/share/doc/${_pkgname}/git.log"
  ln -svr "${pkgdir}/usr/lib/${_pkgname}/tools/README" "${pkgdir}/usr/share/doc/${_pkgname}/README-tools"
  ln -svr "${pkgdir}/usr/share/licenses/${pkgname}/COPYING" "${pkgdir}/usr/share/doc/${_pkgname}/COPYING"
  install -D -v -m644 'COPYING' "${pkgdir}/usr/share/licenses/${pkgname}/COPYING"

  # Install bash completion
  msg2 "Installing bash completion ..."
  install -D -v -m644 "tools/bash_completion/claws-mail" "${pkgdir}/usr/share/bash-completion/completions/${_pkgname}"
}