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

EAPI=2

inherit autotools eutils

MY_P=${P/pdc/PDC}

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

LICENSE="MIT public-domain"
SLOT="0"
KEYWORDS="~amd64 ~x86"
# TODO: add SDL support
IUSE="doc examples nextaw Xaw3d"

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

S=${WORKDIR}/${MY_P}

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

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

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

	# Fixing absolute symlinks
	sed -i -e 's:\(ln -f -s \)$(libdir)/:\1:' \
		Makefile.in || die

	# Fixing tuidemo path
	sed -i -e 's:\.\.[/\\]demos[/\\]::' \
		demos/tuidemo.c || die

	# If enabled, uses "manext" to create a 160K doc/PDCurses.txt
	if ! use doc ; then
		sed -i -e '/cd doc; $(MAKE)/d' \
			Makefile.in || die
	fi

	# Removing the $(DEMOS) from all target
	if ! use examples ; then
		sed -i -e 's/\(^all:[\t a-zA-Z$()]*\) $(DEMOS)/\1/' \
			x11/Makefile.in || die
	fi

	eautoreconf
}

src_configure() {
	econf \
		$(use_with nextaw) \
		$(use_with Xaw3d xaw3d)
}

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

	if use examples ; then
		insinto /usr/share/doc/${PF}/examples
		doins demos/*.[ch] || die

		exeinto /usr/share/doc/${PF}/examples
		cd "${S}/x11" || die
		# Which one is better?
		#doins $(sed -e 's/^DEMOS[ \t]*=\(.*\)/\1/p' -e 'd' Makefile.in)
		doexe $(sed -n -e 's/^DEMOS[ \t]*=\(.*\)/\1/p' Makefile.in) || die
	fi
}