openldap.spec 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  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.12
  35. Release: 20051119
  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. # 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;-ldb43;-ldb;g' \
  86. -e 's;<db\.h>;"db.h";g' \
  87. configure
  88. %if "%{with_sasl}" == "yes"
  89. # hard-code use of SASL2 library
  90. ( echo "ac_cv_lib_sasl2_sasl_client_init=yes"
  91. ) >config.cache
  92. cf="%{l_cppflags sasl}"
  93. %else
  94. cf="%{l_cppflags}"
  95. %endif
  96. LOCLIBS=""
  97. case "%{l_platform -t}" in
  98. *-sunos* )
  99. LOCLIBS="-lrt"
  100. ;;
  101. esac
  102. CC="%{l_cc}" \
  103. CFLAGS="%{l_cflags -O} `%{l_prefix}/bin/pth-config --cflags`" \
  104. CPPFLAGS="$cf -I`%{l_prefix}/bin/pth-config --includedir`" \
  105. LDFLAGS="%{l_ldflags} `%{l_prefix}/bin/pth-config --ldflags` %{l_fsl_ldflags}" \
  106. LIBS="`%{l_prefix}/bin/pth-config --libs` %{l_fsl_libs} $LOCLIBS" \
  107. ./configure \
  108. --cache-file=./config.cache \
  109. --prefix=%{l_prefix} \
  110. --libexecdir=%{l_prefix}/libexec/openldap \
  111. --localstatedir=%{l_prefix}/var/openldap \
  112. --enable-syslog \
  113. --with-readline \
  114. --with-tls \
  115. %if "%{with_sasl}" == "yes"
  116. --with-cyrus-sasl \
  117. --enable-spasswd \
  118. %else
  119. --without-cyrus-sasl \
  120. --disable-spasswd \
  121. %endif
  122. %if "%{with_crypt}" == "yes"
  123. --enable-crypt \
  124. %endif
  125. --disable-dynamic \
  126. --disable-shared \
  127. --disable-modules \
  128. --enable-rewrite \
  129. --enable-ldbm \
  130. --with-ldbm-module=static \
  131. --with-ldbm-api=berkeley \
  132. --with-ldbm-type=btree \
  133. --enable-bdb \
  134. --with-bdb-module=static \
  135. --enable-hdb \
  136. --with-hdb-module=static \
  137. --enable-ldap \
  138. --with-ldap-module=static \
  139. --enable-meta \
  140. --with-meta-module=static \
  141. --enable-monitor \
  142. --with-monitor-module=static \
  143. --enable-dnssrv \
  144. --with-dnssrv-module=static \
  145. --enable-null \
  146. --with-null-module=static \
  147. --enable-shell \
  148. --with-shell-module=static \
  149. %if "%{with_perl}" == "yes"
  150. --enable-perl \
  151. --with-perl-module=static \
  152. %endif
  153. --with-dyngroup \
  154. --with-proxycache \
  155. --with-threads=pth \
  156. --enable-slurpd
  157. # build toolkit
  158. %{l_make} %{l_mflags} depend
  159. %{l_make} %{l_mflags}
  160. %install
  161. # install toolkit
  162. rm -rf $RPM_BUILD_ROOT
  163. %{l_shtool} mkdir -f -p -m 755 \
  164. $RPM_BUILD_ROOT%{l_prefix}/var/openldap
  165. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  166. # post adjustment: remove extra files
  167. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/openldap/*.default
  168. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/openldap/*/*.default
  169. # post adjustment: enable and correct slurpd.pid (slapd.pid as a precaution, too)
  170. %{l_shtool} subst \
  171. -e 's;^[ #]*\(pidfile \).*$;\1 %{l_prefix}/var/openldap/run/slapd.pid;' \
  172. -e 's;^[ #]*\(replica-pidfile \).*$;\1 %{l_prefix}/var/openldap/run/slurpd.pid;' \
  173. $RPM_BUILD_ROOT%{l_prefix}/etc/openldap/slapd.conf
  174. # post adjustment: remove OSSP fsl dependency from libtool files
  175. %{l_shtool} subst \
  176. -e 's;-lfsl *;;' \
  177. $RPM_BUILD_ROOT%{l_prefix}/lib/*.la
  178. # install run-command script
  179. %{l_shtool} mkdir -f -p -m 755 \
  180. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  181. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  182. %{SOURCE rc.openldap} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  183. # install OSSP fsl configuration
  184. %{l_shtool} mkdir -f -p -m 755 \
  185. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
  186. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  187. %{SOURCE fsl.openldap} \
  188. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  189. # install pkg-config configuration
  190. %{l_shtool} mkdir -f -p -m 755 \
  191. $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig
  192. libs="-lldap -llber"
  193. %if "%{with_sasl}" == "yes"
  194. libs="$libs -lsasl2"
  195. %endif
  196. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  197. -e 's;@version@;%{version};' \
  198. -e "s;@libs@;$libs;" \
  199. %{SOURCE openldap.pc} \
  200. $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig/
  201. # determine installation files
  202. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  203. %{l_files_std} \
  204. '%not %dir %{l_prefix}/etc/fsl' \
  205. '%not %dir %{l_prefix}/lib/pkgconfig' \
  206. '%config %{l_prefix}/etc/fsl/fsl.openldap' \
  207. '%config %{l_prefix}/etc/openldap/*.conf'
  208. %files -f files
  209. %clean
  210. rm -rf $RPM_BUILD_ROOT
  211. %pre
  212. # before upgrade, save status and stop service
  213. [ $1 -eq 2 ] || exit 0
  214. eval `%{l_rc} openldap status 2>/dev/null | tee %{l_tmpfile}`
  215. %{l_rc} openldap stop 2>/dev/null
  216. exit 0
  217. %post
  218. [ $1 -eq 2 ] || exit 0
  219. # after upgrade, restore status
  220. { eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}; true; } >/dev/null 2>&1
  221. [ ".$openldap_active" = .yes ] && %{l_rc} openldap start
  222. exit 0
  223. %preun
  224. # before erase, stop service and remove log files
  225. [ $1 -eq 0 ] || exit 0
  226. %{l_rc} openldap stop 2>/dev/null
  227. rm -f $RPM_INSTALL_PREFIX/var/openldap/openldap.log* >/dev/null 2>&1 || true
  228. exit 0