summaryrefslogtreecommitdiff
blob: ce526176461bc3c9efd88abb29029e2a001b0586 (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
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-gfx/xv/xv-3.10a-r10.ebuild,v 1.10 2005/05/16 15:29:54 killerfox Exp $

inherit ccc flag-o-matic eutils

DESCRIPTION="An interactive image manipulation program for X which can deal with a wide variety of image formats"
HOMEPAGE="http://www.trilon.com/xv/index.html"
SRC_URI="ftp://ftp.cis.upenn.edu/pub/xv/${P}.tar.gz
	mirror://gentoo/${P}-gentoo.tar.gz"

LICENSE="xv"
SLOT="0"
KEYWORDS="x86 ppc sparc alpha mips hppa ~ia64 amd64 ppc64 ppc-macos"
IUSE="jpeg tiff png"

DEPEND="virtual/x11
	jpeg? ( >=media-libs/jpeg-6b )
	tiff? ( >=media-libs/tiff-3.6.1-r2 )
	png? ( >=media-libs/libpng-1.2 >=sys-libs/zlib-1.1.4 )"

src_unpack() {
	unpack ${A}

	cd ${S}

	use ppc && epatch ${FILESDIR}/${P}-ppc.patch

	epatch ../${P}-enhanced-Nu.patch || die
	epatch ../${P}-gentoo-Nu.patch || die
	epatch ${FILESDIR}/xv-use-getcwd.patch || die
	# fix security issues #61619
	epatch ${FILESDIR}/${P}-security.diff || die

	# These patches from Dave Coffin
	# http://www.cybercom.net/~dcoffin/dcraw/
	epatch ${FILESDIR}/xv-smoothing-algorithm.diff || die
	epatch ${FILESDIR}/xv-optimize-jpeg.diff || die
	epatch ${FILESDIR}/xv-postscript-double-free.diff || die

	if use ppc-macos; then
		epatch ${FILESDIR}/${P}-xv-osx.patch
		epatch ${FILESDIR}/${P}-vdcomp-osx.patch
		epatch ${FILESDIR}/${P}-makefile-osx.patch
	fi

	# security issue with malformed filenames #83686
	epatch ${FILESDIR}/${PN}-filename-format-string.diff || die
}

src_compile() {
	if use jpeg; then
		append-flags -DDOJPEG
	else
		sed -i -e "s:JPEGLIB = -ljpeg:JPEGLIB =:" Makefile || die "sed jpeg failed"
	fi
	if use png; then
		append-flags -DDOPNG
	else
		sed -i -e "s:PNGLIB = -lpng:PNGLIB =:" Makefile || die "sed png failed"
		sed -i -e "s:ZLIBLIB = -lz:ZLIBLIB =:" Makefile || die "sed zlib failed"
	fi
	if use tiff; then
		append-flags -DDOTIFF
	else
		sed -i -e "s:TIFFLIB = -ltiff:TIFFLIB =:" Makefile || die "sed tiff failed"
	fi
	sed -i 's:CCOPTS = -O:CCOPTS = $(E_CFLAGS):' Makefile || die "sed Makefile failed"
	sed -i 's:COPTS=\t-O:COPTS= $(E_CFLAGS):' tiff/Makefile || die "sed tiff/Makefile failed"
	is-ccc && replace-cc-hardcode
	echo make E_CFLAGS="${CFLAGS}" > go.sh
	make E_CFLAGS="${CFLAGS}" || die
}

src_install() {
	dodir /usr/bin
	dodir /usr/share/man/man1

	# LIBDIR is where xv installs xvdocs.ps and we dodoc it below
	make \
		DESTDIR=${D} \
		BINDIR=${D}/usr/bin \
		MANDIR=${D}/usr/share/man/man1 \
		LIBDIR=/dev/null \
		install || die

	dodoc README INSTALL CHANGELOG BUGS IDEAS docs/*.ps docs/*.doc
}