summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 64d517a582bfeaf023e1e15f6df9324f59af070a (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Maintainer: Tomas Pecka <peckato1 at fit dot cvut dot cz>

pkgname=('algorithms-library-git' 'algorithms-library-gui-git')
pkgbase='algorithms-library-git'
_pkgbase='automata-library'

pkgver=0.0.0.r515.gc4bc905a4
pkgrel=1

pkgdesc='Theoretical computer science datastructures and algorithms implementation. The library provides graphical and console interface similar to bash with many classical algorithms manipulating automata, grammars, regular expressions, trees and strings.'
arch=('x86_64' 'armv7' 'i686')
url='https://gitlab.fit.cvut.cz/algorithms-library-toolkit/'
license=('GPL')

makedepends=('python3' 'cmake' 'gcc>=7.3.1' 'make' 'tclap' 'libxml2' 'qt5-base>=5.7' 'graphviz' 'jsoncpp' 'git')
checkdepends=()

source=("$_pkgbase::git+https://gitlab.fit.cvut.cz/algorithms-library-toolkit/automata-library.git")
sha256sums=('SKIP')
validpgpkeys=()

pkgver() {
	cd "$_pkgbase"
	git describe --long --tags --match="v*" |  sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
	cd "$_pkgbase"

	#patch -p1 -i "$srcdir/$pkgname-$pkgver.patch"

	mkdir -p build
}

build() {
	cd "$_pkgbase/build"
	python ../CMake/generate.py -wm
	cmake .. \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr
	make
}

check() {
	cd "$_pkgbase/build"
	make test ARGS="--output-on-failure"
}

package_algorithms-library-git() {
	depends=('tclap' 'libxml2' 'readline')
	optdepends=('graphviz: Visualize data structures')
	provides=('algorithms-library')
	conflicts=('algorithms-library')

	cd "$_pkgbase/build"
	make DESTDIR="$pkgdir" install

	# remove gui parts
	mkdir -p gui/usr/lib gui/usr/bin gui/usr/include/algorithms-library

	# move binaries
	mv -f $pkgdir/usr/bin/agui2 gui/usr/bin

	# move libraries
	mv -f $pkgdir/usr/lib/libalib2gui* gui/usr/lib

	# move includes
	pushd ../alib2gui/src
	for file in $(find . -name "*.h" -o -name "*.hpp"); do
		mkdir -p $(dirname "../../build/gui/usr/include/algorithms-library/$file")
		mv $pkgdir/usr/include/algorithms-library/$file ../../build/gui/usr/include/algorithms-library/$file
	done
	popd
}

package_algorithms-library-gui-git() {
	depends=('libxml2' 'qt5-base>=5.7' 'graphviz' 'jsoncpp' "algorithms-library-git>=$pkgver" "algorithms-library-git<=$pkgver")
	provides=('algorithms-library-gui')
	conflicts=('algorithms-library-gui')

	cd "$_pkgbase/build"
	mv gui/* $pkgdir
}