File librecad.spec of Package librecad

#
# spec file for package librecad
#
# Copyright (c) 2013 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
Version:        1.0.3
Release:        0
Summary:        Computer-aided design (CAD) software package for 2D design and drafting
License:        GPL-2.0
Group:          Productivity/Graphics/CAD
Url:            http://librecad.org/

#Git-Clone:     git://github.com/LibreCAD/LibreCAD
#Git-Web:       http://github.com/LibreCAD/LibreCAD/tags
#DL-URL:        http://github.com/LibreCAD/LibreCAD/archive/v1.0.3/librecad-1.0.3.tar.gz
Source:         %name-%version.tar.gz
Source2:        %name-rpmlintrc
Patch1:         librecad-no-date.diff
Patch2:         librecad-dxflib25.diff
Patch3:         librecad-external-dxflib.diff
Patch4:         librecad-install.diff
Patch5:         librecad-plugindir.diff
BuildRequires:  bash
BuildRequires:  dxflib-devel
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  libqt4-devel
BuildRequires:  libqt4-devel-doc
BuildRequires:  muparser-devel
BuildRequires:  update-desktop-files
Requires(post): desktop-file-utils
Requires(postun): desktop-file-utils
Recommends:     %name-parts
# old qcad had a newer version, so we provide all versions here.
Provides:       qcad
Obsoletes:      qcad <= 2.0.5
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
LibreCAD is a Qt4 Computer-aided design (CAD) software package for 2D design
and drafting.

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

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

%prep
%setup -qn LibreCAD-%version
%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";

%if 0%{?suse_version}
%suse_update_desktop_file -G "CAD Program" -r %name Graphics 2DGraphics VectorGraphics
%endif
# Fix rpmlint warning "invalid-desktopfile"
perl -pi -e "s|image/vnd.dxf|image/vnd.dxf;|" %buildroot%_datadir/applications/librecad.desktop

%fdupes -s %buildroot

%post
%desktop_database_post

%postun
%desktop_database_postun

%files
%defattr(-,root,root)
%doc gpl-2.0.txt
%_bindir/librecad
%_libdir/%name
%_mandir/man1/librecad.1*
%_datadir/applications/librecad.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