summaryrefslogtreecommitdiff
blob: 39b627fde56b47e8c206d07981b3df20df5d6411 (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
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-gfx/radiance/radiance-3.5.ebuild,v 1.5 2004/04/27 21:48:33 agriffis Exp $

inherit eutils

MY_P=${P/./R}
MY_P=${MY_P/radiance-/rad}

IUSE="X"

DESCRIPTION="Radiance is a suite of programs for the analysis and visualization of lighting in design"
HOMEPAGE="http://radsite.lbl.gov/radiance/"
SRC_URI="http://radsite.lbl.gov/${PN}/dist/$MY_P.tar.gz"

LICENSE="Radiance"
SLOT="0"
KEYWORDS="~x86"

DEPEND="media-libs/tiff
	app-shells/tcsh
	X? ( virtual/x11 dev-lang/tk )"

src_unpack() {
	unpack ${A}
	cd ${WORKDIR}/ray
	mkdir -p src/lib

	use X ||  epatch ${FILESDIR}/${P}-noX11.patch

	# patch to not build libtiff that comes with Radiance
	cp src/px/Rmakefile src/px/Rmakefile.orig
	sed -e "s/\.\.\/lib\/libtiff\.a$//g" \
		src/px/Rmakefile.orig > src/px/Rmakefile

	# fix syntax error in standard.h
	cp src/common/standard.h src/common/standard.h.orig
	sed -e "s/error(et,em) else$/error(et,em); else/g" \
		src/common/standard.h.orig > src/common/standard.h

	# fix incorrect use of errno.h
	cp src/cal/ev.c src/cal/ev.c.orig
	sed -e "s/extern int  errno;/#include <errno.h>/g" \
		src/cal/ev.c.orig > src/cal/ev.c
}

src_compile() {
	mkdir -p ${T}/bin
	mkdir -p ${T}/bin/dev
	mkdir -p ${T}/lib/ray

	cd ${WORKDIR}/ray/src
	local srcdirs="common meta cv gen ot rt px hd util cal"
	for i in $srcdirs ;
	do
		pushd $i
		make "SPECIAL=" \
			"OPT=$CFLAGS -DSPEED=200" \
			"MACH=-Dlinux -L/usr/X11R6/lib -I/usr/include/X11 -DNOSTEREO -DBIGMEM" \
			ARCH=IBMPC "COMPAT=bmalloc.o erf.o getpagesize.o" \
			INSTDIR=${T}/bin \
			LIBDIR=${T}/lib/ray \
			CC=gcc "$@" -f Rmakefile install || die "Unable to build $i"
		popd
	done

	# TODO: figure out what to do with the dev files
	mv ${T}/bin/dev ${T}/dev

	rm -r ${WORKDIR}/ray/lib/CVS
	rm -r ${T}/lib/ray/CVS
	rm -r ${WORKDIR}/ray/doc/notes/CVS
}

src_install() {
	mkdir -p ${D}/usr/bin
	mkdir -p ${D}/usr/lib/ray

	dobin ${T}/bin/*

	cp -R ${T}/lib/ray ${D}/usr/lib/ray
	cd ${WORKDIR}/ray
	(cd lib ; tar -cf - *) | (cd ${D}/usr/lib/ray ; tar -xf -)

	# man = /usr/share/man
	cd ${WORKDIR}/ray
	doman doc/man/man1/*.1
	doman doc/ray.1
	doman doc/man/man3/*.3
	doman doc/man/man5/*.5
	prepallman

	dodoc README

	docinto notes
	dodoc doc/notes/*

	docinto pdf
	dodoc doc/pdf/*.pdf
	dodoc doc/ps/*.ps
	dohtml doc/ray.html
	prepalldocs
}