void-packages/srcpkgs/ghdl/template

110 lines
2.7 KiB
Bash

# Template file for 'ghdl'
#
# We could also package the gcc backend, but that requires an entire gcc
# source tree being available and looks rather complicated, so for now
# only mcode (on x86) and llvm (everywhere) is done
#
pkgname=ghdl
reverts="20181129_1"
version=4.1.0
revision=2
build_style=configure
configure_args="--prefix=/usr --srcdir=.. --disable-werror"
makedepends="zlib-devel"
short_desc="VHDL 2008/93/87 simulator"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-2.0-or-later"
homepage="https://github.com/ghdl/ghdl"
changelog="https://raw.githubusercontent.com/ghdl/ghdl/master/NEWS.md"
distfiles="https://github.com/ghdl/ghdl/archive/v${version}.tar.gz"
checksum=0aab531b45a6613b0918f3ac6ec717b8acfad051d1abb1c39eb7490590c7a324
nocross=yes
# testsuite is big and long
make_check=extended
build_options="llvm mcode"
desc_option_llvm="Build the portable LLVM backend"
desc_option_mcode="Build the x86-only mcode backend"
case "$XBPS_TARGET_MACHINE" in
i686*|x86_64*)
build_options_default="mcode"
;;
*)
build_options_default="llvm"
if [ "$build_option_mcode" ]; then
broken="mcode backend only available on x86"
fi
esac
if [ "$build_option_llvm" ]; then
makedepends+=" llvm18-devel"
fi
do_configure() {
if [ "$build_option_mcode" ]; then
mkdir -p build_mcode
cd build_mcode
../configure ${configure_args}
cd ..
fi
if [ "$build_option_llvm" ]; then
mkdir -p build_llvm
cd build_llvm
../configure --with-llvm-config \
${configure_args}
cd ..
fi
}
do_build() {
if [ "$build_option_mcode" ]; then
make -C build_mcode ${makejobs}
fi
if [ "$build_option_llvm" ]; then
make -C build_llvm ${makejobs}
fi
}
do_install() {
# must be first; make install uses it
vbin ${FILESDIR}/ghdl
# install whatever backends we have
if [ "$build_option_mcode" ]; then
make -C build_mcode DESTDIR=${DESTDIR} install
fi
if [ "$build_option_llvm" ]; then
make -C build_llvm DESTDIR=${DESTDIR} install
fi
# manpage is not installed by default
vman doc/ghdl.1
}
do_check() {
# need a temporary installation for testsuite run so that ghdl is found
for variant in ${build_options_default}; do
cd ${wrksrc}/build_${variant}
mkdir -p tmp_inst/usr/bin
ln -sf ghdl-${variant} tmp_inst/usr/bin/ghdl
make DESTDIR=${wrksrc}/build_${variant}/tmp_inst install
cd ../testsuite
# run all tests but pyunit
GHDL="${wrksrc}/build_${variant}/tmp_inst/usr/bin/ghdl" \
./testsuite.sh sanity gna synth vpi vhpi
cd ${wrksrc}
done
}
ghdl-mcode_package() {
depends="${sourcepkg}>=${version}_${revision}"
short_desc+=" - transitional dummy package"
build_style=meta
}
ghdl-llvm_package() {
depends="${sourcepkg}>=${version}_${revision}"
short_desc+=" - transitional dummy package"
build_style=meta
}