File lilypond.spec of Package lilypond
#
# spec file for package lilypond (Version 2.12.3)
#
# Copyright (c) 2010 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:           lilypond
BuildRequires:  bison fdupes perl
BuildRequires:  flex
BuildRequires:  freetype2-devel
BuildRequires:  emacs-nox
BuildRequires:  gcc-c++
BuildRequires:  fontconfig freetype2
BuildRequires:  ghostscript-fonts-std libgimpprint libpng12-0
BuildRequires:  dejavu xorg-x11-fonts xorg-x11-fonts-core xorg-x11-fonts-devel
BuildRequires:  ghostscript-library >= 8.64
BuildRequires:  gettext => 0.17 libgnutls-extra-devel libgnutls-extra26
# openSUSE bug: guile-devel should depend on libtool/libltdl-devel
BuildRequires:  guile >= 1.8.2 guile-devel >= 1.8.2
BuildRequires:  cairo info
BuildRequires:  libtool
BuildRequires:  netpbm
BuildRequires:  ImageMagick
BuildRequires:  pango pango-devel >= 1.12
BuildRequires:  python-devel >= 2.4
BuildRequires:  python-xml
BuildRequires:  scrollkeeper
BuildRequires:  fontforge >= 20060125
BuildRequires:  boost-devel rsync
#BuildRequires:  texinfo >= 4.12
BuildRequires:  texi2html >= 1.80
#BuildRequires:  t1utils >= 1.33 # ugh, LilyPond recommends 1.33!
BuildRequires:  t1utils >= 1.26
BuildRequires:  texlive-devel texlive-latex texlive-metapost
BuildRequires:  zip
#BuildRequires:	a2ps libspectre1
%define info yes
License:        GPLv2
Group:          Productivity/Publishing/Other
Requires:       fontconfig >= 2.2
Requires:       guile >= 1.8.2
Requires:       ghostscript-library >= 8.60
Requires:       pango >= 1.12
Requires:       python >= 2.4
Summary:        Music Typesetter
Version:        2.12.3
Release:        6
Url:            http://lilypond.org/website/source.html
Source:         %{name}-%{version}.tar.bz2
# Amazing, rpmlint has a broken rule to check for gzipping of info
# pages.  You'd almost think someone really does not *want* to support
# images in info :-)
Source1:        %{name}-2.12.2-rpmlintrc
#Source2:        %%{name}-%%{version}-1.documentation.tar.bz2
Source3:        changelog
Source4:        lilypond-2.12.3-learning-info.patch
Source5:        lilypond-2.12.3-program-info.patch
#Remove make-info command from make install-info in GNUMakefile.in
Patch0:         lilypond-2.12.3-install-info.patch
# Fix build issues with gcc45 - drop vector<Grob*>:: in spacing-spanner.cc - constructors should not be called directly
Patch1:         lilypond-2.12.3-gcc45fix.patch
# Fix texlive-bin-2010 bibtex issue where it no longer writes to to any directory :
# a) other than a subdirectory of the current directory
# b) a subdirectory of TEXMFOUTPUT
Patch2:         lilypond-bib2html.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
PreReq:         %install_info_prereq /usr/bin/touch /usr/bin/sed
%description
LilyPond is a music typesetter, an automated engraving system.  It
produces beautiful sheet music using a high level description file as input.
LilyPond supports many forms of music notation constructs, including
chord names, drum notation, figured bass, grace notes, guitar tablature,
modern notation (cluster notation and rhythmic grouping), tremolos,
(nested) tuplets in arbitrary ratios, and more.
LilyPond's text-based music input language support can integrate into
LaTeX, HTML and Texinfo seamlessly, allowing single sheet music
or musicological treatises to be written from a single source.  Form and
content are separate, and with LilyPond's expert automated formatting,
users don't need typographical expertise to produce good notation.
LilyPond produces PDF, PostScript, SVG, or TeX printed output, as well
as MIDI for listening pleasures.  LilyPond is exported from the
RoseGarden and NoteEdit GUIs, and can import ABC, ETF and MIDI.
LilyPond is part of the GNU Project.
Authors:
--------
   Erlend Aasland <erlenda@gmail.com>
   Pal Benko <benkop@freestart.hu>
   Juliusz Chroboczek <jch@pps.jussieu.fr>
   David Feuer <david.feuer@gmail.com>
   Bernard Hurley <bernard@fong-hurley.org.uk>
   Chris Jackson <chris@fluffhouse.org.uk>
   Heikki Junes <heikki.junes@hut.fi>
   Reinhold Kainhofer <reinhold@kainhofer.com>
   Michael Krause <m.krause@tu-harburg.de>
   Jean-Baptiste Lamy <jiba@tuxfamily.org>
   Werner Lemberg <wl@gnu.org>
   Joe Neeman <joeneeman@gmail.com>
   Han-Wen Nienhuys <hanwen@xs4all.nl>
   Jan Nieuwenhuizen <janneke@gnu.org>
   Jürgen Reuter <reuter_j@web.de>
   Nicolas Sceaux <nicolas.sceaux@free.fr>
   Carl Sorensen <c_sorensen@byu.edu>
   Rune Zedeler <rune@zedeler.dk>
   FONT
   Jürgen Reuter <reuter_j@web.de>
   Werner Lemberg <wl@gnu.org>
   Chris Jackson <chris@fluffhouse.org.uk>
   Rune Zedeler <rune@zedeler.dk>
   Han-Wen Nienhuys <hanwen@xs4all.nl>
   Jan Nieuwenhuizen <janneke@gnu.org>
   Tom Cato Amundsen <tca@gnu.org>
   Arno Waschk <arno@arnowaschk.de>
   SUPPORT (distributions, editor support, lilypond-book)
   Anthony Fok <foka@debian.org>
   Chris Jackson <chris@fluffhouse.org.uk>
   Heikki Junes <heikki.junes@hut.fi>
   David Svoboda <svoboda@cmu.edu>
#'
%package documentation
License:        GPLv2
Summary:        Music Typesetter
Group:          Productivity/Publishing/Other
AutoReqProv:    on
BuildArch:      noarch
%description documentation
Documentation files for the GNU LilyPond music typesetter.
Authors:
--------
   Mats Bengtsson <mats.bengtsson@s3.kth.se>
   Heikki Junes <heikki.junes@hut.fi>
   John Mandereau <john.mandereau@free.fr>
   Christian Mondrup <scancm@biobase.dk>
   Han-Wen Nienhuys <hanwen@xs4all.nl>
   Jan Nieuwenhuizen <janneke@gnu.org>
   Graham Percival <gpermus@gmail.com>
   François Pinard <pinard@iro.umontreal.ca>
   Rune Zedeler <rune@zedeler.dk>
   TRANSLATIONS
   Bjoern Jacke <bjoern.jacke@gmx.de>
   Neil Jerram <nj104@cus.cam.ac.uk>
   Heikki Junes <heikki.junes@hut.fi>
   Tineke de Munnik <tdm@dds.nl>
   August S. Sigov <august@infran.ru>
   David González
   Nicolas Grandclaude <ngclaude@123mail.org>
   Jean-Charles Malahieude <lolyfan@wanadoo.fr>
   John Mandereau <john.mandereau@free.fr>
   Gauvain Pocentek <gauvainpocentek@yahoo.fr>
   Ludovic Sardain <ludovicsardain@gmail.com>
%prep
%setup -q
%patch0
%patch1
%patch2
# Convert translations to UTF-8
for file in $(grep -L charset=UTF-8 po/*.po) ; do
    msgconv -t UTF-8 $file >$file.new
    mv $file.new $file
done
mkdir -p out/examples/
tar -cf - input/  | tar -C out/examples/ -xf- || true
%define _docdir %{_prefix}/share/doc/packages/%{name}
%define _buildir $PWD
%{?suse_update_config:%{suse_update_config -f}}
%build
# autoreconf -f -i || true
# export GS_LIB="/home/$USER/.fonts" is a work around for bnc#568280
export GS_LIB="/home/$USER/.fonts:%{_buildir}/mf/out"
export CFLAGS="-fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -ggdb"
#export CFLAGS="$RPM_OPT_FLAGS -ggdb -fpermissive -fabi-version=4"
export CXXFLAGS="$CFLAGS"
#sed -i -e 's@strchr@(char*) strchr@' lily/relocate.cc # 2.12.2 does not support gcc-4.4
#sed -i -e 's@de, \<ja\>@de@' python/langdefs.py # japanese doc is broken in 2.12.2
#sed -i -e 's@ \<ja\>@@' Documentation/GNUmakefile # japanese doc is broken in 2.12.2
%configure
#
gs -h
%__make %{?jobs:-j%{jobs}} all
# build documentation
make doc
#make info
# brp-compress ignorantly compress the symlink (or directory) for Info images.
#      ERROR: link target doesn't exist (neither in build root nor in installed system):
#      /usr/share/info/lilypond-snippets.gz -> /usr/doc/packages/lilypond/html/input/lsr/.gz
%define __os_install_post \
    %{suse_check} \
    /usr/lib/rpm/brp-compress \
    (cd %{buildroot}/usr/share/info; \
      rm -f lilypond.gz; \
      ln -sf ../doc/packages/lilypond/html/Documentation/user lilypond; \
      rm -f lilypond-snippets.gz; \
      ln -sf ../doc/packages/lilypond/html/input/lsr lilypond-snippets) \
    /usr/lib/rpm/brp-symlink
%install
make DESTDIR=%{buildroot} install
# install and clean up documentation subtree
#ChangeLog
# install examples
mkdir -p %{buildroot}%{_docdir}/examples
find input \( -name '*.*ly' -o -name '*.abc' -o -name '*.tex' \)\
    ! -regex '.*/out-www/.*'  ! -regex '.*/out/.*' \
    -exec cp -a --parents '{}' %{buildroot}/usr/share/doc/packages/%{name}/examples ';'
# install documentation
make install-doc webdir=%{buildroot}%{_docdir}/html
cp -a AUTHORS.txt COPYING \
  DEDICATION HACKING NEWS.txt README.txt ROADMAP \
  THANKS VERSION elisp/server.el.patch \
  %{buildroot}%{_docdir}
%__install -m0644 "%{SOURCE3}" "%{buildroot}%{_docdir}"
find %{buildroot}%{_docdir}/html -name *.signature -exec rm {} \;
chmod 755 %{buildroot}%{_datadir}/%{name}/%{version}/python/langdefs.py
# Fix images in info docs -- harder than it should.  Apparently, Check as well as
# brp-compress are unprepared for Info image links or image directories (available since 2004).
#     ERROR: link target doesn't exist (neither in build root nor in installed system):
#    /usr/share/info/lilypond-snippets.gz -> /usr/doc/packages/lilypond/html/input/lsr/.gz
 (cd %{buildroot}/usr/share/info \
  && rm -f lilypond && ln -sf ../doc/packages/lilypond/html/Documentation/user lilypond\
  && rm -f lilypond-snippets && ln -sf ../doc/packages/lilypond/html/input/lsr lilypond-snippets)
#Fix dir entry in lilypond-learning.info and lilypond-program.info
pushd %{buildroot}%{_infodir}
patch --no-backup-if-mismatch lilypond-learning.info %{SOURCE4}
patch --no-backup-if-mismatch lilypond-program.info %{SOURCE5}
popd
%find_lang %{name}
texhash %{buildroot}%{_datadir}/lilypond/%{version}
%fdupes -s %{buildroot}%{_docdir}/
find %{buildroot}%{_docdir}/ -empty -delete
%clean
rm -rf %{buildroot}
%post
%install_info --info-dir=%{_infodir} %{_infodir}/%{name}.info.gz
%install_info --info-dir=%{_infodir} %{_infodir}/music-glossary.info.gz
%install_info --info-dir=%{_infodir} %{_infodir}/lilypond-learning.info.gz
%install_info --info-dir=%{_infodir} %{_infodir}/lilypond-program.info.gz
#%%install_info --info-dir=%%{_infodir} %%{_infodir}/lilypond-snippets.info.gz
%install_info --info-dir=%{_infodir} %{_infodir}/lilypond-internals.info.gz
touch var/adm/SuSEconfig/run-scrollkeeper-update
%postun
%install_info_delete --info-dir=%{_infodir} %{_infodir}/%{name}.info.gz
for i in 1 2 3 4 5; do
  %install_info_delete --info-dir=%{_infodir} "%{_infodir}/%{name}.info-$i.gz"
done
%install_info_delete --info-dir=%{_infodir} %{_infodir}/music-glossary.info.gz
%install_info_delete --info-dir=%{_infodir} %{_infodir}/lilypond-learning.info.gz
for i in 1 2; do
  %install_info_delete --info-dir=%{_infodir} "%{_infodir}/lilypond-learing.info-$i.gz"
done
%install_info_delete --info-dir=%{_infodir} %{_infodir}/lilypond-program.info.gz
#%%install_info_delete --info-dir=%%{_infodir} %%{_infodir}/lilypond-snippets.info.gz
#for i in 1 2; do
#  %%install_info_delete --info-dir=%%{_infodir} "%%{_infodir}/lilypond-snippets.info-$i.gz"
#done
%install_info_delete --info-dir=%{_infodir} %{_infodir}/lilypond-internals.info.gz
for i in 1 2 3 4 ; do
  %install_info_delete --info-dir=%{_infodir} "%{_infodir}/lilypond-internals-$i.gz"
done
touch var/adm/SuSEconfig/run-scrollkeeper-update
if [ $1 = 0 ] ; then
  sed -i '
    s@^\(TEXMF[[:space:]]*=.*\)\(,!!/usr/share/lilypond/[^,}]*\)\(.*\)}@\1\3}@;
    s@^\(TEXMFDBS[[:space:]]*=.*\)\(;/usr/share/lilypond/[^;]*\)\(.*\)@\1\3@;
    ' etc/texmf/web2c/texmf.cnf
fi
%triggerin -- texlive
sed -i '
  s@^\(TEXMF[[:space:]]*=.*\)\(,!!/usr/share/lilypond/[^,}]*\)\(.*\)}@\1\3}@;
  s@^\(TEXMFDBS[[:space:]]*=.*\)\(;/usr/share/lilypond/[^;]*\)\(.*\)@\1\3@;
  s@^\(TEXMF[[:space:]]*=.*\)}@\1,!!/usr/share/lilypond/%{version}}@;
  s@^\(TEXMFDBS[[:space:]]*=.*\)@\1;/usr/share/lilypond/%{version}@;
  ' etc/texmf/web2c/texmf.cnf
texhash usr/share/lilypond/%{version}
exit 0
#%%post documentation
#%%install_info --info-dir=%%{_infodir} %%{_infodir}/lilypond-snippets.info-images-dir-dep.gz
#%%install_info --info-dir=%%{_infodir} %%{_infodir}/lilypond.info-images-dir-dep.gz
#%%postun documentation
#%%install_info_delete --info-dir=%%{_infodir} %%{_infodir}/lilypond-snippets.info-images-dir-dep.gz
#%%install_info_delete --info-dir=%%{_infodir} %%{_infodir}/lilypond.info-images-dir-dep.gz
%files -f %{name}.lang
%defattr(-,root,root)
%dir %{_libdir}/lilypond
%dir %{_libdir}/lilypond/%{version}
%dir %{_libdir}/lilypond/%{version}/python
%{_libdir}/lilypond/%{version}/python/midi.so
%{_prefix}/bin/*
%dir %{_prefix}/share/lilypond
%dir %{_prefix}/share/lilypond/%{version}
%{_prefix}/share/lilypond/%{version}/[a-km-z]*
%{_prefix}/share/lilypond/%{version}/ly
%ghost %{_datadir}/%{name}/%{version}/ls-R
%{_prefix}/share/omf/lilypond
%{_datadir}/emacs/site-lisp/*.el
%doc %{_mandir}/man?/*.*
%{_docdir}/AUTHORS.txt
%{_docdir}/COPYING
%{_docdir}/changelog
%{_docdir}/DEDICATION
%{_docdir}/HACKING
%{_docdir}/NEWS.txt
%{_docdir}/README.txt
%{_docdir}/ROADMAP
%{_docdir}/THANKS
%{_docdir}/VERSION
%{_docdir}/server.el.patch
%{_infodir}/lilypond-learning.info.gz
%{_infodir}/lilypond-learning.info-?.gz
%{_infodir}/lilypond-program.info.gz
%{_infodir}/music-glossary.info.gz
%{_infodir}/lilypond.info.gz
%{_infodir}/lilypond.info-?.gz
%{_infodir}/lilypond-internals.info.gz
%{_infodir}/lilypond-internals.info-?.gz
#%%{_infodir}/lilypond-snippets.info-?.gz
%files documentation
%defattr(-,root,root)
%{_docdir}/html
%{_docdir}/examples
%dir %{_docdir}
%{_docdir}/html/*
%{_docdir}/examples/*
%{_infodir}/lilypond-snippets
%{_infodir}/lilypond
%changelog