freeradius.spec 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. ##
  2. ## freeradius.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ## Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
  5. ##
  6. ## Permission to use, copy, modify, and distribute this software for
  7. ## any purpose with or without fee is hereby granted, provided that
  8. ## the above copyright notice and this permission notice appear in all
  9. ## copies.
  10. ##
  11. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  12. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  13. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  14. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  15. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  17. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  18. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  19. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  20. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  21. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  22. ## SUCH DAMAGE.
  23. ##
  24. # FIXME: rse: default configuration is a little bit fat
  25. # FIXME: rse: still not run-time tested
  26. # package version
  27. %define V_real 1.1.6
  28. %define V_here 1.1.6
  29. # package information
  30. Name: freeradius
  31. Summary: FreeRADIUS Server
  32. URL: http://www.freeradius.org/
  33. Vendor: The FreeRADIUS Server Project
  34. Packager: OpenPKG Foundation e.V.
  35. Distribution: OpenPKG Community
  36. Class: EVAL
  37. Group: RADIUS
  38. License: GPL
  39. Version: %{V_here}
  40. Release: 20070412
  41. # package options
  42. %option with_mysql no
  43. %option with_openldap yes
  44. %option with_pgsql no
  45. %option with_snmp no
  46. # list of sources
  47. Source0: ftp://ftp.freeradius.org/pub/radius/freeradius-%{V_real}.tar.gz
  48. Source1: rc.freeradius
  49. Patch0: freeradius.patch
  50. # build information
  51. Prefix: %{l_prefix}
  52. BuildRoot: %{l_buildroot}
  53. BuildPreReq: OpenPKG, openpkg >= 20060823, make, gcc, libtool
  54. PreReq: OpenPKG, openpkg >= 20060823
  55. BuildPreReq: perl, openssl, gdbm
  56. PreReq: perl, openssl, gdbm
  57. %if "%{with_mysql}" == "yes"
  58. BuildPreReq: mysql, zlib
  59. PreReq: mysql, zlib
  60. %endif
  61. %if "%{with_openldap}" == "yes"
  62. BuildPreReq: openldap
  63. PreReq: openldap
  64. %endif
  65. %if "%{with_pgsql}" == "yes"
  66. BuildPreReq: postgresql
  67. PreReq: postgresql
  68. %endif
  69. %if "%{with_snmp}" == "yes"
  70. BuildPreReq: snmp
  71. PreReq: snmp
  72. %endif
  73. AutoReq: no
  74. AutoReqProv: no
  75. %description
  76. FreeRADIUS is one of the most modular and featureful RADIUS servers
  77. available today. It has been written by a team of developers who
  78. have more than a decade of collective experience in implementing
  79. and deploying RADIUS software, in software engineering, and in Unix
  80. package management.
  81. %track
  82. prog freeradius = {
  83. version = %{V_real}
  84. url = ftp://ftp.freeradius.org/pub/radius/
  85. regex = freeradius-(\d+\.\d+(\.\d+)*)\.tar\.gz
  86. }
  87. %prep
  88. %setup -q -n freeradius-%{V_real}
  89. %patch -p0
  90. %{l_shtool} subst \
  91. -e 's;\(LIBS *=.* *-lldap\);\1 -llber -lssl -lcrypto;' \
  92. src/modules/rlm_ldap/configure
  93. %build
  94. # configure package
  95. CC="%{l_cc}" \
  96. CFLAGS="-I`pwd`/src/include %{l_cflags -O} %{l_cppflags}" \
  97. CPPFLAGS="%{l_cppflags}" \
  98. LDFLAGS="%{l_ldflags}" \
  99. LIBS="-llber -lssl -lcrypto" \
  100. ./configure \
  101. --prefix=%{l_prefix} \
  102. --libdir=%{l_prefix}/lib/freeradius \
  103. --localstatedir=%{l_prefix}/var/freeradius \
  104. --datadir=%{l_prefix}/share/freeradius \
  105. --sysconfdir=%{l_prefix}/etc \
  106. --disable-shared \
  107. --enable-static \
  108. --with-logdir=%{l_prefix}/var/freeradius \
  109. --with-radacctdir=%{l_prefix}/var/freeradius \
  110. --with-raddbdir=%{l_prefix}/etc/freeradius \
  111. --without-threads \
  112. --with-openssl-includes=%{l_prefix}/include/openssl \
  113. --with-openssl-libraries=%{l_prefix}/lib/ \
  114. %if "%{with_mysql}" == "yes" || "%{with_pgsql}" == "yes"
  115. --with-rlm_sql \
  116. --without-rlm_sql_db2 \
  117. --without-rlm_sql_firebird \
  118. --without-rlm_sql_freetds \
  119. --without-rlm_sql_iodbc \
  120. --without-rlm_sql_oracle \
  121. --without-rlm_sql_sybase \
  122. --without-rlm_sql_unixodbc \
  123. %else
  124. --without-rlm_sql \
  125. %endif
  126. %if "%{with_mysql}" == "yes"
  127. --with-rlm_sql_mysql \
  128. %else
  129. --without-rlm_sql_mysql \
  130. %endif
  131. %if "%{with_openldap}" == "yes"
  132. --with-rlm-ldap-include-dir=%{l_prefix}/include/ \
  133. --with-rlm-ldap-lib-dir=%{l_prefix}/lib/ \
  134. %else
  135. --without-rlm-ldap \
  136. %endif
  137. %if "%{with_pgsql}" == "yes"
  138. --with-rlm_sql_postgresql \
  139. %else
  140. --without-rlm_sql_postgresql \
  141. %endif
  142. %if "%{with_snmp}" == "yes"
  143. --with-snmp \
  144. %else
  145. --without-snmp \
  146. %endif
  147. --without-rlm_eap_sim \
  148. --without-rlm_eap_tls \
  149. --without-rlm_eap_peap \
  150. --without-rlm_eap_ttls \
  151. --without-rlm_krb5 \
  152. --without-rlm_dbm \
  153. --without-rlm_otp \
  154. --without-rlm_pam \
  155. --without-rlm_perl \
  156. --enable-strict-dependencies \
  157. --with-ltdl-lib=%{l_prefix}/lib \
  158. --with-ltdl-include=%{l_prefix}/include \
  159. --disable-ltdl-install
  160. # build package
  161. %{l_make} %{l_mflags}
  162. %install
  163. # install package
  164. rm -rf $RPM_BUILD_ROOT
  165. %{l_shtool} mkdir -f -p -m 755 \
  166. $RPM_BUILD_ROOT%{l_prefix}/lib/freeradius
  167. %{l_make} %{l_mflags} install \
  168. R=$RPM_BUILD_ROOT
  169. # strip down installation
  170. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  171. rm -rf $RPM_BUILD_ROOT%{l_prefix}/etc/freeradius/certs
  172. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/freeradius/*.sample
  173. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/freeradius/doc
  174. rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/rc.radiusd
  175. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/freeradius/*%{V_real}*
  176. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/freeradius/rlm_*
  177. # adjust default configuration
  178. %{l_shtool} subst \
  179. -e 's;^#user = nobody;user = %{l_rusr};' \
  180. -e 's;^#group = nobody;group = %{l_rgrp};' \
  181. $RPM_BUILD_ROOT%{l_prefix}/etc/freeradius/radiusd.conf
  182. # install run-command script
  183. %{l_shtool} mkdir -f -p -m 755 \
  184. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  185. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  186. %{SOURCE rc.freeradius} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  187. # determine installation files
  188. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  189. %{l_files_std} \
  190. '%config %{l_prefix}/etc/freeradius/*' \
  191. '%attr(755,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/freeradius'
  192. %files -f files
  193. %clean
  194. rm -rf $RPM_BUILD_ROOT