1# Make sure that your configuration DOES NOT set ANY gcc-related
2# variables.  ksh93 will not compile if you set even the seemingly
3# most unrelated variable related to gcc configuration.  This means
4# especially any flag which attempts to set the cputype.  Setting the
5# cputype does absolutely nothing except cause systems to fail in
6# horrible ways.  For any modern processor, setting the cputype only
7# serves to expose gcc bugs and does nothing to speed up any known
8# program.  If you are really unconvinced, go ahead but do not
9# complain to me about it.
10
11PORTNAME=	ksh93
12PORTVERSION=	${AST_COMMIT_DATE}
13CATEGORIES=	shells
14PKGNAMESUFFIX=	-devel
15DIST_SUBDIR=	ksh93
16
17MAINTAINER=	ports@MidnightBSD.org
18COMMENT=	Development branch of AT&T KornShell 93
19
20LICENSE=	epl
21
22BROKEN_aarch64=		Fails to link: missing sbrk
23BROKEN_riscv64=		Fails to link: missing sbrk
24
25HASH=		cc1bca27
26AST_COMMIT_DATE=	2020.06.30
27
28USES=		compiler:c11
29
30USE_GITHUB=	yes
31GH_ACCOUNT=	att
32GH_PROJECT=	ast
33GH_TAGNAME=	${HASH}
34
35# IMPORTANT:	Disabling conflicts, i.e. -DDISABLE_CONFLICTS will result in
36#		arcane build failures due to already installed ksh/ksh93 in
37#		$PATH.
38KSH_CONFLICTS=		pdksh-*
39KSH93_CONFLICTS=	ksh93-2* ast-ksh-*
40
41OPTIONS_DEFAULT=	KSH93 EXAMPLES
42OPTIONS_DEFINE=		EXAMPLES STATIC
43OPTIONS_SINGLE=		BIN_KSH
44OPTIONS_SINGLE_BIN_KSH=	KSH KSH93
45KSH_DESC=		Install to ${PREFIX}/bin/ksh
46KSH93_DESC=		Install to ${PREFIX}/bin/ksh93
47
48CFLAGS+=	-DMAP_TYPE
49LDFLAGS+=	-lm
50MAKE_ENV=	CCFLAGS="-Wno-unused-value -Wno-parentheses -Wno-logical-op-parentheses" CFLAGS="${CFLAGS}"
51
52STATIC_MAKE_ENV=	LDFLAGS+=-static
53
54KSH_PLIST_SUB=		93=""
55KSH93_PLIST_SUB=	93="93"
56
57NO_TEST=	yes
58
59.include <bsd.mport.options.mk>
60
61.if ${PORT_OPTIONS:MKSH93}
62PNAME=		ksh93
63.else
64PNAME=		ksh
65.endif
66
67post-patch:
68	@${REINPLACE_CMD} -e 's|SF_FLAGS|SFIO_FLAGS|g' ${WRKSRC}/src/lib/libast/include/sfio*.h ${WRKSRC}/src/lib/libast/sfio/*.c
69
70do-build:
71	@cd ${WRKSRC}/ && ${SETENV} -i ${MAKE_ENV} ${SH} bin/package flat make ksh93
72
73do-install:
74	${INSTALL_PROGRAM} ${WRKSRC}/bin/ksh ${PREFIX}/bin/${PNAME}
75	${INSTALL_MAN} ${WRKSRC}/man/man1/sh.1 ${PREFIX}/share/man/man1/${PNAME}.1
76	${MKDIR} ${EXAMPLESDIR}/
77	cd ${WRKSRC}/fun/ && ${INSTALL_SCRIPT} dirs popd pushd ${EXAMPLESDIR}/
78
79.include <bsd.port.mk>
80