File musescore.spec of Package musescore

#
# spec file for package musescore
#
# 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.


# Internal QML imports
%global __requires_exclude qmlimport\\((MuseScore|FileIO).*

%define         rname mscore
%define         rversion 4.2.1
%define         rversion_lesser 4.2

Name:           musescore
Summary:        A free WYSIWYG music score typesetter  
Version:        %{rversion}
Release:        1
License:        GPL-2.0-or-later AND LGPL-2.0-or-later AND MIT
Group:          Productivity/Multimedia/Sound/Editors and Convertors  
Url:            https://musescore.org/ 
Vendor:         openSUSE-multimedia
BuildRoot:      %{_tmppath}/%{name}-%{rversion}-build
Source0:        https://github.com/musescore/MuseScore/archive/v%{version}/%{name}-%{version}.tar.gz
# MuseScore expect to be able to download the latest version of its soundfonts
# They are downloaded from the link conteinde in CMakeLists.text
# They are newer versions than the one included in the MuseScore tarball itself
Source1:        https://ftp.osuosl.org/pub/musescore/soundfont/MuseScore_General/MuseScore_General_Changelog.md
Source2:        https://ftp.osuosl.org/pub/musescore/soundfont/MuseScore_General/MuseScore_General_License.md
Source3:        https://ftp.osuosl.org/pub/musescore/soundfont/MuseScore_General/MuseScore_General_Readme.md
Source4:        https://ftp.osuosl.org/pub/musescore/soundfont/MuseScore_General/MuseScore_General.sf3
Source5:        README.SUSE
# PATCH-FIX-OPENSUSE: openSUSE has qmake-qt5 qmake was reserved for qt4, which is no longer present
Patch0:         %{name}-use_qmake-qt5.patch
%if 0%{?suse_version} <= 1600
BuildRequires: gcc12
BuildRequires: gcc12-c++
%else
BuildRequires: gcc
BuildRequires: gcc-c++
%endif
BuildRequires:  cmake >= 2.6
BuildRequires:  doxygen

%define fontdir %{_datadir}/fonts/%{name}
%define docdir  %{_datadir}/doc/packages/%{name}-%{rversion}

BuildRequires:  update-desktop-files 
BuildRequires:  fluidsynth-devel
BuildRequires:  portmidi-devel
BuildRequires:  texlive 
BuildRequires:  texlive-context 
BuildRequires:  texlive-dvips
BuildRequires:  fdupes
BuildRequires:  libmp3lame-devel
BuildRequires:  libqt5-linguist-devel
BuildRequires:  libqt5-qtbase-private-headers-devel
BuildRequires:  pkgconfig(alsa)
BuildRequires:  pkgconfig(freetype2)
BuildRequires:  pkgconfig(jack)
BuildRequires:  pkgconfig(libpulse)
BuildRequires:  pkgconfig(libpulse-mainloop-glib)
BuildRequires:  pkgconfig(libpulse-simple)
BuildRequires:  pkgconfig(opus)
BuildRequires:  pkgconfig(portaudio-2.0)
BuildRequires:  pkgconfig(portaudiocpp)
BuildRequires:  pkgconfig(sndfile)
BuildRequires:  pkgconfig(vorbis)
BuildRequires:  pkgconfig(vorbisenc)
BuildRequires:  pkgconfig(vorbisfile)
BuildRequires:  pkgconfig(Qt5Help)
BuildRequires:  pkgconfig(Qt5Core)
BuildRequires:  pkgconfig(Qt5Gui)
BuildRequires:  pkgconfig(Qt5Network)
BuildRequires:  pkgconfig(Qt5NetworkAuth)
BuildRequires:  pkgconfig(Qt5Test)
#BuildRequires:  pkgconfig(Qt5Qml)
BuildRequires:  pkgconfig(Qt5Quick)
BuildRequires:  pkgconfig(Qt5QuickWidgets)
BuildRequires:  pkgconfig(Qt5Sql)
BuildRequires:  pkgconfig(Qt5Widgets)
BuildRequires:  pkgconfig(Qt5X11Extras)
BuildRequires:  pkgconfig(Qt5OpenGL)
BuildRequires:  pkgconfig(Qt5PrintSupport)
BuildRequires:  pkgconfig(Qt5WebEngine)
BuildRequires:  pkgconfig(Qt5WebEngineCore)
BuildRequires:  pkgconfig(Qt5WebEngineWidgets)
BuildRequires:  pkgconfig(Qt5UiTools)
BuildRequires:  pkgconfig(Qt5Designer)
BuildRequires:  pkgconfig(poppler-qt5)
BuildRequires:  pkgconfig(Qt5Script)
BuildRequires:  pkgconfig(qtermwidget5)
#BuildRequires:  pkgconfig(Qt5WebKit)
#BuildRequires:  pkgconfig(Qt5WebKitWidgets)
BuildRequires:  pkgconfig(Qt5Xml)
BuildRequires:  pkgconfig(Qt5XmlPatterns)
BuildRequires:  pkgconfig(Qt5Svg)
BuildRequires:  pkgconfig(Qt5Concurrent)
BuildRequires:  pkgconfig(Qt5QuickControls2)
BuildRequires:  libQt5QuickTemplates2-devel
Requires:       %{name}-fonts = %{version}-%{release}
Requires:       libqt5-qtwebengine
Provides:      %{rname} = %{rversion}-%{release}

%description  
MuseScore is a graphical music typesetter. It allows for fast  
and easy note entry on a virtual note sheet. It has an  
integrated sequencer to allow for immediate play of the score.  
MuseScore can import and export MusicXml and standard Midi files.  
  
%package doc
Summary:       MuseScore documentation
Group:         Documentation/Other
Requires:      %{rname} = %{rversion}-%{release}
BuildArch:     noarch

%description doc
MuseScore is a free cross platform WYSIWYG music notation program.

This package contains the user manual of MuseScore in different languages.

%package fonts
Summary:       MuseScore fonts
Group:         System/X11/Fonts
License:       GPL-2.0-or-later AND OFL-1.1
BuildArch:     noarch
# Requires:      fontpackages-filesystem
# BuildRequires: fontforge
# BuildRequires: fontpackages-devel
# BuildRequires: tex-cm-lgc
BuildRequires: t1utils
BuildRequires: texlive

%description fonts
MuseScore is a free cross platform WYSIWYG music notation program.

%package devel
Summary:        MuseScore development files
License:        GPL-3.0-or-later WITH Font-exception-2.0 AND OFL-1.1
Group:          Development/Libraries/C and C++

%description devel
MuseScore files, used for plugin development.

%prep  
# --------------------------------- prep ---------------------------------
%setup -q -n MuseScore-%{rversion} 
%patch0 -p1
cp %{SOURCE1} %{SOURCE2} %{SOURCE3} %{SOURCE4} share/sound/
cp %{SOURCE5} .

# Fix EOL encoding
sed 's|\r||' fonts/bravura/OFL-FAQ.txt > tmpfile
touch -r fonts/bravura/OFL-FAQ.txt tmpfile
mv -f tmpfile fonts/bravura/OFL-FAQ.txt

sed 's|\r||' thirdparty/rtf2html/README > tmpfile
touch -r thirdparty/rtf2html/README tmpfile
mv -f tmpfile thirdparty/rtf2html/README

sed 's|\r||' thirdparty/rtf2html/README.ru > tmpfile
touch -r thirdparty/rtf2html/README.ru tmpfile
mv -f tmpfile thirdparty/rtf2html/README.ru

%build
%if 0%{?suse_version} <= 1600
export CC=gcc-12
export CXX=g++-12
%endif
# --------------------------------- build ---------------------------------
##export LDFLAGS="-pie"
##export CFLAGS="%%{optflags} -fPIE -pie"
##make %%{?_smp_flags} VERBOSE=1
%define __builddir build.release
%cmake \
       -DCMAKE_BUILD_TYPE=RELEASE \
       -DMUSESCORE_BUILD_CONFIGURATION=app \
       -DMUSESCORE_BUILD_MODE=release \
       -DBUILD_UNIT_TESTS=OFF \
       -DUSE_SYSTEM_FREETYPE="ON" \
       -DBUILD_TELEMETRY_MODULE=OFF \
       -DMUE_BUILD_UPDATE_MODULE=OFF \
       -DMUSESCORE_REVISION=%{revision}
%make_jobs

%install
# --------------------------------- install ---------------------------------
##make DESTDIR=%%{buildroot} install
%cmake_install

# Install fonts
mkdir -p %{buildroot}/%{fontdir}
# install -pm 644 %%{rname}/fonts/%%{fontfamilyname}*.ttf %%{buildroot}/%%{fontdir}
install -pm 644 fonts/*.ttf %{buildroot}/%{fontdir}
install -pm 644 fonts/*/*.ttf %{buildroot}/%{fontdir}
install -pm 644 fonts/*/*.otf %{buildroot}/%{fontdir}

# unique names for font docs
mv fonts/edwin/README.md         fonts/edwin/README.md.edwin
mv fonts/edwin/LICENSE.txt       fonts/edwin/LICENSE.txt.edwin
mv fonts/leland/README.md        fonts/leland/README.md.leland
mv fonts/leland/LICENSE.txt      fonts/leland/LICENSE.txt.leland

# Remove opus devel files, they are provided by system
rm -rf %{buildroot}%{_includedir}/opus
rm -rf %{buildroot}%{_libdir}/libopus.a
# Remove Development files for the Google C++ Mocking and Testing Framework, they are provided by system
rm -rf %{buildroot}%{_includedir}/gmock
rm -rf %{buildroot}%{_libdir}/libgmock*.a
rm -rf %{buildroot}%{_libdir}/pkgconfig/gmock*.pc
rm -rf %{buildroot}%{_includedir}/gtest
rm -rf %{buildroot}%{_libdir}/libgtest*.a
rm -rf %{buildroot}%{_libdir}/pkgconfig/gtest*.pc
rm -rf %{buildroot}%{_libdir}/cmake/GTest
# Delete crashpad binary
rm -rf %{buildroot}%{_bindir}/crashpad_handler

# Manpage
mkdir -p %{buildroot}/%{_mandir}/man1
install -pm 644 build.release/%{rname}.1 %{buildroot}/%{_mandir}/man1/

##### # Openoffice templates
##### cp -a %%{rname}/utils/OOoMuseScore/ %%{buildroot}/%%{_datadir}/%%{rname}-%%{rversion}

# There are many doc files spread around the tarball. Let's collect them
install -dm 755 %{buildroot}%docdir
install -pm 644 README.SUSE                         %{buildroot}%docdir/
install -pm 644 thirdparty/beatroot/COPYING         %{buildroot}%docdir/COPYING.beatroot
install -pm 644 thirdparty/beatroot/README.txt      %{buildroot}%docdir/README.txt.beatroot
install -pm 644 thirdparty/dtl/COPYING              %{buildroot}%docdir/COPYING.BSD.dtl
install -pm 644 thirdparty/intervaltree/README      %{buildroot}%docdir/README.intervaltree
install -pm 644 thirdparty/rtf2html/ChangeLog       %{buildroot}%docdir/ChangeLog.rtf2html
install -pm 644 thirdparty/rtf2html/COPYING.LESSER  %{buildroot}%docdir/COPYING.LESSER.rtf2html
install -pm 644 thirdparty/rtf2html/README          %{buildroot}%docdir/README.rtf2html
install -pm 644 thirdparty/rtf2html/README.mscore   %{buildroot}%docdir/README.mscore.rtf2html
install -pm 644 thirdparty/rtf2html/README.ru       %{buildroot}%docdir/README.ru.rtf2html
install -pm 644 tools/bww2mxml/COPYING              %{buildroot}%docdir/COPYING.bww2mxml
install -pm 644 tools/bww2mxml/README               %{buildroot}%docdir/README.bww2mxml
install -pm 644 share/sound/README.md               %{buildroot}%docdir/README.md.sound
install -pm 644 share/instruments/README.md         %{buildroot}%docdir/README.md.instruments
install -pm 644 share/wallpapers/COPYRIGHT          %{buildroot}%docdir/COPYING.wallpaper

# Package the demos; I've thought about making them a subpack, but they're just small text files, it really doesn't matter
mkdir -p %{buildroot}/%{_datadir}/%{rname}-%{rversion}/demos/
install -pm 644 demos/* %{buildroot}/%{_datadir}/%{rname}-%{rversion}/demos/

%fdupes %{buildroot}

%files
%license LICENSE.txt
%doc README.md README.SUSE
%{_bindir}/%{rname}
%{_datadir}/metainfo/org.musescore.MuseScore.appdata.xml
%{_datadir}/applications/org.musescore.MuseScore.desktop
# Demos are in musescore-2.0.2 directory
%dir %{_datadir}/%{rname}-%{rversion}
%{_datadir}/%{rname}-%{rversion}/*
# everything else in 2.0.2 has been kept in the original musescore-2.0 directory
%dir %{_datadir}/%{rname}-%{rversion_lesser}
%{_datadir}/%{rname}-%{rversion_lesser}/*
%{_datadir}/mime/packages/*.xml
%{_datadir}/icons/hicolor/*
%{_mandir}/man1/*

%files doc
%dir %{docdir}
%doc %{docdir}/*

%files fonts
%dir %{fontdir}
%{fontdir}/*.ttf
%{fontdir}/*.otf
%doc fonts/README.md
%doc fonts/bravura/bravura-text.md
%doc fonts/bravura/OFL-FAQ.txt
%doc fonts/bravura/OFL.txt

%license fonts/campania/LICENSE
%doc fonts/gootville/readme.txt

# see section 'unique names for font docs' above
%license fonts/edwin/LICENSE.txt.edwin
%doc fonts/edwin/README.md.edwin
%license fonts/leland/LICENSE.txt.leland
%doc fonts/leland/README.md.leland

%files devel
%license LICENSE.txt
%{_includedir}/kddockwidgets
%{_libdir}/cmake
%{_libdir}/libkddockwidgets.a

%changelog
openSUSE Build Service is sponsored by