void-packages/srcpkgs/ghdl/template

117 lines
2.9 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=2.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="m3tav3rse <mtvrs@tuta.io>"
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=5f258369e0faf730298916dfdc134c54c25a7a8a7f19722b7ce2717db19af6ec
nocross=yes
make_check=extended
build_options="llvm mcode"
#build_options_default=" "
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() {
# the testsuite is broken
# after a while it fails with this:
# ghdl: unknown command '--synth', try --help
# this indicates a bug in the testsuite
: && return 0
# need a temporary installation for testsuite run so that ghdl1 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
GHDL="${wrksrc}/build_${variant}/tmp_inst/usr/bin/ghdl" \
./testsuite.sh
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
}