Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 721936
Collapse All | Expand All

(-)a/cargo.eclass (-4 / +22 lines)
Lines 23-29 esac Link Here
23
23
24
inherit multiprocessing
24
inherit multiprocessing
25
25
26
EXPORT_FUNCTIONS src_unpack src_compile src_install src_test
26
EXPORT_FUNCTIONS src_unpack src_configure src_compile src_install src_test
27
27
28
IUSE="${IUSE} debug"
28
IUSE="${IUSE} debug"
29
29
Lines 154-159 cargo_gen_config() { Link Here
154
	[[ "${NOCOLOR}" = true || "${NOCOLOR}" = yes ]] && echo "color = 'never'" >> "${ECARGO_HOME}/config"
154
	[[ "${NOCOLOR}" = true || "${NOCOLOR}" = yes ]] && echo "color = 'never'" >> "${ECARGO_HOME}/config"
155
}
155
}
156
156
157
# @FUNCTION: cargo_feature
158
# @DESCRIPTION:
159
# Enable a crate feature
160
cargo_feature() {
161
	if ! [ -z ${1} ]; then
162
		CARGO_FEATURES="${1},${CARGO_FEATURES}"
163
	fi
164
}
165
166
# @FUNCTION: cargo_src_configure
167
# @DESCRIPTION:
168
# Apply the selected features
169
cargo_src_configure() {
170
	if ! [ -z "${CARGO_FEATURES}" ]; then
171
		CARGO_FEATURES="--no-default-features --features ${CARGO_FEATURES}"
172
	fi
173
}
174
157
# @FUNCTION: cargo_src_compile
175
# @FUNCTION: cargo_src_compile
158
# @DESCRIPTION:
176
# @DESCRIPTION:
159
# Build the package using cargo build
177
# Build the package using cargo build
Lines 162-168 cargo_src_compile() { Link Here
162
180
163
	export CARGO_HOME="${ECARGO_HOME}"
181
	export CARGO_HOME="${ECARGO_HOME}"
164
182
165
	cargo build $(usex debug "" --release) "$@" \
183
	cargo build $(usex debug "" --release) ${CARGO_FEATURES} "$@" \
166
		|| die "cargo build failed"
184
		|| die "cargo build failed"
167
}
185
}
168
186
Lines 173-179 cargo_src_install() { Link Here
173
	debug-print-function ${FUNCNAME} "$@"
191
	debug-print-function ${FUNCNAME} "$@"
174
192
175
	cargo install --path ${CARGO_INSTALL_PATH} \
193
	cargo install --path ${CARGO_INSTALL_PATH} \
176
		--root="${ED}/usr" $(usex debug --debug "") "$@" \
194
		--root="${ED}/usr" $(usex debug --debug "") ${CARGO_FEATURES} "$@" \
177
		|| die "cargo install failed"
195
		|| die "cargo install failed"
178
	rm -f "${ED}/usr/.crates.toml"
196
	rm -f "${ED}/usr/.crates.toml"
179
	rm -f "${ED}/usr/.crates2.json"
197
	rm -f "${ED}/usr/.crates2.json"
Lines 187-193 cargo_src_install() { Link Here
187
cargo_src_test() {
205
cargo_src_test() {
188
	debug-print-function ${FUNCNAME} "$@"
206
	debug-print-function ${FUNCNAME} "$@"
189
207
190
	cargo test $(usex debug "" --release) "$@" \
208
	cargo test $(usex debug "" --release) ${CARGO_FEATURES} "$@" \
191
		|| die "cargo test failed"
209
		|| die "cargo test failed"
192
}
210
}
193
211

Return to bug 721936