I used this useful page as a starting point, so some of this is duplicated with a few important additions. My build is for version 2.2.3
yum install rpm-build
find /usr/src/redhat -type d | xargs chmod a+wx
yum install autoconf automake gdbm-devel libtool libtool-ltdl-devel openssl-devel pam-devel zlib-devel net-snmp-devel net-snmp-utils readline-devel libpcap-devel openldap-devel perl-devel perl-ExtUtils-Embed python-devel mysql-devel postgresql-devel unixODBC-devel gcc make
wget http://kojipkgs.fedoraproject.org/packages/freeradius/2.2.3/6.fc19/src/freeradius-2.2.3-6.fc19.src.rpm
rpm -ihv --nomd5 freeradius-2.2.3-6.fc19.src.rpm
cd /usr/src/redhat/SPECS; wget http://confluence.diamond.ac.uk/download/attachments/25140151/freeradius-2.2.3-6.spec
cd /usr/src/redhat/SOURCES; wget https://raw.github.com/FreeRADIUS/freeradius-server/v2.x.x/redhat/freeradius-radiusd-init
- edit freeradius-2.2.3-6.spec to remove -fPIC stuff
#%ifarch s390 s390x #export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -fPIC -fPIE -DPIE" #export LDFLAGS="-pie -Wl,-znow" #%else #export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -fpic -fPIE -DPIE" #export LDFLAGS="-pie -Wl,-znow" #%endif
rpmbuild --buildroot /tmp/rpmbuild -ba /usr/src/redhat/SPECS/freeradius-2.2.3-6.spec
Notes:
- I found that the -fPIC CFLAGs made the libtool fail with a confusing message saying you need to add -fPIC.
- If you don't add --buildroot to the rpmbuild command you'll find it'll be blank and things will be put in all sorts of interesting locations. More worryingly it then deletes stuff and you end up losing things like /usr/include/* which is not good!