summaryrefslogtreecommitdiff
blob: 441704d4d7ee2dd1a714553ee6a7610d2aee72c9 (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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/x11-libs/wxGTK/wxGTK-2.4.2-r3.ebuild,v 1.15 2005/06/06 11:46:50 corsair Exp $

inherit flag-o-matic eutils gnuconfig multilib toolchain-funcs

DESCRIPTION="GTK+ version of wxWidgets, a cross-platform C++ GUI toolkit"
HOMEPAGE="http://www.wxwidgets.org/"
SRC_URI="mirror://sourceforge/wxwindows/${P}.tar.bz2"

LICENSE="wxWinLL-3"
SLOT="2.4"
KEYWORDS="alpha amd64 ~arm hppa ia64 ~ppc ppc64 sparc x86"
IUSE="debug wxgtk1 gtk2 odbc opengl unicode"

RDEPEND="virtual/x11
	sys-libs/zlib
	media-libs/libpng
	media-libs/jpeg
	media-libs/tiff
	!unicode? ( odbc? ( dev-db/unixODBC ) )
	opengl? ( virtual/opengl )
	gtk2? ( >=x11-libs/gtk+-2.0 >=dev-libs/glib-2.0 )
	wxgtk1? ( =x11-libs/gtk+-1.2* =dev-libs/glib-1.2* )"
DEPEND="${RDEPEND}
	gtk2? ( dev-util/pkgconfig )"

# Note 1: Gettext is not runtime dependency even if nls? because wxWidgets
#         has its own implementation of it
# Note 2: PCX support is enabled if the correct libraries are detected.
#         There is no USE flag for this.

src_unpack() {
	unpack ${A}
	epatch ${FILESDIR}/${PN}-2.4.2-menu.cpp.patch || \
		die "Failed to patch menu.cpp"
	# fix xml contrib makefile problems
	EPATCH_OPTS="-d ${S}" epatch ${FILESDIR}/${PN}-2.4.1-contrib.patch
	# disable contrib/src/animate
	EPATCH_OPTS="-d ${S}/contrib/src" epatch ${FILESDIR}/${PN}-2.4.2-contrib_animate.patch
	use amd64 && EPATCH_OPTS="-d ${S}" epatch ${FILESDIR}/${PN}-2.4.2-cleanup.patch
	gnuconfig_update
}

pkg_setup() {
	einfo "New in >=wxGTK-2.4.2-r2:"
	einfo "------------------------"
	einfo "You can now have gtk, gtk2 and unicode versions installed"
	einfo "simultaneously. Use wxgtk1 if you would like a gtk1 lib."
	einfo "Put gtk2 and unicode in your USE flags to get those"
	einfo "additional versions."
	einfo "NOTE:"
	einfo "You can also get debug versions of any of those, but not debug"
	einfo "and normal installed at the same time."
	if  use unicode; then
		! use gtk2 && die "You must put gtk2 in your USE if you need unicode support"
	fi
	if ! use wxgtk1 && ! use gtk2; then
		die "You must have at least gtk2 or wxgtk1 in your USE"
	fi
}

src_compile() {
	local myconf
	export LANG='C'
	filter-flags -fvisibility-inlines-hidden
	myconf="${myconf} `use_with opengl`"
	myconf="${myconf} --with-gtk"
	myconf="${myconf} `use_enable debug`"
	myconf="${myconf} --libdir=/usr/$(get_libdir)"

	if use wxgtk1 ; then
		mkdir build_gtk
		einfo "Building gtk version"
		cd build_gtk
		../configure ${myconf} `use_with odbc`\
			--host=${CHOST} \
			--prefix=/usr \
			--infodir=/usr/share/info \
			--mandir=/usr/share/man || die "./configure failed"
		emake CXX="$(tc-getCXX)" CC="$(tc-getCC)" || die "make gtk failed"
		cd contrib/src
		emake CXX="$(tc-getCXX)" CC="$(tc-getCC)" || die "make gtk contrib failed"
	fi
	cd ${S}

	if use gtk2 ; then
		myconf="${myconf} --enable-gtk2"
		einfo "Building gtk2 version"
		mkdir build_gtk2
		cd build_gtk2
		../configure ${myconf} `use_with odbc` \
			--host=${CHOST} \
			--prefix=/usr \
			--infodir=/usr/share/info \
			--mandir=/usr/share/man || die "./configure failed"
		emake CXX="$(tc-getCXX)" CC="$(tc-getCC)" || die "make gtk2 failed"
		cd contrib/src
		emake CXX="$(tc-getCXX)" CC="$(tc-getCC)" || die "make gtk2 contrib failed"

		cd ${S}

		if use unicode ; then
			myconf="${myconf} --enable-unicode"
			einfo "Building unicode version"
			mkdir build_unicode
			cd build_unicode
			../configure ${myconf} \
				--host=${CHOST} \
				--prefix=/usr \
				--infodir=/usr/share/info \
				--mandir=/usr/share/man || die "./configure failed"

			emake CXX="$(tc-getCXX)" CC="$(tc-getCC)" || die "make unicode failed"

			cd contrib/src
			emake CXX="$(tc-getCXX)" CC="$(tc-getCC)" || die "make unicode contrib failed"
		fi
	fi
}

src_install() {
	if [ -e ${S}/build_gtk ] ; then
		cd ${S}/build_gtk
		einstall libdir="${D}/usr/$(get_libdir)" || die "install gtk failed"
		cd contrib/src
		einstall libdir="${D}/usr/$(get_libdir)" || die "install gtk contrib failed"
	fi

	if [ -e ${S}/build_gtk2 ] ; then
		cd ${S}/build_gtk2
		einstall libdir="${D}/usr/$(get_libdir)" || die "install gtk2 failed"
		cd contrib/src
		einstall libdir="${D}/usr/$(get_libdir)" || die "install gtk2 contrib failed"
	fi

	if [ -e ${S}/build_unicode ] ; then
		cd ${S}/build_unicode
		einstall libdir="${D}/usr/$(get_libdir)" || die "install unicode failed"
		cd contrib/src
		einstall libdir="${D}/usr/$(get_libdir)" || die "install unicode contrib failed"
	fi

	# twp 20040830 wxGTK-2.4.2 forgets to install htmlproc.h; copy it manually
	insinto /usr/include/wx/html
	doins ${S}/include/wx/html/htmlproc.h

	cd ${S}
	dodoc *.txt
}