aboutsummaryrefslogtreecommitdiff
blob: a887c52632fa0af5fc6c8a94a68424be537da13a (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
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

MY_PN="DRAWxtl"
MY_P=${MY_PN}${PV}
DESCRIPTION="This software can be used to produce crystal structure drawings from structural data"
HOMEPAGE="http://www.lwfinger.net/drawxtl/"
SRC_URI="http://home.att.net/~larry.finger/drawxtl/${MY_P}.tar.gz"

LICENSE="GPL-2"
SLOT="5"
KEYWORDS="~amd64 ~x86"
IUSE="examples"

DEPEND="virtual/opengl
	virtual/glut
	virtual/glu
	>=x11-libs/fltk-1.1.6"
RDEPEND="${DEPEND}"

S="${WORKDIR}/${MY_PN}"

src_unpack() {
	unpack ${A}
	cd "${S}"/source
	sed -i -e "s:-g:${CFLAGS} `fltk-config --cxxflags`:" -e "s:-lfltk\b:`fltk-config --ldflags`:g" \
		-e "s:-lXinerama::g" ${MY_P}/Makefile || die "sed failed"
	# the build system uses -DFREEGLUT24 if freeglut-2.4 is present. We will warn about that in pgk_postinst
	# see comment there
	if ! has_version "=media-libs/freeglut-2.4*"; then
		sed -i -e "s:-DFREEGLUT24::g"  ${MY_P}/Makefile || die "sed failed"
	fi
}

src_compile() {
	cd source/${MY_P}
	emake || die "Build of ${MY_PN} failed."
}

src_install() {
	dobin exe/${MY_P}

	dodoc docs/readme.txt
	insinto /usr/share/doc/${P}
	doins docs/*.pdf

	if use examples; then
		docinto examples
		dodoc examples/*
	fi
}

pkg_postinst() {
	# DRAWxtl works around some bug in freeglut-2.4. Unless we have more information, which versions are 
	# affected, I would like to keep it like this. 
	# A patch for DRAWxtl to add a runtime-check could be considered later.
	if has_version "=media-libs/freeglut-2.4*"; then
		elog
		elog "${MY_P} was build for beeing used with freeglut-2.4"
		elog "If you change to a different glut, you should rebuild ${MY_P}"
		elog
	else
		elog
		elog "If you change your glut library to freeglut-2.4, you will have to rebuild ${MY_P}"
		elog
	fi
}