Ticket #24750: Portfile

File Portfile, 8.3 KB (added by scott@…, 15 years ago)

Working Portfile

Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2# $Id$
3
4PortSystem          1.0
5
6name                pure-ftpd
7set pretty_name     Pure-FTPd
8version             1.0.29
9
10categories          net
11platforms           darwin
12maintainers         hostwizard.com:scott
13license             BSD
14
15homepage            http://pureftpd.org/
16description         ${pretty_name} is a fast, production-quality, standard-conformant FTP (SSL/TLS) \
17                    server, based upon Troll-FTPd.
18
19long_description    ${pretty_name} has been designed to be secure in default configuration\; it has no\
20                    known vulnerabilities. Features include: virtual domains, built-in 'ls', \
21                    anti-warez system, configurable ports for passive downloads, FXP protocol, \
22                    bandwidth throttling, ratios, LDAP / MySQL / PostgreSQL-based authentication,\
23                    fortune files, Apache-like log files, text / HTML / XML real-time status report,\
24                    virtual users, virtual quotas, privilege separation, SSL/TLS and more.
25
26master_sites        ftp://ftp.pureftpd.org/pure-ftpd/releases/ \
27                    ftp://ftp.fr.pureftpd.org/pure-ftpd/releases/
28
29use_bzip2           yes
30
31checksums           md5     12a074824b509f9e7684fab333ed6915 \
32                    sha1    9bba0d6122066098273fde6db03b54825911c012 \
33                    rmd160  bcbff660f5ec34d39830a3ffd0594edae5745e79
34                   
35livecheck.type      regex
36livecheck.url       http://download.pureftpd.org/pub/${name}/releases/
37livecheck.regex     ${name}-(\[0-9.\]+)\\.tar
38
39configure.args      --with-everything \
40                    --with-pam \
41                    --with-virtualchroot \
42                    --with-paranoidmsg \
43                    --with-bonjour \
44                    --without-inetd \
45                    --mandir=${prefix}/share/man \
46                    --infodir=${prefix}/share/info \
47                    --sysconfdir=${prefix}/etc/${name}/conf \
48                    --localstatedir=${prefix}/var
49
50destroot.destdir    prefix=${destroot}${prefix} \
51                    mandir=${destroot}${prefix}/share/man
52
53destroot.keepdirs   ${destroot}${prefix}/etc/${name}/ssl \
54                    ${destroot}${prefix}/etc/${name}/conf \
55                    ${destroot}${prefix}/var/log/${name}
56
57post-destroot {
58    file mkdir ${destroot}${prefix}/etc/${name}/ssl
59    file mkdir ${destroot}${prefix}/etc/${name}/conf
60    file mkdir ${destroot}${prefix}/var/log/${name}
61    file mkdir ${destroot}${prefix}/share/doc/${name}
62   
63    # Install the notes and readme files
64    xinstall -m 644 -W ${worksrcpath} \
65        AUTHORS ChangeLog CONTACT COPYING FAQ HISTORY INSTALL NEWS README \
66        pureftpd-ldap.conf pureftpd-mysql.conf pureftpd-pgsql.conf pureftpd.schema \
67        README.Authentication-Modules README.Configuration-File \
68        README README.Authentication-Modules README.Configuration-File README.Contrib \
69        README.Donations README.LDAP README.PGSQL README.TLS \
70        README.MySQL README.Virtual-Users README.MySQL README.PGSQL README.TLS README.Virtual-Users \
71        THANKS \
72        ${destroot}${prefix}/share/doc/${name}
73   
74    # Install in the modified README.MacOS-X file
75    xinstall -m 644 ${filespath}/README.MacOS-X ${destroot}${prefix}/share/doc/${name}/README.MacOS-X
76    reinplace "s|@PREFIX@|${prefix}|g" ${destroot}${prefix}/share/doc/${name}/README.MacOS-X
77   
78    # Copy in the sample launchd plists item
79    file copy ${filespath}/org.pure-ftpd.ftpd.plist.basic.sample.in ${destroot}${prefix}/share/doc/${name}/org.pure-ftpd.ftpd.plist.basic.sample
80    reinplace "s|@PREFIX@|${prefix}|g" ${destroot}${prefix}/share/doc/${name}/org.pure-ftpd.ftpd.plist.basic.sample
81   
82    # Copy in the sample pure-ftpd pam file
83    file copy ${filespath}/pure-ftpd.pam.10.5.sample ${destroot}${prefix}/share/doc/${name}/pure-ftpd.pam.10.5.sample
84    file copy ${filespath}/pure-ftpd.pam.10.6.sample ${destroot}${prefix}/share/doc/${name}/pure-ftpd.pam.10.6.sample
85   
86}
87
88# Variants
89variant uploadscript description "Configures ${name} to support post processing of uploaded files" {
90    configure.args-append --with-uploadscript
91}
92variant mysql5 conflicts postgresql82 postgresql83 postgresql84 description "Use MySQL 5 for privileges database" {
93    depends_lib-append path:bin/mysql_config5:mysql5
94    configure.args-append --with-mysql
95    configure.env-append PATH=${prefix}/lib/mysql5/bin:$env(PATH)
96}
97
98variant postgresql82 conflicts mysql5 postgresql83 postgresql84 description "Use PostgreSQL 8.2 for privileges database" {
99    depends_lib-append port:postgresql82
100    configure.args-append --with-pgsql
101    configure.env-append PATH=${prefix}/lib/postgresql82/bin:$env(PATH)
102}
103
104variant postgresql83 conflicts mysql5 postgresql82 postgresql84 description "Use PostgreSQL 8.3 for privileges database" {
105    depends_lib-append port:postgresql83
106    configure.args-append --with-pgsql
107    configure.env-append PATH=${prefix}/lib/postgresql83/bin:$env(PATH)
108}
109
110variant postgresql84 conflicts mysql5 postgresql82 postgresql83 description "Use PostgreSQL 8.4 for privileges database" {
111    depends_lib-append port:postgresql84
112    configure.args-append --with-pgsql
113    configure.env-append PATH=${prefix}/lib/postgresql84/bin:$env(PATH)
114}
115
116variant tls description "Encryption of ftp control and data channels using SSL/TLS" {
117    depends_lib-append      port:openssl
118    configure.args-append   --with-tls \
119                            --with-certfile=${prefix}/etc/${name}/ssl/pure-ftpd.pem
120}
121
122# Language variants, should only be able to choose one.
123set variants {
124    lang_brazilian
125    lang_czech
126    lang_danish
127    lang_dutch
128    lang_french
129    lang_french_funny
130    lang_german
131    lang_italian
132    lang_korean
133    lang_norwegian
134    lang_polish
135    lang_romanian
136    lang_russian
137    lang_simplified_chinese
138    lang_slovak
139    lang_spanish
140    lang_swedish
141    lang_trad_chinese
142}
143
144foreach variant_name $variants {
145    # Quick way to remove the working variant from the list
146    set the_conflicts [lsearch -all -inline -not -exact $variants $variant_name]
147    # String replace away the lang_ part, as that is not part of the name used for the compile args
148    set variant_configure_name [string map {"lang_" ""} $variant_name]
149    set variant_line "variant $variant_name conflicts $the_conflicts description \"Use $variant_name for server messages\" {
150        configure.args-append --with-language=$variant_configure_name }"
151    eval $variant_line
152
153}
154
155# Notify the user how to launch the ftpd
156post-activate {
157    ui_msg "========================================================================"
158    ui_msg "${pretty_name} documentation is located in: ${prefix}/share/doc/${name}"
159    ui_msg ""
160   
161    ui_msg "You can start ${pretty_name} from the command line with:"
162    ui_msg "    sudo ${prefix}/sbin/${name} &"
163   
164    ui_msg "A future release of ${pretty_name} will no longer support"
165    ui_msg "xinetd, and has been removed from this version.  If you are using that"
166    ui_msg "method to start ${pretty_name} now, please switch to using launchd(8)."
167    ui_msg ""
168   
169    ui_msg "A sample launchd plist has been created to get you started."
170    ui_msg "    1) org.pure-ftpd.ftpd.plist.basic.sample"
171    ui_msg "        Basic but secure chrooted ftp server"
172    ui_msg ""
173   
174    ui_msg "To install the launchd item, issue the following commands:"
175    ui_msg "cd ${prefix}/share/doc/${name}/"
176    ui_msg "sudo cp org.pure-ftpd.ftpd.plist.basic.sample /Library/LaunchDaemons/org.pure-ftpd.ftpd.plist"
177    ui_msg "  - and then load the launchd item - "
178    ui_msg "sudo launchctl load -w /Library/LaunchDaemons/org.pure-ftpd.ftpd.plist"
179    ui_msg ""
180   
181    ui_msg "If you intend to use pure-FTPd with PAM, meaning you want to authenticate against Mac OS X"
182    ui_msg "user accounts, please copy the pure-ftpd.pam.10.x.sample file to /etc/pam.d/pure-ftpd"
183    ui_msg "cd ${prefix}/share/doc/${name}/"
184    ui_msg "sudo cp pure-ftpd.pam.10.x.sample /etc/pam.d/pure-ftpd"
185   
186    ui_msg "You can now test the server with:"
187    ui_msg "    ftp localhost"
188    ui_msg "You should see a Welcome to ${pretty_name} message."
189    ui_msg ""
190   
191    ui_msg "See ${homepage} for more information."
192    ui_msg "========================================================================"
193}