Blob Blame History Raw
%global         pcbver    20091103

Name:           pcb
Version:        0.%{pcbver}
Release:        2%{?dist}

Summary:        An interactive printed circuit board editor
License:        GPLv2
Group:          Applications/Engineering
URL:            http://pcb.sourceforge.net

BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires:  tcl, bison, flex, gawk, ImageMagick, gtk2-devel, gd-devel, fontconfig-devel
BuildRequires:  cups, tetex-latex, libICE-devel, desktop-file-utils, intltool, gettext-devel
BuildRequires:  dbus-devel

Requires:       m4
Requires:       electronics-menu

Source0:        http://downloads.sourceforge.net/sourceforge/%{name}/%{name}-%{pcbver}.tar.gz
Source1:        pcb-reference-card.pdf
Patch0:         pcb-0.20091103-tools.patch
Patch1:         pcb-0.20091103-example.patch
# Upstream's patch
Patch2:         0001-fix-some-warnings-suggested-by-Stefan-Salewski.patch

%description
PCB is an interactive printed circuit board editor.
PCB includes a rats nest feature, design rule checking, and can provide
industry standard RS-274-X (Gerber), NC drill, and centroid data (X-Y data)
output for use in the board fabrication and assembly process. PCB offers
high end features such as an autorouter and trace optimizer which can
tremendously reduce layout time.


%package doc
Summary:         Documentation for PCB, An interactive printed circuit board editor
Group:           Documentation
Requires:        %{name} = %{version}-%{release}
Requires(post):  info
Requires(preun): info

%description doc
This package contains the documentation of PCB, An interactive printed circuit
board editor.


%prep
%setup -q -n %{name}-%{pcbver}

# Removes duplicates
%patch0 -p0 -b .duplicates

%patch2 -p1 -b .upstream

#
# Preparing docs for %%doc
#

# renaming to .pcb extension
mv example/LED  example/LED.pcb
mv example/LED2 example/LED2.pcb
%patch1 -p0 -b .examples
%{__sed} -i \
   's|examplesdir = $(pkgdatadir)/examples|examplesdir = @docdir@/examples|' \
   example/libraries/Makefile.*

%{__sed} -i \
   's|tutdir = $(pkgdatadir)/tutorial|tutdir = @docdir@/tutorial|' \
   tutorial/Makefile.*

%build
export WISH=%{_bindir}/wish

# Fixes failed build on EPEL-5
%if 0%{?rhel}
export CFLAGS=`echo %optflags | sed "s/-D_FORTIFY_SOURCE=2 // g" -`
%endif


# Bug 472618 : disable-update-desktop-database
# Bug 544657 : --enable-dbus
%configure \
    --enable-dbus \
    --disable-update-mime-database \
    --disable-update-desktop-database \
    --docdir=%{_docdir}/%{name}-%{version}

%{__make} %{?_smp_mflags}


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

# in /usr/share/pcb/newlib/ folder, sockets is an empty folder

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

#
# Additional Examples
#
set +x
dest=%{buildroot}%{_docdir}/%{name}-%{version}/examples
for d in thermal pad puller ; do
   echo -n -e "... Fixing path of $d  \t"
   mkdir -p $dest/$d
   mv $dest/../$d.* $dest/$d
   install -pm 0644 doc/$d.{pcb,pdf} $dest/$d
   sed -i "s|$d.png|examples/$d/$d.png|" $dest/../%{name}.html
   echo "done"
done
set -x


## --- pcb supports for acpcircuits
# http://www.apcircuits.com/resources/links/pcb_unix.html
unzip tools/apctools.zip
install -p -m 755 apc*.pl  %{buildroot}%{_datadir}/%{name}/tools

# Removes duplicates
%{__rm} -f %{buildroot}%{_datadir}/%{name}/tools/apctools.zip


## ---

# Old versions of PCB don't support autoroute, pcb2ncap convert
# pcb format to ncap format used for mucspcb to autoroute the circuit.
# In newer versions of PCB, autoroute is included and pcb2ncap and mucspcb
# are no more needed.
%{__rm} -f %{buildroot}%{_datadir}/%{name}/tools/pcb2ncap.tgz

chmod 755 %{buildroot}%{_datadir}/%{name}/tools/{PCB2HPGL,tgo2pcb.tcl,Merge*}


cp -p AUTHORS COPYING README NEWS ChangeLog README_FILES/CHANGES \
      README_FILES/Whats_new_in_2.0 README_FILES/Tools \
      %{buildroot}%{_docdir}/%{name}-%{version}/

%{__rm} -rf %{buildroot}%{_datadir}/info/dir

%{__rm} -f  %{buildroot}%{_docdir}/%{name}-%{version}/refcard*
cp -p %{SOURCE1} %{buildroot}%{_docdir}/%{name}-%{version}


# locale's
%find_lang %{name}


%check
%{__make} check


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


%post
touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
update-desktop-database &> /dev/null || :
update-mime-database %{_datadir}/mime &> /dev/null || :

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

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


%post doc
/sbin/install-info %{_infodir}/%{name}.info %{_infodir}/dir || :

%preun doc
if [ $1 = 0 ] ; then
  /sbin/install-info --delete %{_infodir}/%{name}.info %{_infodir}/dir || :
fi


# Ignored warning W: pcb devel-file-in-non-devel-package /usr/share/pcb/tools/gerbertotk.c
%files doc
%{_infodir}/%{name}*
%doc %{_docdir}/%{name}-%{version}/pcb-reference-card.pdf
%doc %{_docdir}/%{name}-%{version}/pcb.ps
%doc %{_docdir}/%{name}-%{version}/*.html
%doc %{_docdir}/%{name}-%{version}/examples/thermal
%doc %{_docdir}/%{name}-%{version}/examples/pad
%doc %{_docdir}/%{name}-%{version}/examples/puller


%files -f %{name}.lang
%defattr(-, root, root, -)
%exclude %{_docdir}/%{name}-%{version}/pcb-reference-card.pdf
%exclude %{_docdir}/%{name}-%{version}/pcb.ps
%exclude %{_docdir}/%{name}-%{version}/*.html
%exclude %{_docdir}/%{name}-%{version}/examples/thermal
%exclude %{_docdir}/%{name}-%{version}/examples/pad
%exclude %{_docdir}/%{name}-%{version}/examples/puller
%doc %{_docdir}/%{name}-%{version}/
%{_datadir}/applications/%{name}.desktop
%{_bindir}/%{name}
%{_datadir}/%{name}/
%{_mandir}/man1/%{name}*
%{_datadir}/icons/hicolor/*/mimetypes/application-x-*
%{_datadir}/icons/hicolor/*/apps/%{name}.*
%{_datadir}/mime/packages/pcb.xml
%{_datadir}/mimelnk/application/x-*.desktop


%changelog
* Sun Dec 6 2009 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 0.20091103-2
- Enable build for dbus support
- improved reference card

* Sat Nov 7 2009 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 0.20091103-1
- New upstream release

* Tue Sep 8 2009 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 0.20081128-4
- Fixes for PCB EL-5 build.

* Sat Nov 29 2008 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 0.20081128-1
- new upstream release
- restructuring docs, tutorials and examples
- Fixed Bug 472618 -  Must not include /usr/share/applications/mimeinfo.cache

* Sat Feb 09 2008 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 0.20080202-2
- added gettext-devel as BR
- treat locales properly

* Sat Feb 02 2008 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 0.20080202-1
- fixed docdir
- new upstream release
- treat locales properly

* Thu Jun 21 2007 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 0.20070208-2
- fixed docdir

* Fri Feb 09 2007 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 0.20070208-1
- New upstream release - 20070208

* Sun Feb 04 2007 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 0.20060822-9
- fixed presence in gnome menu

* Sun Dec 24 2006 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 0.20060822-8
- Removed duplicates

* Fri Dec 22 2006 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 0.20060822-7
- Fixed info files and added to the pcb package #219406
- Fixed man pages (with patch0 to suit fedora packaging of pcb
- Added refcard.pdf in pcb binary package
- Removed duplicated MergePCBPS and Merge_dimPCBPS from pcb binary package
- pcb supports for acpcircuits included

* Fri Sep 15 2006 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 0.20060822-6
- Fixed ownership of %%{_datadir}/%%{name}/ #206405

* Fri Sep 01 2006 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 0.20060822-5
- release for devel

* Fri Sep 01 2006 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 0.20060822-4
- Added m4 as requires: to fix the error msg:
-       can't find default font-symbol-file 'default_font'

* Fri Aug 25 2006 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 0.20060822-3
- release for devel

* Fri Aug 25 2006 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 0.20060822-2
- release for FC5 and minor fixes

* Fri Aug 25 2006 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 0.20060822-1
- updated to 20060822's snapshot

* Wed Jul 11 2006 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 0.20060422-4
- pcbver corrected in pcb.desktop

* Sun Jul 09 2006 Chitlesh Goorah <chitlesh@fedoraproject.org> - 0.20060422-3
- fixed the icon of pcb

* Sun Jul 09 2006 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 0.20060422-2
- fixed E: pcb info-dir-file /usr/share/info/dir
- added /sbin/install-info as requires for %%post and %%preun
- added icon and treated GTK+ icon cache as required

* Thu Jul 06 2006 Chitlesh Goorah <chitlesh [AT] fedoraproject DOT org> - 0.20060422-1
- New upstream release 20060422
- Minor fixes to work under mock

* Wed Apr 19 2006 <pjones@redhat.com> - 0.20060414-1
- Let there be pcb packaging.