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

inherit autotools eutils

MY_P=${P/pdc/PDC}

DESCRIPTION="A public domain curses library for DOS, OS/2, Win32 and X11"
HOMEPAGE="http://pdcurses.sourceforge.net/"
SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.gz"

KEYWORDS="~x86"

LICENSE="public-domain GPL-2"
SLOT="0"
IUSE="debug doc examples latin1 nextaw Xaw3d"

DEPEND="x11-libs/libX11
	x11-libs/libXmu
	x11-libs/libXt
	x11-libs/libXpm
	x11-proto/xproto
	nextaw? ( x11-libs/neXtaw )
	Xaw3d? ( x11-libs/Xaw3d )
	!nextaw? ( !Xaw3d? ( x11-libs/libXaw ) )"
RDEPEND="${DEPEND}"

S=${WORKDIR}/${MY_P}

pkg_setup() {
	if use Xaw3d && use nextaw ; then
		elog "You have both Xaw3d and nextaw USE-flags set,"
		elog "Xaw3d will be used."
	fi
}

src_unpack() {
	unpack ${A}
	cd "${S}"

	epatch "${FILESDIR}/${P}-configure.patch"

	# Fixing -jX problems:
	sed -i \
		-e 's/\(PDCurses.man:\)/\1 manext/' \
		tools/Makefile.in || die "sed failed"

	# Fixing soname problem:
	sed -i \
		-e "s/\(\$(LD_RXLIB1)\)/\1 -Wl,-soname,libXcurses.so.${PV%.*}/" \
		pdcurses/Makefile.in || die "sed failed"

	eautoreconf
}

src_compile() {

	if ! use examples ; then
		sed -i \
			-e 's/\(^all[ \t]::[\t a-z]*\) demos/\1/' \
			-e '/demos/d' \
			Makefile.in || die "sed failed"
	fi

	if ! use doc ; then
		sed -i \
			-e '/tools/d' \
			Makefile.in || die "sed failed"
	fi

	econf \
		$(use_with Xaw3d xaw3d) \
		$(use_with nextaw) \
		$(use_enable debug) \
		$(use_enable latin1) \
		|| die "econf failed"
	emake || die "emake failed"
}

src_install() {
	emake DESTDIR="${D}" install || die "emake install failed"
	dodoc HISTORY README TODO doc/*

	if use doc ; then
		dodoc tools/PDCurses.man
	fi
	if use examples ; then
		insinto /usr/share/${PN}/examples
		cd demos
		doins *.{h,c} $(sed -e 's/^DEMOS[ \t]*=\ \(.*\)/\1/p' -e 'd' Makefile.in)
	fi

}