makedeb


pplatex 1.0.rc3-2


A tool to reformat the output of latex and friends into readable messages.

Viewing /PKGBUILD.

View raw.

Click here to go back to the Git tree for pplatex.

# Maintainer: Otreblan <otreblain@gmail.com>

pkgname=pplatex
_pkgver=1.0-rc3
pkgver=${_pkgver//-/.}
pkgrel=2
pkgdesc="A tool to reformat the output of latex and friends into readable messages."
arch=('x86_64')
url="https://github.com/stefanhepp/pplatex"
license=('GPL3')
makedepends=('cmake' 'libpcre3-dev' 'dpkg-dev')
source=("$pkgname-$pkgver.tar.gz::$url/archive/$pkgname-$_pkgver.tar.gz")
sha256sums=('83376ca3a92a21cf002ba1e5c7c09686d4c0c83c5af93d0118c4270437945dc7')

prepare() {
	cp -rf "$pkgname-$pkgname-$_pkgver" "$pkgname-$pkgver"

	cd "$pkgname-$pkgver"
	mkdir -p build

	local CMAKE_VERSION="$(LC_ALL=C cmake --version | awk '{print $3; exit}')"

	# Needed for the link time optimization
	sed "s/\(cmake_minimum_required(\).*)/\1VERSION $CMAKE_VERSION)/" \
		-i CMakeLists.txt
}

build() {
	cd "$srcdir/$pkgname-$pkgver/build"

	cmake \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
		..

	make
}

_shlibdeps() {
	mkdir -p "$pkgdir/debian"
	touch "$pkgdir/debian/control"

	pushd "$pkgdir" &> /dev/null
	dpkg-shlibdeps "$@" -O 2> /dev/null |\
		sed "s/.*Depends=\(.*\)/\1/" |\
		sed "s/, /\n/g" |\
		sed "s/\(.*\) (\(.*\) \(.*\))/\1\2\3/g"
	popd &> /dev/null

	rm -rf "$pkgdir/debian"
}

package() {
	cd "$srcdir/$pkgname-$pkgver"

	install -Dm755 build/src/pplatex "$pkgdir/usr/bin/pplatex"
	ln -s pplatex "$pkgdir/usr/bin/ppdflatex"
	install -Dm755 src/ppluatex "$pkgdir/usr/bin/ppluatex"

	depends+=($(_shlibdeps "$pkgdir/usr/bin/pplatex"))
}