| @@ -1,35 +1,38 @@ | | | @@ -1,35 +1,38 @@ |
1 | # $NetBSD: cargo.mk,v 1.8 2019/11/03 19:04:07 rillig Exp $ | | 1 | # $NetBSD: cargo.mk,v 1.9 2019/12/03 02:09:06 minskim Exp $ |
2 | # | | 2 | # |
3 | # Common logic that can be used by packages that depend on cargo crates | | 3 | # Common logic that can be used by packages that depend on cargo crates |
4 | # from crates.io. This lets existing pkgsrc infrastructure fetch and verify | | 4 | # from crates.io. This lets existing pkgsrc infrastructure fetch and verify |
5 | # cargo crates instead of using the rust package manager in the build phase. | | 5 | # cargo crates instead of using the rust package manager in the build phase. |
6 | # Inspired by cargo.mk from FreeBSD ports. | | 6 | # Inspired by cargo.mk from FreeBSD ports. |
7 | # | | 7 | # |
8 | # Usage example: | | 8 | # Usage example: |
9 | # | | 9 | # |
10 | # CARGO_CRATE_DEPENDS+= sha1-0.20 | | 10 | # CARGO_CRATE_DEPENDS+= sha1-0.20 |
11 | # .include "../../lang/rust/cargo.mk" | | 11 | # .include "../../lang/rust/cargo.mk" |
12 | # do-build: | | 12 | # do-build: |
13 | # cargo build --locked --frozen | | 13 | # cargo build --locked --frozen |
14 | # | | 14 | # |
15 | # | | 15 | # |
16 | # If modifying the list of dependencies, re-run the build once without | | 16 | # If modifying the list of dependencies, re-run the build once without |
17 | # --locked --frozen to generate a new valid Cargo.lock. | | 17 | # --locked --frozen to generate a new valid Cargo.lock. |
18 | # | | 18 | # |
19 | # a list of CARGO_CRATE_DEPENDS can be generated via "make show-cargo-depends". | | 19 | # a list of CARGO_CRATE_DEPENDS can be generated via "make show-cargo-depends". |
20 | # | | 20 | # |
21 | # See also www/geckodriver for a full example. | | 21 | # See also www/geckodriver for a full example. |
22 | | | 22 | |
| | | 23 | MASTER_SITES?= -${MASTER_SITE_CRATESIO}${PKGBASE}/${PKGVERSION_NOREV}/download |
| | | 24 | DIST_SUBDIR?= crates.io |
| | | 25 | |
23 | BUILD_DEPENDS+= rust-[0-9]*:../../lang/rust | | 26 | BUILD_DEPENDS+= rust-[0-9]*:../../lang/rust |
24 | | | 27 | |
25 | USE_TOOLS+= bsdtar digest | | 28 | USE_TOOLS+= bsdtar digest |
26 | CARGO_VENDOR_DIR= ${WRKDIR}/vendor | | 29 | CARGO_VENDOR_DIR= ${WRKDIR}/vendor |
27 | | | 30 | |
28 | DISTFILES?= ${DEFAULT_DISTFILES} | | 31 | DISTFILES?= ${DEFAULT_DISTFILES} |
29 | .for _crate in ${CARGO_CRATE_DEPENDS} | | 32 | .for _crate in ${CARGO_CRATE_DEPENDS} |
30 | DISTFILES+= ${_crate}.crate | | 33 | DISTFILES+= ${_crate}.crate |
31 | SITES.${_crate}.crate+= -${MASTER_SITE_CRATESIO}${_crate:C/-[0-9]+\.[0-9.]+.*$//}/${_crate:C/^.*-([0-9]+\.[0-9.]+.*)$/\1/}/download | | 34 | SITES.${_crate}.crate+= -${MASTER_SITE_CRATESIO}${_crate:C/-[0-9]+\.[0-9.]+.*$//}/${_crate:C/^.*-([0-9]+\.[0-9.]+.*)$/\1/}/download |
32 | EXTRACT_DIR.${_crate}.crate?= ${CARGO_VENDOR_DIR} | | 35 | EXTRACT_DIR.${_crate}.crate?= ${CARGO_VENDOR_DIR} |
33 | .endfor | | 36 | .endfor |
34 | | | 37 | |
35 | post-extract: cargo-vendor-crates | | 38 | post-extract: cargo-vendor-crates |