blob: 4155a4059e0dd18684fb8aad6a29e1aef03d4b43 [file] [log] [blame]
Brad Bishopd7bf8c12018-02-25 22:55:05 -05001DESCRIPTION = "FreeRADIUS is an Internet authentication daemon, which implements the RADIUS \
2protocol, as defined in RFC 2865 (and others). It allows Network Access \
3Servers (NAS boxes) to perform authentication for dial-up users. There are \
4also RADIUS clients available for Web servers, firewalls, Unix logins, and \
5more. Using RADIUS allows authentication and authorization for a network to \
6be centralized, and minimizes the amount of re-configuration which has to be \
7done when adding or deleting new users."
8
9SUMMARY = "High-performance and highly configurable RADIUS server"
10HOMEPAGE = "http://www.freeradius.org/"
11SECTION = "System/Servers"
12LICENSE = "GPLv2 & LGPLv2+"
13LIC_FILES_CHKSUM = "file://LICENSE;md5=eb723b61539feef013de476e68b5c50a"
14DEPENDS = "openssl-native openssl libidn libtool libpcap libtalloc"
15
16SRC_URI = "ftp://ftp.freeradius.org/pub/freeradius/freeradius-server-${PV}.tar.bz2 \
17 file://freeradius \
18 file://volatiles.58_radiusd \
19 file://freeradius-enble-user-in-conf.patch \
20 file://freeradius-configure.ac-allow-cross-compilation.patch \
21 file://freeradius-fix-issues-related-to-m4-include-path.patch \
22 file://freeradius-libtool-detection.patch \
23 file://freeradius-configure.ac-add-option-for-libcap.patch \
24 file://freeradius-avoid-searching-host-dirs.patch \
25 file://freeradius-rlm_python-add-PY_INC_DIR.patch \
26 file://freeradius-libtool-do-not-use-jlibtool.patch \
27 file://freeradius-fix-quoting-for-BUILT_WITH.patch \
28 file://freeradius-fix-error-for-expansion-of-macro.patch \
29 file://0001-rlm_mschap-Use-includedir-instead-of-hardcoding-usr-.patch \
30 file://radiusd.service \
31 file://radiusd-volatiles.conf \
32"
33SRC_URI[md5sum] = "0c81a4464ccf1d04f7ef1218a029d37a"
34SRC_URI[sha256sum] = "23267d8505e7b2909f5bdbf3938ca077c1fe122290dc969304d4f3b594f7e3ba"
35
36PARALLEL_MAKE = ""
37
38S = "${WORKDIR}/freeradius-server-${PV}"
39
40EXTRA_OECONF = " --enable-strict-dependencies \
41 --with-docdir=${docdir}/freeradius-${PV} \
42 --with-openssl-includes=${STAGING_INCDIR} \
43 --with-openssl-libraries=${STAGING_LIBDIR} \
44 --without-rlm_ippool \
45 --without-rlm_cache_memcached \
46 --without-rlm_counter \
47 --without-rlm_couchbase \
48 --without-rlm_dbm \
49 --without-rlm_eap_tnc \
50 --without-rlm_eap_ikev2 \
51 --without-rlm_opendirectory \
52 --without-rlm_redis \
53 --without-rlm_rediswho \
54 --without-rlm_sql_db2 \
55 --without-rlm_sql_firebird \
56 --without-rlm_sql_freetds \
57 --without-rlm_sql_iodbc \
58 --without-rlm_sql_oracle \
59 --without-rlm_sql_sybase \
60 --without-rlm_sqlhpwippool \
61 ac_cv_path_PERL=${bindir}/perl \
62 ax_cv_cc_builtin_choose_expr=no \
63 ax_cv_cc_builtin_types_compatible_p=no \
64 ax_cv_cc_builtin_bswap64=no \
65 ax_cv_cc_bounded_attribute=no \
66"
67
68PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)} \
69 pcre libcap \
70"
71
72PACKAGECONFIG[krb5] = "--with-rlm_krb5,--without-rlm_krb5,krb5"
73PACKAGECONFIG[pam] = "--with-rlm_pam,--without-rlm_pam,libpam"
74PACKAGECONFIG[libcap] = "--with-libcap,--without-libcap,libcap"
75PACKAGECONFIG[ldap] = "--with-rlm_ldap,--without-rlm_ldap,openldap"
76PACKAGECONFIG[mysql] = "--with-rlm_sql_mysql,--without-rlm_sql_mysql,mysql5"
77PACKAGECONFIG[sqlite] = "--with-rlm_sql_sqlite,--without-rlm_sql_sqlite,sqlite3"
78PACKAGECONFIG[unixodbc] = "--with-rlm_sql_unixodbc,--without-rlm_sql_unixodbc,unixodbc"
79PACKAGECONFIG[postgresql] = "--with-rlm_sql_postgresql,--without-rlm_sql_postgresql,postgresql"
80PACKAGECONFIG[pcre] = "--with-pcre,--without-pcre,libpcre"
81PACKAGECONFIG[perl] = "--with-perl=${STAGING_BINDIR_NATIVE}/perl-native/perl --with-rlm_perl,--without-rlm_perl,perl-native perl,perl"
82PACKAGECONFIG[python] = "--with-rlm_python --with-rlm-python-bin=${STAGING_BINDIR_NATIVE}/python-native/python --with-rlm-python-include-dir=${STAGING_INCDIR}/${PYTHON_DIR},--without-rlm_python,python-native python"
83PACKAGECONFIG[rest] = "--with-rlm_rest,--without-rlm_rest,curl json-c"
84PACKAGECONFIG[ruby] = "--with-rlm_ruby,--without-rlm_ruby,ruby"
85
86inherit useradd autotools-brokensep update-rc.d systemd
87
88# This is not a cpan or python based package, but it needs some definitions
89# from cpan-base and python-dir bbclasses for building rlm_perl and rlm_python
90# correctly.
91inherit cpan-base python-dir
92
93# The modules subdirs also need to be processed by autoreconf. Use autogen.sh
94# in order to handle the subdirs correctly.
95do_configure () {
96 ./autogen.sh
97
98 # the configure of rlm_perl needs this to get correct
99 # mod_cflags and mod_ldflags
100 if ${@bb.utils.contains('PACKAGECONFIG', 'perl', 'true', 'false', d)}; then
101 export PERL5LIB="${STAGING_LIBDIR}${PERL_OWN_DIR}/perl/${@get_perl_version(d)}"
102 fi
103
104 oe_runconf
105
106 # we don't need dhcpclient
107 sed -i -e 's/dhcpclient.mk//' ${S}/src/modules/proto_dhcp/all.mk
108}
109
110INITSCRIPT_NAME = "radiusd"
111
112SYSTEMD_SERVICE_${PN} = "radiusd.service"
113
114USERADD_PACKAGES = "${PN}"
115USERADD_PARAM_${PN} = "--system --no-create-home --shell /bin/false --user-group radiusd"
116
117do_install() {
118 rm -rf ${D}
119 mkdir -p ${D}/${sysconfdir}/logrotate.d
120 mkdir -p ${D}/${sysconfdir}/pam.d
121 mkdir -p ${D}/${sysconfdir}/init.d
122 mkdir -p ${D}/${localstatedir}/lib/radiusd
123 mkdir -p ${D}${sysconfdir}/default/volatiles
124
125 export LD_LIBRARY_PATH=${D}/${libdir}
126 oe_runmake install R=${D} INSTALLSTRIP=""
127
128 # remove unsupported config files
129 rm -f ${D}/${sysconfdir}/raddb/experimental.conf
130
131 # remove scripts that required Perl(DBI)
132 rm -rf ${D}/${bindir}/radsqlrelay
133
134 cp -f ${WORKDIR}/freeradius ${D}/etc/init.d/radiusd
135 rm -f ${D}/${sbindir}/rc.radiusd
136 chmod +x ${D}/${sysconfdir}/init.d/radiusd
137 rm -rf ${D}/${localstatedir}/run/
138 install -m 0644 ${WORKDIR}/volatiles.58_radiusd ${D}${sysconfdir}/default/volatiles/58_radiusd
139
140 chown -R radiusd:radiusd ${D}/${sysconfdir}/raddb/
141 chown -R radiusd:radiusd ${D}/${localstatedir}/lib/radiusd
142
143 # For systemd
144 install -d ${D}${systemd_unitdir}/system
145 install -m 0644 ${WORKDIR}/radiusd.service ${D}${systemd_unitdir}/system
146 sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \
147 -e 's,@SBINDIR@,${sbindir},g' \
148 -e 's,@STATEDIR@,${localstatedir},g' \
149 -e 's,@SYSCONFDIR@,${sysconfdir},g' \
150 ${D}${systemd_unitdir}/system/radiusd.service
151
152 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
153 install -d ${D}${sysconfdir}/tmpfiles.d/
154 install -m 0644 ${WORKDIR}/radiusd-volatiles.conf ${D}${sysconfdir}/tmpfiles.d/
155 fi
156}
157
158# This is only needed when we install/update on a running target.
159#
160pkg_postinst_${PN} () {
161 if [ -z "$D" ]; then
162 if command -v systemd-tmpfiles >/dev/null; then
163 # create /var/log/radius, /var/run/radiusd
164 systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/radiusd-volatiles.conf
165 elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then
166 ${sysconfdir}/init.d/populate-volatile.sh update
167 fi
168
169 # Fix ownership for /etc/raddb/*, /var/lib/radiusd
170 chown -R radiusd:radiusd ${sysconfdir}/raddb
171 chown -R radiusd:radiusd ${localstatedir}/lib/radiusd
172 fi
173}
174
175# We really need the symlink :(
176INSANE_SKIP_${PN} = "dev-so"
177INSANE_SKIP_${PN}-krb5 = "dev-so"
178INSANE_SKIP_${PN}-ldap = "dev-so"
179INSANE_SKIP_${PN}-mysql = "dev-so"
180INSANE_SKIP_${PN}-perl = "dev-so"
181INSANE_SKIP_${PN}-postgresql = "dev-so"
182INSANE_SKIP_${PN}-python = "dev-so"
183INSANE_SKIP_${PN}-unixodbc = "dev-so"
184
185PACKAGES =+ "${PN}-utils ${PN}-ldap ${PN}-krb5 ${PN}-perl \
186 ${PN}-python ${PN}-mysql ${PN}-postgresql ${PN}-unixodbc"
187
188FILES_${PN}-utils = "${bindir}/*"
189
190FILES_${PN}-ldap = "${libdir}/rlm_ldap.so* \
191 ${sysconfdir}/raddb/mods-available/ldap \
192"
193
194FILES_${PN}-krb5 = "${libdir}/rlm_krb5.so* \
195 ${sysconfdir}/raddb/mods-available/krb5 \
196"
197
198FILES_${PN}-perl = "${libdir}/rlm_perl.so* \
199 ${sysconfdir}/raddb/mods-config/perl \
200 ${sysconfdir}/raddb/mods-available/perl \
201"
202
203FILES_${PN}-python = "${libdir}/rlm_python.so* \
204 ${sysconfdir}/raddb/mods-config/python \
205 ${sysconfdir}/raddb/mods-available/python \
206"
207
208FILES_${PN}-mysql = "${libdir}/rlm_sql_mysql.so* \
209 ${sysconfdir}/raddb/mods-config/sql/*/mysql \
210 ${sysconfdir}/raddb/mods-available/sql \
211"
212
213FILES_${PN}-postgresql = "${libdir}/rlm_sql_postgresql.so* \
214 ${sysconfdir}/raddb/mods-config/sql/*/postgresql \
215"
216
217FILES_${PN}-unixodbc = "${libdir}/rlm_sql_unixodbc.so*"
218
219FILES_${PN} =+ "${libdir}/rlm_*.so* ${libdir}/proto_*so*"
220
221RDEPENDS_${PN} += "perl"
222RDEPENDS_${PN}-utils = "${PN}"