summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: f588c3a5083d963c1b36423df1f1f7b0a4a449ff (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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# Maintainer: Nigel Kukard <nkukard@lbsd.net>
# Maintainer: Caleb Maclennan <caleb@alerque.com>
# Contributor: Maxim Kurnosenko <asusx2@mail.ru>
# Contributor: Xavier Devlamynck <magicrhesus@ouranos.be>
# Contributor: Alessio Biancalana <dottorblaster@gmail.com>
# Contributor: Maik Broemme <mbroemme@libmpq.org>
# Contributor: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>

pkgname=asterisk
pkgver=22.1.0
pkgrel=1
pkgdesc='A complete PBX solution'
arch=(x86_64 i686 aarch64 armv7h)
url=https://www.asterisk.org
license=("GPL-2.0-only")
depends=(alsa-lib
         curl
         jansson
         libedit
         libvorbis
         libxml2
         libxslt
         opus
         popt
         speex)
makedepends=(gsm
             sqlite3)
optdepends=(dahdi
            gsm
            libpri
            libsrtp
            libss7
            lua51
            openr2
            postgresql
            unixodbc)
_confs=(acl.conf
        adsi.conf
        aeap.conf
        agents.conf
        alarmreceiver.conf
        amd.conf
        app_skel.conf
        ari.conf
        ast_debug_tools.conf
        asterisk.adsi
        asterisk.conf
        calendar.conf
        ccss.conf
        cdr.conf
        cdr_adaptive_odbc.conf
        cdr_beanstalkd.conf
        cdr_custom.conf
        cdr_manager.conf
        cdr_odbc.conf
        cdr_pgsql.conf
        cdr_sqlite3_custom.conf
        cdr_tds.conf
        cel.conf
        cel_beanstalkd.conf
        cel_custom.conf
        cel_odbc.conf
        cel_pgsql.conf
        cel_sqlite3_custom.conf
        cel_tds.conf
        chan_dahdi.conf
        chan_mobile.conf
        cli.conf
        cli_aliases.conf
        cli_permissions.conf
        codecs.conf
        confbridge.conf
        config_test.conf
        console.conf
        dbsep.conf
        dnsmgr.conf
        dsp.conf
        dundi.conf
        enum.conf
        extconfig.conf
        extensions.ael
        extensions.conf
        extensions.lua
        extensions_minivm.conf
        features.conf
        festival.conf
        followme.conf
        func_odbc.conf
        geolocation.conf
        hep.conf
        http.conf
        iax.conf
        iaxprov.conf
        indications.conf
        logger.conf
        manager.conf
        meetme.conf
        minivm.conf
        modules.conf
        motif.conf
        musiconhold.conf
        ooh323.conf
        phoneprov.conf
        pjproject.conf
        pjsip.conf
        pjsip_notify.conf
        pjsip_wizard.conf
        prometheus.conf
        queuerules.conf
        queues.conf
        res_config_mysql.conf
        res_config_sqlite3.conf
        res_config_odbc.conf
        res_corosync.conf
        res_curl.conf
        res_fax.conf
        res_http_media_cache.conf
        res_ldap.conf
        res_odbc.conf
        res_parking.conf
        res_pgsql.conf
        res_snmp.conf
        res_stun_monitor.conf
        resolver_unbound.conf
        rtp.conf
        say.conf
        sla.conf
        smdi.conf
        sorcery.conf
        ss7.timers
        stasis.conf
        statsd.conf
        stir_shaken.conf
        telcordia-1.adsi
        test_sorcery.conf
        udptl.conf
        unistim.conf
        users.conf
        voicemail.conf
        xmpp.conf)
backup=("${_confs[@]/#/etc/$pkgname/}")
_archive="$pkgname-$pkgver"
source=("https://downloads.asterisk.org/pub/telephony/$pkgname/releases/$_archive.tar.gz"
        "$pkgname.sysusers"
        "$pkgname.logrotated"
        "$pkgname.tmpfiles"
        "fix-upnp.patch")
sha256sums=('c892e9a51919d62bee2bed8b7c6f59ec79dfd48768ae289df61dba2da83f4413'
            '38a53911647fb2308482179cba605ebf12345df37eed23eb4ea67bf0bf041486'
            'b97dc10a262621c95e4b75e024834712efd58561267b59b9171c959ecd9f7164'
            '1b6b489d4f71015bfc56ce739d92df7e9abdb349aed6f5a47dd9c18d84546c1b'
            '55798baa02698de3d81c4b6e11097b3dee73b20e9dfa1e08091a7037830ad6d8')

prepare() {
	cd "$_archive"

	local filename
	for filename in "${source[@]}"; do
		if [[ "$filename" =~ \.patch$ ]]; then
			echo "Applying patch ${filename##*/}"
			patch -p1 -N -i "$srcdir/${filename##*/}"
		fi
	done
}

build() {
	cd "$_archive"

	./configure \
		--prefix=/usr \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--sbindir=/usr/bin

	make MENUSELECT_CFLAGS= OPTIMIZE= DEBUG= ASTVARRUNDIR="/run/$pkgname" NOISY_BUILD=1
}

package(){
	cd "$_archive"

	make DESTDIR="$pkgdir" install
	make DESTDIR="$pkgdir" install-headers
	make DESTDIR="$pkgdir" samples

	# Backup file list changes frequently and is hard to keep up to date. Check
	# that our current meta data matches whatever just got packaged, else flunk
	# with a helpful output of where the lists differ. We have to compare twice
	# because cmp has a useful exit code, comm has a useful output, neither both
	local _backs=($(cd "$pkgdir/etc/$pkgname" && echo *))
	cmp -s \
		<(IFS=$'\n'; echo "${_confs[*]}" | sort) \
		<(IFS=$'\n'; echo "${_backs[*]}" | sort) ||
		(comm -3 --nocheck-order \
			<(IFS=$'\n'; echo "${_confs[*]}" | sort) \
			<(IFS=$'\n'; echo "${_backs[*]}" | sort) &&
		exit 1)

	sed -i -e 's,/var/run,/run,' "$pkgdir/etc/$pkgname/asterisk.conf"
	install -Dm644 -t "$pkgdir/usr/share/doc/$pkgname/examples" "$pkgdir/etc/$pkgname/"*

	mv "$pkgdir/var/run" "$pkgdir"

	pushd contrib/systemd
	install -Dm644 -t "$pkgdir/usr/lib/systemd/system/" "$pkname"*.{service,socket}

	pushd "$srcdir"
	install -Dm644 "$pkgname.sysusers" "$pkgdir/usr/lib/sysusers.d/$pkgname.conf"
	install -Dm644 "$pkgname.logrotated" "$pkgdir/etc/logrotate.d/$pkgname"
	install -Dm644 "$pkgname.tmpfiles" "$pkgdir/usr/lib/tmpfiles.d/$pkgname.conf"

	chmod 0750 "$pkgdir"/{etc,run,var/{lib,log,spool}}/"$pkgname"
}