1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 PYTHON_COMPAT=( python2_7 )
8 inherit autotools eutils pam python-any-r1 user
12 MY_P="${PN}-server-${PV}"
14 DESCRIPTION="Highly configurable free RADIUS server"
16 ftp://ftp.freeradius.org/pub/radius/${MY_P}.tar.gz
17 ftp://ftp.freeradius.org/pub/radius/old/${MY_P}.tar.gz
18 https://dev.gentoo.org/~flameeyes/${PN}/${PN}-2.2.0-patches-${PATCHSET}.tar.xz
21 HOMEPAGE="http://www.freeradius.org/"
23 KEYWORDS="amd64 ~ppc ~ppc64 ~sparc x86 ~x86-fbsd"
28 debug firebird iodbc kerberos ldap mysql odbc oracle pam pcap
29 postgres python readline sqlite ssl
31 RESTRICT="firebird? ( bindist )"
33 RDEPEND="!net-dialup/cistronradius
38 python? ( ${PYTHON_DEPS} )
39 readline? ( sys-libs/readline )
40 pcap? ( net-libs/libpcap )
41 mysql? ( virtual/mysql )
42 postgres? ( dev-db/postgresql )
43 firebird? ( dev-db/firebird )
45 ssl? ( dev-libs/openssl )
46 ldap? ( net-nds/openldap )
47 kerberos? ( virtual/krb5 )
48 sqlite? ( dev-db/sqlite:3 )
49 odbc? ( dev-db/unixODBC )
50 iodbc? ( dev-db/libiodbc )
51 oracle? ( dev-db/oracle-instantclient-basic )"
54 S="${WORKDIR}/${MY_P}"
58 enewuser radius -1 -1 /var/log/radius radius
60 python-any-r1_pkg_setup
61 export PYTHONBIN="${EPYTHON}"
66 "${WORKDIR}"/patches/0002*patch \
67 "${WORKDIR}"/patches/0004*patch \
68 "${FILESDIR}"/${P}-gentoo.patch
70 # most of the configuration options do not appear as ./configure
71 # switches. Instead it identifies the directories that are available
72 # and run through them. These might check for the presence of
73 # various libraries, in which case they are not built. To avoid
74 # automagic dependencies, we just remove all the modules that we're
75 # not interested in using.
77 use ssl || rm -r src/modules/rlm_eap/types/rlm_eap_{tls,ttls,peap}
78 use ldap || rm -r src/modules/rlm_ldap
79 use kerberos || rm -r src/modules/rlm_krb5
80 use pam || rm -r src/modules/rlm_pam
81 use python || rm -r src/modules/rlm_python
82 # Do not install ruby rlm module, bug #483108
83 rm -r src/modules/rlm_ruby
85 # these are all things we don't have in portage/I don't want to deal
87 rm -r src/modules/rlm_eap/types/rlm_eap_tnc # requires TNCS library
88 rm -r src/modules/rlm_eap/types/rlm_eap_ikev2 # requires libeap-ikev2
89 rm -r src/modules/rlm_opendirectory # requires some membership.h
90 rm -r src/modules/rlm_redis{,who} # requires redis
91 rm -r src/modules/rlm_sql/drivers/rlm_sql_{db2,freetds,sybase}
93 # sql drivers that are not part of experimental are loaded from a
94 # file, so we have to remove them from the file itself when we
98 local driver=rlm_sql_${2:-${flag}}
100 if ! use ${flag}; then
101 rm -r src/modules/rlm_sql/drivers/${driver} || die
102 sed -i -e /${driver}/d src/modules/rlm_sql/stable || die
107 usesqldriver postgres postgresql
108 usesqldriver firebird
110 usesqldriver odbc unixodbc
114 # remove bundled ltdl to avoid conflicts
124 if has_version app-crypt/heimdal; then
125 myconf="${myconf} --enable-heimdal-krb5"
128 use readline || export ac_cv_lib_readline=no
129 use pcap || export ac_cv_lib_pcap_pcap_open_live=no
131 # do not try to enable static with static-libs; upstream is a
132 # massacre of libtool best practices so you also have to make sure
133 # to --enable-shared explicitly.
135 --enable-shared --disable-static \
136 --disable-ltdl-install \
137 --with-system-libtool \
138 --with-system-libltdl \
139 --with-ascend-binary \
142 --with-iodbc-include-dir=/usr/include/iodbc \
143 --with-experimental-modules \
144 --with-docdir=/usr/share/doc/${PF} \
145 --with-logdir=/var/log/radius \
146 $(use_enable debug developer) \
147 $(use_with ldap edir) \
148 $(use_with ssl openssl) \
153 emake LIBTOOL=libtool
158 diropts -m0750 -o root -g radius
160 diropts -m0750 -o radius -g radius
161 dodir /var/log/radius
162 keepdir /var/log/radius/radacct
165 emake LIBTOOL=libtool R="${D}" install
167 fowners -R root:radius /etc/raddb
170 -e 's:/var/run/radiusd:/run/radiusd:' \
171 "${D}"/etc/raddb/radiusd.conf || die
173 pamd_mimic_system radiusd auth account password session
177 rm "${D}/usr/sbin/rc.radiusd"
179 newinitd "${FILESDIR}/radius.init-r3" radiusd
180 newconfd "${FILESDIR}/radius.conf-r3" radiusd
185 cd "${ROOT}"/etc/raddb/certs
191 if ! has_version ${CATEGORY}/${PN} && use ssl; then
192 elog "You have to run \`emerge --config =${CATEGORY}/${PF}\` to be able"
193 elog "to start the radiusd service."