File librecad.spec of Package LibreCAD2

#
# spec file for package librecad (Version 2.0.7)
#
# Copyright (c) 2010-2015 Rallaz
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#

# norootforbuild

Name:		librecad
%define _namesrc LibreCAD
%define _versionsrc 2.0.8+git20151019.dcd167d

BuildRequires: make gcc gcc-c++ glibc-devel
BuildRequires: xz boost-devel
BuildRequires:  libdxfrw-devel >= 0.6.3

%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
BuildRequires: qt4-devel >= 4.4.1
%endif

%if 0%{?fedora_version}
BuildRequires: muParser-devel
%endif

# RedHat specifics
%if 0%{?rhel_version} || 0%{?centos_version}
BuildRequires: muparser-devel
%endif

# Fedora specifics
%if 0%{?fedora_version}
BuildRequires: qt-devel fdupes
%endif

# SUSE Specifics
%if 0%{?suse_version}
BuildRequires:  libqt4-devel >= 4.4.1 libqt4-devel-doc
BuildRequires:  update-desktop-files
BuildRequires:  fdupes muparser-devel
%endif

%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
%define _qmakename qmake-qt4
%else  
%define _qmakename qmake
%endif

Version:	%{_versionsrc}
Release:	0
URL:		http://www.librecad.org/
License:	GPL-2.0

# patch6 pte

Source0:	%{_namesrc}-%{_versionsrc}.tar.xz
Source1:	%{name}-rpmlintrc
# Source2:	ttf2lff.1
Patch1:		%{name}-desktop.patch
Patch2:		%{name}-external-libs.patch
Patch3:		%{name}-no-date.patch
Patch4:		%{name}-install.patch
Patch8:		%{name}-lrelease-fedora.patch
Patch9:		%{name}-oldstd.patch
#Patch10:	%{name}-no_packagesexist.patch
Patch32:	%{name}-plugindir32.patch
Patch64:	%{name}-plugindir64.patch
Group:		Productivity/Graphics/CAD
Summary:	An generic 2D CAD program
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires(post):   shared-mime-info
Requires(postun): shared-mime-info

Requires:   libdxfrw0 >= 0.6.3

%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}

%else  
Recommends:     %{name}-parts
%endif

%description
LibreCAD is a Qt4 application to design 2D cad drawing based
on the community edition of QCad with dxf & dwg support.

%package parts
Group: Productivity/Graphics/CAD
Summary: Parts collection for %{name}
Requires: %{name}
%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}

%else  
Enhances:       %{name}
%endif
%if 0%{?suse_version} > 0
BuildArch:      noarch
%else  
BuildArchitectures: noarch
%endif

%description parts
Collection of parts for %{name}, a Qt4 application to design 2D cad drawing based
on the community edition of QCad.

%package devel
Group: Development/Sources
Summary: Develop files for %{name}
Requires: %{name}
%if 0%{?fedora_version} || 0%{?rhel_version}
Requires:  qt-devel qt4-devel >= 4.4.1
%endif
%if 0%{?mandriva_version} || 0%{?suse_version}
Requires: libqt4-devel >= 4.4.1
%endif

%description devel
Develop headers to develop plugins for %{name}.

%prep
%setup -q -n %{_namesrc}-%{_versionsrc}
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%ifarch x86_64
%patch64 -p1  
%else
%patch32 -p1  
%endif
%if 0%{?fedora_version} || 0%{?rhel_version}
%patch8 -p1
%endif
%if 0%{?rhel_version}
%if 0%{?rhel_version} >= 700
%else
%patch9 -p1
%endif
%endif
#%if 0%{?suse_version}
#%if 0%{?suse_version} >= 1220
#%else
#%patch9 -p1
#%patch10 -p1
#%endif
#%endif

%build
export CXXFLAGS="$RPM_OPT_FLAGS"
%{_qmakename} -makefile librecad.pro "CONFIG+=release"
%{__make} %{?jobs:-j %jobs}

%install
export BUILDDIR="%{buildroot}%{_datadir}"
sh scripts/postprocess-unix.sh

mkdir -p %{buildroot}%{_libdir}/%{name}/plugins
mv unix/resources/plugins/* %{buildroot}%{_libdir}/%{name}/plugins/
# mv gpl-2.0.txt LICENSE
chmod 644 LICENSE
mv README.md README
chmod 644 README
find %{buildroot}%{_datadir}/%{name} -type f -exec chmod 644 {} \;

%{__install} -Dm 755 -s unix/%{name} %{buildroot}%{_bindir}/%{name}
%{__install} -Dm 755 -s unix/ttf2lff %{buildroot}%{_bindir}/ttf2lff
%{__install} -Dm 644 desktop/%{name}.desktop %{buildroot}%{_datadir}/applications/%{name}.desktop
%{__install} -Dm 644 librecad/res/main/%{name}.png %{buildroot}%{_datadir}/pixmaps/%{name}.png
%{__install} -Dm 644 desktop/%{name}.sharedmimeinfo $RPM_BUILD_ROOT%{_datadir}/mime/packages/%{name}.xml
%{__install} -Dm 644 desktop/%{name}.1 %{buildroot}%{_mandir}/man1/%{name}.1
%{__install} -Dm 644 tools/ttf2lff/ttf2lff.1 %{buildroot}%{_mandir}/man1/ttf2lff.1
%{__install} -Dm 644 librecad/src/plugins/document_interface.h %{buildroot}%{_includedir}/%{name}/document_interface.h
%{__install} -Dm 644 librecad/src/plugins/qc_plugininterface.h %{buildroot}%{_includedir}/%{name}/qc_plugininterface.h
%if 0%{?suse_version} > 0
%suse_update_desktop_file -r %{name} Graphics VectorGraphics
%endif
%if 0%{?suse_version}
%fdupes $RPM_BUILD_ROOT
%endif

%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}

%post
%{_bindir}/update-mime-database %{_datadir}/mime >/dev/null

%postun
%{_bindir}/update-mime-database %{_datadir}/mime >/dev/null


%files
%defattr(-,root,root,-)
%doc LICENSE README
%doc %{_mandir}/man1/%{name}.1*
%doc %{_mandir}/man1/ttf2lff.1*
%{_bindir}/%{name}
%{_bindir}/ttf2lff
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/%{name}.png
%{_datadir}/mime/packages/%{name}.xml
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/qm
%{_datadir}/%{name}/qm/*
%dir %{_datadir}/%{name}/fonts
%{_datadir}/%{name}/fonts/*
%dir %{_datadir}/%{name}/patterns
%{_datadir}/%{name}/patterns/*
%dir %{_datadir}/%{name}/doc
%{_datadir}/%{name}/doc/*
%dir %{_datadir}/appdata
%{_datadir}/appdata/*
%dir %{_libdir}/%{name}
%dir %{_libdir}/%{name}/plugins
%{_libdir}/%{name}/plugins/*

%files parts
%defattr(-,root,root,-)
%{_datadir}/%{name}/library

%files devel
%defattr(-,root,root,-)
%dir %{_includedir}/%{name}
%{_includedir}/%{name}/*.h

%changelog
* Mon Aug 24 2015 Rallaz <rallazz@gmail.com> version 2.0.8
- Update to version 2.0.8 (dwg support)
* Wed Apr 29 2015 Rallaz <rallazz@gmail.com> version 2.0.7
- Update to version 2.0.7 + git (dwg support)
* Tue Jan 13 2015 Rallaz <rallazz@gmail.com> version 2.0.7
- Update to version 2.0.7 final (bug fixes)
* Sat Sep 6 2014 Rallaz <rallazz@gmail.com> version 2.0.5
- Update to version 2.0.5 final (bug fixes)
* Sat Jun 28 2014 Rallaz <rallazz@gmail.com> version 2.0.4
- Update to version 2.0.4 final (bug fixes)
* Thu Jan 16 2014 Rallaz <rallazz@gmail.com> version 2.0.2
- Update to version 2.0.2 final (bug fixes)
* Sun Dec 29 2013 Rallaz <rallazz@gmail.com> version 2.0.0
- Update to version 2.0.0 final
* Sun Dec 8 2013 Rallaz <rallazz@gmail.com> version 2.0.0rc3
- Update to version 2.0.0rc3
* Tue Aug 27 2013 Rallaz <rallazz@gmail.com> version 2.0.0rc2-git2013-08-27
- Update to version 2.0.0rc2-git2013-08-27
* Sat May 11 2013 Rallaz <rallazz@gmail.com> version 2.0.0rc1-git2013-06-25
- Update to version 2.0.0rc1-git2013-06-25
* Sat May 11 2013 Rallaz <rallazz@gmail.com> version 2.0.0beta5
- Update to version 2.0.0beta5
* Wed Mar 13 2013 Rallaz <rallazz@gmail.com> version 2.0.0beta2
- Update to version 2.0.0beta2
* Mon Nov 19 2012 Rallaz <rallazz@gmail.com> version 2.0.0beta1
- Update to version 2.0.0beta1
* Wed Sep 12 2012 Rallaz <rallazz@gmail.com> version 2.0.0
- Update to version 2.0.0alpha4+git 11-sep
* Mon Apr 16 2012 Rallaz <rallazz@gmail.com> version 1.0.2
- Update to version 1.0.2
* Sat Apr 07 2012 Rallaz <rallazz@gmail.com> version 1.0.1pre2
- Update to version 1.0.2
* Sat Apr 07 2012 Rallaz <rallazz@gmail.com> version 1.0.1pre2
- Update to version 1.0.1pre2
- Changed fParser to muParser
* Sun Dec 18 2011 Rallaz <rallazz@gmail.com> version 1.0.0
- Update to version 1.0.0 final
* Mon Oct 24 2011 Rallaz <rallazz@gmail.com> version 1.0.0RC4
- Update to RC4
* Thu Oct 13 2011 Rallaz <rallazz@gmail.com> version 1.0.0RC3
- Update to branch 1.0.0-SNAPSHOT for remove
  unlicensed files (doc and fonts)
* Fri Sep 09 2011 Rallaz <rallazz@gmail.com> version 1.0.0RC3
- Update to RC3
* Mon Aug 15 2011 Rallaz <rallazz@gmail.com> version 1.0.0RC2
- Update to RC2
* Fri May 20 2011 Rallaz <rallazz@gmail.com> version 1.0.0RC1
- Update to RC1
* Fri May 20 2011 Rallaz <rallazz@gmail.com> version 1.0.0beta5 git 96_20110520
- Update to git Apr 24 2011
* Mon Apr 25 2011 Rallaz <rallazz@gmail.com> version 1.0.0beta5 git 8677752
- Update to git Apr 24 2011
* Mon Nov 29 2010 Rallaz <rallazz@gmail.com> version svn 112 beta4
- Update to svn 112
- Rename to LibreCAD
* Mon Nov 29 2010 Rallaz <rallazz@gmail.com> version svn 102 beta4
- Update to svn 102 beta4
* Sun Nov 7 2010 Rallaz <rallazz@gmail.com> version svn 88 beta3
- Update to svn 88 beta3
* Mon Nov 1 2010 Rallaz <rallazz@gmail.com>
- Update to svn 85 beta3
* Tue Oct 26 2010 Rallaz <rallazz@gmail.com>
- Update to svn 80
* Fri Mar 12 2010 Rallaz <rallazz@gmail.com>
- Initial release
openSUSE Build Service is sponsored by