source: trunk/dports/net/dnsmasq/Portfile

Last change on this file was 148957, checked in by snc@…, 17 months ago

dnsmasq: update to 2.76

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 5.5 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 148957 2016-05-23 19:28:42Z ryandesign@macports.org $
3
4PortSystem          1.0
5
6name                dnsmasq
7version             2.76
8categories          net
9license             GPL
10maintainers         snc openmaintainer
11description         lightweight DNS forwarder and DHCP server
12long_description    Dnsmasq is lightweight, easy to configure DNS \
13                    forwarder and DHCP server. It is designed to provide \
14                    DNS and, optionally, DHCP, to a small network. It can \
15                    serve the names of local machines which are not in the \
16                    global DNS. The DHCP server integrates with the DNS \
17                    server and allows machines with DHCP-allocated \
18                    addresses to appear in the DNS with names configured \
19                    either in each host or in a central configuration \
20                    file. Dnsmasq supports static and dynamic DHCP leases \
21                    and BOOTP for network booting of diskless machines.
22homepage            http://www.thekelleys.org.uk/dnsmasq/doc.html
23
24platforms           darwin
25
26notes               "A startup item has been generated that will aid in\
27                    starting ${name} with launchd. You must specify the\
28                    path to resolv.conf. For your protection, this script\
29                    is disabled by default. Execute the following command\
30                    to start it, and to cause it to launch at startup:\
31                    \n\nsudo port load ${name}"
32
33master_sites        http://www.thekelleys.org.uk/dnsmasq/
34use_xz              yes
35
36checksums           rmd160  9932b6624dd705fa8826b055ebe23138d3b0302b \
37                    sha256  4b92698dee19ca0cb2a8f2e48f1d2dffd01a21eb15d1fbed4cf085630c8c9f96
38patchfiles          patch-src-config.h.diff \
39                    patch-src-network.c.diff
40post-patch {
41    reinplace "s|@PREFIX@|${prefix}|g" ${worksrcpath}/src/config.h
42    reinplace s|#resolv-file=|resolv-file=/etc/resolv.conf| \
43        ${worksrcpath}/dnsmasq.conf.example
44}
45
46use_configure       no
47
48variant universal {}
49
50build.env-append    CC="${configure.cc} [get_canonical_archflags]"
51destroot.env-append    CC="${configure.cc} [get_canonical_archflags]"
52
53destroot.args       PREFIX=${prefix}
54destroot.keepdirs   ${destroot}${prefix}/var/run/${name}
55
56livecheck.type      regex
57livecheck.url       ${master_sites}
58livecheck.regex     LATEST_IS_(\\d\\.\\d+)
59
60# TODO: remove no_* variants after 2015-01-09
61if { ! [variant_isset no_dhcp] } {
62    default_variants-append +dhcp
63}
64if { ! [variant_isset no_tftp] } {
65    default_variants-append +tftp
66}
67if { ! [variant_isset no_ipv6] } {
68    default_variants-append +ipv6
69}
70
71variant no_dhcp conflicts dhcp description { obsolete } {}
72variant dhcp conflicts no_dhcp description { Provide built-in DHCP server } {
73    build.args-delete   -DNO_DHCP
74}
75
76variant no_tftp conflicts tftp description { obsolete } {}
77variant tftp conflicts no_tftp description { Provide built-in TFTP server } {
78    build.args-delete   -DNO_TFTP
79}
80
81variant no_ipv6 conflicts ipv6 description { obsolete } {}
82variant ipv6 conflicts no_ipv6 description { Provide IPV6 support } {
83    build.args-delete   -DNO_IPV6
84}
85
86set COPTS {}
87if {![variant_isset dhcp]} {
88    lappend COPTS -DNO_DHCP
89}
90if {![variant_isset tftp]} {
91    lappend COPTS -DNO_TFTP
92}
93if {![variant_isset ipv6]} {
94    lappend COPTS -DNO_IPV6
95}
96if {[llength $COPTS] > 0} {
97    set mycopts [join $COPTS " "]
98    build.args-append COPTS="$mycopts"
99}
100
101post-destroot {
102    copy ${worksrcpath}/dnsmasq.conf.example ${destroot}${prefix}/etc/dnsmasq.conf.example
103
104    # Create the directory that dnsmasq likes to store its pid in.
105    xinstall -d -m 777 ${destroot}${prefix}/var/run/${name}
106
107    #
108    # Set up a launchd item.  The daemondo wrapper is not needed.
109    #
110
111    # Create the plist file.
112    set itemname    ${startupitem.name}
113    set uniquename  ${startupitem.uniquename}
114    set plistname   ${startupitem.plist}
115    set daemondest  ${startupitem.location}
116    set itemdir     ${prefix}/etc/${daemondest}/${uniquename}
117
118    file mkdir ${destroot}${itemdir}
119    file attributes ${destroot}${itemdir} -owner root -group wheel
120
121    set plist [open "${destroot}${itemdir}/${plistname}" w 0644]
122    puts ${plist} "<?xml version='1.0' encoding='UTF-8'?>"
123    puts ${plist} "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\""
124    puts ${plist} "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">"
125    puts ${plist} "<plist version='1.0'>"
126    puts ${plist} "  <dict>"
127    puts ${plist} "    <key>Disabled</key>"
128    puts ${plist} "    <true/>"
129    puts ${plist} "    <key>Label</key>"
130    puts ${plist} "    <string>${uniquename}</string>"
131    puts ${plist} "    <key>ProgramArguments</key>"
132    puts ${plist} "    <array>"
133    puts ${plist} "      <string>${prefix}/sbin/dnsmasq</string>"
134    puts ${plist} "      <string>-k</string>"
135    puts ${plist} "    </array>"
136    puts ${plist} "    <key>RunAtLoad</key>"
137    puts ${plist} "    <true/>"
138    puts ${plist} "    <key>KeepAlive</key>"
139    puts ${plist} "    <true/>"
140    puts ${plist} "  </dict>"
141    puts ${plist} "</plist>"
142    close ${plist}
143
144    # Make a symlink to the plist file.
145    file mkdir "${destroot}/Library/${daemondest}"
146    ln -sf "${itemdir}/${plistname}" "${destroot}/Library/${daemondest}"
147}
148
149post-activate {
150    # copy configuration file if not previously created
151    if {![file exists ${prefix}/etc/dnsmasq.conf]} {
152        copy ${prefix}/etc/dnsmasq.conf.example \
153            ${prefix}/etc/dnsmasq.conf
154    }
155}
Note: See TracBrowser for help on using the repository browser.