aboutsummaryrefslogtreecommitdiffstats
path: root/shells/zsh/Makefile
blob: 9315d8b583986995f59c1deee4542bb086cc5a0d (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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# New ports collection makefile for:    zsh
# Date created:         11 Feb. 1995
# Whom:             torstenb
#
# $FreeBSD$
#

PORTNAME=   zsh
PORTVERSION=    4.3.17
PORTREVISION=   3
CATEGORIES= shells
MASTER_SITES=   SF/${PORTNAME}/${PORTNAME}-dev/${PORTVERSION} \
        SF/${PORTNAME}/${PORTNAME}-doc-dev/${PORTVERSION}:doc
DISTFILES=  ${DISTNAME}${EXTRACT_SUFX}

MAINTAINER= bapt@FreeBSD.org
COMMENT=    The Z shell

LICENSE=    ZSH
LICENSE_NAME=   ZSH license
LICENSE_FILE=   ${WRKSRC}/LICENCE
LICENSE_PERMS=  ${_LICENSE_PERMS_DEFAULT}

MAKE_JOBS_UNSAFE=   yes

ZSH_VER=    ${PORTVERSION}

USE_BZIP2=  yes
USE_ICONV=  yes
GNU_CONFIGURE=  yes
USE_NCURSES=    yes

CPPFLAGS+=  -I${LOCALBASE}/include
LDFLAGS+=   -L${LOCALBASE}/lib
CONFIGURE_ARGS= --with-term-lib="ncursesw ncurses" --with-tcsetpgrp \
        --enable-function-subdirs

EXTRA_PATCHES=  ${FILESDIR}/extra-patch-bsdtar
#EXTRA_COMPLETION_FILES=    _sockstat
#EXTRA_COMPLETION_DIR=  Completion/BSD/Command

OPTIONS_DEFINE= GDBM MEM SECURE_FREE MAILDIR MULTIBYTE PCRE STATIC DOCS
OPTIONS_DEFAULT=    SECURE_FREE MAILDIR MULTIBYTE

GDBM_DESC=  "Enable GDBM support (GPL)"
MEM_DESC=   Enable zsh-mem options
SECURE_FREE_DESC=   Enable zsh-secure-free
MAILDIR_DESC=   "Enable support for Maildirs in MAIL(PATH)"

PLIST_SUB+= ZSH_VER="${ZSH_VER}"

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 zshcalsys.1
DOCS=       LICENCE META-FAQ README Etc/BUGS Etc/CONTRIBUTORS Etc/FAQ \
        Etc/completion-style-guide Doc/zsh*.html Doc/zsh.dvi
PORTDOCS=   *
PORTEXAMPLES=   zlogin zshenv zshrc
SHELLS=     /etc/shells

.include <bsd.port.pre.mk>

.if ${PORT_OPTIONS:MDOCS}
DISTFILES+= ${DISTNAME}-doc${EXTRACT_SUFX}:doc
.endif

.if ${PORT_OPTIONS:MGDBM}
LIB_DEPENDS+=       gdbm.4:${PORTSDIR}/databases/gdbm
PLIST_SUB+=     GDBM=""
.else
CONFIGURE_ARGS+=    --disable-gdbm
PLIST_SUB+=     GDBM="@comment "
.endif

.if ${PORT_OPTIONS:MPCRE}
CONFIGURE_ARGS+=    --enable-pcre
LIB_DEPENDS+=       pcre.1:${PORTSDIR}/devel/pcre
PLIST_SUB+=     PCRE=""
.else
CONFIGURE_ARGS+=    --disable-pcre
PLIST_SUB+=     PCRE="@comment "
.endif

.if ${PORT_OPTIONS:MMEM}
CONFIGURE_ARGS+=    --enable-zsh-mem
.endif

.if ${PORT_OPTIONS:MSECURE_FREE}
CONFIGURE_ARGS+=    --enable-zsh-secure-free
.endif

.if ${PORT_OPTIONS:MMAILDIR}
CONFIGURE_ARGS+=    --enable-maildir-support
.endif

.if ${PORT_OPTIONS:MSTATIC}
LDFLAGS+=   -static
CONFIGURE_ARGS+=    --disable-dynamic
PLIST_SUB+=     SHARED="@comment "
.else
CONFIGURE_ARGS+=    --enable-dynamic
PLIST_SUB+=     SHARED=""
.endif

.if ${PORT_OPTIONS:MDEBUG}
CONFIGURE_ARGS+=    --enable-zsh-debug
.else
CONFIGURE_ARGS+=    --disable-zsh-debug
.endif

.if ${PORT_OPTIONS:MMULTIBYTE}
CONFIGURE_ARGS+=    --enable-multibyte
.else
CONFIGURE_ARGS+=    --disable-multibyte
.endif

post-patch:
    @${REINPLACE_CMD} -e '/LIBS/s/-lrt//' ${WRKSRC}/configure
    @${SED} -i "" -e "s,link=dynamic,link=either," \
        ${WRKSRC}/Src/Modules/*.mdd
    @${SED} -i "" -e "s,/etc/,${LOCALBASE}/etc/," \
        ${WRKSRC}/Functions/MIME/zsh-mime-setup
.ifdef EXTRA_COMPLETION_FILES
    @${ECHO} "===>  Installing extra completion files"
.for COMPFILE in ${EXTRA_COMPLETION_FILES}
    @(if [ -f ${WRKSRC}/${EXTRA_COMPLETION_DIR}/${COMPFILE} ] ; then \
        ${ECHO} "${EXTRA_COMPLETION_DIR}/${COMPFILE} already exists" ; \
        exit 1 ; \
    else \
        ${ECHO} ${EXTRA_COMPLETION_DIR}/${COMPFILE} ; \
        ${CP} ${FILESDIR}/${COMPFILE} \
            ${WRKSRC}/${EXTRA_COMPLETION_DIR}/${COMPFILE} ; \
    fi)
.endfor
.endif
    @${FIND} ${WRKSRC}/Completion -type f -iname '*.orig' -delete

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 ${PORT_OPTIONS:MDOCS}
    @${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}
.if !defined(NOPORTEXAMPLES)
    @${MKDIR} ${EXAMPLESDIR}
    cd ${WRKSRC}/StartupFiles && ${INSTALL_DATA} ${PORTEXAMPLES} ${EXAMPLESDIR}
.endif
.if ${PORT_OPTIONS:MDOCS}
    @${MKDIR} ${DOCSDIR}
    cd ${WRKSRC} && ${INSTALL_DATA} ${DOCS} ${DOCSDIR}
    ${INSTALL_DATA} ${WRKSRC}/Doc/zsh.info ${PREFIX}/info/zsh.info
.endif
    @${ECHO_MSG} "Updating ${SHELLS}"
    @${GREP} -v ${PREFIX}/bin/r?zsh ${SHELLS}    > ${SHELLS}.new
    @${ECHO_CMD} ${PREFIX}/bin/zsh          >> ${SHELLS}.new
    @${ECHO_CMD} ${PREFIX}/bin/rzsh         >> ${SHELLS}.new
    @${MV} ${SHELLS}.new ${SHELLS}
    @${PREFIX}/bin/zsh -fc ' \
        setopt extendedglob nomark_dirs; \
        for i in ${DATADIR}/${ZSH_VER}/functions/**/*(/) ; do \
            zcompile -U -M $$i.zwc $$i/*~*.zwc(^/) ; \
            ${CHMOD} 644 $$i.zwc ; \
        done'

.include <bsd.port.post.mk>