aboutsummaryrefslogtreecommitdiffstats
path: root/main/freeradius/APKBUILD
blob: cadbea949ed2dfcd71aeb8ada097e0674babac94 (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
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=freeradius
pkgver=2.1.12
pkgrel=0
pkgdesc="RADIUS (Remote Authentication Dial-In User Service) server"
url="http://freeradius.org/"
arch="all"
license="GPL"
depends="freeradius-lib freeradius-radclient"
makedepends="openssl-dev pth-dev mysql-dev postgresql-dev gdbm-dev readline-dev
	bash libtool autoconf automake perl-dev python-dev openldap-dev unixodbc-dev"
pkggroups="radiusd"
pkgusers="radiusd"
install="freeradius.pre-install"
subpackages="$pkgname-doc $pkgname-dev $pkgname-ldap $pkgname-lib 
	$pkgname-mssql $pkgname-mysql $pkgname-oracle $pkgname-perl 
	$pkgname-postgresql $pkgname-python $pkgname-radclient $pkgname-unixodbc"
source="ftp://ftp.freeradius.org/pub/freeradius/$pkgname-server-$pkgver.tar.gz
	freeradius.confd
	freeradius.initd
	"

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

prepare() {
	cd "$_builddir"
#	for i in ../*.patch; do
#		msg "Applying $i"
#		patch -p1 -i $i || return 1
#	done
	
	# 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

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

build() {
	cd "$_builddir"
	./configure --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 \
		|| 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" -j1 || return 1
}

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

	make -j1 R="$pkgdir" LIBTOOL="$PWD/libtool" install
	sed -i -e 's:^#user *= *nobody:user = radiusd:;s:^#group *= *nobody:group = radiusd:' \
		"$pkgdir"/etc/raddb/radiusd.conf
	chown -R root:radiusd "$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/lorotate.d/$pkgname
	find $pkgdir -iname *.la -delete
}

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

lib() {
	replaces="freeradius"
	mkdir -p $subpkgdir/usr/lib/freeradius $subpkgdir/etc/raddb \
	 $subpkgdir/usr/share
	mv $pkgdir/usr/lib/freeradius/libfreeradius-radius-${pkgver}.so \
	 $subpkgdir/usr/lib/freeradius
	mv $pkgdir/etc/raddb/dictionary $subpkgdir/etc/raddb/dictionary
	mv $pkgdir/usr/share/freeradius $subpkgdir/usr/share/freeradius
}

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

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

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

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

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

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

radclient() {
	depends="freeradius-lib"
	mkdir -p $subpkgdir/usr/bin
	mv $pkgdir/usr/bin/radclient $subpkgdir/usr/bin/radclient
}

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

md5sums="dcbaed16df8ccff672ba132a08bf8510  freeradius-server-2.1.12.tar.gz
fc6693f3df5a0694610110287a28568a  freeradius.confd
7c14a0bc0ada858a08235d7a1d1f2d4c  freeradius.initd"