summaryrefslogtreecommitdiff
blob: 48c48465712dd57480fee739670a5c98cc767d7c (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
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/gtk-engines2.eclass,v 1.16 2008/02/10 14:47:14 eva Exp $

# IMPORTANT:
# This eclass is deprecated and should not be used in new ebuilds.

# Author: Alastair Tse <liquidx@gentoo.org>
#
# This is a utility eclass for installing GTK+ Theme Engines. It detects
# whether gtk+-1 and/or gtk+-2 is installed and sets up variables to help with
# installing the engines into the right position.
#
# Variables it sets are :
#
#  HAS_GTK1 / HAS_GTK2   -- simply if GTK+1 or GTK+2 is installed
#  GTK1_ENGINES_DIR      -- directory where gtk+1 engines are installed
#  GTK2_ENGINES_DIR      -- directory where gtk+2 engines are installed
#
# *** NOTE *** If your engine has both GTK+1 and GTK+2 versions :
#
#  Set the following variables if they are in different directories:
#
#  GTK1_S  -- GTK+1 Source Directory
#  GTK2_S  -- GTK+2 Source Directory
#
#  Also note you should not set DEPEND and let the eclass set the dependencies
#
# Comments:
#
# Most theme engines include ./configure scripts that solve most of the
# path problems. Sometimes there are certain versions that have trouble
# with paths. If they do, then you can use the above variables
#
# We do not employ USE flags "gtk" and "gtk2" because they are unsuitable
# in this case. We install the whole package of themes available, both
# GTK+1 and GTK+2 if available. We assume that the user would want both
# since the space savings are negligible.
#
# Note that this deals specifically with GTK ENGINES and not GTK THEMES. Some
# engines have themes that accompany them, and they are thus installed. You
# should not be using this eclass (it won't help anyway) if you are making
# a pure GTK+ theme ebuild.
#
# - liquidx@gentoo.org (16 Jun 2003)

inherit eutils


DESCRIPTION="GTK+1/2 ${PN/gtk-engines-} Theme Engine"
HOMEPAGE="http://art.gnome.org/ http://themes.freshmeat.net/"

# --- here we define some useful variables for gtk-engines installation

if has_version "=x11-libs/gtk+-1.2*"; then
	HAS_GTK1=1
	GTK1_ENGINES_DIR=/usr/$(get_libdir)/gtk/themes/engines
fi

if has_version ">=x11-libs/gtk+-2" || use gtk2; then
	HAS_GTK2=1
	GTK_VERSION=$(pkg-config --variable=gtk_binary_version gtk+-2.0)
	GTK2_ENGINES_DIR=/usr/$(get_libdir)/gtk-2.0/${GTK_VERSION}/engines
fi

# --- define some deps for binary packages
if [ -n "${HAS_GTK1}" -a ! -n "${HAS_GTK2}" ]; then
	DEPEND="${DEPEND} =x11-libs/gtk+-1.2*"
elif [ -n "${HAS_GTK1}" -a -n "${HAS_GTK2}" ]; then
	DEPEND="${DEPEND} =x11-libs/gtk+-1.2* =x11-libs/gtk+-2*"
elif [ ! -n "${HAS_GTK1}" -a -n "${HAS_GTK2}" ]; then
	DEPEND="${DEPEND} >=x11-libs/gtk+-2"
fi

# --- if we don't have any gtk version, we depend on USE flags to tell us
# --- which one to use. otherwise, we don't add any deps. make the ebuild
# --- tell us what DEPEND it wants.

if ! has_version "x11-libs/gtk+"; then
	DEPEND="gtk2? ( >=x11-libs/gtk+-2 ) !gtk2? ( =x11-libs/gtk+-1.2* )"
	use gtk2 \
		&& HAS_GTK2=1 \
		|| HAS_GTK1=1
fi

# --- if GTK1_S and GTK2_S is set, then we do both themes,
# --- otherwise, just do the normal src_compile/install wrap.

gtk-engines2_src_compile() {

	if [ -n "${GTK2_S}" -a -n "${GTK1_S}" ]; then
		if [ -n "${HAS_GTK2}" ]; then
			cd ${GTK2_S}
			econf || die "gtk2 configure failed"
			emake || die "gtk2 make failed"
		fi
		if [ -n "${HAS_GTK1}" ]; then
			cd ${GTK1_S}
			econf || die "gtk1 configure failed"
			emake || die "gtk1 make failed"
		fi
	else
		cd "${S}"
		econf ${@} || die "configure failed"
		emake || make || die "make failed"
	fi
}

DEFAULT_DOCS="AUTHORS ChangeLog NEWS README"

gtk-engines2_src_install() {

	if [ -n "${GTK2_S}" -a -n "${GTK1_S}" ]; then
		if [ -n "${HAS_GTK2}" ]; then
			cd ${GTK2_S}
			make DESTDIR="${D}" install || die "gtk2 install failed"
			for x in ${DEFAULT_DOCS} ${DOCS}; do
				newdoc ${x} ${x}.gtk2
			done
		fi
		if [ -n "${HAS_GTK1}" ]; then
			cd ${GTK1_S}
			make DESTDIR="${D}" install || die "gtk1 install failed"
			for x in ${DEFAULT_DOCS} ${DOCS}; do
				newdoc ${x} ${x}.gtk1
			done
		fi
	else
		cd "${S}"
		make DESTDIR="${D}" ${@} install || die "install failed"
		dodoc ${DEFAULT_DOCS} ${DOCS}
	fi
}

EXPORT_FUNCTIONS src_compile src_install