File PKGBUILD of Package tinytex

# Arch PKGBUILD for TinyTeX (formerly cLaTeXMath)
# Copyright (C) 2021/22 Florian "sp1rit" <packaging@sp1rit.anonaddy.me>
# 
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
# 
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.
#
# Maintainer: Florian "sp1rit" <packaging@sp1rit.anonaddy.me>

_basename=tinytex
pkgname=tinytex
pkgver=0
pkgrel=0
pkgdesc="A dynamic, cross-platform, and embeddable LaTeX rendering library"
arch=(any)
url="https://github.com/NanoMichael/cLaTeXMath"
license=('MIT')
depends=("cairo" "pango" "gtkmm3" "gtksourceviewmm" "qt5-base" "fontforge")
makedepends=("meson")
optdepends=(
	"tinytex-font-latinmodern-math: TinyTeX mapping for Latin Modern Math"
)
provides=("${_basename}")
source=("${_basename}-${pkgver}.tar.xz")
sha256sums=('SKIP')

prepare() {
	cd "${srcdir}/${_basename}-${pkgver}"
	arch-meson . _build \
		-DTARGET_DEVEL=true \
		-DTEST=true \
		-DCAIRO=true \
		-DEXAMPLE_GTK=true \
		-DQT=true \
		-DEXAMPLE_QT=true \
		-DGDI=disabled \
		-DEXAMPLE_WIN32=false
}

build() {
	cd "${srcdir}/${_basename}-${pkgver}"
	ninja -C _build
}

package() {
	cd "${srcdir}/${_basename}-${pkgver}"
	DESTDIR="${pkgdir}" meson install -C _build

	pushd prebuilt
	sed -e 's|/usr/bin/env sh|/usr/bin/sh|' \
		-e "s|otf2clm.py|/usr/lib/${_basename}-otf2clm.py|" \
		-i otf2clm.sh
	install -Dm755 otf2clm.py ${pkgdir}/usr/lib/${_basename}-otf2clm.py
	install -Dm755 otf2clm.sh ${pkgdir}/usr/bin/${_basename}-otf2clm
	popd
}
openSUSE Build Service is sponsored by