summaryrefslogtreecommitdiff
blob: c9f08b884071033ec03ad9719900734aa1fd1b7e (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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-sound/csound/csound-5.16.6-r1.ebuild,v 1.4 2012/02/28 21:28:40 radhermit Exp $

EAPI="4"
PYTHON_DEPEND="python? 2"

inherit eutils multilib python java-pkg-opt-2 scons-utils toolchain-funcs versionator

MY_PN="${PN/c/C}"
MY_P="${MY_PN}${PV}"
DOCS_P="${MY_PN}$(get_version_component_range 1-2)"

DESCRIPTION="A sound design and signal processing system providing facilities for composition and performance"
HOMEPAGE="http://csounds.com/"
SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.gz
	html? (
		linguas_fr? ( mirror://sourceforge/${PN}/${DOCS_P}_manual-fr_html.zip )
		!linguas_fr? ( mirror://sourceforge/${PN}/${DOCS_P}_manual_html.zip )
	)
	doc? (
		linguas_fr? ( mirror://sourceforge/${PN}/${DOCS_P}_manual-fr_pdf.zip )
		!linguas_fr? ( mirror://sourceforge/${PN}/${DOCS_P}_manual_pdf.zip )
	)"

LICENSE="LGPL-2.1"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="+alsa beats chua csoundac +cxx debug double-precision dssi examples fltk +fluidsynth
html +image jack java keyboard linear lua nls osc openmp doc portaudio portmidi pulseaudio
python samples static-libs stk tcl test +threads +utils vim-syntax vst"

LANGS=" de en_GB en_US es_CO fr it ro ru"
IUSE+="${LANGS// / linguas_}"

RDEPEND=">=media-libs/libsndfile-1.0.16
	alsa? ( media-libs/alsa-lib )
	csoundac? ( x11-libs/fltk:1[threads?]
		dev-libs/boost
		=dev-lang/python-2* )
	dssi? ( media-libs/dssi
		media-libs/ladspa-sdk )
	fluidsynth? ( media-sound/fluidsynth )
	fltk? ( x11-libs/fltk:1[threads?] )
	image? ( media-libs/libpng )
	jack? ( media-sound/jack-audio-connection-kit )
	java? ( >=virtual/jdk-1.5 )
	keyboard? ( x11-libs/fltk:1[threads?] )
	linear? ( sci-mathematics/gmm )
	lua? ( dev-lang/luajit:2 )
	osc? ( media-libs/liblo )
	portaudio? ( media-libs/portaudio )
	portmidi? ( media-libs/portmidi )
	pulseaudio? ( media-sound/pulseaudio )
	stk? ( media-libs/stk )
	tcl? ( >=dev-lang/tcl-8.5
		>=dev-lang/tk-8.5 )
	utils? ( !media-sound/snd )
	vst? ( x11-libs/fltk:1[threads?]
		dev-libs/boost
		=dev-lang/python-2* )"
DEPEND="${RDEPEND}
	sys-devel/flex
	virtual/yacc
	chua? ( dev-libs/boost )
	csoundac? ( dev-lang/swig )
	html? ( app-arch/unzip )
	doc? ( app-arch/unzip )
	nls? ( sys-devel/gettext )
	test? ( =dev-lang/python-2* )
	vst? ( dev-lang/swig )"

REQUIRED_USE="vst? ( csoundac )
	java? ( cxx )
	linear? ( double-precision )
	lua? ( cxx )
	python? ( cxx )"

S="${WORKDIR}/${MY_P}"

pkg_setup() {
	if use openmp ; then
		tc-has-openmp || die "Please switch to an openmp compatible compiler"
	fi

	python_set_active_version 2
	python_pkg_setup
}

src_prepare() {
	epatch "${FILESDIR}"/${P}-scons.patch
	epatch "${FILESDIR}"/${P}-tests.patch
	epatch "${FILESDIR}"/${P}-install.patch

	cat > custom.py <<-EOF
		platform = 'linux'
		customCPPPATH = []
		customCCFLAGS = "${CFLAGS}".split()
		customCXXFLAGS = "${CXXFLAGS}".split()
		customLIBS = []
		customLIBPATH = []
		customLINKFLAGS = "${LDFLAGS}".split()
		customSHLINKFLAGS = []
		customSWIGFLAGS = []
	EOF
}

src_compile() {
	local myconf
	[[ $(get_libdir) == "lib64" ]] && myconf+=" Lib64=1"

	escons \
		prefix=/usr \
		CC="$(tc-getCC)" \
		CXX="$(tc-getCXX)" \
		buildNewParser=1 \
		pythonVersion=$(python_get_version) \
		$(use_scons alsa useALSA) \
		$(use_scons beats buildBeats) \
		$(use_scons chua buildChuaOpcodes) \
		$(use_scons csoundac buildCsoundAC) \
		$(use_scons cxx buildInterfaces) \
		$(use_scons !debug buildRelease) \
		$(use_scons !debug noDebug) \
		$(use_scons debug NewParserDebug) \
		$(use_scons double-precision useDouble) \
		$(use_scons dssi buildDSSI) \
		$(use_scons fluidsynth buildFluidOpcodes) \
		$(use_scons fltk buildCsound5GUI) \
		$(use_scons fltk useFLTK) \
		$(use_scons image buildImageOpcodes) \
		$(use_scons jack useJack) \
		$(use_scons java buildJavaWrapper) \
		$(use_scons keyboard buildVirtual) \
		$(use_scons linear buildLinearOpcodes) \
		$(use_scons lua buildLuaOpcodes) \
		$(use_scons lua buildLuaWrapper) \
		$(use_scons nls useGettext) \
		$(use_scons osc useOSC) \
		$(use_scons openmp useOpenMP) \
		$(use_scons portaudio usePortAudio) \
		$(use_scons portmidi usePortMIDI) \
		$(use_scons pulseaudio usePulseAudio) \
		$(use_scons python buildPythonOpcodes) \
		$(use_scons python buildPythonWrapper) \
		$(use_scons !static-libs dynamicCsoundLibrary) \
		$(use_scons stk buildStkOpcodes) \
		$(use_scons tcl buildTclcsound) \
		$(use_scons !threads noFLTKThreads) \
		$(use_scons threads buildMultiCore) \
		$(use_scons utils buildUtilities) \
		$(use_scons vst buildCsoundVST) \
		${myconf}
}

src_test() {
	export LD_LIBRARY_PATH="${S}" OPCODEDIR="${S}" OPCODEDIR64="${S}"
	cd tests
	./test.py || die "tests failed"
}

src_install() {
	local myconf
	[[ $(get_libdir) == "lib64" ]] && myconf+=" --word64"

	use vim-syntax && myconf+=" --vimdir=/usr/share/vim/vimfiles"

	./install.py --instdir="${D}" --prefix=/usr ${myconf} || die "install failed"
	dodoc AUTHORS ChangeLog readme-csound5-complete.txt

	# Generate env.d file
	if use double-precision ; then
		echo OPCODEDIR64=/usr/$(get_libdir)/${PN}/plugins64 > "${T}"/62${PN}
	else
		echo OPCODEDIR=/usr/$(get_libdir)/${PN}/plugins > "${T}"/62${PN}
	fi
	echo "CSSTRNGS=/usr/share/locale" >> "${T}"/62${PN}
	use stk && echo "RAWWAVE_PATH=/usr/share/csound/rawwaves" >> "${T}"/62${PN}
	doenvd "${T}"/62${PN}

	if use nls ; then
		insinto /usr/share/locale
		for lang in ${LANGS} ; do
			use linguas_${lang} && doins -r po/${lang}
		done
	fi

	if use examples ; then
		dodoc -r examples
		docompress -x /usr/share/doc/${PF}/examples
	fi

	if use html ; then
		dohtml -r "${WORKDIR}"/html/*
	fi

	if use doc ; then
		if use linguas_fr ; then
			dodoc "${WORKDIR}"/${DOCS_P}_manual-fr.pdf
		else
			dodoc "${WORKDIR}"/${DOCS_P}_manual.pdf
		fi
	fi

	use samples && dodoc -r samples
}