pkgsrc/math/R/Makefile.extension
brook 145a1ef204 Conditionally define WRKSRC.
Conditionally define WRKSRC so that R packages with an unusual organization
can override the default.
2020-07-31 17:04:12 +00:00

79 lines
2.4 KiB
Text

# $NetBSD: Makefile.extension,v 1.27 2020/07/31 17:04:12 brook Exp $
#
# This Makefile fragment is included by packages for R library packages.
#
# To use this Makefile fragment, simply:
#
# (1) define R_PKGNAME and R_PKGVER to the R package name and version
# for the package desired.
# (2) Include this Makefile fragment in the package Makefile
_VARGROUPS+= R
_PKG_VARS.R= R_PKGNAME R_PKGVER R_INST_DIRS
_USE_VARS.R= DISTNAME
_DEF_VARS.R= PKGNAME DIST_SUBDIR CATEGORIES HOMEPAGE \
INSTALL_TEMPLATES DEINSTALL_TEMPLATES
_IGN_VARS.R= INSTALLATION_DIRS MAKE_ENV INSTALL_ENV MASTER_SITES \
MASTER_SITE_R_CRAN WRKDIR R_LIB DESTDIR PREFIX WRKSRC \
R_PKG_INSTALL_ARGS R_HOMEPAGE_BASE CONFIGURE_ARGS \
GENERATE_PLIST OPSYS CHECK_FILES_SKIP
.if defined(DISTNAME)
R_PKGNAME?= ${DISTNAME:C/_.*//}
R_PKGVER?= ${DISTNAME:C/.*_//}
.else
DISTNAME?= ${R_PKGNAME}_${R_PKGVER}
.endif
PKGNAME?= R-${R_PKGNAME}-${R_PKGVER:S/-/./}
MASTER_SITES?= ${MASTER_SITE_R_CRAN:=contrib/} \
${MASTER_SITE_R_CRAN:=contrib/Archive/${R_PKGNAME}/}
DIST_SUBDIR?= R
CATEGORIES+= math R
HOMEPAGE?= https://CRAN.R-project.org/package=${R_PKGNAME}
WRKSRC?= ${WRKDIR}/${R_PKGNAME}
INSTALLATION_DIRS= ${R_LIB}
INSTALL_ENV+= R_LIBS=
do-build:
do-test:
${RUN} cd ${WRKDIR} && ${PKGSRC_SETENV} ${MAKE_ENV} ${TEST_ENV} \
${PREFIX}/bin/R CMD check ${R_PKGNAME}
do-install:
${RUN} ${PKGSRC_SETENV} ${INSTALL_ENV} ${MAKE_ENV} \
${PREFIX}/bin/R CMD INSTALL ${R_PKG_INSTALL_ARGS} ${WRKSRC}
.include "../../mk/bsd.fast.prefs.mk"
.if ${OPSYS} == "Darwin"
.PHONY: fix-darwin-install-name
post-install: fix-darwin-install-name
fix-darwin-install-name:
${FIND} ${DESTDIR}${PREFIX} -name "*.so" | while read lib; do \
libname=`basename $${lib}`; \
libdir=`dirname $${lib} | sed -e 's,${DESTDIR},,'`; \
install_name_tool -id $${libdir}/$${libname} $${lib}; \
done
.endif
R_LIB= lib/R/library
R_INST_DIRS?= ${R_PKGNAME}
R_HOMEPAGE_BASE= http://cran.r-project.org/web/packages
R_PKG_INSTALL_ARGS= -l ${DESTDIR}${PREFIX}/${R_LIB}
.if defined(CONFIGURE_ARGS)
R_PKG_INSTALL_ARGS+= --configure-args='${CONFIGURE_ARGS}'
.endif
GENERATE_PLIST+= ( cd ${DESTDIR}${PREFIX}; for dir in ${R_INST_DIRS}; do \
${FIND} ${R_LIB}/$${dir} \( -type f -o -type l \) -print; done ) | ${SORT} -u;
INSTALL_TEMPLATES+= ../../math/R/files/pkg-index.tmpl
DEINSTALL_TEMPLATES+= ../../math/R/files/pkg-index.tmpl
CHECK_FILES_SKIP+= ${PREFIX}/${R_LIB}/R.css
.include "../../math/R/buildlink3.mk"