2019-11-04 20:05:18 +01:00
|
|
|
# $NetBSD: github.mk,v 1.13 2019/11/04 19:05:18 rillig Exp $
|
2015-03-07 15:17:51 +01:00
|
|
|
#
|
|
|
|
# github.com master site handling
|
|
|
|
#
|
|
|
|
# To use, set in Makefile:
|
|
|
|
#
|
|
|
|
# DISTNAME= exampleproject-1.2
|
2015-03-07 22:14:32 +01:00
|
|
|
# MASTER_SITES= ${MASTER_SITE_GITHUB:=accountname/}
|
2015-03-07 15:17:51 +01:00
|
|
|
#
|
2015-03-07 22:14:32 +01:00
|
|
|
# The following variables alter github.mk behavior:
|
2015-03-07 15:17:51 +01:00
|
|
|
#
|
2015-03-07 22:14:32 +01:00
|
|
|
# GITHUB_PROJECT defaults to PKGBASE
|
|
|
|
# GITHUB_TAG defaults to PKGVERSION_NOREV
|
|
|
|
# sometimes you want to override with v${PKGVERSION_NOREV}
|
|
|
|
# SHA-1 commit ids are also acceptable
|
|
|
|
# GITHUB_RELEASE defaults to not defined, set this to ${DISTNAME}
|
|
|
|
# when packaging a release not based on a git tag.
|
|
|
|
# GITHUB_TYPE overrides the autodetected MASTER_SITE URL scheme:
|
2015-03-07 15:17:51 +01:00
|
|
|
#
|
|
|
|
# "tag"
|
2015-03-07 22:14:32 +01:00
|
|
|
# This is the default when GITHUB_RELEASE is not defined. Example URL:
|
|
|
|
# http://github.com/acct/${GITHUB_PROJECT}/archive/{GITHUB_TAG}.tar.gz
|
2015-03-07 15:17:51 +01:00
|
|
|
#
|
|
|
|
# "release"
|
2015-03-07 22:14:32 +01:00
|
|
|
# This is the default when GITHUB_RELEASE is set. Example URL:
|
|
|
|
# http://github.com/acct/${GITHUB_PROJECT}/releases/download/${GITHUB_RELEASE}/${DISTNAME}.tar.gz
|
2015-03-07 16:31:52 +01:00
|
|
|
#
|
|
|
|
# Keywords: github
|
2015-03-07 15:17:51 +01:00
|
|
|
|
2015-03-12 22:00:01 +01:00
|
|
|
.if defined(MASTER_SITES) && !empty(MASTER_SITES:C,^https\://github.com/[-a-zA-Z0-9]*/$,match,:Mmatch)
|
2015-03-07 22:14:32 +01:00
|
|
|
_USE_GITHUB= YES
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if (defined(GITHUB_TAG) || defined(GITHUB_RELEASE)) && !defined(_USE_GITHUB)
|
|
|
|
PKG_FAIL_REASON+= "MASTER_SITES must match https://github.com/account/" \
|
|
|
|
"when GITHUB_TAG or GITHUB_RELEASE is in use." \
|
|
|
|
"For more information: make help topic=github"
|
|
|
|
.endif
|
2015-03-07 15:17:51 +01:00
|
|
|
|
2015-03-07 22:14:32 +01:00
|
|
|
.if defined(_USE_GITHUB) && !empty(_USE_GITHUB:M[yY][eE][sS])
|
2015-03-07 15:17:51 +01:00
|
|
|
|
2015-03-07 22:14:32 +01:00
|
|
|
GITHUB_PROJECT?= ${PKGBASE}
|
|
|
|
GITHUB_TAG?= ${PKGVERSION_NOREV}
|
2015-03-07 15:17:51 +01:00
|
|
|
|
2015-03-07 22:14:32 +01:00
|
|
|
. if !empty(GITHUB_TAG:Mmaster)
|
|
|
|
PKG_FAIL_REASON+= "master is not a valid tag name, use an explicit commit hash"
|
2015-03-07 15:17:51 +01:00
|
|
|
. endif
|
|
|
|
|
2015-03-07 22:14:32 +01:00
|
|
|
. if !defined(GITHUB_TYPE)
|
|
|
|
. if defined(GITHUB_RELEASE) && !empty(GITHUB_RELEASE)
|
|
|
|
GITHUB_TYPE= release
|
|
|
|
. else
|
|
|
|
GITHUB_TYPE= tag
|
2015-03-07 15:17:51 +01:00
|
|
|
. endif
|
|
|
|
. endif
|
|
|
|
|
2015-10-19 16:24:26 +02:00
|
|
|
. if !empty(GITHUB_TYPE:Mtag) && !empty(GITHUB_TAG:M[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]*)
|
2015-03-09 16:50:18 +01:00
|
|
|
# If the github tag is a git hash (7 or more hex digits), encode it in the
|
|
|
|
# distfile name.
|
|
|
|
_GITHUB_DEFAULT_DISTFILES= ${DISTNAME}-${GITHUB_TAG}${EXTRACT_SUFX}
|
|
|
|
. else
|
|
|
|
_GITHUB_DEFAULT_DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
|
|
|
|
. endif
|
|
|
|
|
2015-03-07 22:14:32 +01:00
|
|
|
. if !empty(GITHUB_TYPE:Mrelease)
|
2015-03-09 16:50:18 +01:00
|
|
|
SITES.${_GITHUB_DEFAULT_DISTFILES}= ${MASTER_SITES:=${GITHUB_PROJECT}/releases/download/${GITHUB_RELEASE}/}
|
2015-03-07 22:14:32 +01:00
|
|
|
. endif
|
2015-03-07 15:17:51 +01:00
|
|
|
|
2015-03-07 22:14:32 +01:00
|
|
|
. if !empty(GITHUB_TYPE:Mtag)
|
2015-03-09 16:50:18 +01:00
|
|
|
SITES.${_GITHUB_DEFAULT_DISTFILES}= -${MASTER_SITES:=${GITHUB_PROJECT}/archive/${GITHUB_TAG}${EXTRACT_SUFX}}
|
2015-03-07 22:14:32 +01:00
|
|
|
. endif
|
2015-03-07 15:17:51 +01:00
|
|
|
|
|
|
|
.endif
|
2018-04-08 22:39:47 +02:00
|
|
|
|
|
|
|
_VARGROUPS+= github
|
2019-11-04 20:05:18 +01:00
|
|
|
_PKG_VARS.github= GITHUB_PROJECT DISTNAME GITHUB_TYPE GITHUB_TAG \
|
|
|
|
GITHUB_RELEASE MASTER_SITES EXTRACT_SUFX
|
|
|
|
_DEF_VARS.github= _USE_GITHUB _GITHUB_DEFAULT_DISTFILES \
|
|
|
|
SITES.${_GITHUB_DEFAULT_DISTFILES}
|
2018-08-01 20:01:32 +02:00
|
|
|
_USE_VARS.github= PKGBASE PKGVERSION_NOREV
|
2018-11-30 19:38:19 +01:00
|
|
|
_LISTED_VARS.github= SITES.*
|