#!/usr/bin/bash
# JOBoRun		: Jwm OpenBox Obarun RUNit
# Maintainer		: Joe Bo Run <joborun@disroot.org>
# PkgSource		: url="https://gittea.disroot.org/joborun/jobextra/$pkgname"
#-----------------------------------------| DESCRIPTION |---------------------------------------

pkgname=meson
pkgver=0.61.0
pkgrel=04
pkgdesc='High productivity build system'
url='https://mesonbuild.com/'
arch=('any')
depends=('python-setuptools' 'ninja')
checkdepends=('gcc-objc' 'vala' 'rust' 'gcc-fortran' 'mono' 'boost' 'qt5-base' 'git' 'cython'
              'gtkmm3' 'gtest' 'gmock' 'protobuf' 'wxgtk3' 'python-gobject' 'gobject-introspection'
              'itstool' 'gtk3' 'java-environment=8' 'gtk-doc' 'llvm' 'clang' 'sdl2' 'graphviz'
              'doxygen' 'vulkan-validation-layers' 'openssh' 'mercurial' 'gtk-sharp-2' 'qt5-tools'
              'libwmf' 'valgrind' 'cmake' 'netcdf-fortran' 'openmpi' 'nasm' 'gnustep-base' 'libelf'
              'python-pytest-xdist' 'python2-setuptools' 'ldc' 'rust-bindgen' 'hotdoc')

source=(https://github.com/mesonbuild/meson/releases/download/${pkgver/rc/.rc}/meson-${pkgver}.tar.gz{,.asc}
        skip-test.diff
        arch-meson
        jobo-meson)

prepare() {
  cd ${pkgname}-${pkgver}

  # Our containers do not allow sanitizers to run
  patch -Np1 -i ../skip-test.diff
}

build() {
  cd ${pkgname}-${pkgver}
  python setup.py build
}

#check() (
#  cd ${pkgname}-${pkgver}
#  export LC_CTYPE=en_US.UTF-8 CPPFLAGS= CFLAGS= CXXFLAGS= LDFLAGS=
#  ./run_tests.py
#)

package() {
  cd ${pkgname}-${pkgver}
  python setup.py install --root="${pkgdir}" --optimize=1 --skip-build

  install -d "${pkgdir}/usr/share/vim/vimfiles"
  cp -rt "${pkgdir}/usr/share/vim/vimfiles" data/syntax-highlighting/vim/*/

  install -Dt "${pkgdir}/usr/share/bash-completion/completions" -m644 data/shell-completions/bash/*
  install -Dt "${pkgdir}/usr/share/emacs/site-lisp" -m644 data/syntax-highlighting/emacs/*
  install -Dt "${pkgdir}/usr/share/zsh/site-functions" -m644 data/shell-completions/zsh/*

  # Arch packaging helper
  install -D ../arch-meson -t "${pkgdir}/usr/bin"

  # joborun packaging helper
  install -D ../jobo-meson -t "${pkgdir}/usr/bin"

}

#---- license gpg-key sha256sums ----

license=('Apache')

validpgpkeys=('19E2D6D9B46D8DAA6288F877C24E631BABB1FE70') # Jussi Pakkanen <jpakkane@gmail.com>

sha256sums=(87ca5fa9358a01864529392bd64e027158eb94afca7c7766b1866ef27eccb98e # meson-0.60.3.tar.gz
	25c26bc3bc9127c8f31a5562148baaf8cc8af66a30c2b677ce370d564863e3ea # meson-0.60.3.tar.gz.asc
	c57d93219cadd192d48eb24eedd1859d5949f1da30bd2d2d2c96b285eee2d259 # skip-test.diff
	ac3387ed5759cc512b1f2a4e5b3dd940274b02f943a7e5d644792ee714e6b95e # arch-meson
	b2aeae2787cf8f3ffb8778ee7f1a434895b1512bc0bdb33528c4cb2aeb067904) #  jobo-meson
