# $NetBSD$
#
###########################################################
#                  Generated by fbsd2pkg                  #
#              Fri Jun  1 21:50:38 CDT 2018               #
###########################################################

DISTNAME=	singularity-${PV}
CATEGORIES=	emulators
MASTER_SITES=	${MASTER_SITE_GITHUB:=singularityware/}
GITHUB_PROJECT=	singularity
GITHUB_TAG=	${PV}

MAINTAINER=	bacon@NetBSD.org
HOMEPAGE=	https://github.com/singularityware/singularity
COMMENT=	Application container for Linux
LICENSE=	modified-bsd

DEPENDS+=	squashfs>=0:../../filesystems/squashfs

REPLACE_PYTHON=		libexec/helpers/*/*.py
REPLACE_PYTHON+=	libexec/python/*.py
REPLACE_PYTHON+=	libexec/python/*/*.py
REPLACE_PYTHON+=	libexec/python/*/*/*.py
REPLACE_BASH+=		bin/singularity.in

SUBST_CLASSES+=		path
SUBST_STAGE.path=	pre-configure
SUBST_FILES.path=	bin/singularity.in
SUBST_SED.path=		-e 's|/usr/local|${PREFIX}|g'

USE_TOOLS+=	autoconf automake autoreconf bash
USE_LIBTOOL=	yes
GNU_CONFIGURE=	yes

PV=			2.5.1
CONFIG_SHELL=		${BASH}
# CHECK_PORTABILITY_SKIP=	configure

# Requires clone()
ONLY_FOR_PLATFORM=	Linux-*-*

EGDIR=			${PREFIX}/share/examples/${PKGBASE}
PKG_SYSCONFSUBDIR=	${PKGBASE}
CONF_FILES+=		${EGDIR}/default-nsswitch.conf ${PKG_SYSCONFDIR}/default-nsswitch.conf
CONF_FILES+=		${EGDIR}/init ${PKG_SYSCONFDIR}/init
CONF_FILES+=		${EGDIR}/nvliblist.conf ${PKG_SYSCONFDIR}/nvliblist.conf
CONF_FILES+=		${EGDIR}/singularity.conf ${PKG_SYSCONFDIR}/singularity.conf

INSTALLATION_DIRS=	${EGDIR}

pre-configure:
	cd ${WRKSRC} && autoreconf -if

# FIXME: Should this be necessary?
post-install:
	${MV} ${DESTDIR}${PKG_SYSCONFDIR}/*.conf ${DESTDIR}${EGDIR}
	${MV} ${DESTDIR}${PKG_SYSCONFDIR}/init ${DESTDIR}${EGDIR}
	${CHMOD} a-w ${DESTDIR}${PREFIX}/libexec/singularity/bin/*-suid

.include "../../archivers/libarchive/buildlink3.mk"
.include "../../security/openssl/buildlink3.mk"
.include "../../lang/python/application.mk"
.include "../../mk/bsd.pkg.mk"
