openldap24.spec 8.8 KB

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