# Maintainer: Eric Belanger <eric@archlinux.org>
# Contributor: Kritoke <typeolinux@yahoo.com>

pkgname=gnumeric
pkgver=1.12.50
pkgrel=1
pkgdesc="A GNOME Spreadsheet Program"
arch=('x86_64')
url="https://www.gnome.org/projects/gnumeric/"
license=('GPL')
depends=('goffice')
makedepends=('intltool' 'psiconv' 'pygobject-devel' docbook-xml
             'gobject-introspection' 'python-gobject' gtk-doc autoconf-archive git yelp-tools)
optdepends=('python-gobject: for python plugin support'
            'perl: for perl plugin support'
            'psiconv: for Psion 5 file support'
            'yelp: for viewing the help manual')
_commit=98e953704e14eb808549c179ff064fc35e680746
source=("git+https://gitlab.gnome.org/GNOME/gnumeric.git#commit=$_commit"
        revert-warnings.patch)
sha256sums=('SKIP'
            'bcafca016b809000c2a5bf911e2e3dfa4de28f9e541d9964574cac5c7ce09e53')

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

prepare() {
  cd $pkgname
  patch -Np0 -i ../revert-warnings.patch
  NOCONFIGURE=1 ./autogen.sh
}

build() {
  cd $pkgname
  ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
    --disable-schemas-compile --enable-introspection --disable-silent-rules

  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

package() {
  cd $pkgname
  make DESTDIR="${pkgdir}" install
}
