summaryrefslogtreecommitdiff
blob: 92c00f5714108ec321a35cd35bab216aad08ba33 (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-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-video/mjpegtools/mjpegtools-1.6.2-r4.ebuild,v 1.11 2006/02/04 16:30:11 flameeyes Exp $

inherit flag-o-matic toolchain-funcs eutils autotools

M4V="1"

DESCRIPTION="Tools for MJPEG video"
HOMEPAGE="http://mjpeg.sourceforge.net/"
SRC_URI="mirror://sourceforge/mjpeg/${P}.tar.gz
	mirror://gentoo/${PN}-m4-${M4V}.tar.bz2
	http://dev.gentoo.org/~luckyduck/patches/${P}-mmx-fPIC.patch.bz2"

LICENSE="as-is"
SLOT="1"
KEYWORDS="alpha amd64 ppc ppc64 sparc x86"
IUSE="gtk dv quicktime sdl X yv12 3dnow mmx sse v4l dga"

RDEPEND="media-libs/jpeg
	x86? ( media-libs/libmovtar
		mmx? ( >=media-libs/jpeg-mmx-0.1.6 )
	)
	gtk? ( =x11-libs/gtk+-1.2*
		=dev-libs/glib-1.2* )
	dv? ( >=media-libs/libdv-0.99 )
	quicktime? ( virtual/quicktime )
	sdl? ( >=media-libs/libsdl-1.2.7-r3 )
	X? ( virtual/x11 )"

DEPEND="${RDEPEND}
	x86? ( mmx? ( dev-lang/nasm )
		3dnow? ( dev-lang/nasm )
		sse? ( dev-lang/nasm )
		)
	>=sys-apps/sed-4"

src_unpack() {
	unpack ${A} ; cd ${S}

	epatch ${FILESDIR}/${P}-configure.patch
	epatch ${FILESDIR}/${P}-fPIC.patch
	epatch ${FILESDIR}/${P}-gcc34.patch
	epatch ${FILESDIR}/${P}-libquicktime094.patch
	epatch ${WORKDIR}/${P}-mmx-fPIC.patch

	if use ppc; then
		# Fix an error in the detection of the altivec-support
		# in the compiler
		epatch "${FILESDIR}/altivec-fix-${PV}.patch"
		sed -i -e 's:-O3::' configure.in
		#Worst workaround ever...
		sed -i -e "s/const vector signed short/vector signed short/g" \
			${S}/utils/altivec/fdct_idct.c
	fi

	AT_M4DIR="${WORKDIR}/m4" eautoreconf

	use X || epatch "${FILESDIR}/no-x11-lib-2.patch"
}

src_compile() {
	local myconf

	if use yv12 && use dv; then
		myconf="${myconf} --with-dv-yv12"
	elif use yv12; then
		ewarn "yv12 support is possible when 'dv' is in your USE flags."
	fi

	# This could be changed to allow building on g/fbsd in the future.
	if use x86; then
		if use mmx || use 3dnow || use sse; then
			myconf="${myconf} --enable-simd-accel"
		fi
		if use mmx; then
			myconf="${myconf} --with-jpeg-mmx=/usr/include/jpeg-mmx"
		fi

		if [[ ${CHOST/i686/} != ${CHOST} ]] || [[ ${CHOST/x86_64/} != ${CHOST} ]]; then
			myconf="${myconf} --enable-cmov-extension"
		fi

		[[ $(gcc-major-version) -eq 3 ]] && append-flags -mno-sse2
	fi

	econf \
		$(use_with X x) \
		$(use_enable dga xfree-ext) \
		$(use_with quicktime) \
		$(use_with v4l) \
		$(use_with gtk) \
		$(use_with sdl) \
		$(use_with dv dv /usr) \
		--enable-largefile \
		${myconf} || die "configure failed"

	emake CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" -j1 || die "emake failed"
	cd docs
	local infofile
	for infofile in mjpeg*info*; do
		echo "INFO-DIR-SECTION Miscellaneous" >> ${infofile}
		echo "START-INFO-DIR-ENTRY" >> ${infofile}
		echo "* mjpeg-howto: (mjpeg-howto).                  How to use the mjpeg-tools" >> ${infofile}
		echo "END-INFO-DIR-ENTRY" >> ${infofile}
	done
}

src_install() {
	einstall || die "install failed"
	dodoc mjpeg_howto.txt README PLANS NEWS README.AltiVec README.avilib \
		README.DV README.glav README.lavpipe README.transist TODO \
		HINTS BUGS ChangeLog AUTHORS CHANGES
}