Ticket #37198: Portfile-zsh.patch

File Portfile-zsh.patch, 6.9 KB (added by collin@…, 12 years ago)
  • Portfile-zsh

    old new  
    11# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
    22# $Id: Portfile 96346 2012-08-07 17:47:17Z singingwolfboy@macports.org $
    33
    4 PortSystem 1.0
     4PortSystem      1.0
    55
    66name            zsh
    77version         5.0.0
    8 revision        0
     8revision        1
    99categories      shells
     10platforms       darwin
    1011maintainers     nomaintainer
    1112license         Permissive
    1213description     Zsh is a UNIX command interpreter (shell)
     14
    1315long_description \
    1416    Zsh is a UNIX command interpreter (shell) which of the standard     \
    1517    shells most resembles the Korn shell (ksh), although it is not      \
     
    2022    `custom' shell).
    2123
    2224homepage        http://www.zsh.org
    23 platforms       darwin
    2425use_bzip2       yes
    25 master_sites    sourceforge:project/zsh/zsh/${version} \
    26                   http://www.zsh.org/pub/ \
    27                   ftp://ftp.zsh.org/zsh/ \
    28                   ftp://ftp.sterling.com/zsh/ \
    29                   ftp://ftp.fu-berlin.de/pub/unix/shells/zsh/ \
    30                   ftp://ftp.iij.ad.jp/pub/misc/zsh/ \
    31                   ftp://ftp.icm.edu.pl/vol/wojsyl/zsh/
    32 
    33 checksums           ${distname}${extract.suffix} \
    34                     rmd160  d2aff295e245dd5e805215c6dcca1e76af8b9725 \
    35                     sha256  cd014a8e09a3607c68369d1615db96d0fbb7279a125950b32032fd448c44a888
    3626
    37 depends_lib     port:libiconv port:ncurses port:gdbm
    38 configure.args  --enable-libs="-lncurses" \
     27master_sites    sourceforge:project/zsh/zsh/${version} \
     28                http://www.zsh.org/pub/ \
     29                ftp://ftp.zsh.org/zsh/ \
     30                http://mirror.dejanseo.com.au/pub/zsh/ \
     31                http://www.cs.elte.hu/pub/zsh/ \
     32                ftp://ftp.cs.elte.hu/pub/zsh/
     33
     34checksums       ${distname}${extract.suffix} \
     35                rmd160  d2aff295e245dd5e805215c6dcca1e76af8b9725 \
     36                sha256  cd014a8e09a3607c68369d1615db96d0fbb7279a125950b32032fd448c44a888
     37
     38depends_lib     port:libiconv \
     39                port:ncurses \
     40                port:gdbm
     41
     42configure.args  --mandir=${prefix}/share/man \
     43                --infodir=${prefix}/share/info \
     44                --enable-multibyte \
     45                --enable-etcdir=${prefix}/etc \
    3946                --with-tcsetpgrp
    4047
     48configure.env   DL_EXT=bundle
     49
     50test.run        yes
     51test.target     check
     52
     53set docdir      ${prefix}/share/doc/${distname}
     54
     55# Some love for zsh: http://grml.org/zsh/zsh-lovers.html
     56set love_distname   zsh-lovers_0.8.3
     57set love_distfile   ${love_distname}.tar.gz
     58set worklovedir     zsh-lovers
     59set worklovepath    ${workpath}/${worklovedir}
     60
     61post-patch {
     62    reinplace "s|/usr/share/zsh|${prefix}/share/zsh|" ${worksrcpath}/Functions/Misc/run-help
     63}
     64
     65post-destroot {
     66    # This manpage only includes every zsh manpage; as manpages are gzipped in MacPorts,
     67    # .so groff directives will fail.
     68    system "cd ${destroot}${prefix}/share/man/man1 && \
     69        soelim -I.. zshall.1 > zshall.1.soelim"
     70    move -force \
     71        ${destroot}${prefix}/share/man/man1/zshall.1.soelim \
     72        ${destroot}${prefix}/share/man/man1/zshall.1
     73
     74    # Install helpfiles for shell builtins (for use by run-help) by
     75    # extracting them from the zshbuiltins manpage
     76    set helpdir ${prefix}/share/zsh/${version}/help
     77    xinstall -d ${destroot}${helpdir}
     78    system "cd ${destroot}${helpdir} && nroff -mandoc -Tascii -c \
     79        ${destroot}${prefix}/share/man/man1/zshbuiltins.1 | colcrt - | \
     80        perl ${worksrcpath}/Util/helpfiles"
     81
     82    xinstall -d ${destroot}${docdir}
     83    xinstall -m 0644 -W ${worksrcpath} ChangeLog FEATURES LICENCE NEWS README ${destroot}${docdir}
     84
     85    if {[variant_isset doc] || [variant_isset examples]} {
     86        xinstall -d ${destroot}${docdir}/pdf
     87    }
     88}
     89
     90notes "
     91If you want MacPorts' zsh as login shell, you should run:
     92% sudo sh -c \"echo '${prefix}/bin/zsh' >> /etc/shells\"
     93% chsh -s ${prefix}/bin/zsh
     94"
     95
    4196platform darwin 8 {
    4297    post-configure {
     98        # poll(2) is broken on Darwin 8.
    4399        reinplace "s|#define HAVE_POLL 1|#undef HAVE_POLL|" ${worksrcpath}/config.h
    44100    }
    45101}
    46102
    47103variant mp_completion description {Include automatic completion of MacPorts commands} {
    48     post-destroot   {
    49         file copy -force ${filespath}/_port \
    50           ${destroot}${prefix}/share/${name}/${version}/functions
     104    post-destroot {
     105        set sitedir ${prefix}/share/zsh/site-functions
     106        xinstall -m 0644 ${filespath}/_port ${destroot}${sitedir}
    51107    }
    52108}
    53109
    54 variant doc description {Install documentation} {
     110variant pcre description {Add regular expressions support in builtin functions through PCRE} {
     111    configure.args-append   --enable-pcre
     112    depends_lib-append      port:pcre
     113}
     114
     115variant doc description {Install extra documentation} {
    55116    distfiles-append ${distname}-doc${extract.suffix}
    56117    checksums-append ${distname}-doc${extract.suffix} \
    57                        md5     f81aef500fbaaa6739b6a48e14357dca \
    58                        sha1    ea65b463a0b9475ec084ba4f96f390b84b2630a7 \
    59                        rmd160  83994a0c5a49db26c9876b27631c2327dda0672b
     118                     sha1    ea65b463a0b9475ec084ba4f96f390b84b2630a7 \
     119                     rmd160  83994a0c5a49db26c9876b27631c2327dda0672b
     120
     121    post-build {
     122        system "${build.cmd} -C ${worksrcpath}/Doc html info"
     123    }
     124
     125    destroot.target-append  install.html \
     126                            install.info
     127}
     128
     129variant examples description {Install configuration examples} {
     130    master_sites-append http://deb.grml.org/pool/main/z/zsh-lovers/:love
     131    distfiles-append    ${love_distfile}:love
     132    checksums-append    ${love_distfile} \
     133                        rmd160  f8482d61d700cc79530b4839de5a86aed6783e99 \
     134                        sha256  c786724ac9526e2504142c6d607bc6f3703a35b3db804123f0ffe4214b399ea9
     135    extract.only-delete ${love_distfile}
     136
     137    post-extract {
     138        system "tar xzf ${distpath}/${love_distfile} -C ${workpath}"
     139    }
     140
    60141    post-destroot {
    61         xinstall -d -m 755 ${destroot}${prefix}/share/doc/${name}
    62         eval xinstall -m 644 [glob ${worksrcpath}/Doc/*.html] \
    63           ${destroot}${prefix}/share/doc/${name}
    64         eval xinstall -m 644 [glob ${worksrcpath}/Doc/*.pdf] \
    65           ${destroot}${prefix}/share/doc/${name}
     142        proc xinstall_dir {dir destdir} {
     143            xinstall -d ${destdir}
     144
     145            foreach {file} [glob ${dir}/*] {
     146                if {[file isdirectory ${file}]} {
     147                    xinstall_dir ${file} [file join ${destdir} [file tail ${file}]]
     148                } else {
     149                    xinstall -m 0644 ${file} ${destdir}
     150                }
     151            }
     152        }
     153
     154        xinstall -m 0644 ${worklovepath}/refcard.pdf ${destroot}${docdir}/pdf
     155        xinstall_dir ${worklovepath}/zsh_people ${destroot}${docdir}/examples
    66156    }
    67157}