Changeset View
Changeset View
Standalone View
Standalone View
head/Mk/bsd.sites.mk
Show First 20 Lines • Show All 508 Lines • ▼ Show 20 Lines | |||||
# | # | ||||
# GH_PROJECT - name of the project on GitHub | # GH_PROJECT - name of the project on GitHub | ||||
# default: ${PORTNAME} | # default: ${PORTNAME} | ||||
# | # | ||||
# GH_TAGNAME - name of the tag to download (2.0.1, hash, ...) | # GH_TAGNAME - name of the tag to download (2.0.1, hash, ...) | ||||
# Using the name of a branch here is incorrect. It is | # Using the name of a branch here is incorrect. It is | ||||
# possible to do GH_TAGNAME= GIT_HASH to do a snapshot. | # possible to do GH_TAGNAME= GIT_HASH to do a snapshot. | ||||
# default: ${DISTVERSION} | # default: ${DISTVERSION} | ||||
# GH_TUPLE - above shortened to account:project:tagname[:group] | |||||
# | # | ||||
# GH_SUBDIR - directory relative to WRKSRC where to move this distfile's | |||||
# content after extracting. | |||||
# | |||||
# GH_TUPLE - above shortened to account:project:tagname[:group][/subdir] | |||||
# | |||||
.if defined(USE_GITHUB) | .if defined(USE_GITHUB) | ||||
. if defined(GH_TAGNAME) && ${GH_TAGNAME} == master | . if defined(GH_TAGNAME) && ${GH_TAGNAME} == master | ||||
IGNORE?= Using master as GH_TAGNAME is invalid. \ | IGNORE?= Using master as GH_TAGNAME is invalid. \ | ||||
Must use a tag or commit hash so the upstream does \ | Must use a tag or commit hash so the upstream does \ | ||||
not "reroll" as soon as the branch is updated | not "reroll" as soon as the branch is updated | ||||
. endif | . endif | ||||
. if defined(GH_TUPLE) | . if defined(GH_TUPLE) | ||||
.for _tuple in ${GH_TUPLE} | . for _tuple in ${GH_TUPLE} | ||||
_t_tmp=${_tuple} | _t_tmp=${_tuple} | ||||
.if ${_t_tmp:C@^([^:]*):([^:]*):([^:]*)((:[^:]*)?)@\4@:S/://:C/[a-zA-Z0-9_]//g} | . if ${_t_tmp:C@^([^:]*):([^:]*):([^:]*)((:[^:/]*)?)((/.*)?)@\4@:S/://:C/[a-zA-Z0-9_]//g} | ||||
check-makevars:: | check-makevars:: | ||||
@${ECHO_MSG} "The ${_tuple} GH_TUPLE line has" | @${ECHO_MSG} "The ${_tuple} GH_TUPLE line has" | ||||
@${ECHO_MSG} "a tag containing something else than [a-zA-Z0-9_]" | @${ECHO_MSG} "a tag containing something else than [a-zA-Z0-9_]" | ||||
@${FALSE} | @${FALSE} | ||||
.endif | . endif | ||||
.endfor | . endfor | ||||
GH_ACCOUNT+= ${GH_TUPLE:C@^([^:]*):([^:]*):([^:]*)((:[^:]*)?)@\1\4@} | GH_ACCOUNT+= ${GH_TUPLE:C@^([^:]*):([^:]*):([^:]*)((:[^:/]*)?)((/.*)?)@\1\4@} | ||||
GH_PROJECT+= ${GH_TUPLE:C@^([^:]*):([^:]*):([^:]*)((:[^:]*)?)@\2\4@} | GH_PROJECT+= ${GH_TUPLE:C@^([^:]*):([^:]*):([^:]*)((:[^:/]*)?)((/.*)?)@\2\4@} | ||||
GH_TAGNAME+= ${GH_TUPLE:C@^([^:]*):([^:]*):([^:]*)((:[^:]*)?)@\3\4@} | GH_TAGNAME+= ${GH_TUPLE:C@^([^:]*):([^:]*):([^:]*)((:[^:/]*)?)((/.*)?)@\3\4@} | ||||
GH_SUBDIR+= ${GH_TUPLE:C@^([^:]*):([^:]*):([^:]*)((:[^:/]*)?)((/.*)?)@\6\4@:M/*:S/^\///} | |||||
. endif | . endif | ||||
# We are cheating and using backend URLS for Github here. See ports/194898 | # We are cheating and using backend URLS for Github here. See ports/194898 | ||||
# comment #15 for explanation as to why and how to deal with it if it breaks. | # comment #15 for explanation as to why and how to deal with it if it breaks. | ||||
MASTER_SITE_GITHUB+= https://codeload.github.com/%SUBDIR% | MASTER_SITE_GITHUB+= https://codeload.github.com/%SUBDIR% | ||||
MASTER_SITE_GITHUB_CLOUD+= https://cloud.github.com/downloads/%SUBDIR% | MASTER_SITE_GITHUB_CLOUD+= https://cloud.github.com/downloads/%SUBDIR% | ||||
. if !defined(MASTER_SITES) || !${MASTER_SITES:MGH} && !${MASTER_SITES:MGHC} && !${USE_GITHUB:Mnodefault} | . if !defined(MASTER_SITES) || !${MASTER_SITES:MGH} && !${MASTER_SITES:MGHC} && !${USE_GITHUB:Mnodefault} | ||||
MASTER_SITES+= GH | MASTER_SITES+= GH | ||||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | |||||
_GITHUB_GROUPS+= ${_group} | _GITHUB_GROUPS+= ${_group} | ||||
. endif | . endif | ||||
GH_TAGNAME_${_group}= ${_T:C@^(.*):[^/:]+$@\1@} | GH_TAGNAME_${_group}= ${_T:C@^(.*):[^/:]+$@\1@} | ||||
. endfor | . endfor | ||||
. else | . else | ||||
GH_TAGNAME_DEFAULT= ${_T:C@^(.*):[^/:]+$@\1@} | GH_TAGNAME_DEFAULT= ${_T:C@^(.*):[^/:]+$@\1@} | ||||
. endif | . endif | ||||
. endfor | . endfor | ||||
. for _S in ${GH_SUBDIR} | |||||
_S_SEMP= ${_S:S/^${_S:C@:[^/:]+$@@}//:S/^://} | |||||
. if !empty(_S_SEMP) | |||||
. for _group in ${_S_SEMP:S/,/ /g} | |||||
_G_SEMP= ${_group} | |||||
. if ${_G_SEMP} == all || ${_G_SEMP} == ALL || ${_G_SEMP} == default | |||||
check-makevars:: | |||||
@${ECHO_MSG} "Makefile error: the words all, ALL and default are reserved and cannot be" | |||||
@${ECHO_MSG} "used in group definitions. Please fix your GH_SUBDIR" | |||||
@${FALSE} | |||||
. endif | |||||
. if !${_GITHUB_GROUPS:M${_group}} | |||||
_GITHUB_GROUPS+= ${_group} | |||||
. endif | |||||
GH_SUBDIR_${_group}= ${_S:C@^(.*):[^/:]+$@\1@} | |||||
. endfor | |||||
. else | |||||
GH_SUBDIR_DEFAULT= ${_S:C@^(.*):[^/:]+$@\1@} | |||||
. endif | |||||
. endfor | |||||
# Put the default values back into the variables so that the *default* behavior | # Put the default values back into the variables so that the *default* behavior | ||||
# is not changed. | # is not changed. | ||||
GH_ACCOUNT:= ${GH_ACCOUNT_DEFAULT} | GH_ACCOUNT:= ${GH_ACCOUNT_DEFAULT} | ||||
GH_PROJECT:= ${GH_PROJECT_DEFAULT} | GH_PROJECT:= ${GH_PROJECT_DEFAULT} | ||||
GH_TAGNAME:= ${GH_TAGNAME_DEFAULT} | GH_TAGNAME:= ${GH_TAGNAME_DEFAULT} | ||||
GH_SUBDIR:= ${GH_SUBDIR_DEFAULT} | |||||
. if defined(GH_TAGNAME) | . if defined(GH_TAGNAME) | ||||
GH_TAGNAME_SANITIZED= ${GH_TAGNAME:S,/,-,} | GH_TAGNAME_SANITIZED= ${GH_TAGNAME:S,/,-,} | ||||
# Github silently converts tags starting with v to not have v in the filename | # Github silently converts tags starting with v to not have v in the filename | ||||
# and extraction directory. It also replaces + with -. | # and extraction directory. It also replaces + with -. | ||||
GH_TAGNAME_EXTRACT= ${GH_TAGNAME_SANITIZED:C/^[vV]([0-9])/\1/:S/+/-/g} | GH_TAGNAME_EXTRACT= ${GH_TAGNAME_SANITIZED:C/^[vV]([0-9])/\1/:S/+/-/g} | ||||
. endif | . endif | ||||
. if defined(_GITHUB_MUST_SET_DISTNAME) | . if defined(_GITHUB_MUST_SET_DISTNAME) | ||||
# GH_TAGNAME defaults to DISTVERSIONFULL; Avoid adding DISTVERSIONFULL in twice | # GH_TAGNAME defaults to DISTVERSIONFULL; Avoid adding DISTVERSIONFULL in twice | ||||
Show All 10 Lines | |||||
. if ${MASTER_SITES:MGH} | . if ${MASTER_SITES:MGH} | ||||
DISTNAME:= ${DISTNAME}_GH${_GITHUB_REV} | DISTNAME:= ${DISTNAME}_GH${_GITHUB_REV} | ||||
. endif | . endif | ||||
_GITHUB_EXTRACT_SUFX= .tar.gz | _GITHUB_EXTRACT_SUFX= .tar.gz | ||||
# Put the DEFAULT distfile first | # Put the DEFAULT distfile first | ||||
. if !${USE_GITHUB:Mnodefault} && defined(_GITHUB_MUST_SET_DISTNAME) | . if !${USE_GITHUB:Mnodefault} && defined(_GITHUB_MUST_SET_DISTNAME) | ||||
DISTFILES+= ${DISTNAME}${_GITHUB_EXTRACT_SUFX} | DISTFILES+= ${DISTNAME}${_GITHUB_EXTRACT_SUFX} | ||||
. endif | . endif | ||||
. if !empty(GH_SUBDIR) | |||||
_SITES_extract:= 690:post-extract-gh-DEFAULT | |||||
post-extract-gh-DEFAULT: | |||||
@${RMDIR} ${WRKSRC}/${GH_SUBDIR} 2>/dev/null || : | |||||
@${MKDIR} ${WRKSRC}/${GH_SUBDIR:H} 2>/dev/null || : | |||||
@${LN} -s ${GH_SUBDIR:C/[^\/]//g:C/\//..\//g} ${WRKSRC}/${GH_SUBDIR} | |||||
. endif | |||||
# If there are non default groups | # If there are non default groups | ||||
. if !empty(_GITHUB_GROUPS:NDEFAULT) | . if !empty(_GITHUB_GROUPS:NDEFAULT) | ||||
# Then for each of the remaining groups, add DISTFILES and MASTER_SITES | # Then for each of the remaining groups, add DISTFILES and MASTER_SITES | ||||
# entries with the correct group and create {WRKSRC,DISTNAME,DISTFILES}_group | # entries with the correct group and create {WRKSRC,DISTNAME,DISTFILES}_group | ||||
# helper variables. | # helper variables. | ||||
. for _group in ${_GITHUB_GROUPS:NDEFAULT} | . for _group in ${_GITHUB_GROUPS:NDEFAULT} | ||||
GH_ACCOUNT_${_group}?= ${GH_ACCOUNT_DEFAULT} | GH_ACCOUNT_${_group}?= ${GH_ACCOUNT_DEFAULT} | ||||
GH_PROJECT_${_group}?= ${GH_PROJECT_DEFAULT} | GH_PROJECT_${_group}?= ${GH_PROJECT_DEFAULT} | ||||
GH_TAGNAME_${_group}?= ${GH_TAGNAME_DEFAULT} | GH_TAGNAME_${_group}?= ${GH_TAGNAME_DEFAULT} | ||||
GH_TAGNAME_${_group}_SANITIZED= ${GH_TAGNAME_${_group}:S,/,-,} | GH_TAGNAME_${_group}_SANITIZED= ${GH_TAGNAME_${_group}:S,/,-,} | ||||
GH_TAGNAME_${_group}_EXTRACT= ${GH_TAGNAME_${_group}_SANITIZED:C/^[vV]([0-9])/\1/} | GH_TAGNAME_${_group}_EXTRACT= ${GH_TAGNAME_${_group}_SANITIZED:C/^[vV]([0-9])/\1/} | ||||
DISTNAME_${_group}:= ${GH_ACCOUNT_${_group}}-${GH_PROJECT_${_group}}-${GH_TAGNAME_${_group}_SANITIZED} | DISTNAME_${_group}:= ${GH_ACCOUNT_${_group}}-${GH_PROJECT_${_group}}-${GH_TAGNAME_${_group}_SANITIZED} | ||||
DISTFILE_${_group}:= ${DISTNAME_${_group}}_GH${_GITHUB_REV}${_GITHUB_EXTRACT_SUFX} | DISTFILE_${_group}:= ${DISTNAME_${_group}}_GH${_GITHUB_REV}${_GITHUB_EXTRACT_SUFX} | ||||
DISTFILES:= ${DISTFILES} ${DISTFILE_${_group}}:${_group} | DISTFILES:= ${DISTFILES} ${DISTFILE_${_group}}:${_group} | ||||
MASTER_SITES:= ${MASTER_SITES} ${MASTER_SITE_GITHUB:S@%SUBDIR%@${GH_ACCOUNT_${_group}}/${GH_PROJECT_${_group}}/tar.gz/${GH_TAGNAME_${_group}}?dummy=/:${_group}@} | MASTER_SITES:= ${MASTER_SITES} ${MASTER_SITE_GITHUB:S@%SUBDIR%@${GH_ACCOUNT_${_group}}/${GH_PROJECT_${_group}}/tar.gz/${GH_TAGNAME_${_group}}?dummy=/:${_group}@} | ||||
WRKSRC_${_group}:= ${WRKDIR}/${GH_PROJECT_${_group}}-${GH_TAGNAME_${_group}_EXTRACT} | WRKSRC_${_group}:= ${WRKDIR}/${GH_PROJECT_${_group}}-${GH_TAGNAME_${_group}_EXTRACT} | ||||
. if !empty(GH_SUBDIR_${_group}) | |||||
_SITES_extract:= ${_SITES_extract} 690:post-extract-gh-${_group} | |||||
post-extract-gh-${_group}: | |||||
@${RMDIR} ${WRKSRC}/${GH_SUBDIR_${_group}} 2>/dev/null || : | |||||
@${MKDIR} ${WRKSRC}/${GH_SUBDIR_${_group}:H} 2>/dev/null || : | |||||
@${MV} ${WRKSRC_${_group}} ${WRKSRC}/${GH_SUBDIR_${_group}} | |||||
. endif | |||||
. endfor | . endfor | ||||
. endif | . endif | ||||
.endif # defined(USE_GITHUB) | .endif # defined(USE_GITHUB) | ||||
.endif # !defined(IGNORE_MASTER_SITE_GITHUB) | .endif # !defined(IGNORE_MASTER_SITE_GITHUB) | ||||
.if !defined(IGNORE_MASTER_SITE_GNOME) | .if !defined(IGNORE_MASTER_SITE_GNOME) | ||||
MASTER_SITE_GNOME+= \ | MASTER_SITE_GNOME+= \ | ||||
https://download.gnome.org/%SUBDIR%/ \ | https://download.gnome.org/%SUBDIR%/ \ | ||||
▲ Show 20 Lines • Show All 816 Lines • Show Last 20 Lines |