File yosys.spec of Package yosys

#
# spec file for package yosys
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%bcond_without tests

Name:           yosys
Version:        0.38
Release:        0
Summary:        Yosys open synthesis suite
License:        ISC
URL:            https://yosyshq.net/yosys/
Source0:        https://github.com/YosysHQ/yosys/archive/refs/tags/yosys-%{version}.tar.gz
# PATCH-FIX-UPSTREAM
Patch0:         https://patch-diff.githubusercontent.com/raw/YosysHQ/yosys/pull/4199.patch#/fix_clk2fflogic_test.patch
BuildRequires:  bison
BuildRequires:  flex
BuildRequires:  gcc-c++
BuildRequires:  python3-base
BuildRequires:  readline-devel
BuildRequires:  tcl-devel
BuildRequires:  zlib-devel
BuildRequires:  pkgconfig(libffi)
%if %{with_tests}
BuildRequires:  yosys-abc = 0.38
BuildRequires:  iverilog
%endif
Requires:       yosys-abc = 0.38
Requires:       %{name}-data = %{version}
# Disable 32bit archs, tests fail
ExcludeArch:    %{ix86} %{arm}

%description
A framework for RTL synthesis tools. It currently has extensive
Verilog-2005 support and provides a basic set of synthesis
algorithms for various application domains.

%package data
Summary:       Data files for Yosys
BuildArch:     noarch

%description data
Architecture independent data files for Yosys

%package devel
Summary:       Development files
Requires:      %{name} = %{version}

%description devel
Development headers and helpers for Yosys.

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

%build
%make_build CONFIG=gcc ABCEXTERNAL=%{_bindir}/yosys-abc \
  STRIP=%{_bindir}/true \
  PREFIX=%{_prefix} \
  BINDIR=%{_bindir} \
  LIBDIR=%{_libdir}

%install
%make_install CONFIG=gcc ABCEXTERNAL=%{_bindir}/yosys-abc \
  STRIP=%{_bindir}/true \
  PREFIX=%{_prefix} \
  BINDIR=%{_bindir} \
  LIBDIR=%{_libdir}

# Fix shebang
sed -i -e '1 s/env python3/python3/' %{buildroot}%{_bindir}/yosys-smtbmc

%check
# Note: In case the TS fails, try running with EXTRA_FLAGS="-v"
make CONFIG=gcc ABCEXTERNAL=%{_bindir}/yosys-abc EXTRA_FLAGS="" SEED=314159265359 test


%files
%license COPYING
%doc CHANGELOG README.md
%{_bindir}/yosys
%{_bindir}/yosys-filterlib
%{_bindir}/yosys-smtbmc
%{_bindir}/yosys-witness

%files data
%{_datadir}/yosys
%exclude %{_datadir}/yosys/include

%files devel
%{_bindir}/yosys-config
%{_datadir}/yosys/include

%changelog
openSUSE Build Service is sponsored by