summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 9920d72ebc49ecac20652825dfaba2f19ce9b7d8 (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
84
85
86
87
88
89
90
91
92
93
# Maintainer: xiretza <xiretza+aur@xiretza.xyz>

_pkgbase=prjxray
pkgbase="$_pkgbase-git"
pkgname=("$_pkgbase-tools-git" "python-$_pkgbase-git")
pkgver=r3579.5937733d
pkgrel=1
pkgdesc="Documenting the Xilinx 7-series bit-stream format"
arch=(x86_64)
url="https://github.com/SymbiFlow/prjxray"
license=('ISC')
depends=()
_pythondepends=('python' 'python-fasm' 'python-intervaltree' 'python-numpy'
                'python-yaml' 'python-simplejson')
makedepends=('git' 'cmake' 'python-setuptools')
makedepends+=("${_pythondepends[@]}")
optdepends=('prjxray-db: The pre-built database')
checkdepends=('python-pytest')
source=("git+$url"
        "git+https://github.com/arsenm/sanitizers-cmake"
        "git+https://github.com/google/googletest"
        "git+https://github.com/gflags/gflags"
        "git+https://github.com/google/cctz"
        "git+https://github.com/abseil/abseil-cpp"
        "git+https://github.com/jbeder/yaml-cpp")
sha256sums=('SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP')

pkgver() {
	cd "$_pkgbase"
	printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
	cd "$_pkgbase"

	# include fasm2frames in python package
	mv utils/fasm2frames.py prjxray/
	sed -E 's/(fasm2frames=)utils/\1prjxray/' -i setup.py

	local _mods=(sanitizers-cmake googletest gflags cctz abseil-cpp yaml-cpp)

	git submodule init
	for mod in "${_mods[@]}"; do
		git config "submodule.third_party/$mod.url" "$srcdir/$mod"
	done

	cd third_party
	git submodule update "${_mods[@]}"
}

build() {
	cmake -B build -S "$_pkgbase" \
		-DCMAKE_BUILD_TYPE='None' \
        -DCMAKE_INSTALL_PREFIX='/usr' \
        -Wno-dev
	make -C build

	cd "$_pkgbase"
	python setup.py build
}

check() {
	cd "$_pkgbase"

	env PYTHONPATH=. pytest tests/
}

package_prjxray-tools-git() {
	depends+=('gcc-libs')
	provides=("${pkgname%%-git}" "prjxray" "prjxray-git")
	conflicts=("${pkgname%%-git}" "prjxray")
	replaces=("prjxray-git")

	make -C build DESTDIR="$pkgdir/" install
	install -Dm644 "$_pkgbase/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

package_python-prjxray-git() {
	arch=(any)
	depends+=("${_pythondepends[@]}")
	provides=("${pkgname%%-git}")
	conflicts=("${pkgname%%-git}")

	cd "$_pkgbase"
	python setup.py install --root="$pkgdir/" --optimize=1 --skip-build
	install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}