openldap.spec 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. ##
  2. ## openldap.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2005 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ## Copyright (c) 2000-2005 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. # package information
  25. Name: openldap
  26. Summary: Lightweight Directory Access Protocol (LDAP) Toolkit
  27. URL: http://www.openldap.org/
  28. Vendor: OpenLDAP Project
  29. Packager: OpenPKG
  30. Distribution: OpenPKG
  31. Class: BASE
  32. Group: Database
  33. License: GPL
  34. Version: 2.3.14
  35. Release: 20051225
  36. # package options
  37. %option with_fsl yes
  38. %option with_crypt yes
  39. %option with_sasl no
  40. %option with_perl no
  41. # list of sources
  42. Source0: ftp://ftp.openldap.org/pub/openldap/openldap-release/openldap-%{version}.tgz
  43. Source1: rc.openldap
  44. Source2: fsl.openldap
  45. Source3: openldap.pc
  46. Patch0: openldap.patch
  47. # build information
  48. Prefix: %{l_prefix}
  49. BuildRoot: %{l_buildroot}
  50. BuildPreReq: OpenPKG, openpkg >= 20050615, make, gcc
  51. PreReq: OpenPKG, openpkg >= 20050615
  52. BuildPreReq: readline, openssl, db >= 4.2, pth
  53. PreReq: readline, openssl, db >= 4.2, pth
  54. %if "%{with_fsl}" == "yes"
  55. BuildPreReq: fsl >= 1.2.0
  56. PreReq: fsl >= 1.2.0
  57. %endif
  58. %if "%{with_sasl}" == "yes"
  59. BuildPreReq: sasl
  60. PreReq: sasl
  61. %endif
  62. AutoReq: no
  63. AutoReqProv: no
  64. %description
  65. OpenLDAP is an open source implementation of the Lightweight
  66. Directory Access Protocol (LDAP). The suite includes libraries
  67. implementing the LDAP protocol plus a stand-alone LDAP server
  68. slapd(8) and a stand-alone LDAP replication server slurpd(8).
  69. %track
  70. prog openldap = {
  71. version = %{version}
  72. url = ftp://ftp.openldap.org/pub/openldap/openldap-release/
  73. regex = openldap-(__VER__)\.tgz
  74. }
  75. %prep
  76. %setup -q
  77. %patch -p0
  78. %build
  79. # configuration: standard build flags
  80. export CC="%{l_cc}"
  81. export CFLAGS="%{l_cflags -O}"
  82. export CPPFLAGS="%{l_cppflags}"
  83. export LDFLAGS="%{l_ldflags}"
  84. export LIBS=""
  85. export ARGS=""
  86. ARGS="$ARGS --prefix=%{l_prefix}"
  87. ARGS="$ARGS --libexecdir=%{l_prefix}/libexec/openldap"
  88. ARGS="$ARGS --localstatedir=%{l_prefix}/var/openldap"
  89. ARGS="$ARGS --enable-syslog"
  90. ARGS="$ARGS --with-readline"
  91. ARGS="$ARGS --with-tls"
  92. ARGS="$ARGS --disable-dynamic"
  93. ARGS="$ARGS --disable-shared"
  94. ARGS="$ARGS --disable-modules"
  95. ARGS="$ARGS --enable-ldbm"
  96. ARGS="$ARGS --enable-ldbm-api=berkeley"
  97. ARGS="$ARGS --enable-ldbm-type=btree"
  98. ARGS="$ARGS --enable-bdb"
  99. ARGS="$ARGS --enable-rewrite"
  100. ARGS="$ARGS --enable-hdb"
  101. ARGS="$ARGS --enable-ldap"
  102. ARGS="$ARGS --enable-meta"
  103. ARGS="$ARGS --enable-monitor"
  104. ARGS="$ARGS --enable-dnssrv"
  105. ARGS="$ARGS --enable-null"
  106. ARGS="$ARGS --enable-shell"
  107. ARGS="$ARGS --with-dyngroup"
  108. ARGS="$ARGS --with-proxycache"
  109. ARGS="$ARGS --enable-slurpd"
  110. # configuration: force to use OSSP fsl
  111. LDFLAGS="$LDFLAGS %{l_fsl_ldflags}"
  112. LIBS="$LIBS %{l_fsl_libs}"
  113. # configuration: force to use GNU pth
  114. CFLAGS="$CFLAGS `%{l_prefix}/bin/pth-config --cflags`"
  115. CPPFLAGS="$CPPFLAGS -I`%{l_prefix}/bin/pth-config --includedir`"
  116. LDFLAGS="$LDFLAGS `%{l_prefix}/bin/pth-config --ldflags`"
  117. LIBS="`%{l_prefix}/bin/pth-config --libs` $LIBS"
  118. ARGS="$ARGS --with-threads=pth"
  119. # configuration: optional SASL support
  120. %if "%{with_sasl}" == "yes"
  121. ( echo "ac_cv_lib_sasl2_sasl_client_init=yes"
  122. ) >config.cache
  123. CPPFLAGS="%{l_cppflags sasl} $CPPFLAGS"
  124. ARGS="$ARGS --with-cyrus-sasl --enable-spasswd"
  125. %else
  126. ARGS="$ARGS --without-cyrus-sasl --disable-spasswd"
  127. %endif
  128. # configuration: optional crypt(3) support
  129. %if "%{with_crypt}" == "yes"
  130. ARGS="$ARGS --enable-crypt"
  131. %endif
  132. # configuration: optional Perl support
  133. %if "%{with_perl}" == "yes"
  134. ARGS="$ARGS --enable-perl"
  135. %endif
  136. # configuration: special platform support
  137. case "%{l_platform -t}" in
  138. *-sunos* ) LIBS="$LIBS -lrt" ;;
  139. esac
  140. # configuration: use hard-links and make sure our Berkeley-DB is picked up first
  141. %{l_shtool} subst \
  142. -e 's;ln -s;ln;g' \
  143. -e 's;-ldb4[234];-ldb;g' \
  144. -e 's;<db\.h>;"db.h";g' \
  145. configure
  146. # configuration
  147. ./configure --cache-file=./config.cache $ARGS
  148. # build toolkit
  149. %{l_make} %{l_mflags} depend
  150. %{l_make} %{l_mflags}
  151. %install
  152. # install toolkit
  153. rm -rf $RPM_BUILD_ROOT
  154. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  155. # post adjustment: remove extra files
  156. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/openldap/*.default
  157. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/openldap/*/*.default
  158. # post adjustment: enable and correct slurpd.pid (slapd.pid as a precaution, too)
  159. %{l_shtool} subst \
  160. -e 's;^[ #]*\(pidfile \).*$;\1 %{l_prefix}/var/openldap/run/slapd.pid;' \
  161. -e 's;^[ #]*\(replica-pidfile \).*$;\1 %{l_prefix}/var/openldap/run/slurpd.pid;' \
  162. $RPM_BUILD_ROOT%{l_prefix}/etc/openldap/slapd.conf
  163. # post adjustment: remove OSSP fsl dependency from libtool files
  164. %{l_shtool} subst \
  165. -e 's;-lfsl *;;' \
  166. $RPM_BUILD_ROOT%{l_prefix}/lib/*.la
  167. # install run-command script
  168. %{l_shtool} mkdir -f -p -m 755 \
  169. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  170. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  171. %{SOURCE rc.openldap} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  172. # install OSSP fsl configuration
  173. %{l_shtool} mkdir -f -p -m 755 \
  174. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
  175. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  176. %{SOURCE fsl.openldap} \
  177. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  178. # install pkg-config configuration
  179. %{l_shtool} mkdir -f -p -m 755 \
  180. $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig
  181. libs="-lldap -llber"
  182. %if "%{with_sasl}" == "yes"
  183. libs="$libs -lsasl2"
  184. %endif
  185. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  186. -e "s;@version@;%{version};" \
  187. -e "s;@libs@;$libs;" \
  188. %{SOURCE openldap.pc} \
  189. $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig/
  190. # determine installation files
  191. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  192. %{l_files_std} \
  193. '%not %dir %{l_prefix}/etc/fsl' \
  194. '%not %dir %{l_prefix}/lib/pkgconfig' \
  195. '%config %{l_prefix}/etc/fsl/fsl.openldap' \
  196. '%config %{l_prefix}/etc/openldap/*.conf'
  197. %files -f files
  198. %clean
  199. rm -rf $RPM_BUILD_ROOT
  200. %pre
  201. # before upgrade, save status and stop service
  202. [ $1 -eq 2 ] || exit 0
  203. eval `%{l_rc} openldap status 2>/dev/null | tee %{l_tmpfile}`
  204. %{l_rc} openldap stop 2>/dev/null
  205. exit 0
  206. %post
  207. # after upgrade, restore status
  208. [ $1 -eq 2 ] || exit 0
  209. { eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}; true; } >/dev/null 2>&1
  210. [ ".$openldap_active" = .yes ] && %{l_rc} openldap start
  211. exit 0
  212. %preun
  213. # before erase, stop service and remove log files
  214. [ $1 -eq 0 ] || exit 0
  215. %{l_rc} openldap stop 2>/dev/null
  216. rm -f $RPM_INSTALL_PREFIX/var/openldap/openldap.log* >/dev/null 2>&1 || true
  217. exit 0