Name:		qcad
Version:	2.0.5.0
Release:	1%{?_dist_release}
Summary:	Simple 2D CAD program
Summary(ja):	シンプルな 2D CAD ソフトウェア
Group:		Applications/Graphics
License:	GPLv2
Source:		http://www.ribbonsoft.com/archives/qcad/qcad-2.0.5.0-1-community.src.tar.gz
Source1:	http://www.ribbonsoft.com/archives/qcad/qcad-manual-en-2.0.4.0-1.html.zip
Patch:		qcad-qass.patch
Patch1:		qcad-assistant.patch
Patch2:		qcad-manual-bugs.patch
Patch3:		qcad-64bit.patch
Patch4:		qcad-nopedantic.patch
Patch5:		qcad-arc.patch
Patch6:		qcad-gcc43.patch
URL:		http://www.ribbonsoft.com/qcad.html
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires:	qt-devel 
BuildRequires:	qt-designer
BuildRequires:	python-devel
BuildRequires:	unzip
# Help viewer is Qt Assistant in qt-devel package.
#Requires:       /usr/bin/assistant
Requires(post):	desktop-file-utils
Requires(postun):desktop-file-utils

%description
QCad is an application for computer aided drafting in two dimensions. 
With QCad you can create technical drawings such as plans for buildings,
interiors or mechanical parts. QCad works under Linux, Unix Systems,
Mac OS X and Windows. The source code of QCad is released under the 
GPL (Open Source).

%description -l ja
QCad は 2D の CAD(Computer Assisted Drawing) 用ソフトウェアです。
QCad を使えば、建物や内装、機械部品等の技術的な図面を描くことが
できます。

QCad は Linux や Unix、Mac OS X、Windowsで利用できます。
QCad のソースコードは GPL ライセンスの下でオープンソースソフト
ウェアとしてリリースされています。


%prep
%setup -q -n %{name}-%{version}-1-community.src
%setup -q -T -D -a 1 -n %{name}-%{version}-1-community.src
%patch -p1
%patch1 -p1 -b .assistanterror
# no backup file here, so it doesn't get packaged
%patch2 -p0
%patch3 -p1 -b .64bit
%patch4 -p1 -b .nopedantic
%patch5 -p1 -b .arc
%patch6 -p1 -b .gcc43


%build
[ -n "$QTDIR" ] || . %{_sysconfdir}/profile.d/qt.sh
export PATH="$QTDIR/bin:$PATH"
pushd scripts
    ./build_qcad.sh
popd
find -name '*.ts' -exec lrelease '{}' ';'
find -name '*.qm' -exec cp '{}' qcad/qm ';'


%install
rm -rf $RPM_BUILD_ROOT

%define pkgdatadir %{_datadir}/qcad
mkdir -p $RPM_BUILD_ROOT%{pkgdatadir}
mkdir -p $RPM_BUILD_ROOT%{pkgdatadir}/library
mkdir -p $RPM_BUILD_ROOT%{pkgdatadir}/doc

cp -fr qcad-manual-en-2.0.4.0-1.html/* $RPM_BUILD_ROOT%{pkgdatadir}/doc

cd qcad
cp -fr fonts $RPM_BUILD_ROOT%{pkgdatadir}
cp -fr patterns $RPM_BUILD_ROOT%{pkgdatadir}
cp -fr qm $RPM_BUILD_ROOT%{pkgdatadir}

mkdir -p $RPM_BUILD_ROOT%{_datadir}/pixmaps
cp -f src/xpm/qcad.xpm $RPM_BUILD_ROOT%{_datadir}/pixmaps

mkdir -p $RPM_BUILD_ROOT%{_bindir}
cp -f qcad $RPM_BUILD_ROOT%{_bindir}

cat > qcad.desktop <<EOF
[Desktop Entry]
Name=QCad
Name[ja]=QCad
GenericName=2D CAD drawing
GenericName[ja]=2D CAD ソフトウェア
Comment=A simple 2D CAD program
Comment[ja]=2D CAD 図面を作図します
Exec=qcad
Icon=qcad.xpm
Terminal=false
Type=Application
MimeType=image/vnd.dxf
Encoding=UTF-8
StartupNotify=true
StartupWMClass=qcad
Categories=Application;Graphics
EOF

mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications
install -m644 qcad.desktop $RPM_BUILD_ROOT%{_datadir}/applications


%clean
rm -rf $RPM_BUILD_ROOT


%post
%{_bindir}/update-desktop-database %{_datadir}/applications > /dev/null 2>&1 || :


%postun
%{_bindir}/update-desktop-database %{_datadir}/applications > /dev/null 2>&1 || :


%files
%defattr(-,root,root,-)
%doc qcad/README qcad/data
%{_bindir}/*
%{_datadir}/qcad
%{_datadir}/applications/*
%{_datadir}/pixmaps/*


%changelog
* Sat Jun 05 2010 Kazutaka HARADA <kazutaka@vinelinux.org> 2.0.5.0-1
- initial build for Vine Linux based on fedora development
- add japanese summary and description
- export $QTDIR/bin to PATH for qmake command
- add BuildRequires: qt-designer unzip

* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.5.0-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.5.0-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Wed Sep  3 2008 Tom "spot" Callaway <tcallawa@redhat.com> - 2.0.5.0-9
- fix license tag

* Fri Feb 22 2008 Gerard Milmeister <gemi@bluewin.ch> - 2.0.5.0-8
- patch to compile with GCC 4.3

* Mon Feb 18 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 2.0.5.0-7
- Autorebuild for GCC 4.3

* Wed Jan 23 2008 Gerard Milmeister <gemi@bluewin.ch> - 2.0.5.0-6
- added patch to add arc type tangential to menu

* Mon Aug 28 2006 Gerard Milmeister <gemi@bluewin.ch> - 2.0.5.0-5
- Rebuild for FE6

* Fri Feb 17 2006 Gerard Milmeister <gemi@bluewin.ch> - 2.0.5.0-4
- Rebuild for Fedora Extras 5

* Thu Nov 24 2005 Gerard Milmeister <gemi@bluewin.ch> - 2.0.5.0-3
- generate and include qm files

* Wed Nov 23 2005 Gerard Milmeister <gemi@bluewin.ch> - 2.0.5.0
- New Version 2.0.5.0

* Wed May 25 2005 Jeremy Katz <katzj@redhat.com> - 2.0.4.0-5.fc4
- fix build on 64bit arches (#158650)

* Sun May 22 2005 Jeremy Katz <katzj@redhat.com> - 2.0.4.0-4.fc4
- rebuild on all arches

* Tue Apr  5 2005 Michael Schwendt <mschwendt[AT]users.sf.net> - 2.0.4.0-3.fc4
- Add missing line in qcad-assistant.patch which prevents orphans.

* Mon Feb 14 2005 Michael Schwendt <mschwendt[AT]users.sf.net> - 2.0.4.0-2
- Remove /usr/bin/assistant (-> qt-devel) dependency, replace with
  patches to open a warning dialog in case of Qt Assistant error
  conditions. Add a related patch for the English manual which
  removes references to two missing images.

* Sat Feb 12 2005 Gerard Milmeister <gemi@bluewin.ch> - 2.0.4.0-1
- Added documentation
- Fixed code for calling Qt Assistant: qcad-qass.patch

* Mon Nov 15 2004 Gerard Milmeister <gemi@bluewin.ch> - 2.0.4.0-0.fdr.2
- Added mime type to desktop file

* Fri Oct  1 2004 Gerard Milmeister <gemi@bluewin.ch> - 2.0.4.0-0.fdr.1
- New Version 2.0.4.0

* Sat Jun  5 2004 Gerard Milmeister <gemi@bluewin.ch> - 2.0.3.3-0.fdr.1
- New Version 2.0.3.3

* Sun Apr 25 2004 Gerard Milmeister <gemi@bluewin.ch> - 2.0.3.1-0.fdr.2
- Set QTDIR from qt.sh

* Sun Apr 11 2004 Gerard Milmeister <gemi@bluewin.ch> - 2.0.3.1-0.fdr.1
- New Version 2.0.3.1

* Sat Feb 28 2004 Gerard Milmeister <gemi@bluewin.ch> - 2.0.2.0-0.fdr.1
- New Version 2.0.2.0

* Fri Dec 12 2003 Gerard Milmeister <gemi@bluewin.ch> - 2.0.1.3-0.fdr.1
- New Version 2.0.1.3

* Wed Nov 26 2003 Gerard Milmeister <gemi@bluewin.ch> - 2.0.1.2-1.fdr.2
- Respect RPM_OPT_FLAGS

* Wed Nov 26 2003 Gerard Milmeister <gemi@bluewin.ch> - 2.0.1.2-0.fdr.1
- New Version 2.0.1.2

* Tue Oct 21 2003 Gerard Milmeister <gemi@bluewin.ch> - 2.0.1.1-1.fdr.1
- First Fedora release
