b0f30e6
#%global commit0 8f5bf6de32bcc478312d8f5410826b4894ebadba
b0f30e6
b0f30e6
#%global shortcommit0 %(c=%{commit0}; echo ${c:0:7})
b0f30e6
b0f30e6
%global __python %{__python3}
b0f30e6
b0f30e6
Name:           yosys
b0f30e6
Version:        0.7
cd9cb8c
Release:        10%{?dist}
b0f30e6
# For git snapshot: 2.20160923git%{shortcommit0}%{?dist}
b0f30e6
Summary:        Yosys Open SYnthesis Suite, including Verilog synthesizer
b0f30e6
License:        ISC and MIT
b0f30e6
URL:            http://www.clifford.at/yosys/
b0f30e6
b0f30e6
Source0:        https://github.com/cliffordwolf/yosys/archive/yosys-0.7.tar.gz
b0f30e6
# For git snapshot: https://github.com/cliffordwolf/%{name}/archive/%{commit0}.tar.gz
b0f30e6
Source1:        https://github.com/mdaines/viz.js/releases/download/0.0.3/viz.js
b0f30e6
b0f30e6
# man pages written for Debian:
b0f30e6
Source2:        http://http.debian.net/debian/pool/main/y/yosys/yosys_0.7-2.debian.tar.xz
b0f30e6
# requested that upstream include those man pages:
b0f30e6
#   https://github.com/cliffordwolf/yosys/issues/278
b0f30e6
b0f30e6
# Fedora-specific patch:
b0f30e6
# Change the substitution done when making yosys-config so that it outputs
b0f30e6
# CXXFLAGS with -I/usr/include/yosys
b0f30e6
Patch1:         yosys-cfginc.patch
b0f30e6
b0f30e6
# Fedora-specific patch:
b0f30e6
# When invoking yosys-config for examples in "make manual", need to use
b0f30e6
# relative path for includes, as they're not installed in build host
b0f30e6
# filesystem.
b0f30e6
Patch2:         yosys-mancfginc.patch
b0f30e6
b0f30e6
b0f30e6
BuildRequires:  bison flex readline-devel pkgconfig
b0f30e6
BuildRequires:  tcl-devel libffi-devel
b0f30e6
BuildRequires:  abc >= 1.01-9
b0f30e6
BuildRequires:  iverilog
b0f30e6
BuildRequires:  python%{python3_pkgversion}
b0f30e6
BuildRequires:  txt2man
b0f30e6
b0f30e6
# required for documentation:
b0f30e6
BuildRequires:  graphviz
b0f30e6
BuildRequires:  texlive-beamer
b0f30e6
BuildRequires:  texlive-collection-bibtexextra
b0f30e6
BuildRequires:  texlive-collection-fontsextra
b0f30e6
BuildRequires:  texlive-collection-latexextra
b0f30e6
BuildRequires:  texlive-collection-publishers
b0f30e6
BuildRequires:  texlive-collection-science
b0f30e6
b0f30e6
Requires:       %{name}-share = %{version}-%{release}
b0f30e6
Requires:       graphviz python-xdot
b0f30e6
Requires:       abc >= 1.01-9
b0f30e6
b0f30e6
b0f30e6
%description
b0f30e6
Yosys is a framework for Verilog RTL synthesis. It currently has
b0f30e6
extensive Verilog-2005 support and provides a basic set of synthesis
b0f30e6
algorithms for various application domains.
b0f30e6
b0f30e6
b0f30e6
%package doc
b0f30e6
Summary:        Documentation for Yosys synthesizer
b0f30e6
b0f30e6
%description doc
b0f30e6
Documentation for Yosys synthesizer.
b0f30e6
b0f30e6
b0f30e6
%package share
b0f30e6
Summary:        Architecture-independent Yosys files
b0f30e6
BuildArch:      noarch
b0f30e6
b0f30e6
%description share
b0f30e6
Architecture-independent Yosys files.
b0f30e6
b0f30e6
b0f30e6
%package devel
b0f30e6
Summary:        Development files to build Yosys synthesizer plugins
b0f30e6
Requires:       %{name}%{?_isa} = %{version}-%{release}
b0f30e6
b0f30e6
%description devel
b0f30e6
Development files to build Yosys synthesizer plugins.
b0f30e6
b0f30e6
b0f30e6
%prep
b0f30e6
%setup -q -n %{name}-%{name}-%{version}
b0f30e6
# For git snapshot: %setup -q -n %{name}-%{commit0}
b0f30e6
b0f30e6
%patch1 -p1 -b .cfginc
b0f30e6
%patch2 -p1 -b .mancfginc
b0f30e6
b0f30e6
# Ensure that Makefile doesn't wget viz.js
b0f30e6
cp %{SOURCE1} .
b0f30e6
b0f30e6
# Get man pages from Debian
b0f30e6
%setup -q -T -D -a 2 -n %{name}-%{name}-%{version}
b0f30e6
# For git snapshot: %setup -q -T -D -a 2 -n %{name}-%{commit0}
b0f30e6
b0f30e6
# Remove shebang from Python files that aren't executable,
b0f30e6
# without changing timestamps
b0f30e6
# requested that upstream remove shebang:
b0f30e6
#   https://github.com/cliffordwolf/yosys/issues/279
b0f30e6
for f in backends/smt2/smtio.py
b0f30e6
do
b0f30e6
    sed '/#!\/usr\/bin\/env python3/d' $f >$f.new
b0f30e6
    touch -r $f $f.new
b0f30e6
    mv $f.new $f
b0f30e6
done
b0f30e6
b0f30e6
# In all other Python shebang lines, remove use of /usr/bin/env,
b0f30e6
# without changing timestamps
b0f30e6
for f in `find . -name \*.py`
b0f30e6
do
b0f30e6
    sed 's|/usr/bin/env python3|/usr/bin/python3|' $f >$f.new
b0f30e6
    touch -r $f $f.new
b0f30e6
    mv $f.new $f
b0f30e6
done
b0f30e6
b0f30e6
make config-gcc
b0f30e6
b0f30e6
# Change manual source files to use libertine font rather than non-free
b0f30e6
# luximono
b0f30e6
for f in `find manual -name \*.tex -exec grep -l {luximono} {} \;`
b0f30e6
do
b0f30e6
    sed -i 's|{luximono}|{libertine}|' $f
b0f30e6
done
b0f30e6
b0f30e6
b0f30e6
%build
b0f30e6
make %{?_smp_mflags} CFLAGS="%{optflags}" PREFIX="%{_prefix}" ABCEXTERNAL=%{_bindir}/abc all manual
b0f30e6
b0f30e6
%global man_date "`stat -c %y debian/man/yosys-smtbmc.txt | awk '{ print $1 }'`"
b0f30e6
txt2man -d %{man_date} -t YOSYS-SMTBMC debian/man/yosys-smtbmc.txt >yosys-smtbmc.1
b0f30e6
b0f30e6
b0f30e6
%install
b0f30e6
%make_install PREFIX="%{_prefix}" ABCEXTERNAL=%{_bindir}/abc
b0f30e6
b0f30e6
# move include files to includedir
b0f30e6
install -d -m0755 %{buildroot}%{_includedir}
b0f30e6
mv %{buildroot}%{_datarootdir}/%{name}/include %{buildroot}%{_includedir}/%{name}
b0f30e6
b0f30e6
# install man mages
b0f30e6
install -d -m0755 %{buildroot}%{_mandir}/man1
b0f30e6
install -m 0644 yosys-smtbmc.1 debian/yosys{,-config,-filterlib}.1 %{buildroot}%{_mandir}/man1
b0f30e6
b0f30e6
# install documentation
b0f30e6
install -d -m0755 %{buildroot}%{_docdir}/%{name}
b0f30e6
install -m 0644 manual/*.pdf %{buildroot}%{_docdir}/%{name}
b0f30e6
b0f30e6
%check
b0f30e6
make test ABCEXTERNAL=%{_bindir}/abc SEED=314159265359
b0f30e6
b0f30e6
b0f30e6
%files
b0f30e6
# license texts requested upstream:
b0f30e6
#   https://github.com/cliffordwolf/yosys/issues/263
b0f30e6
%doc README
b0f30e6
%{_bindir}/%{name}
b0f30e6
%{_bindir}/%{name}-filterlib
b0f30e6
%{_bindir}/%{name}-smtbmc
b0f30e6
%{_mandir}/man1/%{name}.1*
b0f30e6
%{_mandir}/man1/%{name}-filterlib.1*
b0f30e6
%{_mandir}/man1/%{name}-smtbmc.1*
b0f30e6
b0f30e6
%files share
b0f30e6
%{_datarootdir}/%{name}
b0f30e6
b0f30e6
%files doc
b0f30e6
%{_docdir}/%{name}
b0f30e6
b0f30e6
%files devel
b0f30e6
%{_bindir}/%{name}-config
b0f30e6
%{_includedir}/%{name}
b0f30e6
%{_mandir}/man1/%{name}-config.1*
b0f30e6
b0f30e6
b0f30e6
%changelog
cd9cb8c
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.7-10
cd9cb8c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
cd9cb8c
805e03d
* Tue Apr 10 2018 Filipe Rosset <rosset.filipe@gmail.com> - 0.7-9
805e03d
- rebuilt due new iverilog
805e03d
a171d98
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.7-8
a171d98
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
a171d98
c354c02
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.7-7
c354c02
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
c354c02
cfa38cb
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.7-6
cfa38cb
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
cfa38cb
cd66dc1
* Mon May 15 2017 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.7-5
cd66dc1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_27_Mass_Rebuild
cd66dc1
dba0a74
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.7-4
dba0a74
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
dba0a74
Igor Gnatenko 10175fc
* Thu Jan 12 2017 Igor Gnatenko <ignatenko@redhat.com> - 0.7-3
Igor Gnatenko 10175fc
- Rebuild for readline 7.x
Igor Gnatenko 10175fc
e782709
* Mon Dec 19 2016 Miro HronĨok <mhroncok@redhat.com> - 0.7-2
e782709
- Rebuild for Python 3.6
e782709
b0f30e6
* Sat Nov 26 2016 Eric Smith <brouhaha@fedoraproject.org> 0.7-1
b0f30e6
- Updated to latest upstream release.
b0f30e6
- Additional changes per package review.
b0f30e6
b0f30e6
* Fri Nov 04 2016 Eric Smith <brouhaha@fedoraproject.org> 0.6.0-2.20160923git8f5bf6d
b0f30e6
- Updated per Randy Barlow's package review comments of 2016-10-20.
b0f30e6
b0f30e6
* Sat Sep 24 2016 Eric Smith <brouhaha@fedoraproject.org> 0.6.0-1.20160923git8f5bf6d
b0f30e6
- Initial version (#1375765).