Blob Blame History Raw
%global commit0 f1b1b355a988b78c746296e097691531d5baf554
%global shortcommit0 %(c=%{commit0}; echo ${c:0:7})

%global commit1 d0b219af41ae3da6150645fbc5cc5613b530603f
%global shortcommit1 %(c=%{commit1}; echo ${c:0:7})

%global snapdate 20190326

%global __python %{__python3}

Name:          trellis
Version:       1.0
Release:       0.2.%{snapdate}git%{shortcommit0}%{?dist}
Summary:       Lattice ECP5 FPGA bitstream creation/analysis/programming tools
License:       ISC
URL: {name}

# Patches:
#Patch1:        some.patch

BuildRequires: cmake gcc-c++
BuildRequires: python3-devel
BuildRequires: boost-python3-devel
# for building docs:
BuildRequires: python-sphinx-latex
BuildRequires: python3-recommonmark
BuildRequires: latexmk
# for building manpages:
BuildRequires: help2man

Requires:      %{name}-data = %{version}-%{release}

Project Trellis enables a fully open-source flow for ECP5 FPGAs using
Yosys for Verilog synthesis and nextpnr for place and route. Project
Trellis provides the device database and tools for bitstream creation.

%package devel
Summary:       Development files for Project Trellis
Requires:      %{name}%{?_isa} = %{version}-%{release}
Requires:      %{name}-data = %{version}-%{release}

%description devel
Development files to build packages using Project Trellis

%package data
Summary:       Project Trellis - Lattice ECP5 Bitstream Database
BuildArch:     noarch

%description data
This package contains the bitstream documentation database for
Lattice ECP5 FPGA devices.

%setup -q -n prj%{name}-%{commit0} -a 1
rm -rf database
mv prj%{name}-db-%{commit1} database
#%%patch1 -p1
# add "-fPIC -g1" to CMAKE_CXX_FLAGS:
# (NOTE: "-g1" reduces debuginfo verbosity over "-g", which helps on armv7hl)
sed -i '/CMAKE_CXX_FLAGS/s/-O3/-O3 -fPIC -g1/' libtrellis/CMakeLists.txt
# prevent "lib64" false positive (e.g., on i386):
sed -i 's/"lib64"/${LIB_INSTALL_DIR}/' libtrellis/CMakeLists.txt
# fix shebang lines in Python scripts:
find . -name \*.py -exec sed -i 's|/usr/bin/env python3|/usr/bin/python3|' {} \;
# remove .gitignore files in examples:
find . -name \.gitignore -delete

%cmake libtrellis
%make_build -C docs latexpdf
# build manpages:
mkdir man1
for f in ecp*
  [ -x $f ] || continue
    help2man --no-discard-stderr --version-string %{version} -N \
             -o man1/$f.1 ./$f
  sed -i '/required but missing/d' man1/$f.1

%make_install PREFIX="%{_prefix}"
install -Dpm644 -t %{buildroot}%{_mandir}/man1 man1/*

# nothing to do for now.

%license COPYING
%doc docs/_build/latex/ProjectTrellis.pdf
%doc examples
%dir %{_libdir}/%{name}

%files devel
%doc libtrellis/examples

%files data
%dir %{_datadir}/%{name}

* Tue Mar 26 2019 Gabriel Somlo <> - 1.0-0.2.20190326gitf1b1b35
- Update to latest upstream snapshot.
* Wed Mar 20 2019 Gabriel Somlo <> - 1.0-0.1.20190320git26d6667
- Initial version.