%global pkgvers 0
%global scdate0 20221116
%global schash0 a57d03b39886c1e2f113c1a893f5b3fad9199a52
%global branch0 master
%global source0 https://github.com/OpenTimer/OpenTimer.git

%global sshort0 %{expand:%%{lua:print(('%{schash0}'):sub(1,8))}}

Name:           opentimer
Version:        2.1.0
Release:        %{scdate0}.%{pkgvers}.git%{sshort0}%{?dist}
Summary:        High-Performance Timing Analysis Tool for VLSI Systems
License:        GPLv3

URL:            https://github.com/OpenTimer/OpenTimer

BuildRequires:  gcc-c++ cmake git tcl python3

%global __cmake_in_source_build 1

%description
OpenTimer is a new static timing analysis (STA) tool
to help IC designers quickly verify the circuit timing.


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

%description devel
OpenTimer is a new static timing analysis (STA) tool
to help IC designers quickly verify the circuit timing.


%prep
%setup -T -c -n %{name}
git clone --depth 1 -n -b %{branch0} %{source0} .
git fetch --depth 1 origin %{schash0}
git reset --hard %{schash0}
git log --format=fuller


%build
sed -i '/enable_testing/,/it.shell.vga_lcd/d' CMakeLists.txt
mkdir build
pushd build
%cmake .. \
       -DCMAKE_SKIP_RPATH=ON \
       -DCMAKE_VERBOSE_MAKEFILE=OFF \
       -DCMAKE_BUILD_TYPE=RelWithDebInfo
%cmake_build
popd


%install
pushd build
%cmake_install
popd
# fix path
mv -f %{buildroot}/usr/lib %{buildroot}/%{_libdir}


%files
%license LICENSE
%license licenses
%doc README.md
%doc doc wiki example
%{_bindir}/*
%{_libdir}/*.so

%files devel
%{_datadir}/*
%{_includedir}/*


%changelog
* Thu Dec 23 2021 Cristian Balint <cristian.balint@gmail.com>
- github upstream releases