openldap.spec 7.9 KB

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