New Ticket     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

root/trunk/dports/sysutils/logrotate/Portfile

Revision 88778, 5.7 KB (checked in by ryandesign@…, 4 months ago)

logrotate: use proper -L and -I flags so that clang can compile it; see #32851

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
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                logrotate
7version             3.8.1
8categories          sysutils
9maintainers         pixilla openmaintainer
10platforms           darwin
11
12description         Rotates, compresses, and mails system logs
13
14long_description    The logrotate utility is designed to simplify the administration of log files \
15                    on a system which generates a lot of log files. Logrotate allows for the \
16                    automatic rotation compression, removal and mailing of log files. Logrotate \
17                    can be set to handle a log file \daily, weekly, monthly or when the log file \
18                    gets to a certain size.
19
20homepage            https://fedorahosted.org/logrotate/
21master_sites        https://fedorahosted.org/releases/l/o/logrotate/
22
23checksums           rmd160  cec3bc6a4cb4226b31696977935818695027b0f8 \
24                    sha256  c12471e70ae8bc923bd5c4f25e8fd6483b68c6301f3cd79f7cfe37bc5b370169
25
26patchfiles          patch-Makefile.diff
27
28depends_run         port:popt port:gettext
29
30post-extract {
31    touch ${worksrcpath}/.depend
32}
33
34post-patch {
35    reinplace "s|@@PREFIX@@|${prefix}|g" \
36        ${worksrcpath}/examples/logrotate-default
37}
38
39use_configure       no
40
41variant universal {}
42
43build.env-append    CC="${configure.cc} [get_canonical_archflags]" \
44                    CXX="${configure.cxx} [get_canonical_archflags]" \
45                    CPP="${configure.cpp} [get_canonical_archflags]" \
46                    BASEDIR="${prefix}" \
47                    POPT_DIR="${prefix}" \
48                    STATEFILE="${prefix}/var/run/logrotate/logrotate.status" \
49                    DEFAULT_MAIL_COMMAND="/usr/sbin/mail"
50
51destroot.args       INSTALL="install" \
52                    BINDIR="${destroot}${prefix}/sbin" \
53                    MANDIR="${destroot}${prefix}/share/man"
54destroot.keepdirs   ${destroot}${prefix}/etc/logrotate.d \
55                    ${destroot}${prefix}/var/run/logrotate
56post-destroot {
57    xinstall -d ${destroot}${prefix}/share/${name}
58    set fp [open ${destroot}${prefix}/share/${name}/logrotate.conf.example w]
59    puts $fp \
60"# see \"man logrotate\" for details
61# rotate log files weekly
62weekly
63
64# keep 4 weeks worth of backlogs
65rotate 4
66
67# create new (empty) log files after rotating old ones
68create
69
70# use date as a suffix of the rotated file
71dateext
72
73# uncomment this if you want your log files compressed
74#compress
75
76# Drop log rotation information into this directory
77include ${prefix}/etc/logrotate.d"
78    close $fp
79
80    set fp [open ${destroot}${prefix}/share/${name}/org.macports.logrotate.plist.example w]
81    puts $fp \
82"<?xml version=\"1.0\" encoding=\"UTF-8\"?>
83<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
84<plist version=\"1.0\">
85<dict>
86        <key>Disabled</key>
87        <true/>
88        <key>Label</key>
89        <string>com.pixilla.logrotate</string>
90        <key>ProgramArguments</key>
91        <array>
92                <string>${prefix}/sbin/logrotate</string>
93                <string>${prefix}/etc/logrotate.conf</string>
94        </array>
95        <key>StartCalendarInterval</key>
96        <dict>
97                <key>Hour</key>
98                <integer>5</integer>
99                <key>Minute</key>
100                <integer>30</integer>
101        </dict>
102</dict>
103</plist>"
104    close $fp
105    if {[variant_isset startupitem]} {
106        xinstall -d ${destroot}${prefix}/etc/LaunchDaemons/org.macports.logrotate
107        xinstall -d ${destroot}/Library/LaunchDaemons
108        xinstall -m 644 ${destroot}${prefix}/share/${name}/org.macports.logrotate.plist.example \
109            ${destroot}${prefix}/etc/LaunchDaemons/org.macports.logrotate/org.macports.logrotate.plist
110        ln -sf "${prefix}/etc/LaunchDaemons/org.macports.logrotate/org.macports.logrotate.plist" "${destroot}/Library/LaunchDaemons/org.macports.logrotate.plist"
111    }
112}
113
114variant bzip2 conflicts gzip description {Use bzip2 compression by default} {
115    build.env-append \
116                    COMPRESS_COMMAND="${prefix}/bin/bzip2" \
117                    COMPRESS_EXT=".bz2" \
118                    UNCOMPRESS_COMMAND="${prefix}/bin/bunzip2"
119    depends_run-append \
120                    port:bzip2
121}
122
123variant gzip conflicts bzip2 description {Use gzip compression by default} {
124    build.pre_args-append \
125                    COMPRESS_COMMAND="${prefix}/bin/gzip" \
126                    COMPRESS_EXT=".gz" \
127                    UNCOMPRESS_COMMAND="${prefix}/bin/gunzip"
128    depends_run-append \
129                    port:gzip
130}
131
132variant startupitem description {Install launchd plist} {
133}
134
135if {![variant_isset bzip2]} {
136    default_variants-append \
137                    +gzip
138    variant_set     gzip
139}
140
141livecheck.url       $homepage
142livecheck.type      regex
143livecheck.regex     "(?!${name}).*${name}-((?!${extract.suffix}).*)${extract.suffix}"
144
145notes \
146"
147
148To use logrotate:
149
150  * If ${prefix}/etc/logrotate.conf does not exist copy the example into place.
151
152    \$ sudo cp ${prefix}/share/${name}/logrotate.conf.example ${prefix}/etc/logrotate.conf
153
154  * Logrotate scripts added to ${prefix}/etc/logrotate.d are read by default.
155
156    \$ sudo ${prefix}/sbin/${name} ${prefix}/etc/logrotate.conf
157
158  * With the startupitem variant (+startupitem) you can activate a scheduled log
159    rotation with this command.
160
161    \$ sudo port load Logrotate
162
163  * To create your own startup item with non-default intervals, build logrotate
164    without the startupitem variant (-startupitem), copy the example into place
165    and edit to your liking and load with launchctl when finished.
166
167    \$ sudo cp ${prefix}/share/${name}/org.macports.logrotate.plist.example /Library/LaunchDaemons/org.macports.logrotate.plist
168
169    \$ sudo launchctl load -w /Library/LaunchDaemons/org.macports.logrotate.plist
170   
171"
Note: See TracBrowser for help on using the browser.