source: trunk/dports/sysutils/logrotate/Portfile

Last change on this file was 109631, checked in by ryandesign@…, 4 years ago

logrotate: be explicit about what tool we're getting archflags for; cpp does not use archflags

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 5.3 KB
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: Portfile 109631 2013-08-19 00:55:25Z ryandesign@macports.org $
3
4PortSystem          1.0
5
6name                logrotate
7version             3.8.6
8revision            2
9categories          sysutils
10platforms           darwin
11license             GPL-2
12maintainers         pixilla openmaintainer
13
14description         Rotates, compresses, and mails system logs
15
16long_description    The logrotate utility is designed to simplify the administration of log files \
17                    on a system which generates a lot of log files. Logrotate allows for the \
18                    automatic rotation compression, removal and mailing of log files. Logrotate \
19                    can be set to handle a log file \daily, weekly, monthly or when the log file \
20                    gets to a certain size.
21
22homepage            https://fedorahosted.org/logrotate/
23master_sites        https://fedorahosted.org/releases/l/o/logrotate/
24
25checksums           rmd160  4cba4954c99896ea036d57190fc11a8307b2765e \
26                    sha256  0e0ef0609afe9ef2a2ef6cae307b5ca618ddd349923ccce6e064513afd4e9d92
27
28depends_lib         port:popt
29
30depends_run         port:gettext
31
32patch.pre_args      -p1
33patchfiles          patch-Makefile.diff
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
43post-patch {
44    reinplace "s|@PREFIX@|${prefix}|g" \
45        ${worksrcpath}/examples/logrotate-default
46    reinplace "s|@PREFIX@|${prefix}|g" \
47        ${worksrcpath}/logrotate.conf.example
48    reinplace "s|@PREFIX@|${prefix}|g" \
49        ${worksrcpath}/org.macports.logrotate.plist.example
50}
51
52use_configure       no
53
54variant universal {}
55
56build.env-append    CC="${configure.cc} [get_canonical_archflags cc]" \
57                    CXX="${configure.cxx} [get_canonical_archflags cxx]" \
58                    CPP="${configure.cpp}" \
59                    BASEDIR="${prefix}" \
60                    POPT_DIR="${prefix}" \
61                    STATEFILE="${prefix}/var/run/logrotate/logrotate.status" \
62                    DEFAULT_MAIL_COMMAND="/usr/bin/mail"
63
64destroot.args       INSTALL="install" \
65                    BINDIR="${destroot}${prefix}/sbin" \
66                    MANDIR="${destroot}${prefix}/share/man"
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} CHANGES COPYING \
72            logrotate.conf.example org.macports.logrotate.plist.example \
73                ${destroot}${prefix}/share/${name}
74
75    # The startupitem.install keyword does not exist in MacPorts < 2.1.
76    if {![info exists startupitem.install]} {
77
78        set startupitem.install yes
79    }
80    if {[variant_isset startupitem]
81    && ${startupitem.install} != "no"
82    && [getuid] == 0} {
83
84        xinstall -d ${destroot}${prefix}/etc/LaunchDaemons/org.macports.logrotate
85        xinstall -d ${destroot}/Library/LaunchDaemons
86        xinstall -m 644 ${destroot}${prefix}/share/${name}/org.macports.logrotate.plist.example \
87            ${destroot}${prefix}/etc/LaunchDaemons/org.macports.logrotate/org.macports.logrotate.plist
88        ln -sf "${prefix}/etc/LaunchDaemons/org.macports.logrotate/org.macports.logrotate.plist" "${destroot}/Library/LaunchDaemons/org.macports.logrotate.plist"
89    }
90}
91
92post-activate {
93
94    if ![file exists ${prefix}/etc/logrotate.conf] {
95   
96        copy ${prefix}/share/${name}/logrotate.conf.example ${prefix}/etc/logrotate.conf
97    }
98}
99
100variant bzip2 conflicts gzip description {Use bzip2 compression by default} {
101    build.env-append \
102                    COMPRESS_COMMAND="${prefix}/bin/bzip2" \
103                    COMPRESS_EXT=".bz2" \
104                    UNCOMPRESS_COMMAND="${prefix}/bin/bunzip2"
105    depends_run-append \
106                    port:bzip2
107}
108
109variant gzip conflicts bzip2 description {Use gzip compression by default} {
110    build.pre_args-append \
111                    COMPRESS_COMMAND="${prefix}/bin/gzip" \
112                    COMPRESS_EXT=".gz" \
113                    UNCOMPRESS_COMMAND="${prefix}/bin/gunzip"
114    depends_run-append \
115                    port:gzip
116}
117
118variant startupitem description {Install launchd plist} {
119}
120
121if {![variant_isset bzip2]} {
122    default_variants-append \
123                    +gzip
124    variant_set     gzip
125}
126
127livecheck.url       $homepage
128livecheck.type      regex
129livecheck.regex     "(?!${name}).*${name}-((?!${extract.suffix}).*)${extract.suffix}"
130
131notes \
132"
133
134To use logrotate:
135
136  * If ${prefix}/etc/logrotate.conf does not exist copy the example into place.
137
138    \$ sudo cp ${prefix}/share/${name}/logrotate.conf.example ${prefix}/etc/logrotate.conf
139
140  * With the startupitem variant (+startupitem) you can activate a scheduled log
141    rotation with this command.
142
143    \$ sudo port load logrotate
144
145  * To create your own startup item with non-default intervals, build logrotate
146    without the startupitem variant (-startupitem), copy the example into place
147    and edit to your liking, then load with launchctl when finished.
148
149    \$ sudo cp ${prefix}/share/${name}/org.macports.logrotate.plist.example /Library/LaunchDaemons/org.macports.logrotate.plist
150
151    \$ sudo launchctl load -w /Library/LaunchDaemons/org.macports.logrotate.plist
152   
153"
Note: See TracBrowser for help on using the repository browser.