aboutsummaryrefslogtreecommitdiffstats
path: root/main/freeradius/APKBUILD
blob: 24cdfe63ff83b70ff2636b46a7a5eb1a9e23fc23 (plain) (blame)
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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
# Contributor: Ɓukasz Jendrysik <scadu@yandex.com>
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=freeradius
pkgver=2.2.6
pkgrel=0
pkgdesc="RADIUS (Remote Authentication Dial-In User Service) server"
url="http://freeradius.org/"
arch="all"
license="GPL"
depends="freeradius-radclient freeradius-lib"
makedepends="openssl-dev mariadb-dev postgresql-dev gdbm-dev readline-dev
	bash libtool autoconf automake perl-dev python-dev openldap-dev
	unixodbc-dev linux-pam-dev sqlite-dev linux-headers"
pkggroups="radius"
pkgusers="radius"
install="freeradius.pre-install"
subpackages="$pkgname-doc $pkgname-dev $pkgname-dbg $pkgname-ldap $pkgname-lib
	$pkgname-mssql $pkgname-mysql $pkgname-oracle $pkgname-perl
	$pkgname-postgresql $pkgname-python $pkgname-radclient $pkgname-sqlite
	$pkgname-unixodbc $pkgname-pam $pkgname-webif $pkgname-webif-doc"
source="ftp://ftp.freeradius.org/pub/freeradius/$pkgname-server-$pkgver.tar.gz
	0001-Use-threadsafe-wrapper-for-getpwnam-getgrnam.patch
	0001-use-threadsafe-rad_getgrnam.patch
	fix-tls-test.patch
	freeradius.confd
	freeradius.initd
	"

_builddir="$srcdir"/$pkgname-server-$pkgver

prepare() {
	cd "$_builddir"
        for i in $source; do
                case $i in
                *.patch)
                        msg "Applying $i"
                        patch -p1 -i "$srcdir"/$i || return 1
                        ;;
                esac
        done
	update_config_sub || return 1

	# we dont have libnsl
	sed -i 's/nsl, //g' configure.in || return 1

	# Fix compilation with heimdal >= 1.3.1
	sed -i 's/ -DKRB5_DEPRECATED//' src/modules/rlm_krb5/Makefile.in \
		|| return 1

	# Fix default config
	sed -i 's%run_dir = .*%run_dir = \$\{localstatedir\}/run/radius%' \
		raddb/radiusd.conf.in || return 1
	# disable directive that pulls in freeradius-mysql package
	sed -i 's%$INCLUDE ${confdir}/sql/mysql/ippool-dhcp.conf%#$INCLUDE ${confdir}/sql/mysql/ippool-dhcp.conf%' \
		raddb/modules/dhcp_sqlippool || return 1

	rm -f libtool.m4
	libtoolize --force -c || return 1
	aclocal && ./autogen.sh || return 1
}

build() {
	cd "$_builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		--libdir=/usr/lib/freeradius \
		--disable-static \
		--enable-shared \
		--disable-ltdl-install \
		--with-system-libtool \
		--with-system-libltdl \
		--with-udpfromto \
		--with-experimental-modules \
                --with-rlm_sql_sqlite \
		--without-rlm_sql_oracle \
		--without-rlm_sql_iodbc \
		--without-rlm_sql_firebird \
		--without-rlm_sql_db2 \
		--without-rlm_ruby \
		--without-rlm_rediswho \
		--without-rlm_redis \
		--without-rlm_krb5 \
		|| return 1

	# * workaround parallel build issue
	# * add -lssl to fix:
	#   radiusd: symbol 'SSL_set_ex_data': can't resolve symbol in lib
	#   '/usr/lib/freeradius/libfreeradius-eap-2.1.10.so'.
	make LDFLAGS="$LDFLAGS -lssl" LIBTOOL="$PWD/libtool" || return 1
}

package() {
	cd "$_builddir"
	install -d -m0750 -o root -g radius "$pkgdir"/etc/raddb
	install -d -m0750 -o radius -g radius "$pkgdir"/var/run/radius
	install -d -m0750 -o radius -g radius "$pkgdir"/var/log/radius
	install -d -m0750 -o radius -g radius "$pkgdir"/var/log/radius/radacct

	make -j1 R="$pkgdir" LIBTOOL="$PWD/libtool" install
	chown -R root:radius "$pkgdir"/etc/raddb/*
	rm -f "$pkgdir/usr/sbin/rc.radiusd"
	install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/radiusd
	install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/radiusd
	install -m644 -D scripts/logrotate.freeradius \
		"$pkgdir"/etc/logrotate.d/$pkgname
	find $pkgdir -iname *.la -delete
}

ldap() {
	depends="freeradius"
	mkdir -p $subpkgdir/etc/raddb
	mv $pkgdir/etc/raddb/ldap.attrmap $subpkgdir/etc/raddb || return 1
	mkdir -p $subpkgdir/etc/raddb/modules
	mv $pkgdir/etc/raddb/modules/ldap $subpkgdir/etc/raddb/modules \
		|| return 1
	mkdir -p $subpkgdir/usr/lib/freeradius
	mv $pkgdir/usr/lib/freeradius/rlm_ldap* $subpkgdir/usr/lib/freeradius \
		|| return 1
}

lib() {
	replaces="freeradius"
	depends=""
	mkdir -p $subpkgdir/usr/lib/freeradius $subpkgdir/etc/raddb \
	 $subpkgdir/usr/share || return 1
	mv $pkgdir/usr/lib/freeradius/libfreeradius-*.so \
	 $subpkgdir/usr/lib/freeradius || return 1
	mv $pkgdir/etc/raddb/dictionary $subpkgdir/etc/raddb/dictionary \
		|| return 1
	mv $pkgdir/usr/share/freeradius $subpkgdir/usr/share/freeradius \
		|| return 1
}

mysql() {
	depends="freeradius"
	mkdir -p $subpkgdir/etc/raddb/sql
	mv $pkgdir/etc/raddb/sql/mysql $subpkgdir/etc/raddb/sql || return 1
	mv $pkgdir/etc/raddb/sql/ndb $subpkgdir/etc/raddb/sql || return 1
	mkdir -p $subpkgdir/usr/lib/freeradius
	mv $pkgdir/usr/lib/freeradius/rlm_sql_mysql* \
		$subpkgdir/usr/lib/freeradius || return 1
}

mssql() {
	depends="freeradius"
	arch="noarch"
	mkdir -p $subpkgdir/etc/raddb/sql
	mv $pkgdir/etc/raddb/sql/mssql $subpkgdir/etc/raddb/sql || return 1
}

oracle() {
	depends="freeradius"
	arch="noarch"
	mkdir -p $subpkgdir/etc/raddb/sql
	mv $pkgdir/etc/raddb/sql/oracle $subpkgdir/etc/raddb/sql || return 1
}

perl() {
	depends="freeradius perl"
	mkdir -p $subpkgdir/usr/lib/freeradius
	mv $pkgdir/usr/lib/freeradius/rlm_perl* $subpkgdir/usr/lib/freeradius \
		|| return 1
	mkdir -p $subpkgdir/usr/bin
	mv $pkgdir/usr/sbin/checkrad $subpkgdir/usr/bin/checkrad || return 1
	mkdir -p $subpkgdir/etc/raddb/modules
	mv $pkgdir/etc/raddb/modules/perl $subpkgdir/etc/raddb/modules/perl \
		|| return 1
}

postgresql() {
	depends="freeradius"
	mkdir -p $subpkgdir/etc/raddb/sql
	mv $pkgdir/etc/raddb/sql/postgresql $subpkgdir/etc/raddb/sql || return 1
	mkdir -p $subpkgdir/usr/lib/freeradius
	mv $pkgdir/usr/lib/freeradius/rlm_sql_postgresql* \
		$subpkgdir/usr/lib/freeradius || return 1
}

python() {
	depends="freeradius python"
	mkdir -p $subpkgdir/usr/lib/freeradius
	mv $pkgdir/usr/lib/freeradius/rlm_python* \
		$subpkgdir/usr/lib/freeradius || return 1
}

radclient() {
	depends=""
	mkdir -p $subpkgdir/usr/bin
	mv $pkgdir/usr/bin/radclient $subpkgdir/usr/bin/radclient || return 1
}

sqlite() {
	depends="freeradius"
	mkdir -p $subpkgdir/usr/lib/freeradius
	mv $pkgdir/usr/lib/freeradius/rlm_sql_sqlite* \
		$subpkgdir/usr/lib/freeradius || return 1
}

unixodbc() {
	depends="freeradius"
	mkdir -p $subpkgdir/usr/lib/freeradius
	mv $pkgdir/usr/lib/freeradius/rlm_sql_unixodbc* \
		$subpkgdir/usr/lib/freeradius || return 1
}

pam() {
	depends="freeradius"
	mkdir -p $subpkgdir/usr/lib/freeradius
	mv $pkgdir/usr/lib/freeradius/rlm_pam* $subpkgdir/usr/lib/freeradius \
		|| return 1
}

webif() {
	depends="php"
	pkgdesc="Dialupadmin interface for FreeRADIUS"
	arch="noarch"
	mkdir -p $subpkgdir/usr/share/webapps/dialupadmin
	mkdir -p $subpkgdir/usr/share/doc/freeradius/dialupadmin
	mkdir -p $subpkgdir/etc/raddb/dialupadmin
	for dir in bin htdocs html lib sql;
	do
		mv $_builddir/dialup_admin/$dir \
		 $subpkgdir/usr/share/webapps/dialupadmin || return 1
	done
	mkdir -p $subpkgdir-doc/usr/share/doc/freeradius/dialupadmin
	mv $_builddir/dialup_admin/doc/* \
	 $subpkgdir-doc/usr/share/doc/freeradius/dialupadmin || return 1
	mv $_builddir/dialup_admin/README \
	 $subpkgdir-doc/usr/share/doc/freeradius/dialupadmin || return 1
	mv $_builddir/dialup_admin/conf/* $subpkgdir/etc/raddb/dialupadmin \
		|| return 1
	for file in $(ls $subpkgdir/usr/share/webapps/dialupadmin/bin)
	do
		sed -i "s|/usr/local/dialup_admin/conf|/etc/raddb/dialupadmin|g" \
		 $subpkgdir/usr/share/webapps/dialupadmin/bin/$file
		sed -i "s|/data/local/dialupadmin/conf|/etc/raddb/dialupadmin|g" \
		 $subpkgdir/usr/share/webapps/dialupadmin/bin/$file
	done
}

md5sums="3d1af22fccef74dbc06785ab1abdfd1f  freeradius-server-2.2.6.tar.gz
f28735060b63d88875783817bcd95586  0001-Use-threadsafe-wrapper-for-getpwnam-getgrnam.patch
aa00c3ed02b53021113b2e145d312ee4  0001-use-threadsafe-rad_getgrnam.patch
b6bcdba16c65503be4265126cf4d2eee  fix-tls-test.patch
fc6693f3df5a0694610110287a28568a  freeradius.confd
b3eefdfc466d80c241cd1bb11face405  freeradius.initd"
sha256sums="f0941f4757ace0a46b9dec11245c9e5b3addbb93a45141179638e3687b56be13  freeradius-server-2.2.6.tar.gz
115ae559fc5c8a638c5ebb510cb58478df66ceeb61a6768584e592e4a1fbc9d4  0001-Use-threadsafe-wrapper-for-getpwnam-getgrnam.patch
8f2dd61e5f90c83198fa26f66bca54394b17cafbb8d2bbb97e948b4f55d1f071  0001-use-threadsafe-rad_getgrnam.patch
38455012b9fc322a7bfdec66e4f8aafeb679d0142eddfba31114aadfd8195b41  fix-tls-test.patch
2d5b3e1af1299373182f2c8021bdf45c29db5d82b0a077b965a16ded32cb6292  freeradius.confd
719bbe4a44df60e76f68d327f7ee70d4dfd6a95e51f9cb01f850cd4ed153f9de  freeradius.initd"
sha512sums="0b2dcefa8607ae88b9cb1f21aaaa7c43d553ea2951dc2163b297560a68729e09820b329e47872355020ac9a987bcebbf8e1e2616f75b1089b706bbd0e296e6fc  freeradius-server-2.2.6.tar.gz
4fb99b6a0f22cb844382139d448e24cc1b698452e30c1b0f06674a6fbd21463bcece2f2f4121618f9c7c57c8eb882eee35511b4dcea6e2a0904e27e5f2a6a679  0001-Use-threadsafe-wrapper-for-getpwnam-getgrnam.patch
dfe522350a2d45bf81c362ee87c57021149f196d4d45b8567911a1bd74e6b11b5172042a36e02f651157854251c08e846330e5d862767427ad7850ac6eac4f96  0001-use-threadsafe-rad_getgrnam.patch
77ee33a3c2059fb07841255fefc577f4e04680f4a1968d320a17f1d2769ddb671c36639dadbba0a1b1faaa31b1fb0c900313c375a209e67c41d75ebf9bef9d8f  fix-tls-test.patch
e248159c0a44f722e405c51c8015d9ad672e42ad0d38ca28f8a051ff911aa4d3e630b9bd4543e9d610940bc4ae50c022594e219ce341b36abe85c572acad418b  freeradius.confd
57f12f06ef9112817204dec4ab2591bcd4baf3c8a033afadb2376e115911f76045c70b7a2c80b294a83dac4e05b1ff22335a3bcc9af1c0760682622ab2cdbd31  freeradius.initd"