summaryrefslogtreecommitdiff
path: root/Mk/Uses/cargo.mk
diff options
context:
space:
mode:
authorTobias Kortkamp <tobik@FreeBSD.org>2019-11-19 21:08:10 +0000
committerTobias Kortkamp <tobik@FreeBSD.org>2019-11-19 21:08:10 +0000
commitab415159b8b9711c67b9978766970765026bc701 (patch)
treed9af614ef135d44e6d177303d176dd571536aa31 /Mk/Uses/cargo.mk
parentUpdate lang/erlang-runtime21 to version 21.3.8.11. (diff)
Mk/Uses/cargo.mk: Add CARGO_GIT_SUBDIR hook to provide hints for CARGO_USE_GIT*
This is a workaround to add some manual "support" for Cargo projects that use workspaces where the current method of patching is not good enough as it causes the various Cargo.toml to point to the wrong directory. With CARGO_GIT_SUBDIR maintainers can control the patching process a little and point things to the correct subdirectories. CARGO_GIT_SUBDIR= <group>:<crate name>:<subdir under ${WRKSRC_group}> This is needed for alacritty 0.4.0-rc2 where the glutin sources are under ${WRKSRC_glutin}/glutin and not just ${WRKSRC_glutin}. This causes the following issue: error: failed to load source for a dependency on `glutin` Caused by: Unable to update .../x11/alacritty/work/glutin-7e479d Caused by: found a virtual manifest at `.../x11/alacritty/work/glutin-7e479d/Cargo.toml` instead of a package manifest For glutin we would set CARGO_GIT_SUBDIR=glutin:glutin:glutin to work around this problem and point the build to .../x11/alacritty/work/glutin-7e479d/glutin instead.
Notes
Notes: svn path=/head/; revision=517982
Diffstat (limited to 'Mk/Uses/cargo.mk')
-rw-r--r--Mk/Uses/cargo.mk18
1 files changed, 16 insertions, 2 deletions
diff --git a/Mk/Uses/cargo.mk b/Mk/Uses/cargo.mk
index b91f9da36c70..d33ff7701f29 100644
--- a/Mk/Uses/cargo.mk
+++ b/Mk/Uses/cargo.mk
@@ -212,14 +212,28 @@ cargo-extract:
_CARGO_GIT_PATCH_CARGOTOML=
.if ${CARGO_USE_GITHUB:tl} == "yes"
. for _group in ${GH_TUPLE:C@^[^:]*:[^:]*:[^:]*:(([^:/]*)?)((/.*)?)@\2@}
+. if empty(CARGO_GIT_SUBDIR:M${_group}\:*)
_CARGO_GIT_PATCH_CARGOTOML:= ${_CARGO_GIT_PATCH_CARGOTOML} \
- -e 's@git = "(https|http|git)://github.com/${GH_ACCOUNT_${_group}}/${GH_PROJECT_${_group}}(\.git)?/?"@path = "${WRKSRC_${_group}}"@'
+ -e "s@git = ['\"](https|http|git)://github.com/${GH_ACCOUNT_${_group}}/${GH_PROJECT_${_group}}(\.git)?/?[\"']@path = \"${WRKSRC_${_group}}\"@"
+. else
+. for _group2 _crate _subdir in ${CARGO_GIT_SUBDIR:M${_group}\:*:S,:, ,g}
+_CARGO_GIT_PATCH_CARGOTOML:= ${_CARGO_GIT_PATCH_CARGOTOML} \
+ -e "/^${_crate} =/ s@git = ['\"](https|http|git)://github.com/${GH_ACCOUNT_${_group}}/${GH_PROJECT_${_group}}(\.git)?/?[\"']@path = \"${WRKSRC_${_group}}/${_subdir}\"@"
+. endfor
+. endif
. endfor
.endif
.if ${CARGO_USE_GITLAB:tl} == "yes"
. for _group in ${GL_TUPLE:C@^(([^:]*://[^:/]*(:[0-9]{1,5})?(/[^:]*[^/])?:)?)([^:]*):([^:]*):([^:]*)(:[^:/]*)((/.*)?)@\8@:S/^://}
+. if empty(CARGO_GIT_SUBDIR:M${_group}\:*)
+_CARGO_GIT_PATCH_CARGOTOML:= ${_CARGO_GIT_PATCH_CARGOTOML} \
+ -e "s@git = ['\"]${GL_SITE_${_group}}/${GL_ACCOUNT_${_group}}/${GL_PROJECT_${_group}}(\.git)?/?['\"]@path = \"${WRKSRC_${_group}}\"@"
+. else
+. for _group2 _crate _subdir in ${CARGO_GIT_SUBDIR:M${_group}\:*:S,:, ,g}
_CARGO_GIT_PATCH_CARGOTOML:= ${_CARGO_GIT_PATCH_CARGOTOML} \
- -e 's@git = "${GL_SITE_${_group}}/${GL_ACCOUNT_${_group}}/${GL_PROJECT_${_group}}(\.git)?/?"@path = "${WRKSRC_${_group}}"@'
+ -e "/^${_crate} = / s@git = ['\"]${GL_SITE_${_group}}/${GL_ACCOUNT_${_group}}/${GL_PROJECT_${_group}}(\.git)?/?['\"]@path = \"${WRKSRC_${_group}}/${_subdir}\"@"
+. endfor
+. endif
. endfor
.endif