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

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

gpg-agent: deprecate no_pinentry variant. Add pinentry and pinentry_mac variants. Change switching algorithm to add either pinentry or pinentry_mac to default_variants.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 5.9 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 128275 2014-11-17 23:23:34Z 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    # Automatically switch between pinentry and pinentry-mac, with pinentry-mac being
59    # preferred.
60    # 10.7 and below are not supported by pinentry-mac, though, and will default to
61    # pinentry. Just like pure darwin without OS X will.
62    if {${os.subplatform} ne "macosx" ||
63        ${os.major} < 12 || ([catch "registry_active pinentry"] &&
64                             ![catch "registry_active pinentry-mac"])} {
65        default_variants-append +pinentry
66    } else {
67        default_variants-append +pinentry_mac
68    }
69
70
71    patchfiles-append       patch-agent_gpg-agent.c-launchd.diff
72    configure.cflags-append -F/System/Library/Frameworks/CoreFoundation.framework \
73                            -D__APPLE_LAUNCHD__
74
75    if {${os.major} < 11} {
76        patchfiles-append   patch-agent_agent.h-strndup-compat-10.6.diff
77    }
78
79    if { [tbool startupitem.install] } {
80        notes-append "
81                       A startup item has been installed that will aid in
82                       starting ${name} with launchd. It is disabled
83                       by default. Execute the following command to launch
84                       ${name} at user login:
85
86                       launchctl load -w /Library/${startupitem.location}/${startupitem.plist}
87
88                       To actually start ${name}, log out and back in.
89                     "
90    } else {
91        notes-append "
92                       A startup item was not installed for ${name}.
93                       Some programs which depend on ${name} might not function properly,
94                       most notably eMail clients.
95                       Execute the following command to launch ${name} at user login:
96
97                       launchctl load -w ${launchd_dir}/${startupitem.plist}
98
99                       To actually start ${name}, log out and back in.
100                     "
101    }
102}
103
104post-extract {
105    xinstall -m 644 -W ${filespath} gpg-agent.plist.default ${worksrcpath}
106}
107
108post-configure {
109    reinplace -W "${worksrcpath}" "s|@PREFIX@|${prefix}|g" gpg-agent.plist.default
110    reinplace -W "${worksrcpath}" "s|@LABEL@|${startupitem.uniquename}|g" gpg-agent.plist.default
111
112    if {${os.platform} eq "darwin"} {
113        reinplace -W "${worksrcpath}" "s|@SSH_SUPPORT@||g" gpg-agent.plist.default
114    }
115}
116
117post-destroot {
118    # Prevent conflict with gnupg2 port.
119    delete ${destroot}${prefix}/share/doc/gnupg/README
120
121    if {${os.platform} eq "darwin"} {
122        xinstall -m 755 -d \
123            ${destroot}${launchd_dir}
124        xinstall -m 444 \
125            ${worksrcpath}/gpg-agent.plist.default \
126            ${destroot}${launchd_dir}${startupitem.plist}.default
127    }
128}
129
130post-activate {
131    if {${os.platform} eq "darwin"} {
132        xinstall -m 644 \
133            ${launchd_dir}${startupitem.plist}.default \
134            ${launchd_dir}${startupitem.plist}
135
136        # install the plist, if startupitem.install is set
137        if {[tbool startupitem.install]} {
138            ln -sf "${launchd_dir}${startupitem.plist}" "/Library/${startupitem.location}"
139        }
140    }
141}
142
143post-deactivate {
144    if {${os.platform} eq "darwin"} {
145        delete ${launchd_dir}${startupitem.plist}
146
147        if { [tbool startupitem.install] } {
148           delete "/Library/${startupitem.location}/${startupitem.plist}"
149        }
150    }
151}
152
153# Remove after 11-17-2015.
154variant no_pinentry conflicts pinentry pinentry_mac description {Legacy compatibility variant for disabling pinentry. Will be removed soon.} {
155}
156
157variant pinentry conflicts pinentry_mac no_pinentry description {Handle user input via pinentry.} {
158    depends_lib-append      port:pinentry
159    configure.args-append   --with-pinentry-pgm=${prefix}/bin/pinentry
160}
161
162variant pinentry_mac conflicts pinentry no_pinentry description {Handle user input via pinentry-mac. Only compatible with OS X 10.8+.} {
163    depends_lib-append      port:pinentry-mac
164    configure.args-append   --with-pinentry-pgm=${applications_dir}/pinentry-mac.app/Contents/MacOS/pinentry-mac
165}
166
167livecheck.type      regex
168livecheck.url       ftp://ftp.gnupg.org/gcrypt/gnupg/
169livecheck.regex     gnupg-(\\d+\\.\\d+\\.\\d+)
Note: See TracBrowser for help on using the repository browser.