summaryrefslogtreecommitdiff
blob: 3a675a96638a23a5f0c00b8983a2de3883482b61 (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
# Copyright 1999-2002 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /var/cvsroot/gentoo-x86/media-gfx/povray/povray-3.50a.ebuild,v 1.2 2002/08/05 03:08:54 rphillips Exp $

S=${WORKDIR}/${P}
DESCRIPTION="POV Ray- The Persistance of Vision Ray Tracer"
SRC_URI="ftp://ftp.povray.org/pub/povray/Official/Unix/povuni_s.tgz"
HOMEPAGE="http://www.povray.org/"

SLOT="0"
LICENSE="povlegal-3.50a"
KEYWORDS="x86 ppc"


DEPEND="media-libs/libpng
	sys-libs/zlib
	X?	  ( virtual/x11 )
	icc?	( dev-lang/icc )
	svga?   ( media-libs/svgalib )"

src_compile() {

	econf || die

	# fix system default povray.ini to point to install directory
	cp povray.ini povray.ini.orig
	sed -e "s:\(/usr/\)local/\(lib\):\1share:" povray.ini.orig > povray.ini

	cd src
	cp Makefile makefile.orig

	DCPU=`echo ${CPPFLAGS} | sed -e "s/.*i\(.86\).*/\\1/"`
	echo "s/^CPPFLAGS.*-DCPU=686/CPPFLAGS = -DCPU=${DCPU}/" > makefile.sed
	
	# Change the header file with the banner when you start povray
	cp optout.h optout.h.orig
	sed -e "s/DISTRIBUTION_MESSAGE_2.*$/DISTRIBUTION_MESSAGE_2 \"Gentoo Linux - `uname -n` - ${USER}\"/" optout.h.orig > optout.h
	cp optout.h optout.h.orig
	sed -e "s/#error You must complete the following DISTRIBUTION_MESSAGE macro//" optout.h.orig > optout.h

	echo "s/^CPPFLAGS =/CPPFLAGS = -ansi -c/" >> makefile.sed

	if [ "`use icc`" ]; then
		# ICC CPPFLAGS
		echo "s/gcc/icc/" >> makefile.sed

		# Should pull from /etc/make.conf
		# If you have a P4 add -tpp7 after the -O3
		# If you want lean/mean replace -axiMKW with -x? (see icc docs for -x)
		# Note: -ipo breaks povray
		# Note: -ip breaks povray on a P3
		echo "s/^CPPFLAGS =/CPPFLAGS = -O3 -axiMKW /" >> makefile.sed
		# This is optimized for my Pentium 2:
		#echo "s/^CPPFLAGS =/CPPFLAGS = -O3 -xM -ip /" >> makefile.sed
		# This is optimized for Pentium 3 (semi-untested, I don't own one):
		#echo "s/^CPPFLAGS =/CPPFLAGS = -O3 -xK /" >> makefile.sed
		# This is optimized for Pentium 4 (untested, I don't own one):
		#echo "s/^CPPFLAGS =/CPPFLAGS = -O3 -xW -ip -tpp7 /" >> makefile.sed

		if [ "`use icc-pgo`" ]; then
			IPD=${BUILDDIR}/icc-pgo
			echo "s:^CPPFLAGS =:CPPFLAGS = -prof_dir ${IPD} :" >> makefile.sed
			if [ ! -d "${IPD}" ]; then
				mkdir -m 777 -p ${IPD}
				echo "s/^CPPFLAGS =/CPPFLAGS = -prof_gen /" >> makefile.sed
				einfo Building PGO prof_gen version.
			else 
				einfo Building PGO prof_use version. 
				echo "s/^CPPFLAGS =/CPPFLAGS = -prof_use /" >> makefile.sed
			fi
		fi
	else
		# GCC CPPFLAGS
		echo "s/^CPPFLAGS =/CPPFLAGS = -finline-functions -ffast-math /" >> makefile.sed
		echo "s/^CPPFLAGS =/CPPFLAGS = ${CFLAGS} /" >> makefile.sed
	fi

    # fix library dependency
	echo 's/LIBS = \(.*\)/LIBS = \1 -ldl/' >> makefile.sed

	cp Makefile Makefile.orig
	sed -f makefile.sed Makefile.orig > Makefile

	cd ${P}

	# stl compatibility
	patch -f -p1 < ${FILESDIR}/gentoo-3.50a.patch

	einfo Building povray
	emake || die
}

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

	mkdir -p ${D}/etc
	dosym /usr/share/povray-3.5/povray.ini /etc/povray.ini
}

pkg_postinst ()
{
	einfo "Installing configuration files"
	einfo "*Warning* I/O Security disabled by default"
	einfo "          Check /etc/povray.conf to enable"

	echo -e "[File I/O Security]\nnone" > /etc/povray.conf
	
}