summaryrefslogtreecommitdiff
path: root/eclass/avahi.eclass
blob: 47164ca399eda8845ce31c538ff5ed964a60f3d3 (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
# Copyright 2004-2011 Sabayon
# Distributed under the terms of the GNU General Public License v2
# $

SUPPORTED_AVAHI_MODULES="base gtk gtk3 mono qt"

# @ECLASS-VARIABLE: AVAHI_MODULE
# @DESCRIPTION:
# Set this variable to the avahi module ebuild name, by default it's used
# the second part of PN, for example: for avahi-glib, it is "glib".
# Supported avahi modules:
# base gtk gtk3 mono qt
AVAHI_MODULE="${AVAHI_MODULE:-${PN/avahi-}}"

# @ECLASS-VARIABLE: AVAHI_PATCHES
# @DEFAULT-UNSET
# @DESCRIPTION:
# List of patches to apply
if [ -z "${AVAHI_PATCHES}" ]; then
	AVAHI_PATCHES=()
fi

# @ECLASS-VARIABLE: AVAHI_MODULE_DEPEND
# @DESCRIPTION:
# Avahi module built time dependencies list
AVAHI_MODULE_DEPEND="${AVAHI_MODULE_DEPEND:-}"

# @ECLASS-VARIABLE: AVAHI_MODULE_RDEPEND
# @DESCRIPTION:
# Avahi module run time dependencies list
AVAHI_MODULE_RDEPEND="${AVAHI_MODULE_RDEPEND:-}"

# @ECLASS-VARIABLE: AVAHI_MODULE_PDEPEND
# @DESCRIPTION:
# Avahi module post dependencies list
AVAHI_MODULE_PDEPEND="${AVAHI_MODULE_PDEPEND:-}"

_supported="0"
for mod in ${SUPPORTED_AVAHI_MODULES} ; do
    if [ "${mod}" = "${AVAHI_MODULE}" ]; then
        _supported="1"
        break
    fi
done
if [ "${_supported}" = "0" ]; then
    die "Unsupported avahi module: ${AVAHI_MODULE}"
fi

MY_P=${P/-${AVAHI_MODULE}}

inherit autotools eutils flag-o-matic systemd

DESCRIPTION="avahi ${AVAHI_MODULE} module"
HOMEPAGE="http://avahi.org/"
SRC_URI="http://avahi.org/download/${MY_P}.tar.gz"
S="${WORKDIR}/${MY_P}"

LICENSE="LGPL-2.1"
SLOT="0"
KEYWORDS="~amd64 ~arm ~x86"

AVAHI_COMMON_DEPEND=">=dev-util/intltool-0.40.5
	>=dev-util/pkgconfig-0.9.0"
DEPEND="${AVAHI_MODULE_DEPEND} ${AVAHI_COMMON_DEPEND}"
RDEPEND="${AVAHI_MODULE_RDEPEND}"
PDEPEND="${AVAHI_MODULE_PDEPEND}"

avahi_src_prepare() {
	sed -i\
		-e "s:\\.\\./\\.\\./\\.\\./doc/avahi-docs/html/:../../../doc/${PF}/html/:" \
		doxygen_to_devhelp.xsl || die

	# Drop DEPRECATED flags, bug #384743
	sed -i -e 's:-D[A-Z_]*DISABLE_DEPRECATED=1::g' avahi-ui/Makefile.am || die

	# Prevent .pyc files in DESTDIR
	>py-compile

	for i in ${!AVAHI_PATCHES[@]}; do
		epatch "${AVAHI_PATCHES[i]}"
	done

	eautoreconf
}

avahi_src_configure() {
	use sh && replace-flags -O? -O0
	# We need to unset DISPLAY, else the configure script might have problems detecting the pygtk module
	unset DISPLAY
	local myconf="
		--disable-static
		--localstatedir=/var
		--with-distro=gentoo
		--disable-xmltoman
		--disable-monodoc
		--enable-glib
		--enable-gobject
		--disable-qt3
		$(systemd_with_unitdir)
		${*}"
	econf ${myconf}
}

avahi_src_install-cleanup() {
	# Remove .la files
	find "${ED}" -name '*.la' -exec rm -f {} + || die
}

EXPORT_FUNCTIONS src_prepare src_configure