File icestorm.spec of Package icestorm

#
# spec file for package icestorm
#
# 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/
#

%global commit 738af82
%global commit_long 738af822905fdcf0466e9dd784b9ae4b0b34987f

%global snapdate 20240914

%global __python %{__python3}

Name:           icestorm
Version:        0~git%{snapdate}
Release:        0
Summary:        Lattice iCE40 FPGA bitstream creation/analysis/programming tools
License:        ISC
URL:            https://github.com/YosysHQ/prjtrellis-db
Source0:        https://github.com/YosysHQ/icestorm/archive/%{commit}.tar.gz#/icestorm-%{commit}.tar.gz

BuildRequires:  gcc-c++
BuildRequires:  python3
BuildRequires:  pkgconfig(libftdi1)

%description
Project IceStorm aims at documenting the bitstream format of Lattice iCE40
FPGAs and providing simple tools for analyzing and creating bitstream files.

%prep
%setup -q -n icestorm-%{commit_long}

# fix shebang lines in Python scripts
find . -name \*.py -exec sed -i 's|/usr/bin/env python3|/usr/bin/python3|' {} \;
# get rid of .gitignore files in examples
find . -name \.gitignore -delete

%build
%global moreflags -I/usr/include/libftdi1
make %{?_smp_mflags} \
     CFLAGS="%{optflags} %{moreflags}" \
     CXXFLAGS="%{optflags} %{moreflags}" \
     PREFIX="%{_prefix}" \
     CHIPDB_SUBDIR="%{name}" \
     LDFLAGS="$RPM_LD_FLAGS"

%install
%make_install PREFIX="%{_prefix}"
chmod +x %{buildroot}%{_bindir}/icebox.py
mv %{buildroot}%{_datarootdir}/icebox %{buildroot}%{_datarootdir}/%{name}
mv %{buildroot}%{_bindir}/iceboxdb.py %{buildroot}%{_datarootdir}/%{name}
install -pm644 icefuzz/timings_*.txt %{buildroot}%{_datarootdir}/%{name}

%files
%license README
%doc examples
%{_bindir}/*
%{_datarootdir}/%{name}

%changelog

openSUSE Build Service is sponsored by