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

pkgname=meson
pkgver=1.0.1
pkgrel=01
pkgdesc='High productivity build system'
url='https://mesonbuild.com/'
depends=(ninja python)
makedepends=(
  python-build
  python-installer
  python-wheel
)
checkdepends=(  boost  clang  cmake  cuda  cython  doxygen  gcc-fortran  gcc-objc
  git  gmock  gnustep-base  gobject-introspection  graphviz  gtest  gtk-doc  gtk-sharp-2
  gtk3  gtkmm3  hotdoc  itstool  java-environment=8  ldc  libelf  libwmf  llvm  mercurial
  mono  nasm  netcdf-fortran  openmpi  openssh  protobuf  python-gobject  python-pytest-xdist
  qt5-base  qt5-tools  rust  rust-bindgen  sdl2  vala  valgrind  vulkan-validation-layers
  wxgtk3)
source=(
  https://github.com/mesonbuild/meson/releases/download/$pkgver/meson-$pkgver.tar.gz{,.asc}
  meson-reference-$pkgver.3::https://github.com/mesonbuild/meson/releases/download/$pkgver/meson-reference.3
  meson-reference-$pkgver.json::https://github.com/mesonbuild/meson/releases/download/$pkgver/reference_manual.json
        0001-Skip-broken-tests.patch
        arch-meson
        jobo-meson)

prepare() {
  cd $pkgname-$pkgver

  ## Arch: Our containers do not allow sanitizers to run
  patch -Np1 -i ../0001-Skip-broken-tests.patch

}

build() {
  cd $pkgname-$pkgver
  python -m build --wheel --no-isolation
}

#
#check() (
#  cd $pkgname-$pkgver
#  export LC_CTYPE=en_US.UTF-8 CPPFLAGS= CFLAGS= CXXFLAGS= LDFLAGS=
#  ./run_tests.py --failfast
#)
#
#========================================== short test summary info ===========================================
#FAILED run_unittests.py::AllPlatformTests::test_testsetups - AssertionError: 'TEST_ENV is set' not found in "Log of Meson test suite run on 2022-12-25T01:12:12.907961...
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#!!!!!!!!!!!!!!!!!!!!!!!!!!! xdist.dsession.Interrupted: stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!!
#===================== 1 failed, 409 passed, 65 skipped, 13 warnings in 154.65s (0:02:34) =====================
#Total time: 155.019 seconds
#

package() {
  cd $pkgname-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl

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

  install -Dm644 data/shell-completions/bash/* -t "$pkgdir/usr/share/bash-completion/completions"
  install -Dm644 data/shell-completions/zsh/*  -t "$pkgdir/usr/share/zsh/site-functions"

  install -Dm644 ../meson-reference-$pkgver.3    "$pkgdir/usr/share/man/man3/meson-reference.3"
  install -Dm644 ../meson-reference-$pkgver.json "$pkgdir/usr/share/doc/$pkgname/reference_manual.json"

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

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

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

arch=('any')

license=('Apache')

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

sha256sums=(d926b730de6f518728cc7c57bc5e701667bae0c3522f9e369427b2cc7839d3c1  # meson-1.0.1.tar.gz
	acdcb7ae0f91c8f5a608e712768a8030c2104bbf7c5a615fc385e8da3a5733c3  # meson-1.0.1.tar.gz.asc
	1176b517e84d930ebfc520c3075a3c16aea1459ea83cd49d4f0d2756449d04f7  # meson-reference-1.0.1.3
	73e6f4e2566fa66dc4c5d048afc3a04760ae806697a7b9bba63489e18e999eff  # meson-reference-1.0.1.json
	f13ec9e555cff3fc281ef6b9cfaf9c08daa565bd3e558d2ebd5f37f50cf5afec  # 0001-Skip-broken-tests.patch
	ac3387ed5759cc512b1f2a4e5b3dd940274b02f943a7e5d644792ee714e6b95e  # arch-meson
	b2aeae2787cf8f3ffb8778ee7f1a434895b1512bc0bdb33528c4cb2aeb067904) # jobo-meson

##  0d12d3d701c53324c5cd304b57764b1ebc83f910726b48acb3c5368f2717fefc  meson-1.0.1-01-any.pkg.tar.lz


