summaryrefslogtreecommitdiff
blob: 64860f7ed516b7c3027473f30106dd56b0a0f49f (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
115
116
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-libs/glide-v3/glide-v3-20060203.ebuild,v 1.2 2006/02/04 21:00:15 spyderous Exp $

inherit multilib eutils

LIBVER="3.10.0"

MY_PN="${PN/g/G}"
MY_PN="${MY_PN/-v3/3}"
MY_P="${MY_PN}-${PV}"

S="${WORKDIR}/${MY_P}"
DESCRIPTION="Hardware support for the voodoo3, voodoo4 and voodoo5"
HOMEPAGE="http://glide.sourceforge.net/"
SRC_URI="mirror://gentoo/${MY_P}.tar.bz2"
LICENSE="3DFX"
SLOT="0"
KEYWORDS="~x86 -sparc"
IUSE="voodoo5 voodoo3 voodoo2 voodoo1"

RDEPEND="|| ( x11-libs/libX11 virtual/x11 )"
DEPEND="${RDEPEND}
	|| ( x11-libs/libXt virtual/x11 )"

src_compile() {
	local compilefor glide_flags

	if use voodoo5; then
		compilefor="${compilefor} h5"
	fi
	if use voodoo3; then
		compilefor="${compilefor} h3"
	fi
	if use voodoo2; then
		compilefor="${compilefor} cvg"
	fi
	if use voodoo1; then
		if use x86; then
			compilefor="${compilefor} sst1"
		else
			ewarn "Voodoo1 support only available on x86 so far."
		fi
	fi
	# If nothing's set, build everything
	if [[ ! -n "${compilefor}" ]]; then
		compilefor="h5 h3 cvg"
		if use x86; then
			compilefor="${compilefor} sst1"
		fi
	fi

	glide_flags="TEXUS2=1"
	if use x86; then
		# Still checks for 3dnow etc at runtime
		glide_flags="${glide_flags} USE_X86=1 USE_3DNOW=1 USE_MMX=1 USE_SSE=1
			USE_SSE2=1"
	fi

	for card in ${compilefor}; do
		if [[ $card = h3 ]] || [[ $card = h5 ]]; then
			glide_flags="${glide_flags} DRI=1 XPATH=/usr/$(get_libdir)"
		fi
		make -f makefile.linux \
			FX_GLIDE_HW=${card} \
			OPTFLAGS="${CFLAGS}" \
			${glide_flags}
		if [[ $card = h5 ]]; then
			mv ${card}/lib/libglide*so libglide3-v5.so
		elif [[ $card = h3 ]]; then
			mv ${card}/lib/libglide*so libglide3-v3.so
		elif [[ $card = cvg ]]; then
			mv ${card}/lib/libglide*so libglide3-v2.so
		elif [[ $card = sst1 ]]; then
			mv ${card}/lib/libglide*so libglide3-v1.so
		fi
		make -f makefile.linux \
			FX_GLIDE_HW=${card} \
			realclean
	done
}

src_install() {
	local default_lib default_libver

	dolib.so ${S}/libglide3-v*.so

	if use voodoo5; then
		default_libver="5"
	elif use voodoo3; then
		default_libver="3"
	elif use voodoo2; then
		default_libver="2"
	elif use voodoo1; then
		default_libver="1"
	else
		# Default to voodoo3
		default_libver="3"
	fi
	default_lib="libglide3-v${default_libver}.so"

	dosym ${default_lib} /usr/$(get_libdir)/libglide3.so.${LIBVER}
	dosym libglide3.so.${LIBVER} /usr/$(get_libdir)/libglide3.so.3
	dosym libglide3.so.${LIBVER} /usr/$(get_libdir)/libglide3.so

	insinto /usr/include/glide3
	doins \
		swlibs/fxmisc/3dfx.h \
		h5/glide3/src/g3ext.h \
		h5/glide3/src/glide.h \
		h5/glide3/src/glidesys.h \
		h5/glide3/src/glideutl.h \
		swlibs/fxmisc/linutil.h \
		h5/incsrc/sst1vid.h \
		swlibs/texus2/lib/texus.h
}