[source]
git = "https://gitlab.redox-os.org/redox-os/kernel.git"

[build]
template = "custom"
script = """
export RUST_TARGET_PATH="${COOKBOOK_SOURCE}/targets"
ARCH="$(echo "${TARGET}" | cut -d - -f1)"
cargo rustc \
	--bin kernel \
	--manifest-path "${COOKBOOK_SOURCE}/Cargo.toml" \
	--target "${COOKBOOK_SOURCE}/targets/${ARCH}-unknown-kernel.json" \
	--release \
	-Z build-std=core,alloc \
	-- \
	-C soft-float \
	-C link-arg=-T -Clink-arg="${COOKBOOK_SOURCE}/linkers/${ARCH}.ld" \
	-C link-arg=-z -Clink-arg=max-page-size=0x1000 \
	--emit link="${PWD}/kernel.all"
"${TARGET}-objcopy" \
	--only-keep-debug \
	kernel.all \
	kernel.sym
"${TARGET}-objcopy" \
	--strip-debug \
	kernel.all \
	kernel
mkdir -v "${COOKBOOK_STAGE}/boot"
cp -v kernel "${COOKBOOK_STAGE}/boot"
"""
