%define         snap   20100214

Name:           geda-gaf
Version:        1.6.1
Release:        2%{?_dist_release}
Summary:        Design Automation toolkit for electronic design

Group:          Applications/Engineering
License:        GPLv2
URL:            http://www.geda.seul.org
Source0:        http://geda.seul.org/devel/v1.6/%{version}/%{name}-%{version}.tar.gz

BuildRoot:      %{_tmppath}/%{name}-%{version}-root
BuildRequires:  desktop-file-utils
BuildRequires:  gettext-devel
BuildRequires:  gawk
BuildRequires:  intltool
BuildRequires:  gd-devel
BuildRequires:  libtool-ltdl-devel
BuildRequires:  shared-mime-info
BuildRequires:  gtk2-devel
BuildRequires:  guile-devel
BuildRequires:  transfig
BuildRequires:  libstroke-devel
BuildRequires:  perl

Requires:       geda-docs      = %{version}-%{release}
Requires:       geda-gattrib   = %{version}-%{release}
Requires:       geda-gschem    = %{version}-%{release}
Requires:       geda-gnetlist  = %{version}-%{release}
Requires:       geda-gsymcheck = %{version}-%{release}
Requires:       geda-utils     = %{version}-%{release}


%description
The GPL Electronic Design Automation (gEDA) project has produced and
continues working on a full GPL'd suite and toolkit of Electronic
Design Automation tools. These tools are used for electrical circuit
design, schematic capture, simulation, prototyping, and production.

Currently, the gEDA project offers a mature suite of free software
applications for electronics design, including schematic capture,
attribute management, bill of materials (BOM) generation, netlisting
into over 20 netlist formats, analog and digital simulation, and
printed circuit board (PCB) layout.


%package      -n  libgeda
Summary:          Libraries for the gEDA project
Group:            System Environment/Libraries

%description  -n  libgeda
This package contains libgeda, the library needed by gEDA applications.


%package      -n  libgeda-devel
Summary:          Development files for the libgeda library
Group:            Development/Libraries
Requires:         libgeda = %{version}-%{release}
Requires:         gtk2-devel
Requires:         guile-devel
Requires:         pkgconfig

%description  -n  libgeda-devel
Development files for libgeda library


%package      -n  geda-symbols
Summary:          Electronic symbols for gEDA
Group:            Applications/Engineering
#BuildArch:        noarch

%description  -n  geda-symbols
This package contains a bunch of symbols of electronic devices
used by gschem, the gEDA project schematic editor.


%package      -n  geda-docs
Summary:          Documentation and Examples for gEDA
Group:            Applications/Documentation
#BuildArch:        noarch
Requires:         geda-symbols
Provides:         geda-examples     = %{version}-%{release}
Obsoletes:        geda-examples     < 20090830-2

%description  -n  geda-docs
This package contains documentation and examples for the gEDA project.


%package      -n  geda-gattrib
Summary:          Attribute editor for gEDA
Group:            Applications/Engineering
Requires:         geda-symbols

%description  -n  geda-gattrib
Gattrib is gEDA's attribute editor. It reads a set of gschem .sch files
(schematic files), and creates a spreadsheet showing all components in
rows, with the associated component attributes listed in the columns.
It allows the user to add, modify, or delete component attributes outside
of gschem, and then save the .sch files back out. When it is completed,
it will allow the user to edit attributes attached to components, nets,
and pins. (Currently, only component attribute editing is implemented;
pin attributes are displayed only, and net attributes are TBD.)


%package      -n  geda-gnetlist
Summary:          Netlister for the gEDA project
Group:            Applications/Engineering
Requires:         geda-symbols

%description  -n  geda-gnetlist
Gnetlist generates netlists from schematics drawn with gschem
(the gEDA schematic editor). Possible output formats are:
- native
- tango
- spice
- allegro
- PCB
- verilog
and others.


%package      -n  geda-gschem
Summary:          Electronics schematics editor
Group:            Applications/Engineering
Requires(pre):    libgeda = %{version}-%{release}
Requires:         geda-symbols
Requires:         geda-docs

%description  -n  geda-gschem
Gschem is an electronics schematic editor. It is part of the gEDA project.


%package      -n  geda-gsymcheck
Summary:          Symbol checker for electronics schematics editor
Group:            Applications/Engineering
Requires:         geda-symbols

%description  -n  geda-gsymcheck
Gsymcheck is a utility to check symbols for gschem.
It is part of the gEDA project.


%package      -n  geda-utils
Summary:          Several utilities for the gEDA project
Group:            Applications/Engineering
Requires:         geda-symbols


%description  -n  geda-utils
Several utilities for the gEDA project.


%prep
%setup -q

# rpmlint UTF-8
for f in symbols/{AUTHORS,ChangeLog-1.0} gschem/ChangeLog; do
   iconv -f ISO-8859-1 -t UTF-8 $f > $f.tmp && \
      ( touch -r $f $f.tmp ; %{__mv} -f $f.tmp $f ) || \
      %{__rm} -f $f.tmp
done

# Fixing rpaths
%if "%{_libdir}" != "/usr/lib"
sed -i -e 's|"/lib /usr/lib|"/%{_lib} %{_libdir}|' configure
%endif

%build

%configure --disable-static
make %{?_smp_mflags}


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


desktop-file-install --vendor "" \
    --dir %{buildroot}%{_datadir}/applications \
    --delete-original                          \
    %{buildroot}%{_datadir}/applications/geda-gschem.desktop \
    %{buildroot}%{_datadir}/applications/geda-gattrib.desktop 


%{__rm} -f %{buildroot}%{_libdir}/*.la
%{__rm} -f %{buildroot}%{_datadir}/applications/mimeinfo.cache
%{__rm} -f %{buildroot}%{_datadir}/mime/{XMLnamespaces,aliases,generic-icons,globs,globs2,icons,magic,mime.cache,subclasses,treemagic,types}


# locale's
for i in libgeda38 geda-gattrib geda-gschem ; do
    if [ -d %{buildroot}%{_datadir}/locale/ ]; then
        for lang_dir in %{buildroot}%{_datadir}/locale/* ; do
            lang=$(basename $lang_dir)
            if [ -e %{buildroot}%{_datadir}/locale/$lang/LC_MESSAGES/$i.mo ] ; then
                echo "%lang($lang) %{_datadir}/locale/$lang/LC_MESSAGES/$i.mo" >> $i.lang
            fi
        done
    fi
done

install -d %{buildroot}%{_docdir}/%{name}/{examples,gnetlist,gsymcheck,utils}

# gschem
install -pm 644 gschem/examples/*.sch    %{buildroot}%{_docdir}/%{name}/examples
install -pm 644 gschem/examples/README.* %{buildroot}%{_docdir}/%{name}/examples

# gnetlist
%{__cp} -pr gnetlist/tests %{buildroot}%{_docdir}/%{name}/gnetlist
%{__cp} -pr gnetlist/docs/* %{buildroot}%{_docdir}/%{name}/gnetlist
%{__cp} -pr gnetlist/examples/* %{buildroot}%{_docdir}/%{name}/examples
%{__rm} -f %{buildroot}%{_docdir}/%{name}/gnetlist/gnetlist.{1,doc}

# gsymcheck
%{__cp} -pr gsymcheck/tests/ %{buildroot}%{_docdir}/%{name}/gsymcheck

# utils
%{__cp} -pr utils/tests %{buildroot}%{_docdir}/%{name}/utils
%{__cp} -pr utils/examples %{buildroot}%{_docdir}/%{name}/utils

find %{buildroot}%{_docdir} -name 'Makefile*' -exec rm -f '{}' \;


%post -n geda-symbols
update-mime-database %{_datadir}/mime &> /dev/null || :

%postun -n geda-symbols
update-mime-database %{_datadir}/mime &> /dev/null || :

%posttrans -n geda-symbols
update-mime-database %{_datadir}/mime &> /dev/null || :


%post -n geda-gschem
touch --no-create %{_datadir}/icons/hicolor || :
%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
update-mime-database %{_datadir}/mime &> /dev/null || :

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

%posttrans -n geda-gschem
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
update-mime-database %{_datadir}/mime &> /dev/null || :


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

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

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


%post -n libgeda
/sbin/ldconfig
update-mime-database %{_datadir}/mime &> /dev/null || :

%postun -n libgeda
/sbin/ldconfig
update-mime-database %{_datadir}/mime &> /dev/null || :

%posttrans -n libgeda
update-mime-database %{_datadir}/mime &> /dev/null || :

# Package Self test 
%check 
make distcheck

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


%files
%defattr(-,root,root,-)
%doc ABOUT-NLS AUTHORS ChangeLog COPYING README NEWS

%files -n libgeda -f libgeda38.lang
%defattr(-,root,root,-)
%doc libgeda/{HACKING,ChangeLog*,BUGS,TODO}
%dir %{_datadir}/gEDA/
%dir %{_datadir}/gEDA/scheme
%{_libdir}/libgeda.so.*
%{_datadir}/gEDA/prolog.ps
%{_datadir}/gEDA/scheme/geda.scm
%{_datadir}/gEDA/system-gafrc
%{_datadir}/mime/packages/libgeda.xml


%files -n libgeda-devel
%defattr(-,root,root,-)
%{_includedir}/libgeda/
%{_libdir}/libgeda.so
%{_libdir}/pkgconfig/libgeda.pc


%files -n geda-symbols
%defattr(-,root,root,-)
%doc symbols/{AUTHORS,ChangeLog*,README,TODO}
%{_datadir}/gEDA/sym/
%dir %{_datadir}/gEDA/gafrc.d/
%{_datadir}/gEDA/gafrc.d/geda-clib.scm
%{_datadir}/mime/application/x-geda-symbol.xml
%{_datadir}/icons/hicolor/*/mimetypes/application-x-geda-symbol.*
%{_datadir}/mime/application/x-geda-gsch2pcb-project.xml
%{_datadir}/icons/hicolor/*/mimetypes/application-x-geda-gsch2pcb-project.*


%files -n geda-docs
%defattr(-,root,root,-)
%dir %{_docdir}/%{name}/
%doc %{_docdir}/%{name}/man
%doc %{_docdir}/%{name}/wiki
%doc %{_docdir}/%{name}/examples
%doc %{_docdir}/%{name}/gedadocs.html
%doc %{_docdir}/%{name}/nc.pdf


%files -n geda-gattrib -f geda-gattrib.lang
%defattr(-,root,root,-)
%doc gattrib/design/{gEDA_Structures_updated.png,ProgramArchitecture.gnumeric}
%doc gattrib/{BUGS,ChangeLog*,NOTES,README,ToDos}
%{_bindir}/gattrib
%{_datadir}/gEDA/system-gattribrc
%{_datadir}/gEDA/gattrib-menus.xml
%{_datadir}/applications/geda-gattrib.desktop
%{_datadir}/icons/hicolor/*/apps/geda-gattrib.*


%files -n geda-gnetlist
%defattr(-,root,root,-)
%doc gnetlist/{BUGS,ChangeLog*,TODO}
%doc %{_docdir}/%{name}/gnetlist
%{_bindir}/gnetlist
%{_bindir}/mk_verilog_syms
%{_bindir}/sch2eaglepos.sh
%{_bindir}/sw2asc
%{_datadir}/gEDA/scheme/gnet*.scm
%{_datadir}/gEDA/system-gnetlistrc
%{_mandir}/man1/gnetlist.*


%files -n geda-gschem -f geda-gschem.lang
%defattr(-,root,root,-)
%doc gschem/{BUGS,ChangeLog*,TODO}
%{_bindir}/gschem
%{_bindir}/gschemdoc
%{_datadir}/gEDA/scheme/auto-place-attribs.scm
%{_datadir}/gEDA/scheme/default-attrib-positions.scm
%{_datadir}/gEDA/scheme/image.scm
%{_datadir}/gEDA/scheme/pcb.scm
%{_datadir}/gEDA/scheme/print.scm
%{_datadir}/gEDA/scheme/auto-uref.scm
%{_datadir}/gEDA/scheme/generate_netlist.scm
%{_datadir}/gEDA/scheme/gschem.scm
%{_datadir}/gEDA/scheme/list-keys.scm
%{_datadir}/gEDA/scheme/print-NB-attribs.scm
%{_datadir}/gEDA/bitmap/gschem-*
%{_datadir}/gEDA/system-gschemrc
%{_datadir}/gEDA/gschem-gtkrc
%{_datadir}/gEDA/gschem-colormap-darkbg
%{_datadir}/gEDA/gschem-colormap-lightbg
%{_datadir}/gEDA/print-colormap-darkbg
%{_datadir}/gEDA/print-colormap-lightbg
%{_datadir}/gEDA/scheme/color-map.scm
%{_datadir}/mime/application/x-geda-schematic.xml
%{_datadir}/applications/geda-gschem.desktop
%{_mandir}/man1/gschem.*
%{_datadir}/icons/hicolor/*/apps/geda-gschem.*
%{_datadir}/icons/hicolor/*/mimetypes/application-x-geda-schematic.*


%files -n geda-gsymcheck
%defattr(-,root,root,-)
%doc gsymcheck/{BUGS,ChangeLog*,TODO}
%doc %{_docdir}/%{name}/gsymcheck
%{_bindir}/gsymcheck
%{_datadir}/gEDA/system-gsymcheckrc
%{_mandir}/man1/gsymcheck.*


%files -n geda-utils
%defattr(-,root,root,-)
%doc utils/{ChangeLog*,README,AUTHORS}
%doc %{_docdir}/%{name}/utils
%doc %{_docdir}/%{name}/readmes/
%{_bindir}/garchive
%{_bindir}/grenum
%{_bindir}/gmk_sym
%{_bindir}/smash_megafile
%{_bindir}/convert_sym
%{_bindir}/sarlacc_schem
%{_bindir}/sarlacc_sym
%{_bindir}/gschupdate
%{_bindir}/gsymfix.pl
%{_bindir}/pcb_backannotate
%{_bindir}/gschlas
%{_bindir}/olib
%{_bindir}/refdes_renum
%{_bindir}/gsch2pcb
%{_bindir}/pads_backannotate
%{_bindir}/tragesym
%{_bindir}/gsymupdate
%{_bindir}/gxyrs
%{_bindir}/gnet_hier_verilog.sh
%{_datadir}/gEDA/system-gschlasrc
%{_mandir}/man1/grenum.1.gz
%{_datadir}/gEDA/perl/lib/gxyrs.pm


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

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

* Tue Nov 24 2009 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 1.6.0-3
- Enabling self test: https://fedorahosted.org/fedora-electronic-lab/ticket/56

* Mon Nov 02 2009 Dennis Gilmore <dennis@ausil.us> - 1.6.0-2
- RHEL-5 does not support noarch subpackages

* Tue Oct  6 2009 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 1.6.0-1
- new upstream release

* Thu Sep 24 2009 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 1.5.4-2
- Fixed most rpmlints and rpath
- Optimize desktop/icon scriptlets

* Mon Aug 31 2009 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 1.5.4-1
- new development snapshot

* Sun Dec 21 2008 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 20081220-1
- new upstream release

* Tue Nov 11 2008 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 20080929-1
- New upstream release

* Sat Feb 02 2008 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 20080127-1
- New upstream release

* Tue Jan 22 2008 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 20071231-1
- New upstream release

* Mon Sep 03 2007 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 20070902-1
- New upstream release

* Thu Aug 23 2007 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 20070708-2
- mass rebuild for fedora 8 - ppc32

* Sat Jul 14 2007 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 20070708-1
- New upstream release

* Tue Jun 27 2007 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 20070626-1
- new upstream release

* Thu Jun 14 2007 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 20070526-1
- new upstream release

* Wed Mar 28 2007 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 20070216-1
- fix ownership of /usr/share/gEDA/docs -  #233792

* Sun Sep 10 2006 Chitlesh Goorah <chitlesh@fedoraproject.org> - 20061020-1
- New upstream release

* Sun Sep 10 2006 Chitlesh Goorah <chitlesh@fedoraproject.org> - 20060906-2
- Rebuilt for FC-6 devel

* Sun Sep 10 2006 Chitlesh Goorah <chitlesh@fedoraproject.org> - 20060906-1
- Upstream release 20060906

* Tue Sep 05 2006 Chitlesh Goorah <chitlesh@fedoraproject.org> - 20060824-2
- Removed unauthorized file : MPEG sequence : favicon

* Tue Sep 05 2006 Chitlesh Goorah <chitlesh@fedoraproject.org> - 20060824-1
- Upstream release 20060824

* Mon Aug 28 2006 Chitlesh Goorah <chitlesh@fedoraproject.org> - 20060123-3
- rebuilt for FC5 and later with minor fixes

