summaryrefslogtreecommitdiff
blob: 1eb03def6167c6dc523d3ee2aecb0ae1def5f5f1 (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
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-libs/capseo/capseo-0.3.0_pre200712251-r2.ebuild,v 1.3 2009/03/24 03:13:07 jer Exp $

inherit flag-o-matic multilib

DESCRIPTION="Capseo Video Codec Library"
HOMEPAGE="http://rm-rf.in/captury/wiki/CapseoCodec"
SRC_URI="http://upstream.rm-rf.in/captury/captury-${PV}.tar.bz2"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~hppa ~ppc ~ppc64 ~x86"
IUSE="debug theora"

RDEPEND=">=media-libs/libtheora-1.0_alpha6-r1"
DEPEND="${RDEPEND}
	x86? ( >=dev-lang/yasm-0.4.0 )
	amd64? ( >=dev-lang/yasm-0.4.0 )
	dev-util/pkgconfig"

S="${WORKDIR}/captury-${PV}/${PN}"

EMULTILIB_PKG="true"

src_unpack() {
	unpack ${A} || die

	cd "${S}"
	einfo "pwd: $(pwd)"
	epatch "${FILESDIR}/no-cpsplay.diff"

	if [[ ! -f configure ]]; then
		./autogen.sh || die "autogen.sh failed"
	fi
}

src_compile() {
	if [[ -z ${OABI} ]] && has_multilib_profile; then
		use debug && append-flags -O0 -g3
		use debug || append-flags -DNDEBUG=1

		einfo "Building multilib ${PN} for ABIs: $(get_install_abis)"
		OABI=${ABI}
		for ABI in $(get_install_abis); do
			export ABI=${ABI}
			src_compile
		done
		ABI=${OABI}
		return
	fi

	cd "${S}" || die

	# obviousely in src_install() it is set to "default" on non-multilib hosts,
	# but isn't in src_compile()
	ABI=${ABI:-default}

	mkdir abi-${ABI}
	cd abi-${ABI}

	local myconf=
	case ${ABI} in
		amd64|x86)
			myconf="${myconf} --with-accel=${ABI}"
			;;
	esac

	if is_final_abi; then
		myconf="${myconf} $(use_enable theora)"
	else
		# drop unnecessary theora dependency for secondary ABIs (as theora is
		# only used for the cpsrecode tool anyway).
		# see bug 200093.
		myconf="${myconf} --disable-theora"
	fi

	../configure ${myconf} \
		--prefix="/usr" \
		--host="$(get_abi_CHOST ${ABI})" \
		--libdir="/usr/$(get_libdir)" \
		|| die "./configure for ABI ${ABI} failed"

	emake || die "make for ABI ${ABI} failed"
}

src_install() {
	for ABI in $(get_install_abis); do
		make -C abi-${ABI} install DESTDIR="${D}" || die "make install for ABI ${ABI} failed."
	done

	rm "${D}/usr/bin/cpsplay" # currently unsupported

	dodoc AUTHORS ChangeLog* NEWS README* TODO
}

pkg_postinst() {
	einfo "Use the following command to re-encode your screen captures to a"
	einfo "file format current media players do understand:"
	einfo
	einfo "    cpsrecode -i capture.cps -o - | mencoder - -o capture.avi \\"
	einfo "              -ovc lavc -lavcopts vcodec=xvid:autoaspect=1"
	einfo
	einfo "or play in-place via mplayer:"
	einfo
	einfo "    cpsrecode -i capture.cps -o - | mplayer -demuxer y4m -"
	einfo
	einfo "or if use-flag theora enabled, create your ogg/theora file inplace:"
	einfo
	einfo "    cpsrecode -i capture.cps -o capture.ogg -c theora"
	echo
}

# vim:ai:noet:ts=4:nowrap