summaryrefslogtreecommitdiff
blob: 6690b75e6f8854b1cd0e2eaf6f5e0d287452cded (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-sound/lilypond/lilypond-1.6.6.ebuild,v 1.10 2004/03/01 05:37:14 eradicator Exp $

inherit gcc

MY_PV="v$(echo ${PV} | cut -d. -f1,2)"
DESCRIPTION="GNU Music Typesetter"
HOMEPAGE="http://lilypond.org/"
SRC_URI="http://www.lilypond.org/ftp/${MY_PV}/${P}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="x86 alpha"
IUSE="doc"

DEPEND=">=dev-lang/python-2.2.1-r2
	>=dev-lang/perl-5.6.1-r6
	>=dev-util/guile-1.4-r3
	>=sys-devel/bison-1.35
	>=app-text/tetex-1.0.7-r12
	>=sys-apps/texinfo-4.2-r5
	>=sys-devel/flex-2.5.4a-r5
	doc? ( >=app-text/mftrace-1.0.8
		virtual/ghostscript
		>=media-libs/netpbm-9.12-r2 )"
RDEPEND=">=dev-util/guile-1.4-r3
	virtual/ghostscript
	>=app-text/tetex-1.0.7-r10
	>=dev-lang/python-2.2.1-r2"

src_compile() {
	# See http://lilypond.org/stable/Documentation/topdocs/out-www/INSTALL.html
	local flex_version=`flex --version | cut -d' ' -f2`
	case "$(gcc-version):${flex_version}" in
		2.*:*)
			# Verified by agriffis 03 Dec 2002 using
			# gcc-2.95.3-r7 with flex-2.5.4a-r5
			# (i.e. Gentoo 1.2)
			./configure --build=${CHOST} --prefix=/usr || die "configure failed"
			emake || die "emake failed"
			;;

		3.0:*)
			# Unverified
			./configure --build=${CHOST} --prefix=/usr || die "configure failed"
			make -C lily out/lexer.cc
			( cd out; patch -p1 < ../lexer-gcc-3.0.patch; )
			emake || die "emake failed"
			;;

		3.1:*)
			# Unverified
			./lexer-gcc-3.1.sh
			CPPFLAGS=-I$(pwd)/lily/out ./configure || die "configure failed"
			./lexer-gcc-3.1.sh
			emake || die "emake failed"
			;;

		# Note the following is the DEFAULT if there was no match,
		# i.e. for gcc >= 3.2
		3.2:*|*)
			# Verified by agriffis 03 Dec 2002 using
			# gcc-3.2.1 with flex-2.5.4a and flex-2.5.23
			./configure --build=${CHOST} --prefix=/usr || die "configure failed"
			# Fix std::cerr problem in flex 2.5.4a and 2.5.23
			make -C lily out/lexer.cc
			perl -i -pe 's/\scerr\s/ std::cerr /g' lily/out/lexer.cc
			emake || die "emake failed"
			;;
	esac
	#use doc && make web-doc || "make web-doc failed"
}

src_install () {
	make \
		prefix=${D}/usr \
		mandir=${D}/usr/share/man \
		infodir=${D}/usr/share/info \
		datadir=${D}/usr/share \
		lilypond_datadir=${D}/usr/share/lilypond \
		local_lilypond_datadir=${D}/usr/share/lilypond/${PV} \
		install || die "make install failed"
	dodoc AUTHORS* COPYING ChangeLog DEDICATION NEWS README.txt \
		ROADMAP THANKS VERSION *.el
	insinto /usr/share/lilypond/${PV}/buildscripts/out
	doins buildscripts/out/lilypond-profile \
		buildscripts/out/lilypond-login \
		buildscripts/out/clean-fonts
}

pkg_postinst () {
	# Cleaning out old fonts is more appropriate in pkg_prerm, but we
	# also need to clean up after any lilypond installations which may
	# not have been installed via portage.
	. /usr/share/lilypond/${PV}/buildscripts/out/clean-fonts
}

pkg_prerm () {
	. /usr/share/lilypond/${PV}/buildscripts/out/clean-fonts
}