summaryrefslogtreecommitdiff
path: root/shells/zsh/Makefile.common
blob: 91f48d1631b29d522ea1b89abdfa26a95885b5e4 (plain)
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
# $NetBSD: Makefile.common,v 1.61 2011/07/30 11:42:42 ryoon Exp $
# used by shells/zsh/Makefile
# used by shells/zsh-current/Makefile

DISTNAME=	zsh-${ZSH_VERSION}
CATEGORIES=	shells
MASTER_SITES=	ftp://mirrors.dotsrc.org/zsh/ \
		ftp://ftp.fu-berlin.de/pub/unix/shells/zsh/ \
		http://www.math.technion.ac.il/pub/zsh/ \
		ftp://ftp.zsh.org/zsh/
EXTRACT_SUFX=	.tar.bz2

MAINTAINER=	${ZSH_MAINTAINER}
HOMEPAGE=	http://zsh.sourceforge.net/
COMMENT=	The Z shell

PKG_DESTDIR_SUPPORT=	user-destdir

GNU_CONFIGURE=		yes

CONFIGURE_ARGS+=	--enable-etcdir=${PKG_SYSCONFDIR:Q}

USE_TOOLS+=		makeinfo
INFO_FILES=		# PLIST
TEXINFO_REQD=		4.0

PKG_INSTALLATION_TYPES=	overwrite pkgviews

.include "../../mk/bsd.prefs.mk"

# Handle any PKG_OPTIONS that this package might have.
.sinclude "options.mk"

BUILD_DEFS+=	ZSH_STATIC
MAKE_JOBS_SAFE=	no
INSTALL_TARGET=	install install.info
PKG_SHELL=	bin/zsh
PLIST_VARS=	dynamic terminfo curses

################################################################################

_ZSH_OPSYS.OpenBSD=		ldflags tcsetpgrp
_ZSH_OPSYS.Linux=		ldflags tcsetpgrp
_ZSH_OPSYS.IRIX=		ldflags tcsetpgrp
_ZSH_OPSYS.Interix=		ldflags notcsetpgrp
_ZSH_OPSYS.DragonFly=		ldflags tcsetpgrp
_ZSH_OPSYS.FreeBSD=		ldflags tcsetpgrp
_ZSH_OPSYS.SunOS=		-       tcsetpgrp

_ZSH_OPSYS.${OPSYS}?=		ldflags tcsetpgrp

################################################################################

### static

_ZSH_LINKAGE.static.CONFIGURE_ARGS=	--disable-dynamic
_ZSH_LINKAGE.static.BUILDLINK_PASSTHRU_RPATHDIRS?=
_ZSH_LINKAGE.static.LDFLAGS?=		-static

### dynamic

_ZSH_DYNAMIC_VARS.ldflags=	${COMPILER_RPATH_FLAG}${PREFIX}/lib/zsh

_ZSH_LINKAGE.dynamic.CONFIGURE_ARGS=
_ZSH_LINKAGE.dynamic.BUILDLINK_PASSTHRU_RPATHDIRS=
# XXXUEBAYASI old make(1) has problems to handle :?true_str:false_str
#_ZSH_LINKAGE.dynamic.LDFLAGS= \
#	${_ZSH_OPSYS.${OPSYS}:Mldflags:?${_ZSH_DYNAMIC_VARS.ldflags}:}
.if !empty(_ZSH_OPSYS.${OPSYS}:Mldflags)
_ZSH_LINKAGE.dynamic.LDFLAGS=	${_ZSH_DYNAMIC_VARS.ldflags}
.endif

### tcsetpgrp

_ZSH_OPSYS_VARS.tcsetpgrp=	--with-tcsetpgrp
_ZSH_OPSYS_VARS.notcsetpgrp=	--without-tcsetpgrp

### terminfo
CHECK_BUILTIN.terminfo=	yes
.include "../../mk/terminfo.builtin.mk"
.if !empty(USE_BUILTIN.terminfo:M[Yy][Ee][Ss])
PLIST.terminfo=	yes
.endif

### curses
.if empty(MACHINE_PLATFORM:MNetBSD-[0-9]*)
CHECK_BUILTIN.curses=	yes
.include "../../mk/curses.builtin.mk"
.if !empty(USE_BUILTIN.curses:M[Yy][Ee][Ss])
PLIST.curses=	yes
.endif
.endif

################################################################################

# XXXUEBAYASI old make(1) has problems to handle :?true_str:false_str
#_ZSH_LINKAGE=	${ZSH_STATIC:M[Yy][Ee][Ss]:?static:dynamic}	# static / dynamic
ZSH_STATIC?=	no
.if !empty(ZSH_STATIC:M[Yy][Ee][Ss])
_ZSH_LINKAGE=	static
.else
_ZSH_LINKAGE=	dynamic
.endif

CONFIGURE_ARGS+=		${_ZSH_LINKAGE.${_ZSH_LINKAGE}.CONFIGURE_ARGS} \
				${_ZSH_OPSYS_VARS.${_ZSH_OPSYS.${OPSYS}:Mtcsetpgrp}} \
				${_ZSH_OPSYS_VARS.${_ZSH_OPSYS.${OPSYS}:Mnotcsetpgrp}}
BUILDLINK_PASSTHRU_RPATHDIRS+=	${_ZSH_LINKAGE.${_ZSH_LINKAGE}.BUILDLINK_PASSTHRU_RPATHDIRS}
LDFLAGS+=			${_ZSH_LINKAGE.${_ZSH_LINKAGE}.LDFLAGS}
.if ${_ZSH_LINKAGE} == dynamic
PLIST.dynamic=	yes
.endif

################################################################################

.undef MANZ

pre-install:
	@cd ${WRKSRC}/Completion; ${FIND} . -name \*.orig -exec ${RM} \{\} \;

post-install:
	${INSTALL_DATA_DIR} ${DESTDIR}${PREFIX}/share/doc/zsh
	cd ${WRKSRC}/Etc && ${INSTALL_DATA} BUGS FAQ 	\
		${DESTDIR}${PREFIX}/share/doc/zsh
	cd ${WRKSRC} && ${INSTALL_DATA} FEATURES NEWS	\
		${DESTDIR}${PREFIX}/share/doc/zsh

# Utilize Zsh's test framework.
# Testing of dynamic shell only works after install has been done
#
.PHONY: do-test do-su-test real-su-test

do-test: do-su-test

do-su-test:
	@${_PKG_SILENT}${_PKG_DEBUG}					\
	${ECHO_MSG} "*** Warning: This test needs to be run as root"
	@${_PKG_SILENT}${_PKG_DEBUG}					\
	realtarget="real-su-test";					\
	action="install";						\
	${_SU_TARGET}

real-su-test:
	@${_PKG_SILENT}${_PKG_DEBUG}					\
	${ECHO_MSG} "${_PKGSRC_IN}> Testing for ${PKGNAME}"
	@cd ${WRKSRC} && ${MAKE} check
	@cd ${WRKSRC}/Test && ${MAKE} clean