proftpd.spec 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. ##
  2. ## proftpd.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2003 Cable & Wireless Deutschland GmbH
  4. ## Copyright (c) 2000-2003 The OpenPKG Project <http://www.openpkg.org/>
  5. ## Copyright (c) 2000-2003 Ralf S. Engelschall <rse@engelschall.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: proftpd
  27. Summary: Professional FTP Daemon
  28. URL: http://www.proftpd.net/
  29. Vendor: The ProFTPD Project
  30. Packager: The OpenPKG Project
  31. Distribution: OpenPKG [BASE]
  32. Group: FTP
  33. License: GPL
  34. Version: 1.2.8
  35. Release: 20030704
  36. # package options
  37. %option with_mysql no
  38. %option with_pam no
  39. %option with_pgsql no
  40. %option with_ldap no
  41. # checking option conflicts
  42. %if "%{with_mysql}" == "yes" && "%{with_pgsql}" == "yes"
  43. RPM ERROR: with_mysql conflicts with with_pgsql
  44. %endif
  45. # list of sources
  46. Source0: ftp://ftp.proftpd.net/distrib/source/proftpd-%{version}.tar.bz2
  47. Source1: proftpd.conf
  48. Source2: proftpd.msg.goaway
  49. Source3: proftpd.msg.login
  50. Source4: rc.proftpd
  51. Patch0: proftpd.patch
  52. # build information
  53. Prefix: %{l_prefix}
  54. BuildRoot: %{l_buildroot}
  55. BuildPreReq: OpenPKG, openpkg >= 20030103, ncurses, getopt, make
  56. PreReq: OpenPKG, openpkg >= 20030103, ncurses
  57. %if "%{with_mysql}" == "yes"
  58. BuildPreReq: mysql
  59. %endif
  60. %if "%{with_pam}" == "yes"
  61. BuildPreReq: PAM
  62. PreReq: PAM
  63. %endif
  64. %if "%{with_pgsql}" == "yes"
  65. BuildPreReq: postgresql, openssl
  66. %endif
  67. %if "%{with_ldap}" == "yes"
  68. BuildPreReq: openldap, openssl
  69. PreReq: openldap
  70. %endif
  71. AutoReq: no
  72. AutoReqProv: no
  73. %description
  74. ProFTPD grew out of the desire to have a secure and configurable FTP
  75. server, and out of a significant admiration of the Apache web server.
  76. There are currently a very limited number of FTP servers running on unix
  77. (or unix-like) hosts. The most commonly used server is probably wu-ftpd.
  78. While wu-ftpd provides excellent performance and is generally a good
  79. product, it lacks numerous features found in newer Win32 FTP servers, and
  80. has a poor security history. Many people, including the developers who
  81. work on ProFTPD have spent a great deal of time fixing bugs and hacking
  82. features into wu-ftpd. Unfortunately, it quickly became clear that a
  83. complete redesign was necessary in order to implement the configurability
  84. and features desired. ProFTPD is not a hack based on any other server,
  85. it's an independent source tree from the ground up. Click here for a small
  86. list of some of the sites ProFTPD powers -- many of them handling large
  87. volumes of traffic on a daily basis.
  88. %prep
  89. %setup -q
  90. %patch -p0
  91. # utils also require link with getopt
  92. %{l_shtool} subst \
  93. -e 's;\(\$(BUILD_FTPCOUNT_OBJS).*\);\1 %{l_ldflags} -lgetopt;g' \
  94. -e 's;\(\$(BUILD_FTPSHUT_OBJS).*\);\1 %{l_ldflags} -lgetopt;g' \
  95. -e 's;\(\$(BUILD_FTPTOP_OBJS).*\);\1 %{l_ldflags} -lgetopt;g' \
  96. -e 's;\(\$(BUILD_FTPWHO_OBJS).*\);\1 %{l_ldflags} -lgetopt;g' \
  97. Makefile.in
  98. %if "%{with_mysql}" == "yes"
  99. libs=`mysql_config --libs`
  100. # libmysqlclient may require more libraries
  101. %{l_shtool} subst \
  102. -e "s;\(-lmysqlclient\);$libs;g" \
  103. contrib/mod_sql_mysql.c
  104. %endif
  105. # libpq also requires openssl
  106. # postgresql also doesn't provide its own inlude subdirectory
  107. %{l_shtool} subst \
  108. -e 's;\(-lpq\);\1 -lssl -lcrypto;g' \
  109. -e 's;^\(#include <\)pgsql/\(libpq-fe.h>.*\)$;\1postgresql/\2;' \
  110. contrib/mod_sql_postgres.c
  111. # libldap also requires openssl
  112. %{l_shtool} subst \
  113. -e 's;\(-llber\);\1 -lssl -lcrypto;g' \
  114. contrib/mod_ldap.c
  115. %build
  116. # make non-standard "rundir" the same as standard "sysconfdir"
  117. %{l_shtool} subst \
  118. -e 's;^\(rundir=@localstatedir@\)/proftpd;\1;' \
  119. Make.rules.in
  120. # write shutdown message file to OpenPKG instance, not outside
  121. %{l_shtool} subst \
  122. -e 's;\(#define SHUTMSG_PATH.*"\)\(/etc/\)\(shutmsg\)";\1%{l_prefix}\2%{name}/\3";' \
  123. include/default_paths.h
  124. # configure the ProFTPd source tree
  125. MOD="mod_ratio:mod_readme"
  126. MOD_INC="%{l_prefix}/include"
  127. MOD_LIB="%{l_prefix}/lib"
  128. %if "%{with_mysql}" == "yes" || "%{with_pgsql}" == "yes"
  129. MOD="$MOD:mod_sql"
  130. %if "%{with_mysql}" == "yes"
  131. MOD="$MOD:mod_sql_mysql"
  132. %endif
  133. %if "%{with_pgsql}" == "yes"
  134. MOD="$MOD:mod_sql_postgres"
  135. %endif
  136. %endif
  137. %if "%{with_ldap}" == "yes"
  138. MOD="$MOD:mod_ldap"
  139. %endif
  140. CC="%{l_cc}" \
  141. CFLAGS="%{l_cflags -O}" \
  142. %if "%{with_pam}" == "yes"
  143. CPPFLAGS="%{l_cppflags ncurses} -I`%{l_prefix}/etc/rc --query pam_incdir`" \
  144. LDFLAGS="%{l_ldflags} -L`%{l_prefix}/etc/rc --query pam_libdir`" \
  145. %else
  146. CPPFLAGS="%{l_cppflags ncurses}" \
  147. LDFLAGS="%{l_ldflags}" \
  148. LIBS="-lgetopt" \
  149. %endif
  150. ./configure \
  151. --prefix=%{l_prefix} \
  152. --sysconfdir=%{l_prefix}/etc/proftpd \
  153. --localstatedir=%{l_prefix}/var/proftpd \
  154. --with-modules="$MOD" \
  155. --with-includes="$MOD_INC" \
  156. --with-libraries="$MOD_LIB" \
  157. --without-getopt \
  158. %if "%{with_pam}" == "yes"
  159. --enable-auth-pam
  160. %else
  161. --disable-auth-pam
  162. %endif
  163. # build ProFTPd programs
  164. %{l_make} %{l_mflags -O}
  165. %install
  166. rm -rf $RPM_BUILD_ROOT
  167. # make sure the "install" procedure does not try
  168. # to perform explicit ownership assignments
  169. %{l_shtool} subst -v \
  170. -e 's;-o $(INSTALL_USER) -g $(INSTALL_GROUP);;g' \
  171. -e 's;chown;true;g' \
  172. Makefile
  173. # perform the "install" procedure while redirecting
  174. # it to the temporarily install area
  175. %{l_make} %{l_mflags} \
  176. install-proftpd install-utils install-man \
  177. prefix=$RPM_BUILD_ROOT%{l_prefix} \
  178. sysconfdir=$RPM_BUILD_ROOT%{l_prefix}/etc/proftpd \
  179. localstatedir=$RPM_BUILD_ROOT%{l_prefix}/var/proftpd \
  180. rundir=$RPM_BUILD_ROOT%{l_prefix}/var/proftpd
  181. # strip installation
  182. rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/in.proftpd
  183. # install more stuff manually
  184. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/share/proftpd
  185. %{l_shtool} install -c -m 644 doc/faq.html \
  186. $RPM_BUILD_ROOT%{l_prefix}/share/proftpd/faq.html
  187. %{l_shtool} install -c -m 644 doc/Configuration.html \
  188. $RPM_BUILD_ROOT%{l_prefix}/share/proftpd/cfg.html
  189. # extended installation with own stuff
  190. l_pam="#"
  191. %if "%{with_pam}" == "yes"
  192. l_pam=""
  193. %endif
  194. %{l_shtool} install -c -m 644 \
  195. -e 's;@l_prefix@;%{l_prefix};g' \
  196. -e 's;@l_nusr@;%{l_nusr};g' \
  197. -e 's;@l_ngrp@;%{l_ngrp};g' \
  198. -e "s;@l_pam@;${l_pam};g" \
  199. %{SOURCE proftpd.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/proftpd/
  200. %{l_shtool} install -c -m 644 \
  201. %{SOURCE proftpd.msg.goaway} \
  202. %{SOURCE proftpd.msg.login} \
  203. $RPM_BUILD_ROOT%{l_prefix}/etc/proftpd/
  204. %{l_shtool} install -c -m 644 \
  205. %{SOURCE proftpd.msg.login} \
  206. $RPM_BUILD_ROOT%{l_prefix}/share/proftpd/.msg.login
  207. %{l_shtool} install -c -m 644 \
  208. %{SOURCE proftpd.msg.goaway} \
  209. $RPM_BUILD_ROOT%{l_prefix}/share/proftpd/.msg.goaway
  210. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  211. %{l_shtool} install -c -m 755 -e 's;@l_prefix@;%{l_prefix};g' \
  212. -e 's;@l_susr@;%{l_susr};g' -e 's;@l_sgrp@;%{l_sgrp};g' \
  213. %{SOURCE rc.proftpd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  214. # determine the package ingredients
  215. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  216. %{l_files_std} \
  217. '%config %{l_prefix}/etc/proftpd/proftpd.conf'
  218. %files -f files
  219. %clean
  220. rm -rf $RPM_BUILD_ROOT
  221. %post
  222. %if "%{with_pam}" == "yes"
  223. # add PAM configuration entry
  224. if [ $1 -eq 1 ]; then
  225. $RPM_INSTALL_PREFIX/sbin/pamtool --add --smart --name=proftpd
  226. fi
  227. %endif
  228. %preun
  229. %if "%{with_pam}" == "yes"
  230. # remove PAM configuration entry
  231. if [ $1 -eq 0 ]; then
  232. $RPM_INSTALL_PREFIX/sbin/pamtool --remove --smart --name=proftpd
  233. fi
  234. %endif
  235. if [ $1 -eq 0 ]; then
  236. $RPM_INSTALL_PREFIX/etc/rc proftpd stop
  237. rm -f $RPM_INSTALL_PREFIX/var/proftpd/*.log
  238. rm -f $RPM_INSTALL_PREFIX/var/proftpd/*.pid
  239. fi