# Maintainer (arch): Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor (arch): Jan de Groot <jgc@archlinux.org>
# Contributor: Andreas Grapentin <andreas@grapentin.org>
# Contributor: Márcio Silva <coadde@hyperbola.info>
# Contributor: Isaac David <isacdaavid@at@isacdaavid@dot@info>
# Contributor: Freemor <freemor@freemor.ca>
# Contributor: bill-auger <bill-auger@programmer.net>


# parabola changes and rationale:
#  - removed libgdata support
#  - pinned to 'icu' sodep


pkgname=evolution-data-server
pkgver=3.38.2
pkgrel=2
pkgrel+=.nonprism1
pkgdesc="Centralized access to appointments and contacts"
pkgdesc+=", without libgdata support"
url="https://wiki.gnome.org/Apps/Evolution"
arch=(x86_64)
arch+=(armv7h i686)
depends=(gnome-online-accounts nss krb5 libgweather libical db libgdata libphonenumber)
depends=(${depends[@]/libgdata/})
makedepends=(intltool gperf gobject-introspection vala gtk-doc boost git cmake ninja)
provides=(libcamel-1.2.so libebackend-1.2.so libebook-1.2.so libebook-contacts-1.2.so
          libecal-2.0.so libedata-book-1.2.so libedata-cal-2.0.so libedataserver-1.2.so
          libedataserverui-1.2.so)
license=(GPL)
_commit=e5135dcf71a7f4ac0e60acb7ba2b3ac551e9578e  # tags/3.38.2^0
source=("git+https://gitlab.gnome.org/GNOME/evolution-data-server.git#commit=$_commit")
sha256sums=('SKIP')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/^EVOLUTION_DATA_SERVER_//;s/_/./g;s/-/+/g'
}

prepare() {
  cd $pkgname
}

build() {
  CFLAGS+=" $CPPFLAGS"
  CXXFLAGS+=" $CPPFLAGS"
  cmake -S $pkgname -B build -G Ninja \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DLIBEXEC_INSTALL_DIR=/usr/lib \
    -DSYSCONF_INSTALL_DIR=/etc \
    -DENABLE_INTROSPECTION=ON \
    -DENABLE_VALA_BINDINGS=ON \
    -DENABLE_UOA=OFF \
    -DENABLE_GOOGLE=OFF \
    -DHAVE_LIBGDATA=OFF \
    -DENABLE_GOOGLE_AUTH=OFF \
    -DENABLE_GTK_DOC=ON \
    -DWITH_PHONENUMBER=ON
  cmake --build build
}

check() {
  # libedata-book tests fail because they try to
  # mkdir /usr/lib/evolution-data-server/camel-providers
  cmake --build build --target test || :
}

package() {
  depends+=(libicui18n.so libicuuc.so)

  DESTDIR="$pkgdir" cmake --install build
}
