aboutsummaryrefslogtreecommitdiffstats
path: root/Mk
diff options
context:
space:
mode:
authormat <mat@FreeBSD.org>2016-08-24 22:50:04 +0800
committermat <mat@FreeBSD.org>2016-08-24 22:50:04 +0800
commit68c70f03568c2486c36c86e3b9616310ee09d2b2 (patch)
tree2ea794732811d2a0fb93f0cd87576b38d773968e /Mk
parent4f2c7569522251f7911e435f4d897407647f8268 (diff)
downloadfreebsd-ports-gnome-68c70f03568c2486c36c86e3b9616310ee09d2b2.tar.gz
freebsd-ports-gnome-68c70f03568c2486c36c86e3b9616310ee09d2b2.tar.zst
freebsd-ports-gnome-68c70f03568c2486c36c86e3b9616310ee09d2b2.zip
Add GH_SUBDIR, automatically moves a secondary distfile to the right
place inside ${WRKSRC}. Before: GH_TUPLE= Regaddi:Chart.js:f13f99b:chart_js \ FVANCOP:ChartNew.js:77e7f87:chartnew_js post-extract: @${RMDIR} ${WRKSRC}/database ${WRKSRC}/3rd/Chart.js @${MV} ${WRKSRC_database} ${WRKSRC}/database @${MV} ${WRKSRC_chart_js} ${WRKSRC}/3rd/Chart.js After: GH_TUPLE= Regaddi:Chart.js:f13f99b:chart_js/3rd/Chart.js \ FVANCOP:ChartNew.js:77e7f87:chartnew_js/3rd/ChartNew.js Sponsored by: Absolight Differential Revision: https://reviews.freebsd.org/D7583
Diffstat (limited to 'Mk')
-rw-r--r--Mk/bsd.port.mk2
-rw-r--r--Mk/bsd.sites.mk56
2 files changed, 49 insertions, 9 deletions
diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk
index 708c54a6d08f..5cf8d1a89141 100644
--- a/Mk/bsd.port.mk
+++ b/Mk/bsd.port.mk
@@ -5276,7 +5276,7 @@ _EXTRACT_SEQ= 010:check-build-conflicts 050:extract-message 100:checksum \
150:extract-depends 190:clean-wrkdir 200:${EXTRACT_WRKDIR} \
300:pre-extract 450:pre-extract-script 500:do-extract \
700:post-extract 850:post-extract-script \
- ${_OPTIONS_extract} ${_USES_extract}
+ ${_OPTIONS_extract} ${_USES_extract} ${_SITES_extract}
_PATCH_DEP= extract
_PATCH_SEQ= 050:ask-license 100:patch-message 150:patch-depends \
300:pre-patch 450:pre-patch-script 500:do-patch \
diff --git a/Mk/bsd.sites.mk b/Mk/bsd.sites.mk
index 2b56134e9e57..7d10606edfaf 100644
--- a/Mk/bsd.sites.mk
+++ b/Mk/bsd.sites.mk
@@ -514,7 +514,11 @@ MASTER_SITE_GENTOO+= \
# Using the name of a branch here is incorrect. It is
# possible to do GH_TAGNAME= GIT_HASH to do a snapshot.
# 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(GH_TAGNAME) && ${GH_TAGNAME} == master
@@ -523,18 +527,19 @@ IGNORE?= Using master as GH_TAGNAME is invalid. \
not "reroll" as soon as the branch is updated
. endif
. if defined(GH_TUPLE)
-.for _tuple in ${GH_TUPLE}
+. for _tuple in ${GH_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::
@${ECHO_MSG} "The ${_tuple} GH_TUPLE line has"
@${ECHO_MSG} "a tag containing something else than [a-zA-Z0-9_]"
@${FALSE}
-.endif
-.endfor
-GH_ACCOUNT+= ${GH_TUPLE:C@^([^:]*):([^:]*):([^:]*)((:[^:]*)?)@\1\4@}
-GH_PROJECT+= ${GH_TUPLE:C@^([^:]*):([^:]*):([^:]*)((:[^:]*)?)@\2\4@}
-GH_TAGNAME+= ${GH_TUPLE:C@^([^:]*):([^:]*):([^:]*)((:[^:]*)?)@\3\4@}
+. endif
+. endfor
+GH_ACCOUNT+= ${GH_TUPLE:C@^([^:]*):([^:]*):([^:]*)((:[^:/]*)?)((/.*)?)@\1\4@}
+GH_PROJECT+= ${GH_TUPLE:C@^([^:]*):([^:]*):([^:]*)((:[^:/]*)?)((/.*)?)@\2\4@}
+GH_TAGNAME+= ${GH_TUPLE:C@^([^:]*):([^:]*):([^:]*)((:[^:/]*)?)((/.*)?)@\3\4@}
+GH_SUBDIR+= ${GH_TUPLE:C@^([^:]*):([^:]*):([^:]*)((:[^:/]*)?)((/.*)?)@\6\4@:M/*:S/^\///}
. endif
# 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.
@@ -613,11 +618,32 @@ GH_TAGNAME_${_group}= ${_T:C@^(.*):[^/:]+$@\1@}
GH_TAGNAME_DEFAULT= ${_T:C@^(.*):[^/:]+$@\1@}
. endif
. 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
# is not changed.
GH_ACCOUNT:= ${GH_ACCOUNT_DEFAULT}
GH_PROJECT:= ${GH_PROJECT_DEFAULT}
GH_TAGNAME:= ${GH_TAGNAME_DEFAULT}
+GH_SUBDIR:= ${GH_SUBDIR_DEFAULT}
. if defined(GH_TAGNAME)
GH_TAGNAME_SANITIZED= ${GH_TAGNAME:S,/,-,}
# Github silently converts tags starting with v to not have v in the filename
@@ -644,6 +670,13 @@ _GITHUB_EXTRACT_SUFX= .tar.gz
. if !${USE_GITHUB:Mnodefault} && defined(_GITHUB_MUST_SET_DISTNAME)
DISTFILES+= ${DISTNAME}${_GITHUB_EXTRACT_SUFX}
. 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 !empty(_GITHUB_GROUPS:NDEFAULT)
# Then for each of the remaining groups, add DISTFILES and MASTER_SITES
@@ -660,6 +693,13 @@ DISTFILE_${_group}:= ${DISTNAME_${_group}}_GH${_GITHUB_REV}${_GITHUB_EXTRACT_SUF
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}@}
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
. endif
.endif # defined(USE_GITHUB)