media-sound/qmidiroute: EAPI-7 bump
[gentoo.git] / media-sound / lilypond / lilypond-2.21.1.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5 PYTHON_COMPAT=( python3_{6,7,8} )
6
7 inherit elisp-common autotools python-single-r1 toolchain-funcs xdg-utils
8
9 if [[ "${PV}" = "9999" ]]; then
10         inherit git-r3
11         EGIT_REPO_URI="https://git.savannah.gnu.org/git/lilypond.git"
12 else
13         MAIN_VER=$(ver_cut 1-2)
14         SRC_URI="http://lilypond.org/download/sources/v${MAIN_VER}/${P}.tar.gz"
15         KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~x86"
16 fi
17
18 DESCRIPTION="GNU Music Typesetter"
19 HOMEPAGE="http://lilypond.org/"
20
21 LICENSE="GPL-3 FDL-1.3"
22 SLOT="0"
23 IUSE="debug emacs guile2 profile vim-syntax"
24 REQUIRED_USE="${PYTHON_REQUIRED_USE}"
25
26 BDEPEND="
27         >=dev-texlive/texlive-metapost-2013
28         || (
29                 >=app-text/texlive-core-2013
30                 >=dev-tex/metapost-1.803
31         )
32         >=sys-apps/texinfo-4.11
33         >=sys-devel/bison-2.0
34         sys-devel/flex
35         virtual/pkgconfig
36 "
37 RDEPEND=">=app-text/ghostscript-gpl-8.15
38         >=dev-scheme/guile-1.8.2:12=[deprecated,regex]
39         media-fonts/tex-gyre
40         media-libs/fontconfig
41         media-libs/freetype:2
42         >=x11-libs/pango-1.12.3
43         emacs? ( >=app-editors/emacs-23.1:* )
44         guile2? ( >=dev-scheme/guile-2:12 )
45         !guile2? (
46                 >=dev-scheme/guile-1.8.2:12=[deprecated,regex]
47                 <dev-scheme/guile-2.0:12
48         )
49         ${PYTHON_DEPS}"
50 DEPEND="${RDEPEND}
51         app-text/t1utils
52         dev-lang/perl
53         dev-libs/kpathsea
54         media-gfx/fontforge[png]
55         sys-devel/gettext"
56
57 # Correct output data for tests isn't bundled with releases
58 RESTRICT="test"
59
60 PATCHES=(
61         "${FILESDIR}"/${P}-fix-font-size.patch
62 )
63
64 DOCS=( DEDICATION HACKING README.txt ROADMAP )
65
66 pkg_setup() {
67         # make sure >=metapost-1.803 is selected if it's installed, bug 498704
68         if [[ ${MERGE_TYPE} != binary ]] && has_version ">=dev-tex/metapost-1.803" ; then
69                 if [[ $(readlink "${EROOT}"/usr/bin/mpost) =~ mpost-texlive-* ]] ; then
70                         einfo "Updating metapost symlink"
71                         eselect mpost update || die
72                 fi
73         fi
74
75         python-single-r1_pkg_setup
76 }
77
78 src_prepare() {
79         default
80
81         if ! use vim-syntax ; then
82                 sed -i 's/vim//' GNUmakefile.in || die
83         fi
84
85         # respect CFLAGS
86         sed -i 's/OPTIMIZE -g/OPTIMIZE/' aclocal.m4 || die
87
88         # remove bundled texinfo file (fixes bug #448560)
89         rm tex/texinfo.tex || die
90
91         eautoreconf
92
93         xdg_environment_reset #586592
94 }
95
96 src_configure() {
97         # documentation generation currently not supported since it requires a newer
98         # version of texi2html than is currently in the tree
99
100         local myeconfargs=(
101                 --with-texgyre-dir=/usr/share/fonts/tex-gyre
102                 --disable-documentation
103                 --disable-optimising
104                 --disable-pipe
105                 $(use_enable debug debugging)
106                 $(use_enable profile profiling)
107         )
108
109         econf "${myeconfargs[@]}"
110 }
111
112 src_compile() {
113         default
114
115         if use emacs ; then
116                 elisp-compile elisp/lilypond-{font-lock,indent,mode,what-beat}.el \
117                         || die "elisp-compile failed"
118         fi
119 }
120
121 src_install() {
122         emake DESTDIR="${D}" vimdir=/usr/share/vim/vimfiles install
123
124         # remove elisp files since they are in the wrong directory
125         rm -r "${ED}"/usr/share/emacs || die
126
127         if use emacs ; then
128                 elisp-install ${PN} elisp/*.{el,elc} elisp/out/*.el \
129                         || die "elisp-install failed"
130                 elisp-site-file-install "${FILESDIR}"/50${PN}-gentoo.el
131         fi
132
133         python_fix_shebang "${ED}"
134
135         einstalldocs
136 }
137
138 pkg_postinst() {
139         use emacs && elisp-site-regen
140 }
141
142 pkg_postrm() {
143         use emacs && elisp-site-regen
144 }