File canorus.spec of Package canorus

#
# spec file for package canorus
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2012 Lars Vogdt
#
# 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:           canorus
Version:        0.7.3rc3
Release:        0
Summary:        Free cross-platform music score editor
License:        GPL-3.0+
Group:          Productivity/Multimedia/Sound/Midi
Url:            http://www.canorus.org/
Source0:        https://downloads.sourceforge.net/project/canorus/0.7.3/%{name}-%{version}.tar.bz2
Source1:        canorus.1
Source2:        canorus.xpm
# PATCH-FIX-openSUSE -- added german translation
Patch1:         canorus-0.5-desktopfile.patch
# PATCH-FIX-UPSTREAM -- userguide does not honour DESTDIR: add it
Patch2:         canorus-0.7.2-DESTDIR.patch
BuildRequires:  ImageMagick
BuildRequires:  alsa-devel
BuildRequires:  cmake
BuildRequires:  fdupes
BuildRequires:  freefont
BuildRequires:  hicolor-icon-theme
BuildRequires:  libqt5-linguist-devel
Buildrequires:  python3-devel
BuildRequires:  pkgconfig(Qt5Core)
BuildRequires:  pkgconfig(Qt5Gui)
BuildRequires:  pkgconfig(Qt5Help)
BuildRequires:  pkgconfig(Qt5PrintSupport)
BuildRequires:  pkgconfig(Qt5Svg)
BuildRequires:  pkgconfig(Qt5WebEngineWidgets) >= 5.6
BuildRequires:  pkgconfig(Qt5Xml)
BuildRequires:  swig
BuildRequires:  update-desktop-files
BuildRequires:  zlib-devel
Requires:       %{name}-python
Requires:       freefont


%description
Canorus is a free music score editor. It supports note writing, scripting
support, import/export of various file formats, MIDI input and output and more!

Note that Canorus is still in early stage of development and not nearly all the
features are implemented yet!

%package python
Summary:        Python module for %{name}
Group:          Productivity/Multimedia/Sound/Midi
Url:            http://www.canorus.org/
Requires:       %{name} = %{version}

%description python
The modules in this package allow scripting and plugins in Python to work 
with %{name}.

%lang_package

%prep
%setup -q
# set correct version
echo %{version} > VERSION
%patch -P 1 -p0
%patch -P 2 -p1
sed -i '1i #include <cmath>' src/layout/drawabletuplet.cpp

%build
export CXXFLAGS="-std=c++11"
%cmake

%install
%cmake_install
#
install -D -m644 %{name}.desktop %{buildroot}%{_datadir}/applications/%{name}.desktop
install -D -m644 %{SOURCE1} %{buildroot}%{_mandir}/man1/%{name}.1
install -D -m644 %{SOURCE2} %{buildroot}%{_datadir}/pixmaps/%{name}.xpm
strip %{buildroot}%{_bindir}/%{name}

# use the font file provided by the distribution
if [ -f %{buildroot}%{_datadir}/%{name}/fonts/FreeSans.ttf ]; then
  rm %{buildroot}%{_datadir}/%{name}/fonts/FreeSans.ttf
  ln -s %{_datadir}/fonts/truetype/FreeSans.ttf %{buildroot}%{_datadir}/%{name}/fonts/FreeSans.ttf
fi
%suse_update_desktop_file %{name} Sequencer

# the only way to avoid duplicates
rm doc/CMakeLists.txt
mkdir -pv %{buildroot}%{_defaultdocdir}/%{name}
cp -a doc -t %{buildroot}%{_defaultdocdir}/%{name}

# Create the lang file
echo "%defattr (644, root, root, 755)" >> %{name}.lang
echo "%%dir %{_datadir}/%{name}/lang/" >> %{name}.lang
for file in %{buildroot}%{_datadir}/%{name}/lang/*.qm; do
  language=$(basename $file|cut -f 2 -d _|sed 's|\..*||')
  echo %%lang\($language\) %{_datadir}/%{name}/lang/$language.qm >> %{name}.lang
done

%fdupes -s %{buildroot}

%files 
%defattr(-,root,root)
%doc AUTHORS DEVELOPERS NEWS README TODO
%doc %{_defaultdocdir}/%{name}/doc
%license COPYING
%{_bindir}/%{name}
%{_mandir}/man1/%{name}.1%{ext_man}
%exclude %{_datadir}/%{name}/lang
%{_datadir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/%{name}.xpm

%files python
%defattr(-,root,root)
%{_prefix}/lib/*

%files lang -f %{name}.lang

%changelog
openSUSE Build Service is sponsored by