summaryrefslogtreecommitdiff
blob: 0a242fb559d18a0da874ae352dcf3ea7a504e354 (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
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sci-electronics/gtkwave/gtkwave-3.0.23.ebuild,v 1.1 2007/04/01 15:17:14 calchan Exp $

DESCRIPTION="A wave viewer for LXT, LXT2, VZT, GHW and standard Verilog VCD/EVCD files"
HOMEPAGE="http://home.nc.rr.com/gtkwave/"
SRC_URI="http://home.nc.rr.com/gtkwave/${P}.tar.gz
	doc? ( http://home.nc.rr.com/gtkwave/${PN}-doc-${PV}.tar.gz )"

IUSE="doc examples"
LICENSE="GPL-2 MIT"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~sparc ~x86"

DEPEND=">=x11-libs/gtk+-2
	dev-util/pkgconfig"

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

	# Using sed below, because equivalent patch is much bigger

	# configure must not be interactive, force GTK2
	sed -i \
		-e 's:echo "Build GTKWave for GTK+-1.x or 2.x?:# Build for GTK2:' \
		-e 's:read X:X="2":' \
		configure \
		|| die "sed failed"

	# Fix command substitution
	sed -i \
		-e 's:`pkg-config gtk+-2.0 --libs`:$(shell pkg-config gtk+-2.0 --libs):' \
		-e 's:`pkg-config gtk+-2.0 --cflags`:$(shell pkg-config gtk+-2.0 --cflags):' \
		src/Makefile_GTK2.in \
		contrib/rtlbrowse/Makefile_GTK2.in \
		|| die "sed failed"

	# Comply with DESTDIR
	sed -i \
		-e 's:$(bindir):$(DESTDIR)/$(bindir):' \
		-e 's:$(mandir):$(DESTDIR)/$(mandir):' \
		Makefile.in \
		|| die "sed failed"

	# CFLAGS fixes
	sed -i \
		-e 's:CFLAGS = -O2:CFLAGS +=:' \
		src/Makefile_GTK2.in \
		*/*/Makefile*.in \
		|| die "sed failed"
	sed -i \
		-e 's:=$(COPT): +=:' \
		contrib/pccts/*/*/Makefile.in \
		|| die "sed failed"
	sed -i \
		-e 's:= $(COPT):+=:' \
		contrib/pccts/*/Makefile.in \
		|| die "sed failed"

	# LDFLAGS fixes
	sed -i \
		-e 's:$(CFLAGS) $(OBJS):$(CFLAGS) $(LDFLAGS) $(OBJS):' \
		src/Makefile_GTK2.in \
		|| die "sed failed"
	sed -i \
		-e 's:LDFLAGS=:LDFLAGS+=:' \
		contrib/rtlbrowse/Makefile_GTK2.in \
		|| die "sed failed"
	sed -i \
		-e 's:$(CC) $(CFLAGS) -o:$(CC) $(CFLAGS) $(LDFLAGS) -o:' \
		contrib/pccts/*/Makefile.in \
		src/helpers/Makefile.in \
		|| die "sed failed"
	sed -i \
		-e 's:$(CC) -o:$(CC) $(LDFLAGS) -o:' \
		contrib/vertex/Makefile.in \
		contrib/pccts/sorcerer/Makefile.in \
		contrib/pccts/support/genmk/Makefile.in \
		|| die "sed failed"
	sed -i \
		-e 's:-o ghwdump:$(LDFLAGS) -o ghwdump:' \
		src/helpers/Makefile.in \
		|| die "sed failed"
}

src_compile() {
	econf || die 'Configuration failed'

	# Bug #142871
	emake -j1 || die 'Compilation failed'
}

src_install() {
	emake DESTDIR=${D} install || die "Installation failed"
	dodoc ANALOG_README.TXT CHANGELOG.TXT
	if use doc ; then
		insinto /usr/share/doc/${PF}
		doins "${WORKDIR}/${PN}.pdf" || die "Failed to install documentation."
	fi
	if use examples ; then
		insinto /usr/share/doc/${PF}
		doins -r examples || die "Failed to install examples."
	fi
}