aboutsummaryrefslogtreecommitdiffstats
path: root/main/mosquitto/APKBUILD
blob: 590dc107118ed6259bd80444d88e2618909200aa (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
# Contributor: Pedro Filipe <xpecex@outlook.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=mosquitto
pkgver=2.0.10
pkgrel=0
pkgdesc="An open source MQTT broker"
url="https://mosquitto.org/"
arch="all"
license="EPL-1.0"
replaces="mosquitto-utils"
install="$pkgname.pre-install"
options="!check" # FIXME: some of the tests are flaky
makedepends="openssl-dev c-ares-dev util-linux-dev libwebsockets-dev libxslt cjson-dev"
checkdepends="python3 cunit-dev"
subpackages="$pkgname-dbg $pkgname-dev $pkgname-doc $pkgname-libs++:_pp $pkgname-openrc
	$pkgname-libs $pkgname-clients"
source="http://mosquitto.org/files/source/mosquitto-$pkgver.tar.gz
	mosquitto.initd
	mosquitto.confd
	"

# secfixes:
#   2.0.10-r0:
#     - CVE-2021-28166
#   1.6.7-r0:
#     - CVE-2019-11779
#   1.5.6-r0:
#     - CVE-2018-12546
#     - CVE-2018-12550
#     - CVE-2018-12551
#   1.5.3-r0:
#     - CVE-2018-12543
#   1.4.15-r0:
#     - CVE-2017-7652
#     - CVE-2017-7651
#   1.4.13-r0:
#     - CVE-2017-9868
#   1.4.12-r0:
#     - CVE-2017-7650

prepare() {
	default_prepare

	# don't strip
	sed -i -e "s|(INSTALL) -s|(INSTALL)|g" \
		-e 's|--strip-program=${CROSS_COMPILE}${STRIP}||' \
		*/Makefile */*/Makefile
}

build() {
	# PSK not supported by libressl
	make \
		WITH_MEMORY_TRACKING=no \
		WITH_WEBSOCKETS=yes \
		WITH_SRV=yes \
		WITH_ADNS=no \
		prefix=/usr
}

check() {
	make test
}

package() {
	make prefix=/usr DESTDIR="$pkgdir" install

	mv "$pkgdir"/etc/mosquitto/mosquitto.conf.example \
		"$pkgdir"/etc/mosquitto/mosquitto.conf
	sed -i -e 's/#log_dest stderr/log_dest syslog/' \
		"$pkgdir"/etc/mosquitto/mosquitto.conf

	install -Dm755 "$srcdir"/mosquitto.initd "$pkgdir"/etc/init.d/mosquitto
	install -Dm755 "$srcdir"/mosquitto.confd "$pkgdir"/etc/conf.d/mosquitto
}

_pp() {
	pkgdesc="C++ wrapper for libmosquitto"
	replaces=""

	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/libmosquittopp.so.* "$subpkgdir"/usr/lib/
}

clients() {
	pkgdesc="Mosquitto command line MQTT clients"
	replaces="mosquitto-utils"

	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/mosquitto_[ps]ub "$subpkgdir"/usr/bin/
}

sha512sums="c356bfe5dc9317e1943cf14c20ae52af544aefc0138349abd3be5001032ce63579aa059dd62901a0802f08d059a9dc29b6fbcba852e3c4cd702189433ceac174  mosquitto-2.0.10.tar.gz
a527813957b6f2d7afdb7269bade61d99b3023a147861b38902971929ff342a7c8c276bdb808fcfe7e48fa3e5c7521a16d777e5a3313256b8bf1e759cec5b7b0  mosquitto.initd
678a8aaefb9181f5f4998304046e5a8737049f90cf6bbbfd5fd4549592728afe77cb536547b39ad1598d53fe0b7c03e1506b2683e7b936712b9fad4a317f4b43  mosquitto.confd"