summaryrefslogtreecommitdiff
blob: 18abcf114b429c7e93628f06e228a144fbd5421a (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
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-sound/mpg123/mpg123-0.59s-r2.ebuild,v 1.7 2004/02/18 17:40:01 azarah Exp $

inherit eutils

IUSE="mmx"

DESCRIPTION="Real Time mp3 player"
HOMEPAGE="http://www.mpg123.de/"
SRC_URI="http://www.mpg123.de/mpg123/${PN}-pre${PV}.tar.gz"

LICENSE="as-is"
SLOT="0"
KEYWORDS="x86 ia64 amd64 ppc sparc alpha hppa -mips"

DEPEND="virtual/glibc
	>=sys-apps/sed-4"
PROVIDE="virtual/mpg123"

S=${WORKDIR}/${PN}

src_unpack() {
	unpack ${A} && cd ${S} || die "unpack failed"

	# Apply security fixes
	epatch ${FILESDIR}/${P}-security.diff
	epatch ${FILESDIR}/${P}-heapfix.diff

	# Add linux-generic target
	epatch ${FILESDIR}/${PV}-generic.patch

	# Always apply this patch, even though it's particularly for
	# amd64.  It's good to understand the distinction between int and
	# long: ANSI says that int should be 32-bits, long should be the
	# native size of the CPU (usually the same as a pointer).
	epatch ${FILESDIR}/mpg123-0.59s-amd64.patch

	# Don't force gcc since icc/ccc might be possible
	sed -i -e "s|CC=gcc||" Makefile

	# Fix a glitch in the x86 related section of the Makefile
	sed -i -e "s:-m486::g" Makefile
	# Fix a glitch in the ppc-related section of the Makefile
	sed -i -e "s:-mcpu=ppc::" Makefile
	# Make sure we use our CFLAGS
	sed -i -e "s:-O2::g" Makefile
}

src_compile() {
	local style=""

	case $ARCH in
		ppc)
			style="-ppc";;
		x86)
			use mmx && style="-mmx" || style="-i486";;
		sparc*)
			style="-sparc";;
		amd64|x86_64)
			style="-x86_64";;
		alpha)
			style="-alpha";;
		arm|hppa|ia64)
			style="-generic";;
	esac

	make linux${style} CFLAGS="${CFLAGS}" || die
}

src_install() {
	into /usr
	dobin mpg123
	doman mpg123.1
	dodoc BENCHMARKING BUGS CHANGES COPYING JUKEBOX README* TODO
}