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
Name:		librecad
Summary:	Computer-aided design (CAD) software package for 2D design and drafting
Version:	1.0.2
Release:	0
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://
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

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.

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

# 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};

# No make install :(
export BUILDDIR="%buildroot/%_datadir/%name";
bash scripts/;

install -Dpm0755 "unix/%name" "$b/%_bindir/%name";
install -Dpm0644 desktop/%name.1 "$b/%_mandir/man1/%name.1";
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

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

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

%dir %_datadir/%name

%files parts
%dir %_datadir/%name

openSUSE Build Service is sponsored by