Name:             gerbv
Version:          2.4.0
Release:          2%{?dist}
Summary:          Gerber file viewer from the gEDA toolkit

Group:            Applications/Engineering
License:          GPLv2
URL:              http://gerbv.gpleda.org/index.html

Source:           http://downloads.sourceforge.net/gerbv/%{name}-%{version}.tar.gz

BuildRoot:        %{_tmppath}/%{name}-%{version}-root
BuildRequires:    gtk2-devel
BuildRequires:    libpng-devel
BuildRequires:    desktop-file-utils
BuildRequires:    automake
BuildRequires:    ImageMagick-devel

Requires:         electronics-menu

%description
Gerber Viewer (gerbv) is a viewer for Gerber files. Gerber files
are generated from PCB CAD system and sent to PCB manufacturers
as basis for the manufacturing process. The standard supported
by gerbv is RS-274X.

gerbv also supports drill files. The format supported are known
under names as NC-drill or Excellon. The format is a bit undefined
and different EDA-vendors implement it different.

gerbv is listed among Fedora Electronic Lab (FEL) packages.

%package devel
Summary:          Header files, libraries and development documentation for %{name}
Group:            Development/Libraries
Requires:         %{name} = %{version}-%{release}
Requires:         gtk2-devel
Requires:         libpng-devel

%description devel
This package contains the header files, libraries and development
documentation for %{name}. If you like to develop programs using %{name},
you will need to install %{name}-devel.


%prep
%setup -q

%build

# default measurement units set to millimeters
%configure             \
   --enable-exportpng  \
   --enable-unit-mm    \
   --disable-update-desktop-database \
   --disable-static    \
   --enable-gtk2

# clean unused-direct-shlib-dependencies
sed -i -e 's! -shared ! -Wl,--as-needed\0!g' libtool

make %{?_smp_mflags}


%install
%{__rm} -rf %{buildroot}
make INSTALL="%{__install} -p" install DESTDIR=%{buildroot}


desktop-file-install --vendor ""               \
    --remove-category Education                \
    --dir %{buildroot}%{_datadir}/applications \
    --delete-original                          \
    %{buildroot}%{_datadir}/applications/%{name}.desktop


%{__rm} -f %{buildroot}%{_libdir}/libgerbv.la

%{__rm} -f  {doc,example}/Makefile*

pushd example/
for dir in * ; do
  [ -d $dir ] && %{__rm} -f $dir/Makefile*
done
popd


pushd doc/
for dir in * ; do
  [ -d $dir ] && %{__rm} -f $dir/Makefile*
done
popd


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


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

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



%files
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING NEWS README TODO CONTRIBUTORS HACKING
%doc example/
%doc doc/example-code
%doc doc/eagle
%doc doc/sources.txt
%doc doc/aperturemacro.txt
%doc doc/PNG-print
%{_bindir}/%{name}
%{_datadir}/%{name}/
%{_mandir}/man1/gerbv.*
%{_datadir}/icons/hicolor/??x??/apps/%{name}.png
%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
%{_datadir}/applications/%{name}.desktop
%{_libdir}/lib%{name}.so.*


%files devel
%defattr(-,root,root,-)
%dir %{_includedir}/%{name}-%{version}
%{_includedir}/%{name}-%{version}/%{name}.h
%{_libdir}/lib%{name}.so
%{_libdir}/pkgconfig/libgerbv.pc


%changelog
* Tue Sep 28 2010 Shu KONNO <owa@bg.wakwak.com> 2.4.0-2
- rebuilt with rpm-4.8.1 for pkg-config

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

* Sun Sep 13 2009 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 2.3.0-3
- Fixed gerbv-2.3.0-1 png failed to open - FEL ticket #47 
- Fixed bug 2841371 (segfault on edit->orientation with no layer loaded)

* Sat Jul 11 2009 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 2.3.0-1
- new upstream release

* Sat Mar 07 2009 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 2.2.0-3
- added requires electronics-menu #485585

* Thu Jan 22 2009 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 2.2.0-1
- new upstream release

* Thu Dec  4 2008 Michael Schwendt <mschwendt@fedoraproject.org> - 2.1.0-3
- Include unowned headers directory.

* Thu Nov 13 2008 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 2.1.0-2
- BR ImageMagick-devel added

* Thu Nov 13 2008 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 2.1.0-1
- New upstream release and split into -devel package

* Tue Feb 01 2008 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 2.0.0-1
- New upstream release

* Tue Dec 04 2007 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 1.0.3-1
- new upstream release

* Thu Aug 23 2007 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 1.0.2-3
- mass rebuild for fedora 8 - ppc

* Thu Jun 28 2007 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 1.0.2-2
- remove gdk-pixbuf-devel as BR

* Thu Sep 14 2006 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 1.0.2-1
- Initial package for Fedora Core
