File librecad.spec of Package librecad

#
# spec file for package librecad
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name:		librecad
Summary:	Computer-aided design (CAD) software package for 2D design and drafting
Version:	1.0.2
Release:	0
URL:		http://librecad.org/
License:	GPL-2.0
Group:		Productivity/Graphics/CAD

# old qcad had a newer version, so we provide all versions here.
Provides:       qcad
Obsoletes:      qcad <= 2.0.5

#Git-Clone:	git://github.com/LibreCAD/LibreCAD
#Git-Web:	https://github.com/LibreCAD/LibreCAD/tags
#DL-URL:	https://github.com/LibreCAD/LibreCAD/tarball/v1.0.2
Source:		%name-%version.tar.xz
Source2:	%name-rpmlintrc
Source3:	librecad.mime.desktop
Patch1:		librecad-no-date.diff
Patch2:		librecad-dxflib25.diff
Patch3:		librecad-external-dxflib.diff
Patch4:		librecad-install.diff
Patch5:		librecad-plugindir.diff
BuildRoot:	%_tmppath/%name-%version-build
BuildRequires:	bash, fdupes, gcc-c++, dxflib-devel, muparser-devel
BuildRequires:	libqt4-devel, libqt4-devel-doc, update-desktop-files, xz
Requires(post):	shared-mime-info
Requires(postun):	shared-mime-info
Recommends:	%name-parts

%description
LibreCAD is a Qt4 application to design 2D CAD drawings.

%package parts
Summary:	Parts collection for LibreCAD
Requires:	%name
Group:		Productivity/Graphics/CAD
BuildArch:	noarch

%description parts
Collection of parts for LibreCAD, a Qt4 application to design 2D
CAD drawings.

%prep
%setup -qn LibreCAD-LibreCAD-a5c34b2
%patch -P 1 -P 2 -P 3 -P 4 -P 5 -p1

%build
# qmake seems to have an extra expansion step, so we need one more escape step.
f="%optflags -DCONFIG_LIBDIR=\\\\\\\"%_libdir\\\\\\\"";
qmake CONFIG+="release" QMAKE_CFLAGS+="$f" QMAKE_CXXFLAGS+="$f";
make %{?_smp_mflags};
pushd plugins/;
qmake CONFIG+="release" QMAKE_CFLAGS+="%optflags" QMAKE_CXXFLAGS+="%optflags";
make %{?_smp_mflags};
popd;

%install
b="%buildroot";
# No make install :(
export BUILDDIR="%buildroot/%_datadir/%name";
bash scripts/postprocess-unix.sh;

install -Dpm0755 "unix/%name" "$b/%_bindir/%name";
install -Dpm0644 desktop/%name.1 "$b/%_mandir/man1/%name.1";
p="$b/%_libdir/%name/plugins";
mkdir -p "$p";
install -Dpm0755 unix/resources/plugins/* "$p/";
install -Dpm0644 "desktop/%name.desktop" "$b/%_datadir/applications/%name.desktop";
install -Dpm0644 "res/main/%name.png" "$b/%_datadir/pixmaps/%name.png";
install -Dpm0644 "%{S:3}" "$b/%_datadir/mime/image/dxf.desktop";

#find "$b/%_datadir/%name" -type f -exec chmod a-x "{}" "+";

%if 0%{?suse_version}
%suse_update_desktop_file -r %name Graphics VectorGraphics
%suse_update_desktop_file %buildroot/%_datadir/mime/image/dxf.desktop
%endif

%post
%_bindir/update-mime-database %_datadir/mime >/dev/null || :

%postun
%_bindir/update-mime-database %_datadir/mime >/dev/null || :

%files
%defattr(-,root,root)
%_bindir/librecad
%_libdir/%name
%_mandir/man1/librecad.1*
%_datadir/applications/librecad.desktop
%_datadir/mime/image/dxf.desktop
%_datadir/pixmaps/librecad.png
%dir %_datadir/%name
%_datadir/%name/fonts
%_datadir/%name/patterns
%_datadir/%name/qm

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

%changelog
openSUSE Build Service is sponsored by