File ghdl_llvm.spec of Package ghdl-llvm

%global shortcommit0 %(c=%{commit0}; echo ${c:0:7})
%global sover 5_1_1

Name:           ghdl_llvm
Version:        5.1.1
Release:        0
Summary:        VHDL 2008/93/87 simulator (LLVM)
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
# Enable build with pie
Patch0001:      0001-pie.patch

BuildRequires:  gcc-ada
BuildRequires:  zlib-devel
BuildRequires:  clang
BuildRequires:  (llvm20-devel or llvm19-devel)

%description
GHDL is an open-source simulator for the VHDL language.
GHDL LLVM allows you to compile and execute your VHDL code directly in your PC.

%package -n libghdl_llvm-%{sover}
Summary: GHDL runtime library (LLVM)

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

%package -n libghdlvpi_llvm
Summary: GHDL VPI/VHPI implementation (LLVM)

%description -n libghdlvpi_llvm
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 (LLVM)
Requires: libghdl_llvm-%{sover}

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

%prep
%autosetup -p1 -n ghdl-%{version}

%build
# 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} --with-llvm-config --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}

%files
%license COPYING.md
%doc README.md
%{_bindir}/ghdl
%{_bindir}/ghdl1-llvm
/usr/lib/ghdl


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

%files -n libghdlvpi_llvm
%{_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