openldap.spec 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. ##
  2. ## openldap.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2004 The OpenPKG Project <http://www.openpkg.org/>
  4. ## Copyright (c) 2000-2004 Ralf S. Engelschall <rse@engelschall.com>
  5. ## Copyright (c) 2000-2004 Cable & Wireless <http://www.cw.com/>
  6. ##
  7. ## Permission to use, copy, modify, and distribute this software for
  8. ## any purpose with or without fee is hereby granted, provided that
  9. ## the above copyright notice and this permission notice appear in all
  10. ## copies.
  11. ##
  12. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  13. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  15. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  16. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  18. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  19. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  20. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  21. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  22. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  23. ## SUCH DAMAGE.
  24. ##
  25. # package information
  26. Name: openldap
  27. Summary: Lightweight Directory Access Protocol (LDAP) Toolkit
  28. URL: http://www.openldap.org/
  29. Vendor: OpenLDAP Project
  30. Packager: The OpenPKG Project
  31. Distribution: OpenPKG
  32. Class: BASE
  33. Group: Database
  34. License: GPL
  35. Version: 2.2.15
  36. Release: 20040825
  37. # package options
  38. %option with_fsl yes
  39. %option with_crypt yes
  40. %option with_sasl no
  41. %option with_perl no
  42. # list of sources
  43. Source0: ftp://ftp.openldap.org/pub/openldap/openldap-release/openldap-%{version}.tgz
  44. Source1: rc.openldap
  45. Source2: fsl.openldap
  46. Patch0: openldap.patch
  47. # build information
  48. Prefix: %{l_prefix}
  49. BuildRoot: %{l_buildroot}
  50. BuildPreReq: OpenPKG, openpkg >= 20040130, make, gcc
  51. PreReq: OpenPKG, openpkg >= 20040130
  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. # configure toolkit
  80. # (1. use hard-links)
  81. # (2. make sure our Berkeley-DB is picked up first)
  82. %{l_shtool} subst \
  83. -e 's;ln -s;ln;g' \
  84. -e 's;-ldb42;-ldb;g' \
  85. -e 's;<db\.h>;"db.h";g' \
  86. configure
  87. %if "%{with_sasl}" == "yes"
  88. # hard-code use of SASL2 library
  89. ( echo "ac_cv_lib_sasl2_sasl_client_init=yes"
  90. ) >config.cache
  91. cf="%{l_cppflags sasl}"
  92. %else
  93. cf="%{l_cppflags}"
  94. %endif
  95. CC="%{l_cc}" \
  96. CFLAGS="%{l_cflags -O} `%{l_prefix}/bin/pth-config --cflags`" \
  97. CPPFLAGS="$cf" \
  98. LDFLAGS="%{l_ldflags} `%{l_prefix}/bin/pth-config --ldflags` %{l_fsl_ldflags}" \
  99. LIBS="`%{l_prefix}/bin/pth-config --libs` %{l_fsl_libs}" \
  100. ./configure \
  101. --cache-file=./config.cache \
  102. --prefix=%{l_prefix} \
  103. --libexecdir=%{l_prefix}/libexec/openldap \
  104. --localstatedir=%{l_prefix}/var/openldap \
  105. --enable-syslog \
  106. --with-readline \
  107. --with-tls \
  108. %if "%{with_sasl}" == "yes"
  109. --with-cyrus-sasl \
  110. --enable-spasswd \
  111. %else
  112. --without-cyrus-sasl \
  113. --disable-spasswd \
  114. %endif
  115. %if "%{with_crypt}" == "yes"
  116. --enable-crypt \
  117. %endif
  118. --disable-dynamic \
  119. --disable-shared \
  120. --disable-modules \
  121. --enable-rewrite \
  122. --enable-ldbm \
  123. --with-ldbm-module=static \
  124. --with-ldbm-api=berkeley \
  125. --with-ldbm-type=btree \
  126. --enable-bdb \
  127. --with-bdb-module=static \
  128. --enable-hdb \
  129. --with-hdb-module=static \
  130. --enable-ldap \
  131. --with-ldap-module=static \
  132. --enable-meta \
  133. --with-meta-module=static \
  134. --enable-monitor \
  135. --with-monitor-module=static \
  136. --enable-dnssrv \
  137. --with-dnssrv-module=static \
  138. --enable-null \
  139. --with-null-module=static \
  140. --enable-shell \
  141. --with-shell-module=static \
  142. %if "%{with_perl}" == "yes"
  143. --enable-perl \
  144. --with-perl-module=static \
  145. %endif
  146. --with-dyngroup \
  147. --with-proxycache \
  148. --with-threads=pth \
  149. --enable-slurpd
  150. # build toolkit
  151. %{l_make} %{l_mflags}
  152. %install
  153. # install toolkit
  154. rm -rf $RPM_BUILD_ROOT
  155. %{l_shtool} mkdir -f -p -m 755 \
  156. $RPM_BUILD_ROOT%{l_prefix}/var/openldap
  157. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  158. # post adjustment: remove extra files
  159. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/openldap/*.default
  160. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/openldap/*/*.default
  161. # post adjustment: enable and correct slurpd.pid (slapd.pid as a precaution, too)
  162. %{l_shtool} subst \
  163. -e 's;^[ #]*\(pidfile \).*$;\1 %{l_prefix}/var/openldap/run/slapd.pid;' \
  164. -e 's;^[ #]*\(replica-pidfile \).*$;\1 %{l_prefix}/var/openldap/run/slurpd.pid;' \
  165. $RPM_BUILD_ROOT%{l_prefix}/etc/openldap/slapd.conf
  166. # post adjustment: remove OSSP fsl dependency from libtool files
  167. %{l_shtool} subst \
  168. -e 's;-lfsl *;;' \
  169. $RPM_BUILD_ROOT%{l_prefix}/lib/*.la
  170. # install run-command script
  171. %{l_shtool} mkdir -f -p -m 755 \
  172. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  173. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  174. %{SOURCE rc.openldap} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  175. # install OSSP fsl configuration
  176. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
  177. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  178. %{SOURCE fsl.openldap} \
  179. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  180. # determine installation files
  181. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  182. %{l_files_std} \
  183. '%not %dir %{l_prefix}/etc/fsl' \
  184. '%config %{l_prefix}/etc/fsl/fsl.openldap' \
  185. '%config %{l_prefix}/etc/openldap/*.conf'
  186. %files -f files
  187. %clean
  188. rm -rf $RPM_BUILD_ROOT
  189. %pre
  190. # before upgrade, save status and stop service
  191. [ $1 -eq 2 ] || exit 0
  192. eval `%{l_rc} openldap status 2>/dev/null | tee %{l_tmpfile}`
  193. %{l_rc} openldap stop 2>/dev/null
  194. exit 0
  195. %post
  196. [ $1 -eq 2 ] || exit 0
  197. # after upgrade, restore status
  198. { eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}; true; } >/dev/null 2>&1
  199. [ ".$openldap_active" = .yes ] && %{l_rc} openldap start
  200. exit 0
  201. %preun
  202. # before erase, stop service and remove log files
  203. [ $1 -eq 0 ] || exit 0
  204. %{l_rc} openldap stop 2>/dev/null
  205. rm -f $RPM_INSTALL_PREFIX/var/openldap/openldap.log* >/dev/null 2>&1 || true
  206. exit 0