diff options
Diffstat (limited to 'meta/classes-recipe/cargo_common.bbclass')
-rw-r--r-- | meta/classes-recipe/cargo_common.bbclass | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/meta/classes-recipe/cargo_common.bbclass b/meta/classes-recipe/cargo_common.bbclass index 0fb443edbd..c9eb2d09a5 100644 --- a/meta/classes-recipe/cargo_common.bbclass +++ b/meta/classes-recipe/cargo_common.bbclass | |||
@@ -18,7 +18,7 @@ | |||
18 | inherit rust-common | 18 | inherit rust-common |
19 | 19 | ||
20 | # Where we download our registry and dependencies to | 20 | # Where we download our registry and dependencies to |
21 | export CARGO_HOME = "${WORKDIR}/cargo_home" | 21 | export CARGO_HOME = "${UNPACKDIR}/cargo_home" |
22 | 22 | ||
23 | # The pkg-config-rs library used by cargo build scripts disables itself when | 23 | # The pkg-config-rs library used by cargo build scripts disables itself when |
24 | # cross compiling unless this is defined. We set up pkg-config appropriately | 24 | # cross compiling unless this is defined. We set up pkg-config appropriately |
@@ -41,20 +41,20 @@ CARGO_SRC_DIR ??= "" | |||
41 | CARGO_MANIFEST_PATH ??= "${S}/${CARGO_SRC_DIR}/Cargo.toml" | 41 | CARGO_MANIFEST_PATH ??= "${S}/${CARGO_SRC_DIR}/Cargo.toml" |
42 | 42 | ||
43 | # Path to Cargo.lock | 43 | # Path to Cargo.lock |
44 | CARGO_LOCK_PATH ??= "${@ os.path.join(os.path.dirname(d.getVar('CARGO_MANIFEST_PATH', True)), 'Cargo.lock')}" | 44 | CARGO_LOCK_PATH ??= "${@ os.path.join(os.path.dirname(d.getVar('CARGO_MANIFEST_PATH')), 'Cargo.lock')}" |
45 | 45 | ||
46 | CARGO_RUST_TARGET_CCLD ??= "${RUST_TARGET_CCLD}" | 46 | CARGO_RUST_TARGET_CCLD ??= "${RUST_TARGET_CCLD}" |
47 | cargo_common_do_configure () { | 47 | cargo_common_do_configure () { |
48 | mkdir -p ${CARGO_HOME}/bitbake | 48 | mkdir -p ${CARGO_HOME}/bitbake |
49 | 49 | ||
50 | cat <<- EOF > ${CARGO_HOME}/config | 50 | cat <<- EOF > ${CARGO_HOME}/config.toml |
51 | # EXTRA_OECARGO_PATHS | 51 | # EXTRA_OECARGO_PATHS |
52 | paths = [ | 52 | paths = [ |
53 | $(for p in ${EXTRA_OECARGO_PATHS}; do echo \"$p\",; done) | 53 | $(for p in ${EXTRA_OECARGO_PATHS}; do echo \"$p\",; done) |
54 | ] | 54 | ] |
55 | EOF | 55 | EOF |
56 | 56 | ||
57 | cat <<- EOF >> ${CARGO_HOME}/config | 57 | cat <<- EOF >> ${CARGO_HOME}/config.toml |
58 | 58 | ||
59 | # Local mirror vendored by bitbake | 59 | # Local mirror vendored by bitbake |
60 | [source.bitbake] | 60 | [source.bitbake] |
@@ -62,7 +62,7 @@ cargo_common_do_configure () { | |||
62 | EOF | 62 | EOF |
63 | 63 | ||
64 | if [ ${CARGO_DISABLE_BITBAKE_VENDORING} = "0" ]; then | 64 | if [ ${CARGO_DISABLE_BITBAKE_VENDORING} = "0" ]; then |
65 | cat <<- EOF >> ${CARGO_HOME}/config | 65 | cat <<- EOF >> ${CARGO_HOME}/config.toml |
66 | 66 | ||
67 | [source.crates-io] | 67 | [source.crates-io] |
68 | replace-with = "bitbake" | 68 | replace-with = "bitbake" |
@@ -70,7 +70,7 @@ cargo_common_do_configure () { | |||
70 | EOF | 70 | EOF |
71 | fi | 71 | fi |
72 | 72 | ||
73 | cat <<- EOF >> ${CARGO_HOME}/config | 73 | cat <<- EOF >> ${CARGO_HOME}/config.toml |
74 | 74 | ||
75 | [http] | 75 | [http] |
76 | # Multiplexing can't be enabled because http2 can't be enabled | 76 | # Multiplexing can't be enabled because http2 can't be enabled |
@@ -82,7 +82,7 @@ cargo_common_do_configure () { | |||
82 | 82 | ||
83 | EOF | 83 | EOF |
84 | 84 | ||
85 | cat <<- EOF >> ${CARGO_HOME}/config | 85 | cat <<- EOF >> ${CARGO_HOME}/config.toml |
86 | 86 | ||
87 | # HOST_SYS | 87 | # HOST_SYS |
88 | [target.${RUST_HOST_SYS}] | 88 | [target.${RUST_HOST_SYS}] |
@@ -90,7 +90,7 @@ cargo_common_do_configure () { | |||
90 | EOF | 90 | EOF |
91 | 91 | ||
92 | if [ "${RUST_HOST_SYS}" != "${RUST_BUILD_SYS}" ]; then | 92 | if [ "${RUST_HOST_SYS}" != "${RUST_BUILD_SYS}" ]; then |
93 | cat <<- EOF >> ${CARGO_HOME}/config | 93 | cat <<- EOF >> ${CARGO_HOME}/config.toml |
94 | 94 | ||
95 | # BUILD_SYS | 95 | # BUILD_SYS |
96 | [target.${RUST_BUILD_SYS}] | 96 | [target.${RUST_BUILD_SYS}] |
@@ -99,7 +99,7 @@ cargo_common_do_configure () { | |||
99 | fi | 99 | fi |
100 | 100 | ||
101 | if [ "${RUST_TARGET_SYS}" != "${RUST_BUILD_SYS}" -a "${RUST_TARGET_SYS}" != "${RUST_HOST_SYS}" ]; then | 101 | if [ "${RUST_TARGET_SYS}" != "${RUST_BUILD_SYS}" -a "${RUST_TARGET_SYS}" != "${RUST_HOST_SYS}" ]; then |
102 | cat <<- EOF >> ${CARGO_HOME}/config | 102 | cat <<- EOF >> ${CARGO_HOME}/config.toml |
103 | 103 | ||
104 | # TARGET_SYS | 104 | # TARGET_SYS |
105 | [target.${RUST_TARGET_SYS}] | 105 | [target.${RUST_TARGET_SYS}] |
@@ -110,7 +110,7 @@ cargo_common_do_configure () { | |||
110 | # Put build output in build directory preferred by bitbake instead of | 110 | # Put build output in build directory preferred by bitbake instead of |
111 | # inside source directory unless they are the same | 111 | # inside source directory unless they are the same |
112 | if [ "${B}" != "${S}" ]; then | 112 | if [ "${B}" != "${S}" ]; then |
113 | cat <<- EOF >> ${CARGO_HOME}/config | 113 | cat <<- EOF >> ${CARGO_HOME}/config.toml |
114 | 114 | ||
115 | [build] | 115 | [build] |
116 | # Use out of tree build destination to avoid polluting the source tree | 116 | # Use out of tree build destination to avoid polluting the source tree |
@@ -118,7 +118,7 @@ cargo_common_do_configure () { | |||
118 | EOF | 118 | EOF |
119 | fi | 119 | fi |
120 | 120 | ||
121 | cat <<- EOF >> ${CARGO_HOME}/config | 121 | cat <<- EOF >> ${CARGO_HOME}/config.toml |
122 | 122 | ||
123 | [term] | 123 | [term] |
124 | progress.when = 'always' | 124 | progress.when = 'always' |
@@ -129,7 +129,7 @@ cargo_common_do_configure () { | |||
129 | python cargo_common_do_patch_paths() { | 129 | python cargo_common_do_patch_paths() { |
130 | import shutil | 130 | import shutil |
131 | 131 | ||
132 | cargo_config = os.path.join(d.getVar("CARGO_HOME"), "config") | 132 | cargo_config = os.path.join(d.getVar("CARGO_HOME"), "config.toml") |
133 | if not os.path.exists(cargo_config): | 133 | if not os.path.exists(cargo_config): |
134 | return | 134 | return |
135 | 135 | ||
@@ -138,11 +138,11 @@ python cargo_common_do_patch_paths() { | |||
138 | return | 138 | return |
139 | 139 | ||
140 | patches = dict() | 140 | patches = dict() |
141 | workdir = d.getVar('WORKDIR') | 141 | workdir = d.getVar('UNPACKDIR') |
142 | fetcher = bb.fetch2.Fetch(src_uri, d) | 142 | fetcher = bb.fetch2.Fetch(src_uri, d) |
143 | for url in fetcher.urls: | 143 | for url in fetcher.urls: |
144 | ud = fetcher.ud[url] | 144 | ud = fetcher.ud[url] |
145 | if ud.type == 'git': | 145 | if ud.type == 'git' or ud.type == 'gitsm': |
146 | name = ud.parm.get('name') | 146 | name = ud.parm.get('name') |
147 | destsuffix = ud.parm.get('destsuffix') | 147 | destsuffix = ud.parm.get('destsuffix') |
148 | if name is not None and destsuffix is not None: | 148 | if name is not None and destsuffix is not None: |
@@ -171,7 +171,7 @@ python cargo_common_do_patch_paths() { | |||
171 | # here is better than letting cargo tell (in case the file is missing) | 171 | # here is better than letting cargo tell (in case the file is missing) |
172 | # "Cargo.lock should be modified but --frozen was given" | 172 | # "Cargo.lock should be modified but --frozen was given" |
173 | 173 | ||
174 | lockfile = d.getVar("CARGO_LOCK_PATH", True) | 174 | lockfile = d.getVar("CARGO_LOCK_PATH") |
175 | if not os.path.exists(lockfile): | 175 | if not os.path.exists(lockfile): |
176 | bb.fatal(f"{lockfile} file doesn't exist") | 176 | bb.fatal(f"{lockfile} file doesn't exist") |
177 | 177 | ||