redox/recipes/core/drivers/recipe.toml
2024-04-19 09:08:08 -06:00

64 lines
1.5 KiB
TOML

[source]
git = "https://gitlab.redox-os.org/redox-os/drivers.git"
[build]
template = "custom"
script = """
# Drivers that are built on all architectures, and NOT in drivers-initfs
BINS=(
alxd
e1000d
ihdad
ixgbed
pcid
rtl8139d
rtl8168d
usbctl
usbhidd
usbhubd
usbscsid
virtio-netd
xhcid
inputd
)
# Add additional drivers to the list to build, that are not in drivers-initfs
# depending on the target architecture
case "${TARGET}" in
i686-unknown-redox | x86_64-unknown-redox)
BINS+=(ac97d bgad pcspkrd sb16d vboxd)
;;
*)
;;
esac
#Build each driver in the list
mkdir -pv "${COOKBOOK_STAGE}/bin"
export CARGO_PROFILE_RELEASE_OPT_LEVEL=s
export CARGO_PROFILE_RELEASE_PANIC=abort
"${COOKBOOK_CARGO}" build --release \
--manifest-path "${COOKBOOK_SOURCE}/Cargo.toml" \
$(for bin in "${BINS[@]}"; do echo "-p" "${bin}"; done)
for bin in "${BINS[@]}"
do
cp -v "target/${TARGET}/release/${bin}" "${COOKBOOK_STAGE}/bin"
done
mkdir -pv "${COOKBOOK_STAGE}/bin"
${FIND} "target/${TARGET}/release" \
-maxdepth 1 \
-executable \
-type f \
-exec cp -v {} "${COOKBOOK_STAGE}/bin/" ';'
mkdir -pv "${COOKBOOK_STAGE}/etc/pcid"
cp -v "${COOKBOOK_SOURCE}/initfs.toml" "${COOKBOOK_STAGE}/etc/pcid/initfs.toml"
mkdir -pv "${COOKBOOK_STAGE}/etc/pcid.d"
${FIND} "${COOKBOOK_SOURCE}" -maxdepth 3 -type f -name 'config.toml' | while read conf
do
driver="$(basename "$(dirname "$conf")")"
cp -v "$conf" "${COOKBOOK_STAGE}/etc/pcid.d/$driver.toml"
done
"""