PORTNAME=	scala
DISTVERSION=	3.3.7
PORTREVISION=	1
CATEGORIES=	lang java
MASTER_SITES=	https://github.com/scala/scala3/releases/download/${DISTVERSION}/
DISTNAME=	scala3-${DISTVERSION}

MAINTAINER=	freebsd-ports@jan0sch.de
COMMENT=	Scala Programming Language
WWW=		https://www.scala-lang.org/

LICENSE=	APACHE20

RUN_DEPENDS=	bash:shells/bash

USES=		cpe java
CPE_VENDOR=	${PORTNAME}-lang

NO_ARCH=	yes
NO_BUILD=	yes

SCALA_HOME=	${DATADIR}
SCALA_SHRDIRS=	lib
SCALA_BINS=	common scala scalac scaladoc

PLIST_FILES=	${SCALA_BINS:S,^,bin/,}

PORTDATA=	*

pre-patch:
	@${ECHO_MSG} "Installation settings:"
	@${ECHO_MSG} "   SCALA_HOME:    ${SCALA_HOME}"

do-install:
	@${MKDIR} ${STAGEDIR}${SCALA_HOME}/bin
	${INSTALL_SCRIPT} ${SCALA_BINS:S,^,${WRKSRC}/bin/,} \
		${STAGEDIR}${SCALA_HOME}/bin
	${RLN} ${SCALA_BINS:S,^,${STAGEDIR}${SCALA_HOME}/bin/,} \
		${STAGEDIR}${PREFIX}/bin
.for d in ${SCALA_SHRDIRS}
	(cd ${WRKSRC}/${d} && ${COPYTREE_SHARE} . ${STAGEDIR}${SCALA_HOME}/${d})
.endfor

.include <bsd.port.mk>
