Ticket #46056: Portfile

File Portfile, 7.9 KB (added by Schamschula (Marius Schamschula), 9 years ago)
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 128604 2014-11-24 10:04:25Z ciserlohn@macports.org $
3
4PortSystem          1.0
5
6name                git
7version             2.2.0
8description         A fast version control system
9long_description    Git is a fast, scalable, distributed open source version \
10                    control system focusing on speed and efficiency.
11maintainers         ciserlohn
12categories          devel
13license             GPL-2 LGPL-2.1+
14platforms           darwin
15homepage            http://git-scm.com/
16master_sites        https://www.kernel.org/pub/software/scm/git/
17distname            git-${version}
18distfiles           git-${version}${extract.suffix} \
19                    git-manpages-${version}${extract.suffix}
20
21checksums           git-${version}${extract.suffix} \
22                    rmd160  7207c9092eee11e4c465e515f714b91f6c5c4388 \
23                    sha256  bea9548f5a39daaf7c3873b6a5be47d7f92cbf42d32957e1be955a2e0e7b83b4 \
24                    git-manpages-${version}${extract.suffix} \
25                    rmd160  cbcf3e1c8eb8100bbbd71d25da43bd59977b64c2 \
26                    sha256  81645cd064f737ba35e7a6082266036ec95bfa3390dcddddb08ff6aab0a79484 \
27
28depends_run         port:rsync
29
30depends_lib         port:curl \
31                    port:zlib \
32                    port:openssl \
33                    port:expat \
34                    port:libiconv
35
36if {[variant_isset perl5_12]} {
37    set perl_version 5.12
38} elseif {[variant_isset perl5_14]} {
39    set perl_version 5.14
40} else {
41    set perl_version 5.16
42    default_variants +perl5_16
43}
44
45
46depends_run-append  port:p${perl_version}-authen-sasl \
47                    port:p${perl_version}-error \
48                    port:p${perl_version}-net-smtp-ssl \
49                    port:p${perl_version}-term-readkey
50
51depends_lib-append  port:perl${perl_version}
52
53patchfiles          patch-Makefile.diff git-subtree.1.diff
54patch.pre_args      -p1
55
56extract.only        git-${version}${extract.suffix} \
57                    git-manpages-${version}${extract.suffix}
58
59use_configure       no
60
61variant universal   {}
62
63set CFLAGS          "-I. -Wall -O2 -I${prefix}/include [get_canonical_archflags cc]"
64set LDFLAGS         "-L${prefix}/lib [get_canonical_archflags ld]"
65
66build.args          CFLAGS="${CFLAGS}" \
67                    LDFLAGS="${LDFLAGS}" \
68                    CC=${configure.cc} \
69                    prefix=${prefix} \
70                    CURLDIR=${prefix} \
71                    OPENSSLDIR=${prefix} \
72                    ICONVDIR=${prefix} \
73                    PERL_PATH="${prefix}/bin/perl${perl_version}" \
74                    NO_FINK=1 \
75                    NO_DARWIN_PORTS=1 \
76                    NO_R_TO_GCC_LINKER=1 \
77                    V=1
78
79test.run            yes
80test.cmd            make
81test.target         test
82test.dir            ${worksrcpath}
83pre-test {
84    eval test.args  ${build.args}
85}
86
87destroot.target     install
88pre-destroot {
89    eval destroot.args  ${build.args}
90    xinstall -m 644 ${worksrcpath}/contrib/subtree/git-subtree.1 ${workpath}/man1
91}
92
93set docdestroot ${destroot}${prefix}/share/doc/git-doc
94
95post-destroot {
96    foreach f {1 5 7} {
97        xinstall -d ${destroot}${prefix}/share/man/man${f}
98        foreach m [glob -directory ${workpath} man${f}/*.${f}] {
99            xinstall ${m} ${destroot}${prefix}/share/man/man${f}
100        }
101    }
102    if {![variant_isset svn]} {
103        system "rm ${destroot}${prefix}/libexec/git-core/git-svn*"
104    }
105    xinstall -d ${docdestroot}
106
107    fs-traverse badfile ${destroot} {
108        if {[string last perllocal.pod ${badfile}] != -1} {
109            ui_info "Removing ${badfile}"
110            file delete ${badfile}
111        }
112    }
113
114    set completions_path ${destroot}${prefix}/share/bash-completion/completions
115    xinstall -d ${completions_path}
116    xinstall -m 644 ${worksrcpath}/contrib/completion/git-completion.bash \
117        ${completions_path}/git
118   
119    set share_path ${destroot}${prefix}/share/${name}
120    xinstall -d ${share_path}
121    xinstall -m 644 ${worksrcpath}/contrib/completion/git-prompt.sh \
122        ${share_path}/git-prompt.sh
123
124    xinstall -m 755 ${worksrcpath}/contrib/subtree/git-subtree.sh \
125        ${destroot}${prefix}/libexec/git-core/git-subtree
126
127    file delete -force ${share_path}/contrib
128    copy ${worksrcpath}/contrib ${share_path}
129
130    xinstall -m 755 -d ${destroot}${prefix}/share/emacs/site-lisp/
131    eval xinstall -m 644 [glob ${worksrcpath}/contrib/emacs/*.el] \
132        ${destroot}${prefix}/share/emacs/site-lisp/
133
134}
135
136if {![variant_isset python26] && ![variant_isset python27]} {
137    default_variants    +python27
138}
139
140variant python26 conflicts python27 description {Use Python 2.6} {
141    build.args-append       PYTHON_PATH="${prefix}/bin/python2.6"
142    depends_lib-append      port:python26
143}
144
145variant python27 conflicts python26 description {Use Python 2.7} {
146    build.args-append       PYTHON_PATH="${prefix}/bin/python2.7"
147    depends_lib-append      port:python27
148}
149
150variant perl5_16 conflicts perl5_14 perl5_12 description {use perl 5.16} {}
151variant perl5_14 conflicts perl5_16 perl5_12 description {use perl 5.14} {}
152variant perl5_12 conflicts perl5_16 perl5_14 description {use perl 5.12} {}
153
154variant pcre {
155    build.args-append       LIBPCREDIR=${prefix} USE_LIBPCRE=1
156    depends_lib-append      port:pcre
157}
158
159variant doc description {Install HTML and plaintext documentation} {
160    distfiles-append        git-htmldocs-${version}${extract.suffix}
161    checksums-append        git-htmldocs-${version}${extract.suffix} \
162                            rmd160  120dfb8de62d419bc5327b53d2c58c99068e5a28 \
163                            sha256  79a1ebf6799318ad2632ab9d770f6bb2624bfab999d7184b27e19e7d7ec2ba55
164
165    patchfiles-append       git-subtree.html.diff
166
167    post-extract {
168        file mkdir ${workpath}/htmldocs
169        system -W ${workpath}/htmldocs "${extract.cmd} ${extract.pre_args} \
170            ${distpath}/git-htmldocs-${version}${extract.suffix} \
171            ${extract.post_args}"
172    }
173
174    pre-destroot {
175        xinstall -m 644 ${worksrcpath}/contrib/subtree/git-subtree.html ${workpath}/htmldocs
176    }
177
178    post-destroot {
179        foreach f [glob ${workpath}/htmldocs/*] {
180            file delete -force "${docdestroot}/[file tail ${f}]"
181            file attribute ${f} -permissions ugo+r
182            copy ${f} ${docdestroot}
183        }
184    }
185}
186
187variant gitweb description {Install gitweb.cgi} {
188    build.target-append     gitweb/gitweb.cgi
189
190    post-destroot {
191        xinstall -d ${destroot}${prefix}/share/${name}/gitweb
192        xinstall -W ${worksrcpath}/gitweb \
193            gitweb.cgi \
194            ${destroot}${prefix}/share/${name}/gitweb
195        xinstall -m 444 -W ${worksrcpath}/gitweb/static \
196            gitweb.css \
197            gitweb.js \
198            git-favicon.png \
199            git-logo.png \
200            ${destroot}${prefix}/share/${name}/gitweb
201        xinstall -d ${docdestroot}/gitweb
202        xinstall -m 444 -W ${worksrcpath}/gitweb README INSTALL \
203            ${docdestroot}/gitweb
204    }
205}
206
207variant svn description {Bi-directional subversion repository support} {
208    depends_run-append  port:subversion \
209                        port:p${perl_version}-libwww-perl \
210                        port:p${perl_version}-svn-simple
211}
212
213variant bash_completion {
214    depends_run-append  path:etc/bash_completion:bash-completion
215}
216
217
218variant credential_osxkeychain description {Install git credential-osxkeychain utility from contrib} {
219
220    post-build {
221        system -W "${worksrcpath}/contrib/credential/osxkeychain" "make [join ${build.args}]"
222    }
223
224    pre-destroot {
225        xinstall -m 755 "${worksrcpath}/contrib/credential/osxkeychain/git-credential-osxkeychain" \
226            "${destroot}${prefix}/bin/"
227    }
228}
229
230platform darwin 8 {
231    build.args-append   NO_APPLE_COMMON_CRYPTO=1
232}
233
234default_variants    +doc +pcre +credential_osxkeychain
235
236livecheck.type          regexm
237livecheck.regex         {<span class="version">.*?(\d\.\d\.\d).*?</span>}