%{?!_icondir:%define _icondir   %{_datadir}/icons}

Name:       electronics-menu
Version:    1.0
Release:    9%{?_dist_release}
Summary:    Electronics Menu for the Desktop

License:    GPLv2
Group:      User Interface/Desktops

URL:        http://geda.seul.org/
Source0:    http://geda.seul.org/dist/%{name}-%{version}.tar.gz
# Created by Chitlesh
Source1:    electronics-menu-1.0-submenu.tar.bz2

Patch0:     electronics-menu-1.0-submenus.patch
Patch1:     electronics-menu-1.0-makefile.patch
Patch2:     electronics-menu-1.0-typo.patch
Patch4:     electronics-menu-1.0-submenus-qucs.patch

BuildRoot:  %{_tmppath}/%{name}-%{version}-root
BuildArch: noarch

Requires(pre): gtk2


%description
The programs from the category Electronics are normally located
in the Edutainment directory.
This Package adds a Electronics menu to the xdg menu structure.

%{name} is listed among Fedora Electronic Lab (FEL) packages.

%prep
%setup -q -a 1

%patch0 -p0 -b .submenus
%patch1 -p0 -b .submenus

# allowing timestamps
sed -i 's|install|install -p|g' Makefile

# Fedora Specific Vendor
sed -i 's|<Filename>|<Filename>fedora-|' electronics.menu


%build


%install
%{__rm} -rf %{buildroot}
%{__make} install DESTDIR=%{buildroot}


%clean
%{__rm} -rf %{buildroot}


%post
touch --no-create %{_datadir}/icons/hicolor || :
%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :


%postun
if [ $1 -eq 0 ] ; then
    touch --no-create %{_datadir}/icons/hicolor &>/dev/null
    gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
fi


%posttrans
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :



%files
%defattr(-,root,root,-)
%doc COPYING README
%{_icondir}/hicolor/??x??/categories/applications-electronics*.png
%{_icondir}/hicolor/scalable/categories/applications-electronics*.svg
%config(noreplace) %{_sysconfdir}/xdg/menus/applications-merged/electronics.menu
%{_datadir}/desktop-directories/*.directory



%changelog
* Thu Oct 30 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> - 1.0-9
- added Patch2 and 4 from fc
  * Mon Apr  8 2013 Alain Portal <alain.portal[AT]univ-montp2[DOT]fr> - 1.0-12
  - Fix a typo in menu french translation
  - Frenchify submenus
  - Add eeschema & pcbnew (kicad), pikdev and qucs menu entries

* Sun Jun 20 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 1.0-8
- Initial build for Vine Linux

* Tue Sep 29 2009 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 1.0-7
- Improved submenus structure for F-12

* Sat Aug 28 2009 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 1.0-6
- Improved submenus structure for F-12

* Wed Jul 08 2009 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 1.0-4
- patched for submenus
- added extra icons and directory desktop files to support the submenus feature

* Tue Feb 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Sun Jul 06 2008 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 1.0-2
- Corrected yum install with requires(pre)

* Fri Feb 01 2008 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 1.0-1
- Initial package for Fedora
