File ghdl.spec of Package ghdl

#global commit0 ba3368ed3ff7235650169a5f3c98f391199b411c
%global shortcommit0 %(c=%{commit0}; echo ${c:0:7})
#global date0 20220228
%global sover 5_1_1
%global gcc_version 13


Name:           ghdl
Version:        5.1.1
Release:        0
Summary:        VHDL 2008/93/87 simulator
License:        GPL-2.0-or-later
URL:            https://github.com/ghdl/ghdl
Source0: https://github.com/ghdl/ghdl/archive/refs/tags/v5.1.1.tar.gz#/ghdl-5.1.1.tar.gz

BuildRequires:  gcc%{gcc_version}-ada
BuildRequires:  zlib-devel

%description
GHDL is an open-source analyzer, compiler, simulator and (experimental)
synthesizer for VHDL, a Hardware Description Language (HDL).
GHDL is not an interpreter: it allows you to analyse and elaborate sources to 
generate machine code from your design. Native program execution is the only
way for high speed simulation.

%package -n libghdl-%{sover}
Summary: GHDL runtime library

%description -n libghdl-%{sover}
This package contains the libraries required by GHDL programs.

%package -n libghdlvpi
Summary: GHDL VPI/VHPI implementation

%description -n libghdlvpi
This package contains the PLI/VPI and VHPI implementations.

%package ghwdump
Summary: GHDL waveform dumper/manipulation tool

%description ghwdump
This package contains the ghwdump tool for dumping waveforms and
corresponding library.

%package devel
Summary: GHDL development files
Requires: libghdl-%{sover}

%description devel
This package contains the development files for GHDL programs.

%prep
%autosetup -p1

%build
# Fixes Sorry, you need GNAT to build GHDL. error
export GNATMAKE=/usr/bin/gnatmake-%{gcc_version}
export GNAT=/usr/bin/gnat-%{gcc_version}
# Fixes for when %%_libdir is not "lib"
sed -e "s/^libdirsuffix=lib\/ghdl/libdirsuffix=%{_lib}\/ghdl/" -i configure
sed -e "s/\"lib\"/\"%{_lib}\"/" -i src/ghdldrv/ghdlsynth.adb
mkdir lib
# Using gnatbind -shared so that we always link with shared libgnat.so and avoid PIC/PIE problems
./configure --prefix=%{_prefix} --default-pic --disable-werror --enable-libghdl --enable-synth
%make_build GNAT_BARGS="-bargs -E -shared" libdir=%{_libdir}

%install
%make_install GNAT_BARGS="-bargs -E -shared" libdir=%{_libdir}
mkdir -p %buildroot%{_libexecdir}
mv %buildroot/usr/lib/ghdl %buildroot%{_libexecdir}/ghdl || :

%files
%license COPYING.md
%doc README.md
%{_bindir}/ghdl
%{_libexecdir}/ghdl

%files -n libghdl-%{sover}
%{_libdir}/libghdl-5*.so

%files -n libghdlvpi
%{_libdir}/libghdlvpi.so

%files ghwdump
%{_bindir}/ghwdump
%{_libdir}/libghw.so

%files devel
%{_includedir}/ghdl
%{_libdir}/libghdl.a
%{_libdir}/libghdl.link

%changelog

openSUSE Build Service is sponsored by