I would've like to know how to change the python executable name to python-pnglatex from the PKGBUILD anyways (it shouldn't be too hard I just couldn't find where), if I find it later I'll post it for good measure, but I'll go ahead and mark this as solved.
]]>Here's a proper PKGBUILD for python-pnglatex:
pkgname=python-pnglatex
_name=${pkgname#python-}
pkgver=1.1
pkgrel=1
pkgdesc="A small program that converts LaTeX snippets to png"
arch=('any')
url="https://github.com/MaT1g3R/pnglatex"
license=('GPL3')
depends=('netpbm' 'poppler' 'python' 'texlive-core')
makedepends=('python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_name::1}/$_name/$_name-$pkgver.tar.gz")
sha256sums=('0995060d4926b6d3b40731586c615234c3e45b3142fc15b836601e3b0cf863d3')
build() {
cd "$_name-$pkgver"
python setup.py build
}
package() {
cd "$_name-$pkgver"
python setup.py install --root="$pkgdir" --optimize=1 --skip-build
}
Also I know this sort of renaming is possible since I've seen in some Arch packages, like 'perl-rename' vs 'rename'. I'll keep looking in the python documentation and reread the PKGBUILD wiki.
]]>#!/bin/bash
tempdir="$(mktemp -d)" &&
sed -e '1 s/^/\\documentclass{minimal}\\usepackage{amsmath}\\begin{document}/' -e '$ s/$/\\end{document}/' < /dev/stdin | pdflatex --interaction=batchmode --output-directory "$tempdir" &>/dev/null &&
pdfcrop "$tempdir/texput.pdf" &>/dev/null &&
pdftoppm -png -r 600 -singlefile "$tempdir/texput-crop.pdf" "${1%.png}" && rm -rf "$tempdir"
Save that as latex2png.sh and chmod +x latex2png, then, e.g.:
echo '$x^2 + y^2 = z^2$' | latex2png.sh outputname.png
]]>pkgname=python-pnglatex
_name=${pkgname#python-}
pkgver=1
pkgrel=1
pkgdesc="A small program that converts LaTeX snippets to png"
arch=("any")
url="https://github.com/MaT1g3R/pnglatex"
license=("GPL3")
depends=(
"texlive-core"
"poppler"
"netpbm"
)
source=("$pkgname::git+$url")
md5sums=('SKIP')
prepare() {
cd "$srcdir/$pkgname"
sed -i '30,$s/pnglatex/python-pnglatex/g' "setup.py"
}
build() {
cd "$srcdir/$pkgname"
python setup.py build
}
package() {
cd "$srcdir/$pkgname"
python setup.py install --prefix=/usr --root="${pkgdir}/" --optimize=1 --skip-build
}
PS: I know the name should probably have -git at the end, but I'm not planning on submitting to the AUR
Edit: I incorrectly put in the comment the url of the shell script pnglatex repo, not the python pnglatex. The PKGBUILD is still broken.
]]>