summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 3574d30f9b4058d53302fed3be7a19f040248342 (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
# Maintainer: Adrien Prost-Boucle <adrien.prost-boucle@laposte.net>
# Maintainer: xiretza <xiretza+aur@xiretza.xyz>

pkgname=ghdl-llvm-git
pkgver=4.0.0dev.r8602.g97df73f72
pkgrel=1
arch=('x86_64' 'i686' 'pentium4' 'arm' 'armv6h' 'armv7h' 'aarch64')
pkgdesc='VHDL simulator - LLVM back-end'
url='https://github.com/ghdl/ghdl'
license=('GPL2')

provides=("ghdl=$pkgver" "ghdl-git=$pkgver")
conflicts=('ghdl' 'ghdl-gcc-git' 'ghdl-mcode-git')
makedepends=('git' 'llvm' 'clang')
depends=('gcc-ada')
checkdepends=(
	'python-pytest' 'python-pyvhdlmodel>=0.12'
	'python-pytooling' 'python-pyattributes'
)
optdepends=(
	'python-pyghdl: python bindings and utilities'
)

source=(
	"ghdl::git+https://github.com/ghdl/ghdl.git"
)
sha256sums=('SKIP')

pkgver() {
	cd "${srcdir}/ghdl"

	# GHDL version (extracted from configure)
	local _distver=`sed -n -e 's/^ghdl_version=.*"\(.*\)".*/\1/p' configure | tr -d '-'`

	# Date of the last git commit
	#local _gitver=`git log -n 1 --date=short | sed -n -e 's/.*Date:\s*\([0-9-]*\).*/\1/p' | tr -d -`
	# Revision number
	local _gitrev=`git rev-list --count HEAD`
	# Short hash of latest commit
	local _githash=`git rev-parse --short HEAD`

	#echo $_distver.git$_gitver;
	echo $_distver.r$_gitrev.g$_githash;
}

build() {
	cd "${srcdir}/ghdl"

	# 2021-05-16 Comment by xiretza : LLVM can't handle -fvar-tracking-assignments from DEBUG_C(XX)FLAGS
	CFLAGS=${CFLAGS/-fvar-tracking-assignments}
	CXXFLAGS=${CXXFLAGS/-fvar-tracking-assignments}

	export ADA_FLAGS="$CFLAGS -fno-strict-aliasing"
	ADA_FLAGS="${ADA_FLAGS//-Wformat}"
	ADA_FLAGS="${ADA_FLAGS//-Werror=format-security}"

	./configure \
		--prefix=/usr/ \
		--with-llvm-config \
		--enable-libghdl \
		--enable-synth

	make
}

check() {
	cd "${srcdir}/ghdl"

	make install.vpi.local

	make test
}

package() {
	cd "${srcdir}/ghdl"

	make DESTDIR="${pkgdir}" install

	# In case it does not exist, create symlink libghdl.so
	local _gso=`ls "${pkgdir}/usr/lib/" | grep -e '^libghdl-.*\.so$' | head -n 1`
	if [[ -n "$_gso" ]] ; then
		ln -s "$_gso" "${pkgdir}/usr/lib/libghdl.so"
	fi

	# GTKWave has always installed binary ghwdump, now ghdl does it too
	# While awaiting for the two projects to agree, don't install ghwdump from here
	rm -f "${pkgdir}/usr/bin/ghwdump"
}