proftpd/proftpd.spec

changeset 182
42a8c8d745e6
child 183
94771d2369b6
equal deleted inserted replaced
-1:000000000000 0:5d797a363fba
1 ##
2 ## proftpd.spec -- OpenPKG RPM Package Specification
3 ## Copyright (c) 2000-2009 OpenPKG Foundation e.V. <http://openpkg.net/>
4 ##
5 ## Permission to use, copy, modify, and distribute this software for
6 ## any purpose with or without fee is hereby granted, provided that
7 ## the above copyright notice and this permission notice appear in all
8 ## copies.
9 ##
10 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
21 ## SUCH DAMAGE.
22 ##
23
24 # package version
25 %define V_proftpd 1.3.2
26 %define V_mod_exec 0.9.6
27 %define V_mod_otp 0.9.1
28 %define V_mod_shaper 0.6.5
29 %define V_mod_sql_sqlite 0.2
30 %define V_mod_sql_odbc 0.3.2
31 %define V_mod_time 2.2.1
32 %define V_mod_vroot 0.8.5
33 %define V_mod_gss 1.3.2
34 %define V_mod_sftp 0.9.6
35 %define V_mod_sftp_sql 0.1
36 %define V_mod_md5 0.3.3
37
38 # package information
39 Name: proftpd
40 Summary: Professional FTP Daemon
41 URL: http://www.proftpd.org/
42 Vendor: The ProFTPD Project
43 Packager: OpenPKG Foundation e.V.
44 Distribution: OpenPKG Community
45 Class: BASE
46 Group: FTP
47 License: GPL
48 Version: %{V_proftpd}
49 Release: 20090327
50
51 # package options
52 %option with_ifsession no
53 %option with_ctrls no
54 %option with_radius no
55 %option with_pam no
56 %option with_mysql no
57 %option with_pgsql no
58 %option with_sqlite no
59 %option with_odbc no
60 %option with_ldap no
61 %option with_skey no
62 %option with_opie no
63 %option with_kerberos no
64 %option with_ssl no
65 %option with_sftp no
66 %option with_md5 no
67
68 # checking option conflicts
69 %if "%{with_mysql}" == "yes" && "%{with_pgsql}" == "yes"
70 %{error:build-time options 'with_mysql' and 'with_pgsql' conflict}
71 %endif
72
73 # list of sources
74 Source0: ftp://ftp.proftpd.org/distrib/source/proftpd-%{V_proftpd}.tar.bz2
75 Source1: http://www.castaglia.net/proftpd/modules/proftpd-mod-exec-%{V_mod_exec}.tar.gz
76 Source2: http://www.castaglia.net/proftpd/modules/proftpd-mod-otp-%{V_mod_otp}.tar.gz
77 Source3: http://www.castaglia.net/proftpd/modules/proftpd-mod-shaper-%{V_mod_shaper}.tar.gz
78 Source4: http://www.castaglia.net/proftpd/modules/proftpd-mod-sql-sqlite-%{V_mod_sql_sqlite}.tar.gz
79 Source5: http://www.castaglia.net/proftpd/modules/proftpd-mod-sql-odbc-%{V_mod_sql_odbc}.tar.gz
80 Source6: http://www.castaglia.net/proftpd/modules/proftpd-mod-time-%{V_mod_time}.tar.gz
81 Source7: http://www.castaglia.net/proftpd/modules/proftpd-mod-vroot-%{V_mod_vroot}.tar.gz
82 Source8: http://switch.dl.sourceforge.net/gssmod/mod_gss-%{V_mod_gss}.tar.gz
83 Source9: http://www.castaglia.net/proftpd/modules/proftpd-mod-sftp-%{V_mod_sftp}.tar.gz
84 Source10: http://www.castaglia.net/proftpd/modules/proftpd-mod-sftp-sql-%{V_mod_sftp_sql}.tar.gz
85 Source11: http://www.castaglia.net/proftpd/modules/proftpd-mod-md5-%{V_mod_md5}.tar.gz
86 Source12: proftpd.conf
87 Source13: proftpd.msg.goaway
88 Source14: proftpd.msg.login
89 Source15: rc.proftpd
90 Patch0: proftpd.patch
91
92 # build information
93 Prefix: %{l_prefix}
94 BuildRoot: %{l_buildroot}
95 BuildPreReq: OpenPKG, openpkg >= 20060823, make
96 PreReq: OpenPKG, openpkg >= 20060823
97 BuildPreReq: ncurses, getopt
98 PreReq: ncurses, getopt
99 %if "%{with_mysql}" == "yes"
100 BuildPreReq: mysql
101 PreReq: mysql
102 %endif
103 %if "%{with_pam}" == "yes"
104 BuildPreReq: PAM
105 PreReq: PAM
106 %endif
107 %if "%{with_pgsql}" == "yes"
108 BuildPreReq: postgresql, openssl
109 PreReq: postgresql, openssl
110 %endif
111 %if "%{with_sqlite}" == "yes"
112 BuildPreReq: sqlite
113 PreReq: sqlite
114 %endif
115 %if "%{with_odbc}" == "yes"
116 BuildPreReq: ODBC
117 PreReq: ODBC
118 %endif
119 %if "%{with_ldap}" == "yes"
120 BuildPreReq: openldap, openssl
121 PreReq: openldap, openssl
122 %endif
123 %if "%{with_skey}" == "yes"
124 BuildPreReq: skey
125 PreReq: skey
126 %endif
127 %if "%{with_opie}" == "yes"
128 BuildPreReq: opie
129 PreReq: opie
130 %endif
131 %if "%{with_kerberos}" == "yes"
132 BuildPreReq: KERBEROS
133 PreReq: KERBEROS
134 %endif
135 %if "%{with_ssl}" == "yes" || "%{with_sftp}" == "yes"
136 BuildPreReq: openssl
137 PreReq: openssl
138 %endif
139 AutoReq: no
140 AutoReqProv: no
141
142 %description
143 ProFTPD grew out of the desire to have a secure and configurable
144 FTP server, and out of a significant admiration of the Apache web
145 server. There are currently a very limited number of FTP servers
146 running on unix (or unix-like) hosts. The most commonly used server
147 is probably wu-ftpd. While wu-ftpd provides excellent performance
148 and is generally a good product, it lacks numerous features found
149 in newer Win32 FTP servers, and has a poor security history. Many
150 people, including the developers who work on ProFTPD have spent a
151 great deal of time fixing bugs and hacking features into wu-ftpd.
152 Unfortunately, it quickly became clear that a complete redesign was
153 necessary in order to implement the configurability and features
154 desired. ProFTPD is not a hack based on any other server, it's an
155 independent source tree from the ground up. Click here for a small
156 list of some of the sites ProFTPD powers -- many of them handling
157 large volumes of traffic on a daily basis.
158
159 %track
160 prog proftpd = {
161 version = %{V_proftpd}
162 url = ftp://ftp.proftpd.org/distrib/source/
163 regex = proftpd-(\d+\.\d+\.\d+(?:rc\d+|[a-z]?))\.tar\.bz2
164 }
165 prog proftpd:mod_exec = {
166 version = %{V_mod_exec}
167 url = http://www.castaglia.net/proftpd/
168 regex = proftpd-mod-exec-(__VER__)\.tar\.gz
169 }
170 prog proftpd:mod_shaper = {
171 version = %{V_mod_shaper}
172 url = http://www.castaglia.net/proftpd/
173 regex = proftpd-mod-shaper-(__VER__)\.tar\.gz
174 }
175 prog proftpd:mod_sql_sqlite = {
176 version = %{V_mod_sql_sqlite}
177 url = http://www.castaglia.net/proftpd/
178 regex = proftpd-mod-sql-sqlite-(__VER__)\.tar\.gz
179 }
180 prog proftpd:mod_sql_odbc = {
181 version = %{V_mod_sql_odbc}
182 url = http://www.castaglia.net/proftpd/
183 regex = proftpd-mod-sql-odbc-(__VER__)\.tar\.gz
184 }
185 prog proftpd:mod_time = {
186 version = %{V_mod_time}
187 url = http://www.castaglia.net/proftpd/
188 regex = proftpd-mod-time-(__VER__)\.tar\.gz
189 }
190 prog proftpd:mod_vroot = {
191 version = %{V_mod_vroot}
192 url = http://www.castaglia.net/proftpd/
193 regex = proftpd-mod-vroot-(__VER__)\.tar\.gz
194 }
195 prog proftpd:mod_gss = {
196 version = %{V_mod_gss}
197 url = http://prdownloads.sourceforge.net/gssmod/
198 regex = mod_gss-(__VER__)\.tar\.gz
199 }
200 prog proftpd:mod_sftp = {
201 version = %{V_mod_sftp}
202 url = http://www.castaglia.net/proftpd/
203 regex = proftpd-mod-sftp-(__VER__)\.tar\.gz
204 }
205 prog proftpd:mod_sftp_sql = {
206 version = %{V_mod_sftp_sql}
207 url = http://www.castaglia.net/proftpd/
208 regex = proftpd-mod-sftp-sql-(__VER__)\.tar\.gz
209 }
210 prog proftpd:mod_md5 = {
211 version = %{V_mod_md5}
212 url = http://www.castaglia.net/proftpd/
213 regex = proftpd-mod-md5-(__VER__)\.tar\.gz
214 }
215
216 %prep
217 %setup -q
218 %setup -q -D -T -a 1
219 %setup -q -D -T -a 2
220 %setup -q -D -T -a 3
221 %setup -q -D -T -a 4
222 %setup -q -D -T -a 5
223 %setup -q -D -T -a 6
224 %setup -q -D -T -a 7
225 %setup -q -D -T -a 8
226 %setup -q -D -T -a 9
227 %setup -q -D -T -a 10
228 %setup -q -D -T -a 11
229 %patch -p0
230
231 %{l_shtool} subst \
232 -e '/LINENO: error: C[+]* preprocessor/{N;N;N;N;s/.*/:/;}' \
233 configure
234
235 # utils require to link with getopt
236 %{l_shtool} subst \
237 -e 's;\(\$(BUILD_FTPCOUNT_OBJS).*\);\1 %{l_ldflags} -lgetopt;g' \
238 -e 's;\(\$(BUILD_FTPSHUT_OBJS).*\);\1 %{l_ldflags} -lgetopt;g' \
239 -e 's;\(\$(BUILD_FTPTOP_OBJS).*\);\1 %{l_ldflags} -lgetopt;g' \
240 -e 's;\(\$(BUILD_FTPWHO_OBJS).*\);\1 %{l_ldflags} -lgetopt;g' \
241 Makefile.in
242 %if "%{with_mysql}" == "yes"
243 libs=`mysql_config --libs`
244 # libmysqlclient may require more libraries
245 %{l_shtool} subst \
246 -e "s;\(-lmysqlclient\);$libs;g" \
247 contrib/mod_sql_mysql.c
248 %endif
249
250 # libpq also requires openssl
251 # postgresql also doesn't provide its own include subdirectory
252 %{l_shtool} subst \
253 -e 's;\(-lpq\);\1 -lssl -lcrypto;g' \
254 -e 's;^\(#include <\)pgsql/\(libpq-fe.h>.*\)$;\1postgresql/\2;' \
255 contrib/mod_sql_postgres.c
256
257 # libldap also requires openssl
258 %{l_shtool} subst \
259 -e 's;\(-llber\);\1 -lssl -lcrypto;g' \
260 contrib/mod_ldap.c
261
262 # prepare mod_otp module
263 %if "%{with_skey}" == "yes" || "%{with_opie}" == "yes"
264 ( cd mod_otp
265 CC="%{l_cc}" \
266 CFLAGS="%{l_cflags -O}" \
267 CPPFLAGS="%{l_cppflags}" \
268 LDFLAGS="%{l_ldflags}" \
269 ./configure \
270 %if "%{with_skey}" == "yes"
271 --with-skey \
272 %endif
273 %if "%{with_opie}" == "yes"
274 --with-opie \
275 %endif
276 %{l_nil}
277 cp mod_otp.[ch] ../contrib/
278 ) || exit $?
279 %endif
280
281 # prepare mod_sql_odbc module
282 %if "%{with_odbc}" == "yes"
283 ( cd mod_sql_odbc
284 if [ -f %{l_prefix}/etc/unixodbc/odbc.ini ]; then
285 ./configure --enable-unixodbc
286 else
287 ./configure --enable-iodbc
288 fi
289 ) || exit $?
290 %endif
291
292 # prepare optional add-on modules
293 cp mod_exec/mod_exec.c contrib/
294 cp mod_sql_sqlite/mod_sql_sqlite.c contrib/
295 cp mod_sql_odbc/mod_sql_odbc.[ch] contrib/
296 cp mod_time/mod_time.c contrib/
297 cp mod_vroot/mod_vroot.c contrib/
298 %if "%{with_ctrls}" == "yes"
299 cp mod_shaper/mod_shaper.c contrib/
300 %endif
301 %if "%{with_sftp}" == "yes"
302 cp -r mod_sftp contrib/
303 %if "%{with_mysql}" == "yes" || "%{with_pgsql}" == "yes" || "%{with_sqlite}" == "yes" || "%{with_odbc}" == "yes"
304 cp mod_sftp_sql/mod_sftp_sql.c contrib/
305 %endif
306 %endif
307 %if "%{with_md5}" == "yes"
308 cp mod_md5/mod_md5.c contrib/
309 %endif
310
311 # prepare mod_gss module
312 %if "%{with_kerberos}" == "yes"
313 ( cd mod_gss-*
314 CC="%{l_cc}" \
315 CFLAGS="%{l_cflags -O}" \
316 CPPFLAGS="%{l_cppflags}" \
317 LDFLAGS="%{l_ldflags}" \
318 ./configure \
319 --prefix=%{l_prefix} \
320 `if [ -d %{l_prefix}/include/heimdal ]; then \
321 echo "--enable-heimdal"; \
322 else \
323 echo "--enable-mit"; \
324 fi`
325 cp mod_gss.h ../include/
326 cp mod_gss.c ../contrib/
327 ) || exit $?
328 %endif
329
330 %build
331 # make non-standard "rundir" the same as standard "sysconfdir"
332 %{l_shtool} subst \
333 -e 's;^\(rundir=@localstatedir@\)/proftpd;\1;' \
334 Make.rules.in
335 %{l_shtool} subst \
336 -e 's;^\(#define PR_RUN_DIR "`eval echo "${localstatedir}\)/proftpd;\1;' \
337 configure
338
339 # write shutdown message file to OpenPKG instance, not outside
340 %{l_shtool} subst \
341 -e 's;\(#define PR_SHUTMSG_PATH.*"\)\(/etc/\)\(shutmsg\)";\1%{l_prefix}\2proftpd/\3";' \
342 include/default_paths.h
343
344 # configure the ProFTPd source tree
345 MOD="mod_ratio:mod_readme:mod_exec:mod_time:mod_vroot"
346 MOD_INC="%{l_prefix}/include"
347 MOD_LIB="%{l_prefix}/lib"
348 %if "%{with_ifsession}" == "yes"
349 MOD="$MOD:mod_ifsession"
350 %endif
351 %if "%{with_ctrls}" == "yes"
352 MOD="$MOD:mod_shaper"
353 MOD="$MOD:mod_ctrls_admin"
354 %endif
355 %if "%{with_radius}" == "yes"
356 MOD="$MOD:mod_radius"
357 %endif
358 %if "%{with_mysql}" == "yes" || "%{with_pgsql}" == "yes" || "%{with_sqlite}" == "yes" || "%{with_odbc}" == "yes"
359 MOD="$MOD:mod_sql"
360 %if "%{with_mysql}" == "yes"
361 MOD="$MOD:mod_sql_mysql"
362 MOD_INC=":%{l_prefix}/include/mysql"
363 %endif
364 %if "%{with_pgsql}" == "yes"
365 MOD="$MOD:mod_sql_postgres"
366 MOD_INC=":%{l_prefix}/include/postgresql"
367 %endif
368 %if "%{with_sqlite}" == "yes"
369 MOD="$MOD:mod_sql_sqlite"
370 %endif
371 %if "%{with_odbc}" == "yes"
372 MOD="$MOD:mod_sql_odbc"
373 %endif
374 %endif
375 %if "%{with_ldap}" == "yes"
376 MOD="$MOD:mod_ldap"
377 %endif
378 %if "%{with_skey}" == "yes" || "%{with_opie}" == "yes"
379 MOD="$MOD:mod_otp"
380 %endif
381 %if "%{with_kerberos}" == "yes"
382 MOD="$MOD:mod_gss"
383 %endif
384 %if "%{with_ssl}" == "yes"
385 MOD="$MOD:mod_tls"
386 %endif
387 %if "%{with_sftp}" == "yes"
388 MOD="$MOD:mod_sftp"
389 %if "%{with_mysql}" == "yes" || "%{with_pgsql}" == "yes" || "%{with_sqlite}" == "yes" || "%{with_odbc}" == "yes"
390 MOD="$MOD:mod_sftp_sql"
391 %endif
392 %endif
393 %if "%{with_md5}" == "yes"
394 MOD="$MOD:mod_md5"
395 %endif
396 export CC="%{l_cc}"
397 export CFLAGS="%{l_cflags -O}"
398 export CPPFLAGS="%{l_cppflags ncurses}"
399 export LDFLAGS="%{l_ldflags}"
400 export LIBS="-lgetopt"
401 %if "%{with_pam}" == "yes"
402 CPPFLAGS="$CPPFLAGS -I`%{l_rc} --query pam_incdir`"
403 LDFLAGS="$LDFLAGS -L`%{l_rc} --query pam_libdir`"
404 %endif
405 %if "%{with_kerberos}" == "yes"
406 CPPFLAGS="$CPPFLAGS `krb5-config --cflags gssapi`"
407 LIBS="$LIBS `krb5-config --libs gssapi`"
408 %endif
409 ./configure \
410 --prefix=%{l_prefix} \
411 --sysconfdir=%{l_prefix}/etc/proftpd \
412 --localstatedir=%{l_prefix}/var/proftpd \
413 --with-modules="$MOD" \
414 --with-includes="$MOD_INC" \
415 --with-libraries="$MOD_LIB" \
416 --enable-buffer-size=1024 \
417 %if "%{with_ctrls}" == "yes"
418 --enable-ctrls \
419 %endif
420 %if "%{with_pam}" == "yes"
421 --enable-auth-pam
422 %else
423 --disable-auth-pam
424 %endif
425
426 # build ProFTPd programs
427 %{l_make} %{l_mflags}
428
429 %install
430 rm -rf $RPM_BUILD_ROOT
431
432 # make sure the "install" procedure does not try
433 # to perform explicit ownership assignments
434 %{l_shtool} subst -v \
435 -e 's;-o $(INSTALL_USER) -g $(INSTALL_GROUP);;g' \
436 -e 's;chown;true;g' \
437 Makefile Make.rules
438
439 # perform the "install" procedure while redirecting
440 # it to the temporarily install area
441 %{l_make} %{l_mflags} \
442 install-proftpd install-utils install-man \
443 prefix=$RPM_BUILD_ROOT%{l_prefix} \
444 bindir=$RPM_BUILD_ROOT%{l_prefix}/bin \
445 sbindir=$RPM_BUILD_ROOT%{l_prefix}/sbin \
446 sysconfdir=$RPM_BUILD_ROOT%{l_prefix}/etc/proftpd \
447 localstatedir=$RPM_BUILD_ROOT%{l_prefix}/var/proftpd \
448 rundir=$RPM_BUILD_ROOT%{l_prefix}/var/proftpd
449
450 # strip installation
451 rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/in.proftpd
452
453 # install more stuff manually
454 %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/share/proftpd
455 %{l_shtool} install -c -m 644 doc/faq.html \
456 $RPM_BUILD_ROOT%{l_prefix}/share/proftpd/faq.html
457 %{l_shtool} install -c -m 644 doc/Configuration.html \
458 $RPM_BUILD_ROOT%{l_prefix}/share/proftpd/cfg.html
459
460 # extended installation with own stuff
461 l_pam="#"
462 %if "%{with_pam}" == "yes"
463 l_pam=""
464 %endif
465 %{l_shtool} install -c -m 644 %{l_value -s -a} \
466 -e "s;@l_pam@;${l_pam};g" \
467 %{SOURCE proftpd.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/proftpd/
468 %{l_shtool} install -c -m 644 \
469 %{SOURCE proftpd.msg.goaway} \
470 %{SOURCE proftpd.msg.login} \
471 $RPM_BUILD_ROOT%{l_prefix}/etc/proftpd/
472 %{l_shtool} install -c -m 644 \
473 %{SOURCE proftpd.msg.login} \
474 $RPM_BUILD_ROOT%{l_prefix}/share/proftpd/.msg.login
475 %{l_shtool} install -c -m 644 \
476 %{SOURCE proftpd.msg.goaway} \
477 $RPM_BUILD_ROOT%{l_prefix}/share/proftpd/.msg.goaway
478 %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
479 %{l_shtool} install -c -m 755 %{l_value -s -a} \
480 %{SOURCE rc.proftpd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
481
482 # determine the package ingredients
483 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
484 %{l_files_std} \
485 '%config %attr(0600,%{l_susr},%{l_sgrp}) %{l_prefix}/etc/proftpd/proftpd.conf' \
486 '%config %{l_prefix}/etc/proftpd/proftpd.msg.*'
487
488 %files -f files
489
490 %clean
491 rm -rf $RPM_BUILD_ROOT
492
493 %post
494 %if "%{with_pam}" == "yes"
495 # add PAM configuration entry
496 if [ $1 -eq 1 ]; then
497 $RPM_INSTALL_PREFIX/sbin/pamtool --add --smart --name=proftpd
498 fi
499 %endif
500
501 # after upgrade, restart service
502 [ $1 -eq 2 ] || exit 0
503 eval `%{l_rc} proftpd status 2>/dev/null`
504 [ ".$proftpd_active" = .yes ] && %{l_rc} proftpd restart
505 exit 0
506
507 %preun
508 # before erase, stop service and remove log files
509 [ $1 -eq 0 ] || exit 0
510 %{l_rc} proftpd stop 2>/dev/null
511 rm -f $RPM_INSTALL_PREFIX/var/proftpd/*.log* >/dev/null 2>&1 || true
512 rm -f $RPM_INSTALL_PREFIX/var/proftpd/*.pid >/dev/null 2>&1 || true
513 %if "%{with_pam}" == "yes"
514 # remove PAM configuration entry
515 $RPM_INSTALL_PREFIX/sbin/pamtool --remove --smart --name=proftpd
516 %endif
517 exit 0
518

mercurial