source: trunk/dports/net/dnsmasq/Portfile @ 81291

Last change on this file since 81291 was 81291, checked in by snc@…, 6 years ago

snc ports: update checksum to use new default (rmd160/sha256)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.6 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 81291 2011-07-29 02:51:08Z snc@macports.org $
3
4PortSystem          1.0
5
6name                dnsmasq
7version             2.57
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/
34
35checksums           rmd160  fa94717d4e0c7d095d734a18a77baa46ddc2cd54 \
36                    sha256  c2e0c7b82122d636933b28a1c28e6bccb6daad49162e7534b641b3c3340ff8ae
37
38patchfiles          patch-src-config.h.diff \
39                    patch-src-network.c.diff \
40                    patch-Makefile.diff
41post-patch {
42    reinplace "s|@PREFIX@|${prefix}|g" ${worksrcpath}/src/config.h
43    reinplace s|#resolv-file=|resolv-file=/etc/resolv.conf| \
44        ${worksrcpath}/dnsmasq.conf.example
45}
46
47use_configure       no
48
49destroot.args       PREFIX=${prefix}
50destroot.keepdirs   ${destroot}${prefix}/var/run
51
52livecheck.type      regex
53livecheck.url       ${master_sites}
54livecheck.regex     LATEST_IS_(\\d\\.\\d+)
55
56set COPTS ""
57variant no_dhcp description { Disable built in DHCP server } {
58    set COPTS "${COPTS} -DNO_DHCP"
59    build.args COPTS="${COPTS}"
60}
61
62variant no_tftp description { Disable built in TFTP server } {
63    set COPTS "${COPTS} -DNO_TFTP"
64    build.args COPTS="${COPTS}"
65}
66
67variant no_ipv6 description { Disable IPV6 support } {
68    set COPTS "${COPTS} -DNO_IPV6"
69    build.args COPTS="${COPTS}"
70}
71
72post-destroot {
73    # copy configuration file if not previously created
74    if {![file exists ${prefix}/etc/dnsmasq.conf]} {
75        copy ${destroot}${prefix}/etc/dnsmasq.conf.sample \
76            ${destroot}${prefix}/etc/dnsmasq.conf
77    }
78
79    # Create the directory that dnsmasq likes to store its pid in.
80    xinstall -d -m 755 ${destroot}${prefix}/var/run
81
82    #
83    # Set up a launchd item.  The daemondo wrapper is not needed.
84    #
85
86    # Create the plist file.
87    set itemname    ${startupitem.name}
88    set uniquename  ${startupitem.uniquename}
89    set plistname   ${startupitem.plist}
90    set daemondest  ${startupitem.location}
91    set itemdir     ${prefix}/etc/${daemondest}/${uniquename}
92
93    file mkdir ${destroot}${itemdir}
94    file attributes ${destroot}${itemdir} -owner root -group wheel
95
96    set plist [open "${destroot}${itemdir}/${plistname}" w 0644]
97    puts ${plist} "<?xml version='1.0' encoding='UTF-8'?>"
98    puts ${plist} "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\""
99    puts ${plist} "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">"
100    puts ${plist} "<plist version='1.0'>"
101    puts ${plist} "  <dict>"
102    puts ${plist} "    <key>Label</key>"
103    puts ${plist} "    <string>${uniquename}</string>"
104    puts ${plist} "    <key>ProgramArguments</key>"
105    puts ${plist} "    <array>"
106    puts ${plist} "      <string>${prefix}/sbin/dnsmasq</string>"
107    puts ${plist} "      <string>-k</string>"
108    puts ${plist} "    </array>"
109    puts ${plist} "    <key>KeepAlive</key>"
110    puts ${plist} "    <dict>"
111    puts ${plist} "      <key>NetworkState</key>"
112    puts ${plist} "      <true/>"
113    puts ${plist} "    </dict>"
114    puts ${plist} "  </dict>"
115    puts ${plist} "</plist>"
116    close ${plist}
117
118    # Make a symlink to the plist file.
119    file mkdir "${destroot}/Library/${daemondest}"
120    ln -sf "${itemdir}/${plistname}" "${destroot}/Library/${daemondest}"
121}
Note: See TracBrowser for help on using the repository browser.