summaryrefslogtreecommitdiff
blob: f7b24d3127624ab134bd7b47c92337aecdc165de (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
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-libs/mediastreamer/mediastreamer-2.2.3_p1.ebuild,v 1.1 2009/04/27 17:45:01 volkmar Exp $

EAPI="2"

inherit eutils autotools multilib

MY_P=${P/_p1/}

DESCRIPTION="Mediastreaming library for telephony application"
HOMEPAGE="http://www.linphone.org/index.php/eng/code_review/mediastreamer2"
SRC_URI="http://download.savannah.nongnu.org/releases/linphone/${PN}/${MY_P}.tar.gz
	mirror://gentoo/${P}-linphone-3.1.1.patch.tgz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~ppc"
IUSE="alsa arts debug doc examples gsm ipv6 jack oss portaudio speex theora
video X"

RDEPEND=">=net-libs/ortp-0.15.0_p1
	alsa? ( media-libs/alsa-lib )
	arts? ( kde-base/arts )
	gsm? ( media-sound/gsm )
	jack? ( media-libs/libsamplerate
		media-sound/jack-audio-connection-kit )
	portaudio? ( media-libs/portaudio )
	speex? ( >=media-libs/speex-1.2_beta3 )
	video? ( media-libs/libsdl[video,X]
		media-video/ffmpeg
		theora? ( media-libs/libtheora )
		X? ( x11-libs/libX11 ) )"
DEPEND="${RDEPEND}
	dev-util/pkgconfig
	doc? ( app-doc/doxygen )"

S=${WORKDIR}/${MY_P}

# TODO:
# run-time test for arts support
# run-time test for ipv6 : does it need ortp[ipv6] ?

# NOTES:
# in some way, v4l support is auto-magic but keeping it like that atm

pkg_setup() {
	if ! use oss && ! use alsa && ! use arts && ! use jack && ! use portaudio;
	then
		eerror "You must enable at least oss, alsa, arts, jack or portaudio"
		eerror "Please, re-emerge ${PN} with one of this USE flag enabled"
		die
	fi

	if ! use video && ( use theora || use X ); then
		ewarn "X and theora support are enabled if video USE flag is enabled"
		ewarn "If you want X or theora support, consider re-emerge with USE=\"video\""
	fi
}

src_prepare() {
	epatch "${WORKDIR}"/${P}-linphone-3.1.1.patch

	# fixing doc, oss, jack, gsm, speex, theora and X auto-magic deps
	epatch "${FILESDIR}"/${P}-autodeps.patch

	# fix arts detection for gentoo
	epatch "${FILESDIR}"/${P}-arts.patch

	# too hard to have a flexible lib dir in a clean way
	sed -i -e "s:\(/usr/kde/3.5/\)lib:\1$(get_libdir):" configure.ac \
		|| die "patching configure.ac failed"

	# respect user's CFLAGS
	sed -i -e "s:-O2::" configure.ac || die "patching configure.ac failed"

	# change default paths
	sed -i -e "s:\(\${prefix}/\)lib:\1$(get_libdir):" \
		-e "s:\(prefix/share\):\1/${PN}:" configure.ac \
		|| die "patching configure.ac failed"

	# fix html doc installation dir
#	sed -i -e "s:\$(pkgdocdir):\$(docdir):" help/Makefile.am \
#		|| die "patching help/Makefile.am failed"
	sed -i -e "s:\(doc_htmldir=\).*:\1\$(htmldir):" help/Makefile.am \
		|| die "patching help/Makefile.am failed"

	eautoreconf

	# fix arts include
	sed -i -e "s:kde/\(artsc/artsc.h\):\1:" src/arts.c \
		|| die "patching src/arts.c failed"

	# don't build examples in tests/
	sed -i -e "s:\(SUBDIRS = .*\) tests \(.*\):\1 \2:" Makefile.in \
		|| die "patching Makefile.in failed"
}

src_configure() {
	# strict: don't want -Werror
	# macsnd and macaqsnd: macosx related
	# external-ortp: don't use bundled libs
	econf \
		--htmldir=/usr/share/doc/${PF}/html \
		--datadir=/usr/share/${PN} \
		--libdir=/usr/$(get_libdir) \
		--disable-strict \
		--disable-macsnd \
		--disable-macaqsnd \
		--enable-external-ortp \
		--disable-dependency-tracking \
		$(use_enable alsa) \
		$(use_enable arts artsc) \
		$(use_enable debug) \
		$(use_enable doc) \
		$(use_enable gsm) \
		$(use_enable ipv6) \
		$(use_enable jack) \
		$(use_enable oss) \
		$(use_enable portaudio) \
		$(use_enable speex) \
		$(use_enable theora) \
		$(use_enable video) \
		$(use_enable X x11)
}

src_install() {
	emake DESTDIR="${D}" install || die "emake install failed"

	dodoc AUTHORS ChangeLog NEWS README || die "dodoc failed"

	if use examples; then
		insinto /usr/share/doc/${PF}/examples
		doins tests/*.c || die "doins failed"
	fi
}