Line 0
Link Here
|
0 |
- |
1 |
# Copyright 1999-2018 Gentoo Foundation |
|
|
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
|
4 |
EAPI=6 |
5 |
PYTHON_COMPAT=( python2_7 ) |
6 |
|
7 |
inherit systemd user toolchain-funcs python-any-r1 |
8 |
|
9 |
DESCRIPTION="An Open Source MQTT v3 Broker" |
10 |
HOMEPAGE="https://mosquitto.org/" |
11 |
SRC_URI="https://mosquitto.org/files/source/${P}.tar.gz" |
12 |
|
13 |
LICENSE="EPL-1.0" |
14 |
SLOT="0" |
15 |
KEYWORDS="~amd64 ~arm ~x86" |
16 |
IUSE="bridge examples +persistence +srv ssl tcpd test websockets" |
17 |
|
18 |
REQUIRED_USE="test? ( bridge )" |
19 |
|
20 |
RDEPEND="tcpd? ( sys-apps/tcp-wrappers ) |
21 |
ssl? ( dev-libs/openssl:0= )" |
22 |
DEPEND="${RDEPEND} |
23 |
${PYTHON_DEPS} |
24 |
srv? ( net-dns/c-ares ) |
25 |
websockets? ( net-libs/libwebsockets )" |
26 |
|
27 |
PATCHES=( |
28 |
"${FILESDIR}/${P}-conditional-tests.patch" |
29 |
"${FILESDIR}/${P}-fix-socket_get_address.patch" |
30 |
) |
31 |
|
32 |
_emake() { |
33 |
LIBDIR=$(get_libdir) |
34 |
emake \ |
35 |
CC="$(tc-getCC)" \ |
36 |
LIB_SUFFIX="${LIBDIR:3}" \ |
37 |
WITH_BRIDGE="$(usex bridge)" \ |
38 |
WITH_PERSISTENCE="$(usex persistence)" \ |
39 |
WITH_SRV="$(usex srv)" \ |
40 |
WITH_TLS="$(usex ssl)" \ |
41 |
WITH_WEBSOCKETS="$(usex websockets)" \ |
42 |
WITH_WRAP="$(usex tcpd)" \ |
43 |
"$@" |
44 |
} |
45 |
|
46 |
pkg_setup() { |
47 |
enewgroup mosquitto |
48 |
enewuser mosquitto -1 -1 -1 mosquitto |
49 |
} |
50 |
|
51 |
src_prepare() { |
52 |
default |
53 |
if use persistence; then |
54 |
sed -i -e "/^#autosave_interval/s|^#||" \ |
55 |
-e "s|^#persistence false$|persistence true|" \ |
56 |
-e "/^#persistence_file/s|^#||" \ |
57 |
-e "s|#persistence_location|persistence_location /var/lib/mosquitto/|" \ |
58 |
mosquitto.conf || die |
59 |
fi |
60 |
|
61 |
# Remove prestripping |
62 |
sed -i -e 's/-s --strip-program=${CROSS_COMPILE}${STRIP}//'\ |
63 |
client/Makefile lib/cpp/Makefile src/Makefile lib/Makefile || die |
64 |
|
65 |
python_setup |
66 |
rm test/{broker,lib}/ptest.py |
67 |
python_fix_shebang test |
68 |
} |
69 |
|
70 |
src_compile() { |
71 |
_emake |
72 |
} |
73 |
|
74 |
src_test() { |
75 |
_emake test |
76 |
} |
77 |
|
78 |
src_install() { |
79 |
_emake DESTDIR="${D}" prefix=/usr install |
80 |
keepdir /var/lib/mosquitto |
81 |
fowners mosquitto:mosquitto /var/lib/mosquitto |
82 |
dodoc readme.md CONTRIBUTING.md ChangeLog.txt |
83 |
doinitd "${FILESDIR}"/mosquitto |
84 |
insinto /etc/mosquitto |
85 |
doins mosquitto.conf |
86 |
systemd_dounit "${FILESDIR}/mosquitto.service" |
87 |
|
88 |
if use examples; then |
89 |
docompress -x "/usr/share/doc/${PF}/examples" |
90 |
docinto "/usr/share/doc/${PF}" |
91 |
doins -r examples |
92 |
fi |
93 |
} |
94 |
|
95 |
pkg_postinst() { |
96 |
if [[ -z "${REPLACING_VERSIONS}" ]]; then |
97 |
elog "The Python module has been moved out of mosquitto." |
98 |
elog "See https://mosquitto.org/documentation/python/" |
99 |
else |
100 |
elog "To start the mosquitto daemon at boot, add it to the default runlevel with:" |
101 |
elog "" |
102 |
elog " rc-update add mosquitto default" |
103 |
elog " or" |
104 |
elog " systemctl enable mosquitto" |
105 |
fi |
106 |
} |