void-packages/srcpkgs/ghdl/template

112 lines
2.8 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=3.0.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=c1ed4d2095df80131260a48c55bb53409ce8d4c38bba42618ca040115faf08b9
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+=" llvm12"
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
rm -rf ${DESTDIR}/usr/lib/ghdl/src
fi
if [ "$build_option_llvm" ]; then
make -C build_llvm DESTDIR=${DESTDIR} install
rm -rf ${DESTDIR}/usr/lib/ghdl/src
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
}