# Maintainer: Carlos Aznarán <caznaranl@uni.pe>
# Contributor: Ronald van Haren <ronald.archlinux.org>
# Contributor: Antonio Rojas <arojas@archlinux.org>
# Contributor: Damir Perisa <damir.perisa@bluewin.ch>
# Contributor: Christopher Reimer <c.reimer1993@gmail.com>

pkgname=texmacs
pkgver=2.1.4
pkgrel=1
pkgdesc="Free scientific text editor, inspired by TeX and GNU Emacs. WYSIWYG editor TeX-fonts and CAS-interface (Giac, GTybalt, Macaulay 2, Maxima, Octave, Pari, Qcl, R and Yacas) in one."
arch=(aarch64 x86_64)
url="http://www.texmacs.org"
license=('GPL')
# do not remove texlive-core dependency, as it is needed!
depends=('perl' 'libguile.so' 'zlib' 'texlive-core' 'python'
         'libjpeg.so' 'libpng' 'libsqlite3.so' 'libfreetype.so'
         'qt5-svg' 'qt5-base')
optdepends=('transfig: convert images using fig2ps'
  'gawk: conversion of some files'
  'ghostscript: rendering ps files'
  'imagemagick: convert images'
  'aspell: spell checking')
makedepends=('ghostscript' 'cmake')
source=(https://github.com/texmacs/texmacs/archive/refs/tags/v${pkgver}.tar.gz)
options=('!emptydirs')
sha512sums=('79ff9409639661910d7c05839af2a8b6f1539010e54f37c443588915308516add013fb803f80b35330174c0344b31f08bed9d5e8929b59b96aea417ba40b1f61')

build() {
  cmake \
    -S texmacs-${pkgver} \
    -B build \
    -DCMAKE_BUILD_TYPE=RelWithDebInfo \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DGUILECONFIG_EXECUTABLE=/usr/bin/guile-config1.8 \
    -Wno-dev
  cmake --build build
}

package() {
  DESTDIR="${pkgdir}" cmake --build build --target install
}
