Blob Blame History Raw
%define fontfamilyname %{name}
%define minorver -0.9

Name:          mscore
Summary:       Music Composition & Notation Software
Version:       0.9.4
Release:       3%{?dist}.1
# rtf2html is LGPLv2+
# paper4.png paper5.png are LGPLv3
# the rest is GPLv2
License:       GPLv2 and LGPLv2+ and LGPLv3
Group:         Applications/Multimedia
URL:           http://musescore.org/en
# Upstream tarball contains a non-free soundfont "Gort's Minipiano"
# We generate our own tarball by removing this soundfont via:
#    wget http://downloads.sourceforge.net/mscore/mscore-0.9.4.tar.bz2
#    tar jxf mscore-*.tar.bz2
#    rm -f mscore-*/mscore/mscore/data/piano1.sf2
#    tar jcf mscore-0.9.4-free.tar.bz2 mscore-0.9.4/
Source0:       %{name}-%{version}-free.tar.bz2
# Use Fedora's default soundfont instead of the removed one:
Patch0:        %{name}-use-pclite-soundfont.patch
# The upstream provides a stipped down version of AWL plugin for qtdesigner.
# We don't really need to package this. The full version of AWL plugin
# will be part of the upcoming muse2.
Patch1:        %{name}-no-awl-plugin.patch
# We don't build the common files (font files, wallpapers, demo song, instrument
# list) into the binary executable to reduce its size. This is also useful to 
# inform the users about the existence of different choices for common files.
# The font files need to be separated due to the font packaging guidelines.
Patch2:        %{name}-separate-commonfiles.patch
BuildRoot:     %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires: cmake jack-audio-connection-kit-devel qt4-devel
BuildRequires: alsa-lib-devel portaudio-devel fluidsynth-devel
BuildRequires: desktop-file-utils

# Fonts related:
BuildRequires: t1utils fontforge texlive fontpackages-devel
%if "%{fedora}" >= "11"
BuildRequires: tex-cm-lgc
%else
BuildRequires: tetex-font-cm-lgc
%endif

Requires:      %{name}-%{fontfamilyname}-fonts = %{version}-%{release}

# Doxygen documentation is useless. Hence we don't build it for now.
# Otherwise it needs:
# BuildRequires: graphviz doxygen texlive-latex texlive-dvips

Requires:      soundfont2

Provides:      musescore = %{name}-%{version}

%description
MuseScore is a free cross platform WYSIWYG music notation program. Some
highlights:

    * WYSIWYG, notes are entered on a "virtual note sheet"
    * Unlimited number of staves
    * Up to four voices per staff
    * Easy and fast note entry with mouse, keyboard or MIDI
    * Integrated sequencer and FluidSynth software synthesizer
    * Import and export of MusicXML and Standard MIDI Files (SMF)
    * Available in 12 languages

%package %{fontfamilyname}-fonts
Summary:       MuseScore fonts
Group:         User Interface/X
License:       GPL+ with exceptions
Requires:      fontpackages-filesystem

%description %{fontfamilyname}-fonts
MuseScore is a free cross platform WYSIWYG music notation program.

This package contains the musical notation fonts for use of MuseScore.

%prep
%setup -q 

%patch0 -p1 -b .soundfont
%patch1 -p1 -b .noawlplugin
%patch2 -p1 -b .separatecommon

# Remove the precompiled binary
rm mscore/rtf2html/rtf2html

# Force Fedora specific flags:
find . -name CMakeLists.txt -exec sed -i 's|-O3|%{optflags}|' {} \;
find . -name CMakeLists.txt -exec sed -i 's|-fno-exceptions|%{optflags}|' {} \;

# Use global fluidsynth instead of the bundled one:
sed -i 's|USE_GLOBAL_FLUID FALSE|USE_GLOBAL_FLUID TRUE|' %{name}/CMakeLists.txt

# Do not build the bundled qt scripting interface:
sed -i 's|BUILD_SCRIPT_INTERFACE TRUE|BUILD_SCRIPT_INTERFACE FALSE|' %{name}/CMakeLists.txt
sed -i 's|BUILD_SCRIPT_DEBUG TRUE|BUILD_SCRIPT_DEBUG FALSE|' %{name}/CMakeLists.txt

# Fix EOL encoding
sed 's|\r||' %{name}/rtf2html/README > tmpfile
touch -r %{name}/rtf2html/README tmpfile
mv -f tmpfile %{name}/rtf2html/README

# Fix for systems (usually 64bit ones) where size_t != unsigned int
sed -i 's|relStaff %%d, %%d|relStaff %%d, %%zd|' %{name}/%{name}/importxml.cpp

# Remove preshipped fonts. We will build them from source
rm -f %{name}/%{name}/fonts/*.ttf

%build
# Build the actual program
mkdir build
pushd build
   export PATH=${PATH}:%{_libdir}/qt4/bin
   %cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_CXX_FLAGS="%{optflags}" ../mscore
   make lupdate %{?_smp_flags}
   make lrelease %{?_smp_flags}
   make %{?_smp_flags} VERBOSE=1
popd

# Build fonts from source:
pushd %{name}/%{name}/fonts
   ./genFont
popd

%install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot}

# Install fonts
mkdir -p %{buildroot}/%{_fontdir}
install -pm 644 %{name}/%{name}/fonts/%{fontfamilyname}*.ttf %{buildroot}/%{_fontdir}

# Desktop file
desktop-file-validate %{buildroot}/%{_datadir}/applications/%{name}.desktop

# Move images to the freedesktop location
mkdir -p %{buildroot}/%{_datadir}/icons/hicolor/{32x32,64x64}/apps/
mv %{buildroot}/%{_datadir}/pixmaps/%{name}.xpm \
   %{buildroot}/%{_datadir}/icons/hicolor/32x32/apps/
mv %{buildroot}/%{_datadir}/pixmaps/%{name}.png \
   %{buildroot}/%{_datadir}/icons/hicolor/64x64/apps/

# Manpage
mkdir -p %{buildroot}/%{_mandir}/man1
install -pm 644 %{name}/packaging/%{name}.1 %{buildroot}/%{_mandir}/man1

# Openoffice templates
cp -a %{name}/utils/OOoMuseScore/ %{buildroot}/%{_datadir}/%{name}%{?minorver}

# There are many doc files spread around the tarball. Let's collect them
pushd %{name}
   mv rtf2html/ChangeLog        ChangeLog.rtf2html
   mv rtf2html/COPYING.LESSER   COPYING.LESSER.rtf2html
   mv rtf2html/README           README.rtf2html
   mv rtf2html/README.mscore    README.mscore.rtf2html
   mv rtf2html/README.ru        README.ru.rtf2html
   mv osdabzip/README           README.osdabzip
   mv osdabzip/README.mscore    README.mscore.osdabzip
   mv share/wallpaper/COPYRIGHT COPYING.wallpaper
popd

%check
# The tests seem outdated. Skipping.

%clean
rm -rf %{buildroot}

%post
touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :

%postun
if [ $1 -eq 0 ] ; then
    touch --no-create %{_datadir}/icons/hicolor &>/dev/null
    gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
fi

%posttrans
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :


%files
%defattr(-,root,root,-)
%doc mscore/{ChangeLog*,COPYING*,manual/manual-de.odt,NEWS,README*}
%{_bindir}/%{name}
%{_datadir}/%{name}%{?minorver}
%{_datadir}/icons/hicolor/*/*/*
%{_datadir}/applications/%{name}.desktop
%{_mandir}/man1/*

%_font_pkg -n %{fontfamilyname} %{fontfamilyname}*.ttf

%changelog 
* Mon Mar 23 2009 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 0.9.4-3.fc10.1
- Add BR: tetex-font-cm-lgc for Fedora < 11

* Mon Mar 23 2009 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 0.9.4-3
- Add Provides: musescore = %%{name}-%%{version}
- Replace "fluid-soundfont" requirement with "soundfont2" (just for F-10, this 
  will be "soundfont2-default" when fluid-soundfont is default in F-10)

* Fri Mar 06 2009 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 0.9.4-2
- Add extra BR:tex-cm-lgc for F-11+. This is necessary to build the fonts from source
- Update icon scriptlets according to the new guidelines

* Sat Feb 21 2009 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 0.9.4-1
- Initial Fedora build