source: trunk/dports/security/gpg-agent/Portfile @ 128396

Last change on this file since 128396 was 128396, checked in by ionic@…, 5 years ago

gpg-agent: add xcode version check to automatic variant selector.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.1 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 128396 2014-11-20 18:25:38Z ionic@macports.org $
3
4PortSystem          1.0
5
6# When updating gpg-agent, update gnupg2 also if applicable.
7name                gpg-agent
8version             2.0.26
9revision            4
10categories          security mail
11maintainers         ionic openmaintainer
12license             GPL-3+
13installs_libs       no
14
15description         GPG key agent
16long_description    gpg-agent is a key management agent similar \
17                    in function to ssh-agent.
18homepage            http://www.gnupg.org
19platforms           darwin freebsd sunos
20distname            gnupg-${version}
21dist_subdir         gnupg2
22master_sites        gnupg:gnupg
23
24use_bzip2           yes
25
26checksums           rmd160  874040ed8fad12067cbe67c8da222b2ad99a5a96 \
27                    sha256  7758e30dc382ae7a7167ed41b7f936aa50af5ea2d6fccdef663b5b750b65b8e0
28
29startupitem.location \
30                    LaunchAgents
31
32set launchd_dir     ${prefix}/etc/${startupitem.location}/${startupitem.uniquename}/
33
34configure.args      --enable-agent-only
35
36# glib fails to find the right stdint.h  It picks clang's internal one rather
37# than the system header
38configure.env       gl_cv_absolute_stdint_h=/usr/include/stdint.h
39
40depends_lib         port:libiconv       \
41                    port:gettext        \
42                    port:zlib           \
43                    port:bzip2          \
44                    port:bison          \
45                    port:libassuan      \
46                    port:libksba        \
47                    port:libgcrypt      \
48                    port:libgpg-error   \
49                    port:pth
50
51
52patchfiles          patch-po_Makevars.diff
53
54# DO NOT USE. Maintainer-only helper for debugging purposes. DO NOT USE.
55#configure.cflags-append -g3 -ggdb3 -gdwarf-2 -O0
56
57platform darwin {
58    if {![variant_isset no_pinentry] &&
59        ![variant_isset pinentry] && ![variant_isset pinentry_mac]} {
60        # Automatically switch between pinentry and pinentry-mac, with pinentry-mac being
61        # preferred.
62        # 10.7 and below are not supported by pinentry-mac, though, and will default to
63        # pinentry. Just like pure darwin without OS X will.
64        if {${os.subplatform} ne "macosx" ||
65            ${xcodeversion} eq "none" ||
66            [vercmp ${xcodeversion} {5.0}] < 0 ||
67            ${os.major} < 12 || ([catch {registry_active pinentry}] &&
68                                 ![catch {registry_active pinentry-mac}])} {
69            default_variants-append +pinentry
70        } else {
71            default_variants-append +pinentry_mac
72        }
73    }
74
75
76    patchfiles-append       patch-agent_gpg-agent.c-launchd.diff
77    configure.cflags-append -F/System/Library/Frameworks/CoreFoundation.framework \
78                            -D__APPLE_LAUNCHD__
79
80    if {${os.major} < 11} {
81        patchfiles-append   patch-agent_agent.h-strndup-compat-10.6.diff
82    }
83
84    if { [tbool startupitem.install] } {
85        notes-append "
86                       A startup item has been installed that will aid in
87                       starting ${name} with launchd. It is disabled
88                       by default. Execute the following command to launch
89                       ${name} at user login:
90
91                       launchctl load -w /Library/${startupitem.location}/${startupitem.plist}
92
93                       To actually start ${name}, log out and back in.
94                     "
95    } else {
96        notes-append "
97                       A startup item was not installed for ${name}.
98                       Some programs which depend on ${name} might not function properly,
99                       most notably eMail clients.
100                       Execute the following command to launch ${name} at user login:
101
102                       launchctl load -w ${launchd_dir}/${startupitem.plist}
103
104                       To actually start ${name}, log out and back in.
105                     "
106    }
107}
108
109post-extract {
110    xinstall -m 644 -W ${filespath} gpg-agent.plist.default ${worksrcpath}
111}
112
113post-configure {
114    reinplace -W "${worksrcpath}" "s|@PREFIX@|${prefix}|g" gpg-agent.plist.default
115    reinplace -W "${worksrcpath}" "s|@LABEL@|${startupitem.uniquename}|g" gpg-agent.plist.default
116
117    if {${os.platform} eq "darwin"} {
118        reinplace -W "${worksrcpath}" "s|@SSH_SUPPORT@||g" gpg-agent.plist.default
119    }
120}
121
122post-destroot {
123    # Prevent conflict with gnupg2 port.
124    delete ${destroot}${prefix}/share/doc/gnupg/README
125
126    if {${os.platform} eq "darwin"} {
127        xinstall -m 755 -d \
128            ${destroot}${launchd_dir}
129        xinstall -m 444 \
130            ${worksrcpath}/gpg-agent.plist.default \
131            ${destroot}${launchd_dir}${startupitem.plist}.default
132    }
133}
134
135post-activate {
136    if {${os.platform} eq "darwin"} {
137        xinstall -m 644 \
138            ${launchd_dir}${startupitem.plist}.default \
139            ${launchd_dir}${startupitem.plist}
140
141        # install the plist, if startupitem.install is set
142        if {[tbool startupitem.install]} {
143            ln -sf "${launchd_dir}${startupitem.plist}" "/Library/${startupitem.location}"
144        }
145    }
146}
147
148post-deactivate {
149    if {${os.platform} eq "darwin"} {
150        delete ${launchd_dir}${startupitem.plist}
151
152        if { [tbool startupitem.install] } {
153           delete "/Library/${startupitem.location}/${startupitem.plist}"
154        }
155    }
156}
157
158# Remove after 11-17-2015.
159variant no_pinentry conflicts pinentry pinentry_mac description {Legacy compatibility variant for disabling pinentry. Will be removed soon.} {
160}
161
162variant pinentry conflicts pinentry_mac no_pinentry description {Handle user input via pinentry.} {
163    depends_lib-append      port:pinentry
164    configure.args-append   --with-pinentry-pgm=${prefix}/bin/pinentry
165}
166
167variant pinentry_mac conflicts pinentry no_pinentry description {Handle user input via pinentry-mac. Only compatible with OS X 10.8+.} {
168    depends_lib-append      port:pinentry-mac
169    configure.args-append   --with-pinentry-pgm=${applications_dir}/pinentry-mac.app/Contents/MacOS/pinentry-mac
170}
171
172livecheck.type      regex
173livecheck.url       ftp://ftp.gnupg.org/gcrypt/gnupg/
174livecheck.regex     gnupg-(\\d+\\.\\d+\\.\\d+)
Note: See TracBrowser for help on using the repository browser.