summaryrefslogtreecommitdiff
path: root/mk/bsd.pkg.mk
diff options
context:
space:
mode:
authortnn <tnn@pkgsrc.org>2015-03-07 14:17:51 +0000
committertnn <tnn@pkgsrc.org>2015-03-07 14:17:51 +0000
commit6370898cba24215be2489e33c04c45c7d10c624c (patch)
treee48a0c7459988ce75818375808c9e213e55a77b5 /mk/bsd.pkg.mk
parent18291a436d9933cf32026c4c23385a98b57ab5df (diff)
downloadpkgsrc-6370898cba24215be2489e33c04c45c7d10c624c.tar.gz
Adopt USE_GITHUB from FreeBSD ports to make github MASTER_SITE
handling less painful. See: https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/makefile-distfiles.html#makefile-master_sites-github To use, set in Makefile: DISTNAME= exampleproject-1.2 USE_GITHUB= YES The following variables alter USE_GITHUB behavior: GH_ACCOUNT defaults to PKGBASE GH_PROJECT defaults to PKGBASE GH_TAGNAME defaults to PKGVERSION_NOREV (sometimes you want to override with v${PKGVERSION_NOREV}) GH_COMMIT explicit commit hash if no tag is available GH_RELEASE default empty, may be set to ${DISTNAME} for example GH_TYPE overrides the autodetected MASTER_SITE URL scheme
Diffstat (limited to 'mk/bsd.pkg.mk')
-rw-r--r--mk/bsd.pkg.mk10
1 files changed, 9 insertions, 1 deletions
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk
index 5603a63d66e..5f38185fa51 100644
--- a/mk/bsd.pkg.mk
+++ b/mk/bsd.pkg.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.mk,v 1.2009 2015/01/01 07:51:47 dholland Exp $
+# $NetBSD: bsd.pkg.mk,v 1.2010 2015/03/07 14:17:51 tnn Exp $
#
# This file is in the public domain.
#
@@ -96,7 +96,15 @@ MAINTAINER?= pkgsrc-users@NetBSD.org
.endif
PKGWILDCARD?= ${PKGBASE}-[0-9]*
TOOL_DEPENDS?= # empty
+.if defined(USE_GITHUB) && !empty(USE_GITHUB:M[yY][eE][sS]) && \
+ defined(GH_COMMIT) && !empty(GH_COMMIT)
+WRKSRC?= ${WRKDIR}/${GH_PROJECT}-${GH_COMMIT}
+.elif defined(USE_GITHUB) && !empty(USE_GITHUB:M[yY][eE][sS]) && \
+ defined(GH_TAGNAME) && !empty(GH_TAGNAME)
+WRKSRC?= ${WRKDIR}/${GH_PROJECT}-${GH_TAGNAME:C/^v//}
+.else
WRKSRC?= ${WRKDIR}/${DISTNAME:U${PKGNAME_NOREV}}
+.endif
# Override for SU_CMD user check
_IS_ROOT_CMD?= ${TEST} `${ID} -u` = `${ID} -u ${_SU_ROOT_USER}`