summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7c9b95ad9f17f3834c706e3afec27ab88da00ce4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Maintainer: Andreas Baumann <mail@andreasbaumann.cc>

pkgname=pdfalto
pkgver=0.4
pkgrel=2
pkgdesc='PDF to XML ALTO file converter'
arch=('x86_64')
url='https://github.com/kermitt2/pdfalto'
license=('GPL2')
depends=('libtiff' 'freetype2' 'icu' 'libpng14' 'libxml2' 'zlib')
makedepends=('cmake' 'gcc12')
source=("git+https://github.com/kermitt2/${pkgname}.git#tag=${pkgver}"
        "pdfalto-use-system-libs.patch"
        "pdfalto-compilation-fixes.patch")
md5sums=('3ab6d630f542e95b63a664ccad5d17a4'
         '6d1ef0ea61e4ec3f65bca9c5a78fa62f'
         '8cb9aeb09a45f860ae0b793ce329a425')

prepare()
{
	cd "$srcdir"/$pkgname

	# external references to subproject should not point to clone URLs which
	# force the user to log in
	sed -i 's|git@github.com:kermitt2|https://github.com/kermitt2|' .gitmodules
	git submodule init
	git submodule update
	
	# Do NOT inject local includes and static libraries!
	patch -Np1 -i "$srcdir/pdfalto-use-system-libs.patch"
	rm -rf "$srcdir/pdfalto/libs/"

	patch -Np1 -i "$srcdir/pdfalto-compilation-fixes.patch"
	
	cd ../..
}

build()
{
	rm -rf "$srcdir"/build
	mkdir "$srcdir"/build
	cd "$srcdir"/build
	export CC=gcc-12
	export CXX=g++-12
	cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr "$srcdir/$pkgname"
	make
	cd ../..
}

package()
{
	cd "$srcdir"/build

	# Install pdfalto binary
	install -Dm775 pdfalto "$pkgdir"/usr/bin/pdfalto

	# Additional files
	install -Dm644 "$srcdir"/pdfalto/LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}