##
## freeradius.spec -- OpenPKG RPM Package Specification
## Copyright (c) 2000-2007 OpenPKG Foundation e.V.
## Copyright (c) 2000-2007 Ralf S. Engelschall
##
## Permission to use, copy, modify, and distribute this software for
## any purpose with or without fee is hereby granted, provided that
## the above copyright notice and this permission notice appear in all
## copies.
##
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
## SUCH DAMAGE.
##
# FIXME: rse: default configuration is a little bit fat
# FIXME: rse: still not run-time tested
# package version
%define V_real 1.1.6
%define V_here 1.1.6
# package information
Name: freeradius
Summary: FreeRADIUS Server
URL: http://www.freeradius.org/
Vendor: The FreeRADIUS Server Project
Packager: OpenPKG Foundation e.V.
Distribution: OpenPKG Community
Class: EVAL
Group: RADIUS
License: GPL
Version: %{V_here}
Release: 20070412
# package options
%option with_mysql no
%option with_openldap yes
%option with_pgsql no
%option with_snmp no
# list of sources
Source0: ftp://ftp.freeradius.org/pub/radius/freeradius-%{V_real}.tar.gz
Source1: rc.freeradius
Patch0: freeradius.patch
# build information
Prefix: %{l_prefix}
BuildRoot: %{l_buildroot}
BuildPreReq: OpenPKG, openpkg >= 20060823, make, gcc, libtool
PreReq: OpenPKG, openpkg >= 20060823
BuildPreReq: perl, openssl, gdbm
PreReq: perl, openssl, gdbm
%if "%{with_mysql}" == "yes"
BuildPreReq: mysql, zlib
PreReq: mysql, zlib
%endif
%if "%{with_openldap}" == "yes"
BuildPreReq: openldap
PreReq: openldap
%endif
%if "%{with_pgsql}" == "yes"
BuildPreReq: postgresql
PreReq: postgresql
%endif
%if "%{with_snmp}" == "yes"
BuildPreReq: snmp
PreReq: snmp
%endif
AutoReq: no
AutoReqProv: no
%description
FreeRADIUS is one of the most modular and featureful RADIUS servers
available today. It has been written by a team of developers who
have more than a decade of collective experience in implementing
and deploying RADIUS software, in software engineering, and in Unix
package management.
%track
prog freeradius = {
version = %{V_real}
url = ftp://ftp.freeradius.org/pub/radius/
regex = freeradius-(\d+\.\d+(\.\d+)*)\.tar\.gz
}
%prep
%setup -q -n freeradius-%{V_real}
%patch -p0
%{l_shtool} subst \
-e 's;\(LIBS *=.* *-lldap\);\1 -llber -lssl -lcrypto;' \
src/modules/rlm_ldap/configure
%build
# configure package
CC="%{l_cc}" \
CFLAGS="-I`pwd`/src/include %{l_cflags -O} %{l_cppflags}" \
CPPFLAGS="%{l_cppflags}" \
LDFLAGS="%{l_ldflags}" \
LIBS="-llber -lssl -lcrypto" \
./configure \
--prefix=%{l_prefix} \
--libdir=%{l_prefix}/lib/freeradius \
--localstatedir=%{l_prefix}/var/freeradius \
--datadir=%{l_prefix}/share/freeradius \
--sysconfdir=%{l_prefix}/etc \
--disable-shared \
--enable-static \
--with-logdir=%{l_prefix}/var/freeradius \
--with-radacctdir=%{l_prefix}/var/freeradius \
--with-raddbdir=%{l_prefix}/etc/freeradius \
--without-threads \
--with-openssl-includes=%{l_prefix}/include/openssl \
--with-openssl-libraries=%{l_prefix}/lib/ \
%if "%{with_mysql}" == "yes" || "%{with_pgsql}" == "yes"
--with-rlm_sql \
--without-rlm_sql_db2 \
--without-rlm_sql_firebird \
--without-rlm_sql_freetds \
--without-rlm_sql_iodbc \
--without-rlm_sql_oracle \
--without-rlm_sql_sybase \
--without-rlm_sql_unixodbc \
%else
--without-rlm_sql \
%endif
%if "%{with_mysql}" == "yes"
--with-rlm_sql_mysql \
%else
--without-rlm_sql_mysql \
%endif
%if "%{with_openldap}" == "yes"
--with-rlm-ldap-include-dir=%{l_prefix}/include/ \
--with-rlm-ldap-lib-dir=%{l_prefix}/lib/ \
%else
--without-rlm-ldap \
%endif
%if "%{with_pgsql}" == "yes"
--with-rlm_sql_postgresql \
%else
--without-rlm_sql_postgresql \
%endif
%if "%{with_snmp}" == "yes"
--with-snmp \
%else
--without-snmp \
%endif
--without-rlm_eap_sim \
--without-rlm_eap_tls \
--without-rlm_eap_peap \
--without-rlm_eap_ttls \
--without-rlm_krb5 \
--without-rlm_dbm \
--without-rlm_otp \
--without-rlm_pam \
--without-rlm_perl \
--enable-strict-dependencies \
--with-ltdl-lib=%{l_prefix}/lib \
--with-ltdl-include=%{l_prefix}/include \
--disable-ltdl-install
# build package
%{l_make} %{l_mflags}
%install
# install package
rm -rf $RPM_BUILD_ROOT
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/lib/freeradius
%{l_make} %{l_mflags} install \
R=$RPM_BUILD_ROOT
# strip down installation
strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
rm -rf $RPM_BUILD_ROOT%{l_prefix}/etc/freeradius/certs
rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/freeradius/*.sample
rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/freeradius/doc
rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/rc.radiusd
rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/freeradius/*%{V_real}*
rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/freeradius/rlm_*
# adjust default configuration
%{l_shtool} subst \
-e 's;^#user = nobody;user = %{l_rusr};' \
-e 's;^#group = nobody;group = %{l_rgrp};' \
$RPM_BUILD_ROOT%{l_prefix}/etc/freeradius/radiusd.conf
# install run-command script
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE rc.freeradius} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
# determine installation files
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
%{l_files_std} \
'%config %{l_prefix}/etc/freeradius/*' \
'%attr(755,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/freeradius'
%files -f files
%clean
rm -rf $RPM_BUILD_ROOT