summaryrefslogtreecommitdiff
blob: de996e5021f9f6b70a6baece52b5e23514bd45b4 (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
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="3"
PYTHON_DEPEND="python? 2"
SUPPORT_PYTHON_ABIS="1"
RESTRICT_PYTHON_ABIS="3.*"

CD_LANGS="ar cs de el es et eu fr hu id it ja nl pl  pt_BR pt ru sk sr sv tr uk
	zh_CN zh_TW"

inherit cmake-utils cairo-dock python

DESCRIPTION="Official recommended plugins for cairo-dock"
HOMEPAGE="http://www.glx-dock.org"

LICENSE="|| ( LGPL-2 LGPL-2.1 LGPL-3 ) GPL-2 GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~x86"
CD_PLUGINS_IUSE="gnome xfce"
IUSE="${CD_PLUGINS_IUSE} gtk2 mono python ruby vala"

CDP_DEPEND="dev-libs/dbus-glib
	>=dev-libs/glib-2.22:2
	dev-libs/libxml2:2
	gnome-base/librsvg:2
	sys-apps/dbus
	x11-libs/cairo
	~x11-misc/cairo-dock-${PV}[gtk2=]
	!x11-misc/cairo-dock-plugins
	!x11-plugins/cairo-dock-plugins
	!gtk2? ( x11-libs/gtk+:3 )
	gtk2? ( x11-libs/gtk+:2 )"
RDEPEND="${CDP_DEPEND}
	mono? (
		dev-dotnet/glib-sharp
		dev-dotnet/ndesk-dbus
		dev-dotnet/ndesk-dbus-glib
		dev-lang/mono
	)
	ruby? ( dev-lang/ruby )
	vala? (
		dev-lang/vala
		>=dev-libs/glib-2.26:2
	)"
DEPEND="${RDEPEND}
	dev-util/intltool
	sys-devel/gettext
	virtual/pkgconfig
	mono? ( !dev-util/pkgconf )"

pkg_setup() {
	CD_PLUGINS=(
		"dock-rendering"
		"desklet-rendering"
		"dialog-rendering"
		"Dbus"
		"Animated-icons"
		"icon-effect"
		"illusion"
		"drop-indicator"
	)
	use gnome && CD_PLUGINS+=( "gnome-integration" )
	use xfce && CD_PLUGINS+=( "xfce-integration" )
	use gnome || use xfce && CD_PLUGINS+=( "gvfs-integration" )
}

src_unpack() {
	cairo-dock_src_unpack
}

src_prepare() {
	cairo-dock_src_prepare
	if use python; then
		epatch "${FILESDIR}"/${PN}-${CD_PV_MAJ_MIN}-python_Dbus.patch
		python_copy_sources Dbus/interfaces/{bash,python}
		add_target_to_CMakeLists() {
			cat >> Dbus/interfaces/CMakeLists.txt <<-EOF
				add_subdirectory(bash-${PYTHON_ABI})
				add_subdirectory(python-${PYTHON_ABI})
			EOF
		}
		python_execute_function add_target_to_CMakeLists
	fi
	use xfce &&	epatch \
		"${FILESDIR}"/${PN}-${CD_PV_MAJ_MIN}-xfce-integration_CMakeLists.patch
}

src_configure() {
	mycmakeargs+=(
		"$(cmake-utils_use_enable gnome GNOME-INTEGRATION)"
		"$(cmake-utils_use_enable xfce XFCE-INTEGRATION)"
		"$(cmake-utils_use_with mono MONO-INTERFACE)"
		"$(cmake-utils_use_with python PYTHON-INTERFACE)"
		"$(cmake-utils_use_with ruby RUBY-INTERFACE)"
		"$(cmake-utils_use_with vala VALA-INTERFACE)"
	)
	cmake-utils_src_configure
}

src_compile() {
	cmake-utils_src_compile

	if use python; then
		build_bindings() {
			"$(PYTHON)" setup.py -q build
		}
		local target sdir="../${P}_build/Dbus/interfaces/"
		for target in "bash" "python"; do
			python_execute_function -s --source-dir ${sdir}${target} build_bindings
		done
	fi
}

src_install() {
	cmake-utils_src_install

	if use python; then
		install_bindings() {
			insinto "$(python_get_sitedir)"/cairodock
			doins build/lib/*.py
			touch "${D}/$(python_get_sitedir)"/cairodock/__init__.py
		}
		local target sdir="../${P}_build/Dbus/interfaces/"
		for target in "bash" "python"; do
			python_execute_function -s --source-dir ${sdir}${target} install_bindings
		done
	fi
}

pkg_postinst() {
	use python && python_mod_optimize cairodock
}

pkg_postrm() {
	use python && python_mod_cleanup cairodock
}