Annotation of pkgsrc/mk/fetch/github.mk, revision 1.8
1.8 ! tnn 1: # $NetBSD: github.mk,v 1.7 2015/03/09 15:50:18 tnn Exp $
1.1 tnn 2: #
3: # github.com master site handling
4: #
5: # To use, set in Makefile:
6: #
7: # DISTNAME= exampleproject-1.2
1.5 tnn 8: # MASTER_SITES= ${MASTER_SITE_GITHUB:=accountname/}
1.1 tnn 9: #
1.5 tnn 10: # The following variables alter github.mk behavior:
1.1 tnn 11: #
1.5 tnn 12: # GITHUB_PROJECT defaults to PKGBASE
13: # GITHUB_TAG defaults to PKGVERSION_NOREV
14: # sometimes you want to override with v${PKGVERSION_NOREV}
15: # SHA-1 commit ids are also acceptable
16: # GITHUB_RELEASE defaults to not defined, set this to ${DISTNAME}
17: # when packaging a release not based on a git tag.
18: # GITHUB_TYPE overrides the autodetected MASTER_SITE URL scheme:
1.1 tnn 19: #
20: # "tag"
1.5 tnn 21: # This is the default when GITHUB_RELEASE is not defined. Example URL:
22: # http://github.com/acct/${GITHUB_PROJECT}/archive/{GITHUB_TAG}.tar.gz
1.1 tnn 23: #
24: # "release"
1.5 tnn 25: # This is the default when GITHUB_RELEASE is set. Example URL:
26: # http://github.com/acct/${GITHUB_PROJECT}/releases/download/${GITHUB_RELEASE}/${DISTNAME}.tar.gz
1.2 tnn 27: #
28: # Keywords: github
1.1 tnn 29:
1.8 ! tnn 30: .if defined(MASTER_SITES) && !empty(MASTER_SITES:C,^https\://github.com/[-a-zA-Z0-9]*/$,match,:Mmatch)
1.5 tnn 31: _USE_GITHUB= YES
32: .endif
33:
34: .if (defined(GITHUB_TAG) || defined(GITHUB_RELEASE)) && !defined(_USE_GITHUB)
35: PKG_FAIL_REASON+= "MASTER_SITES must match https://github.com/account/" \
36: "when GITHUB_TAG or GITHUB_RELEASE is in use." \
37: "For more information: make help topic=github"
38: .endif
1.1 tnn 39:
1.5 tnn 40: .if defined(_USE_GITHUB) && !empty(_USE_GITHUB:M[yY][eE][sS])
1.1 tnn 41:
1.5 tnn 42: GITHUB_PROJECT?= ${PKGBASE}
43: GITHUB_TAG?= ${PKGVERSION_NOREV}
1.1 tnn 44:
1.5 tnn 45: . if !empty(GITHUB_TAG:Mmaster)
46: PKG_FAIL_REASON+= "master is not a valid tag name, use an explicit commit hash"
1.1 tnn 47: . endif
48:
1.5 tnn 49: . if !defined(GITHUB_TYPE)
50: . if defined(GITHUB_RELEASE) && !empty(GITHUB_RELEASE)
51: GITHUB_TYPE= release
52: . else
53: GITHUB_TYPE= tag
1.1 tnn 54: . endif
55: . endif
56:
1.7 tnn 57: . if defined(GITHUB_TAG) && !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]*)
58: # If the github tag is a git hash (7 or more hex digits), encode it in the
59: # distfile name.
60: _GITHUB_DEFAULT_DISTFILES= ${DISTNAME}-${GITHUB_TAG}${EXTRACT_SUFX}
61: . else
62: _GITHUB_DEFAULT_DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
63: . endif
64:
1.5 tnn 65: . if !empty(GITHUB_TYPE:Mrelease)
1.7 tnn 66: SITES.${_GITHUB_DEFAULT_DISTFILES}= ${MASTER_SITES:=${GITHUB_PROJECT}/releases/download/${GITHUB_RELEASE}/}
1.5 tnn 67: . endif
1.1 tnn 68:
1.5 tnn 69: . if !empty(GITHUB_TYPE:Mtag)
1.7 tnn 70: SITES.${_GITHUB_DEFAULT_DISTFILES}= -${MASTER_SITES:=${GITHUB_PROJECT}/archive/${GITHUB_TAG}${EXTRACT_SUFX}}
1.5 tnn 71: . endif
1.1 tnn 72:
73: .endif
CVSweb <webmaster@jp.NetBSD.org>