File tkgate.spec of Package tkgate

#
# spec file for package tkgate
#
# Copyright (c) 2012 Lars Vogdt
#
# 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 http://bugs.opensuse.org/
#

%if  ! %{defined _defaultlicensedir}
%define _defaultlicensedir %{_datadir}/licenses
%endif

Name:           tkgate
Version:        2.1
Release:        1
License:        GPL-2.0+
Summary:        Event driven digital circuit simulator with a tcl/tk interface
Url:            http://www.tkgate.org/
Group:          Productivity/Scientific/Electronics
Source:         %{name}-%{version}.tar.bz2
Source2:        tkgate.desktop
Source3:        tkgate.png
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  libtool
BuildRequires:  pkgconfig(pangoxft)
BuildRequires:  bison
BuildRequires:  fdupes
BuildRequires:  flex
BuildRequires:  gcc-c++
BuildRequires:  tcl-devel
BuildRequires:  tk-devel
BuildRequires:  update-desktop-files
BuildRequires:  xorg-x11-devel
%if 0%{?suse_version} > 1210 || 0%{?fedora}
BuildRequires:  imake
BuildRequires:  libX11-devel
BuildRequires:  pkgconfig(xext)
BuildRequires:  pkgconfig(xmu)
BuildRequires:  pkgconfig(xt)
%else
BuildRequires:  xorg-x11-libX11-devel
BuildRequires:  xorg-x11-libXext-devel
BuildRequires:  xorg-x11-libXmu-devel
BuildRequires:  xorg-x11-libXt-devel
%endif
BuildRequires:  desktop-file-utils 
Requires:       tcl >= 8
Requires:       tk >= 8
Vendor:         openSUSE-Education
%if 0%{?suse_version} <= 1230
%define         tkversion 8.5
%define         tklibversion 8.5
%define         tclversion 8.5
%define         tcllibversion 8.5
%else
%define         tkversion 8.6
%define         tklibversion 8.6
%define         tclversion 8.6
%define         tcllibversion 8.6
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
TkGate is a event driven digital circuit simulator with a tcl/tk-based
graphical editor. TkGate supports a wide range of primitive circuit
elements as well as user-defined modules for hierarchical design.
The distribution comes with a number of tutorial and example circuits
which can be loaded through the "Help" menu. The example circuits include
a simple CPU, programmed to run the Animals game.

TkGate Features:
- Easy to use point-and-click user interface.
- Customizable color configuration.
- Intelligent placement and movement of wires.
- Multi-bit buses.
- Hierarchical design through user defined modules.
- Six valued logic including 0, 1, floating, unknown, "low" and "high".
- Wide range of circuit elements including:
-      Basic gates (AND, OR, etc.)
-      Switch-level NMOS and PMOS transistors
-      Tristate buffers
-      Alu components (Adders, shifters, multipliers)
-      Memory elements (Registers, RAMs, ROMs)
-      A "tty" element which allows the creation of interactive circuits.
- Graphical display of simulation results.
- Breakpoints, single-step and clock-step simulator control.
- Includes a generic microcode/macrocode compiler for creating memory
  initialization files.
- Simulations can be controlled through the GUI or through script files.
- Verilog-like save file format.
- Hyperlinks to move about in circuit or load other files.
- Can be configured to use Japanese interface (see README file).
- Supports static critical path analysis.

%prep
%setup -q
find . -name "*.v.orig" -exec rm {} \;
find . -type f -name "*.xml" -exec chmod -x {} \;

#Fix file-contains-date-and-time
datetime=$(date --date "`stat --format %y config.h`" +"%b %d %H:%M %Y")
sed -i 's/.__DATE__,__TIME__/ \"'"$datetime"'\\n\"/g' src/tkgate/tkgate.c

%build
export TCL_LIBRARY="%{_libdir}"
export TK_LIBRARY="%{_libdir}"
autoreconf -fi
%configure
%if 0%{?suse_version} >= 1310
echo '#define USE_INTERP_RESULT 1' >> config.h
%endif
%{__make} %{?_smp_mflags}

%install
mkdir -p %{buildroot}%{_libdir}/
make DESTDIR=$RPM_BUILD_ROOT install 
# fix docu directories
mkdir -p %{buildroot}%{_defaultdocdir}/%{name}
cp -r README doc %{buildroot}%{_defaultdocdir}/%{name}
install -D -m644 COPYING %{buildroot}%{_defaultlicensedir}/%{name}/COPYING
ln -s %{_datadir}/tkgate/doc %{buildroot}%{_defaultdocdir}/%{name}/doc
# fix script permissions
chmod +x %{buildroot}%{_datadir}/tkgate/scripts/tree.tcl
# install desktop file
install -Dm644 %{S:3} %{buildroot}%{_datadir}/pixmaps/%name.png
%if 0%{?suse_version}
%suse_update_desktop_file -i -n %name Education X-KDE-Edu-Teaching
# reduce space, create symlinks
%fdupes -s %{buildroot}
%else
desktop-file-install %{S:2}
%endif

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%dir %{_defaultlicensedir}/%{name}
%dir %{_datadir}/doc/%{name}
%doc %{_defaultdocdir}/%{name}
%license %{_defaultlicensedir}/%{name}/COPYING
%{_datadir}/doc/%{name}/*
%{_datadir}/tkgate
%{_datadir}/applications/tkgate.desktop
%{_datadir}/pixmaps/tkgate.*
%{_bindir}/tkgate
%{_bindir}/gmac
%{_bindir}/verga
%{_mandir}/man1/*

%changelog
openSUSE Build Service is sponsored by