Annotation of pkgsrc/mk/fetch/github.mk, revision 1.4
1.4 ! tnn 1: # $NetBSD: github.mk,v 1.3 2015/03/07 16:17:42 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
8: # USE_GITHUB= YES
9: #
10: # The following variables alter USE_GITHUB behavior:
11: #
12: # GH_ACCOUNT defaults to PKGBASE
13: # GH_PROJECT defaults to PKGBASE
14: # GH_TAGNAME defaults to PKGVERSION_NOREV
15: # (sometimes you want to override with v${PKGVERSION_NOREV})
16: # GH_COMMIT explicit commit hash if no tag is available
17: # GH_RELEASE default empty, may be set to ${DISTNAME} for example
18: # GH_TYPE overrides the autodetected MASTER_SITE URL scheme:
19: #
20: # "tag"
1.3 tnn 21: # This is the default when GH_TAGNAME is set or no type was specified. Exampe URL:
22: # http://github.com/acct/proj/archive/{GH_TAGNAME}.tar.gz
1.1 tnn 23: #
24: # "release"
25: # This is the default when GH_RELEASE is set. Example URL:
1.3 tnn 26: # http://github.com/acct/proj/releases/download/${GH_RELEASE}/${DISTNAME}.tar.gz
1.1 tnn 27: #
28: # "commit"
1.3 tnn 29: # This is the default when GH_COMMIT is set. Example URL:
30: # http://github.com/acct/proj/archive/${GH_COMMIT}.tar.gz
1.2 tnn 31: #
32: # Keywords: github
1.1 tnn 33:
34: .if defined(USE_GITHUB) && !empty(USE_GITHUB:M[yY][eE][sS])
35:
36: # maybe move this to sites.mk
1.4 ! tnn 37: MASTER_SITE_GITHUB?= https://github.com/
1.1 tnn 38:
39: GH_ACCOUNT?= ${PKGBASE}
40: GH_PROJECT?= ${PKGBASE}
41: GH_TAGNAME?= ${PKGVERSION_NOREV}
42:
43: . if !empty(GH_TAGNAME:Mmaster)
44: PKG_FAIL_REASON+= "master is not a valid tag name, use an explicit commit hash (hint: set GH_COMMIT)"
45: . endif
46:
47: . if !defined(GH_TYPE)
48: . if defined(GH_COMMIT) && !empty(GH_COMMIT:M*)
49: GH_TYPE= commit
50: . elif defined(GH_RELEASE) && !empty(GH_RELEASE:M*)
51: GH_TYPE= release
52: . else
53: GH_TYPE= tag
54: . endif
55: . endif
56:
57: .if !empty(GH_TYPE:Mrelease)
58: MASTER_SITES?= ${MASTER_SITE_GITHUB}${GH_ACCOUNT}/${GH_PROJECT}/releases/download/${GH_RELEASE}/
59: .endif
60:
61: .if !empty(GH_TYPE:Mcommit)
62: MASTER_SITES?= -${MASTER_SITE_GITHUB}${GH_ACCOUNT}/${GH_PROJECT}/archive/${GH_COMMIT}${EXTRACT_SUFX}
63: .endif
64:
65: .if !empty(GH_TYPE:Mtag)
66: MASTER_SITES?= -${MASTER_SITE_GITHUB}${GH_ACCOUNT}/${GH_PROJECT}/archive/${GH_TAGNAME}${EXTRACT_SUFX}
67: .endif
68:
69: .endif
CVSweb <webmaster@jp.NetBSD.org>