Ticket #58045: Portfile

File Portfile, 4.3 KB (added by Schamschula (Marius Schamschula), 6 years ago)
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
3PortSystem          1.0
4PortGroup           github 1.0
5
6github.setup        logrotate logrotate 3.15.0
7
8github.tarball_from releases
9use_xz              yes
10checksums           rmd160  8a2a190a1e4240575d038f5400d08d1550a7fcbf \
11                    sha256  313612c4776a305393454c874ef590d8acf84c9ffa648717731dfe902284ff8f \
12                    size    158284
13categories          sysutils
14platforms           darwin
15license             GPL-2
16maintainers         {ctreleaven @ctreleaven} openmaintainer
17
18description         Rotates, compresses, and mails system logs
19
20long_description    The logrotate utility is designed to simplify the administration of logs \
21                    on a system which generates a lot of log files. Logrotate provides \
22                    automatic rotation, compression (gzip by default), removal and mailing \
23                    of log files. Logrotate can be set to handle a log file daily, weekly, \
24                    monthly or when the log file exceeds a certain size.
25
26depends_lib         port:popt
27
28depends_run         port:gettext \
29                    port:gzip
30
31set compress        ${prefix}/bin/gzip
32set compress_ext    .gz
33set uncompress      ${prefix}/bin/gunzip
34
35post-extract {
36    touch ${worksrcpath}/.depend
37    copy ${filespath}/logrotate.conf.example \
38        ${worksrcpath}/
39    copy ${filespath}/org.macports.logrotate.plist.example \
40        ${worksrcpath}/
41}
42
43patchfiles          patch-logrotate.c.diff
44
45post-patch {
46    reinplace "s|@PREFIX@|${prefix}|g" \
47        ${worksrcpath}/examples/logrotate.conf
48    reinplace "s|@PREFIX@|${prefix}|g" \
49        ${worksrcpath}/logrotate.conf.example
50    reinplace "s|@PREFIX@|${prefix}|g" \
51        ${worksrcpath}/org.macports.logrotate.plist.example
52}
53
54use_autoreconf      yes
55autoreconf.args-append \
56                    --force
57configure.args-append \
58                    --disable-silent-rules\
59                    --with-state-file-path=${prefix}/var/run/logrotate/logrotate.status \
60                    --with-default-mail-command=/bin/mail \
61                    --with-compress-command=${compress} \
62                    --with-uncompress-command=${uncompress} \
63                    --with-compress-extension=${compress_ext} 
64
65universal_variant   no
66
67destroot.keepdirs   ${destroot}${prefix}/etc/logrotate.d \
68                    ${destroot}${prefix}/var/run/logrotate
69post-destroot {
70    xinstall -d ${destroot}${prefix}/share/${name}
71        xinstall -m 644 -W ${worksrcpath} ChangeLog.md COPYING \
72            logrotate.conf.example org.macports.logrotate.plist.example \
73                ${destroot}${prefix}/share/${name}
74
75    if {[variant_isset startupitem]
76    && ${startupitem.install} != "no"
77    && [getuid] == 0} {
78
79        xinstall -d ${destroot}${prefix}/etc/LaunchDaemons/org.macports.logrotate
80        xinstall -d ${destroot}/Library/LaunchDaemons
81        xinstall -m 644 ${destroot}${prefix}/share/${name}/org.macports.logrotate.plist.example \
82            ${destroot}${prefix}/etc/LaunchDaemons/org.macports.logrotate/org.macports.logrotate.plist
83        ln -sf "${prefix}/etc/LaunchDaemons/org.macports.logrotate/org.macports.logrotate.plist" "${destroot}/Library/LaunchDaemons/org.macports.logrotate.plist"
84    }
85}
86
87post-activate {
88
89    if ![file exists ${prefix}/etc/logrotate.conf] {
90   
91        copy ${prefix}/share/${name}/logrotate.conf.example ${prefix}/etc/logrotate.conf
92    }
93}
94
95variant bzip2 description {Use bzip2 compression by default} {
96    set compress    ${prefix}/bin/bzip2
97    set compress_ext .bz2
98    set uncompress   ${prefix}/bin/bunzip2
99    depends_run-replace \
100                    port:gzip port:bzip2
101}
102
103notes "
104To use logrotate:
105
106  * See 'man logrotate' for configuration options.
107
108  * Enable daily log rotation with this command.
109
110    \$ sudo port load logrotate
111
112  * To create your own startup item with non-default intervals, build logrotate
113    without the startupitem variant (-startupitem), copy the example into place
114    and edit to your liking, then load with launchctl when finished.
115
116    \$ sudo cp ${prefix}/share/${name}/org.macports.logrotate.plist.example /Library/LaunchDaemons/org.macports.logrotate.plist
117
118    \$ sudo launchctl load -w /Library/LaunchDaemons/org.macports.logrotate.plist
119"