aboutsummaryrefslogtreecommitdiffstats
path: root/shells/zsh/Makefile
blob: 64e0334930cee0a7ee026bdb80c049a15948f609 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# New ports collection makefile for:    zsh
# Date created:         11 Feb. 1995
# Whom:             torstenb
#
# $FreeBSD$
#

# The following compile-time options are available:
# NOSHARED=yes      compile a static version of zsh
#           (default: use dynamically loadable modules)
# WITHOUT_ZSH_MEM=yes   disable zsh-mem and zsh-secure-free options
#           (default: on)
# WITHOUT_ZSH_MAILDIR=yes disable support for Maildirs in MAIL and MAILPATH
#           (default: on)
# WITHOUT_ZSH_MULTIBYTE=yes disable multibyte character support 
#           (default: on)
# ZSH_ETCDIR=<dir>  directory for zsh system-wide configuration files:
#           zshenv, zlogin, zprofile, zshrc, zlogout.
#           e.g. use this to put config files inside ${PREFIX}
#           (default: /etc)
#           NOTE: does NOT have to be inside ${PREFIX} tree
# ZSH_FNDIR=<dir>   directory for zsh functions (part of distribution)
#           (default: ${PREFIX}/share/zsh/${ZSH_VER}/functions)
#           NOTE: should be inside ${PREFIX} tree
# ZSH_SITEFNDIR=<dir>   directory for zsh site functions (locally developed)
#           (default: ${PREFIX}/share/zsh/site-functions)
#           NOTE: does NOT have to be inside ${PREFIX} tree

PORTNAME=   zsh
PORTVERSION=    4.3.2
CATEGORIES= shells
MASTER_SITES=   \
        http://archive.progeny.com/zsh/ \
        ftp://archive.progeny.com/zsh/ \
        http://www.zsh.org/pub/ \
        ftp://ftp.zsh.org/pub/ \
        ftp://sunsite.dk/pub/unix/shells/zsh/ \
        http://mirrors.dotsrc.org/zsh/ \
        ftp://mirrors.dotsrc.org/zsh/ \
        ftp://ftp.funet.fi/pub/unix/shells/zsh/ \
        ftp://nephtys.lip6.fr/pub/unix/shells/zsh/ \
        ftp://ftp.fu-berlin.de/pub/unix/shells/zsh/ \
        http://www.cs.elte.hu/pub/zsh/ \
        ftp://ftp.cs.elte.hu/pub/zsh/ \
        ftp://ftp.kfki.hu/pub/packages/zsh/ \
        ftp://ftp.math.technion.ac.il/pub/zsh/ \
        ftp://ftp.demon.nl/pub/mirrors/zsh/ \
        ftp://ftp.kappa.ro/pub/mirrors/ftp.zsh.org/pub/zsh/ \
        ftp://ftp.lysator.liu.se/pub/unix/zsh/ \
        ftp://sunsite.org.uk/package/zsh/ \
        http://zsh.open-mirror.com/
DISTNAME=   ${PORTNAME}-${ZSH_VER}
.if !defined(NOPORTDOCS)
DISTFILES=  ${DISTNAME}${EXTRACT_SUFX} ${DISTNAME}-doc${EXTRACT_SUFX}
.endif

MAINTAINER?=    sergei@FreeBSD.org
COMMENT?=   The Z shell

ZSH_VER=    ${PORTVERSION}
# Conflicts with shells/zsh-devel as it installs files into the same locations
CONFLICTS=  zsh-devel-[0-9]* zsh-4.1.*

USE_BZIP2=  yes
GNU_CONFIGURE=  yes

CONFIGURE_TARGET=   --build=${MACHINE_ARCH}-portbld-freebsd${OSREL}
CONFIGURE_ARGS= --with-curses-terminfo --with-tcsetpgrp \
        --enable-etcdir=${ZSH_ETCDIR} \
        --enable-fndir=${ZSH_FNDIR} --enable-function-subdirs \
        --enable-site-fndir=${ZSH_SITEFNDIR}

.if !defined(WITHOUT_ZSH_MEM)
CONFIGURE_ARGS+=    --enable-zsh-mem --enable-zsh-secure-free
.endif

.if !defined(WITHOUT_ZSH_MAILDIR)
CONFIGURE_ARGS+=    --enable-maildir-support
.endif

.if defined(NOSHARED)
CONFIGURE_ENV=      LDFLAGS="${LDFLAGS} -static"
CONFIGURE_ARGS+=    --disable-dynamic
PLIST_SUB+=     NO_STATIC="@comment "
.else
CONFIGURE_ARGS+=    --enable-dynamic
PLIST_SUB+=     NO_STATIC=""
.endif

# These variables can be overriden by user
ZSH_ETCDIR?=    /etc
ZSH_FNDIR?= ${DATADIR}/${ZSH_VER}/functions
ZSH_SITEFNDIR?= ${DATADIR}/site-functions

PLIST_SUB+= ZSH_VER="${ZSH_VER}" ZSHETCDIR="${ZSH_ETCDIR}" \
        ZSH_FNDIR="${ZSH_FNDIR:S!${PREFIX}/!!}" \
        ZSH_SITEFNDIR="${ZSH_SITEFNDIR}"

MAN1=       zsh.1 zshbuiltins.1 zshcompctl.1 zshcompwid.1 zshcompsys.1 \
        zshcontrib.1 zshexpn.1 zshmisc.1 zshmodules.1 zshoptions.1 \
        zshparam.1 zshroadmap.1 zshtcpsys.1 zshzftpsys.1 zshzle.1 \
        zshall.1
DOCS=       LICENCE META-FAQ README Etc/BUGS Etc/CONTRIBUTORS Etc/FAQ \
        Etc/completion-style-guide Doc/zsh*.html Doc/zsh.dvi
EXAMPLES=   zlogin zshenv zshrc

.include <bsd.port.pre.mk>

.if ${OSVERSION} >= 500000 && !defined(WITHOUT_ZSH_MULTIBYTE)
CONFIGURE_ARGS+=    --enable-multibyte
.endif

.if ${OSVERSION} >= 503000
EXTRA_PATCHES=  ${FILESDIR}/extra-patch-bsdtar
.endif

post-patch:
    ${REINPLACE_CMD} -e "s,link=dynamic,link=either," \
        ${WRKSRC}/Src/Modules/*.mdd
    ${REINPLACE_CMD} -e "s,/etc/,${LOCALBASE}/etc/," \
        ${WRKSRC}/Functions/MIME/zsh-mime-setup
    ${RM} -f ${WRKSRC}/Functions/MIME/zsh-mime-setup.bak
.if ${OSVERSION} >= 503000
    ${RM} -f ${WRKSRC}/Completion/Unix/Type/_tar_archive.orig
.endif

post-build:
    # Fix ".so" macro problem by using "soelim" command.
    ${LN} -sf ${WRKSRC}/Doc ${WRKSRC}/man1
    ${MV} ${WRKSRC}/Doc/zshall.1 ${WRKSRC}/Doc/zshall.1.source
    cd ${WRKSRC} && /usr/bin/soelim ${WRKSRC}/Doc/zshall.1.source > \
        ${WRKSRC}/Doc/zshall.1
.if !defined(NOPORTDOCS)
    @${MKDIR} ${PREFIX}/info
    makeinfo --no-split --output=${WRKSRC}/Doc/zsh.info \
        ${WRKSRC}/Doc/zsh.texi

INFO=   zsh
.endif

post-install:
    ${LN} ${PREFIX}/bin/zsh ${PREFIX}/bin/rzsh
    ${TEST} -d ${ZSH_ETCDIR} || ${MKDIR} ${ZSH_ETCDIR}
    ${TEST} -d ${ZSH_SITEFNDIR} || ${MKDIR} ${ZSH_SITEFNDIR}
    @${MKDIR} ${EXAMPLESDIR}
    cd ${WRKSRC}/StartupFiles && ${INSTALL_DATA} ${EXAMPLES} ${EXAMPLESDIR}
.if !defined(NOPORTDOCS)
    @${MKDIR} ${DOCSDIR}
    cd ${WRKSRC} && ${INSTALL_DATA} ${DOCS} ${DOCSDIR}
    ${INSTALL_DATA} ${WRKSRC}/Doc/zsh.info ${PREFIX}/info/zsh.info
.endif
    @${ECHO_MSG} "Updating /etc/shells"
    @${CP} /etc/shells /etc/shells.bak
    @(${GREP} -v ${PREFIX}/bin/zsh /etc/shells.bak; \
      ${ECHO_CMD} ${PREFIX}/bin/zsh) > /etc/shells
    @${RM} /etc/shells.bak

.include <bsd.port.post.mk>