Remove cook.sh

This commit is contained in:
bjorn3 2025-09-01 21:52:06 +02:00
parent f4d3630ef8
commit 24eccf7093
3 changed files with 31 additions and 109 deletions

View File

@ -10,7 +10,25 @@ else
recipes="$@"
fi
for recipe_path in $recipes
for recipe in $recipes
do
./cook.sh "$recipe_path" distclean
if (echo "$recipe" | grep '.*/.*' >/dev/null); then
recipe_name=$(basename "$recipe")
recipe_path="$recipe"
else
recipe_name="$recipe"
recipe_path=`target/release/find_recipe $recipe`
fi
echo -e "\033[01;38;5;215mcook - clean $recipe_name\033[0m"
if [ -d "$ROOT/$recipe_path" ]
then
COOKBOOK_RECIPE="${ROOT}/$recipe_path"
TARGET_DIR="${ROOT}/$recipe_path/target/${TARGET}"
rm -rf "${TARGET_DIR}"
else
echo "clean.sh: recipe '$recipe_name' not found" >&2
fi
done

105
cook.sh
View File

@ -1,105 +0,0 @@
#!/usr/bin/env bash
set -e
shopt -s nullglob
source config.sh
# Variables to be overriden by recipes
export BINDIR=bin
export CARGO=(env RUSTFLAGS="$PREFIX_RUSTFLAGS -C link-arg=-zmuldefs" cargo)
export CARGOBUILD=rustc
export CARGOFLAGS=
export DEBUG=
export EXAMPLES=
export PREPARE_COPY=1
function usage {
echo "cook.sh $1 <op>" >&2
echo " distclean" >&2
echo " unfetch" >&2
}
function op {
if [ ! "$COOK_QUIET" = "1" ]
then
echo -e "\033[01;38;5;215mcook - $1 $2\033[0m" >&2
fi
case "$2" in
distclean)
op $1 unpkg
op $1 unstage
op $1 unprepare
;;
unfetch)
rm -rfv source source.tar
;;
unprepare)
rm -rf "${COOKBOOK_BUILD}"
rm -rf "${COOKBOOK_SYSROOT}"
;;
unstage)
rm -rfv "${COOKBOOK_STAGE}"
rm -fv "${TARGET_DIR}/auto_deps.toml"
;;
unpkg)
rm -fv "${COOKBOOK_STAGE}.pkgar" "${COOKBOOK_STAGE}.toml"
;;
*)
usage $1
;;
esac
}
if [ -n "$1" ]
then
if (echo "$1" | grep '.*/.*' >/dev/null); then
recipe_name=$(basename "$1")
recipe_path="$1"
else
recipe_name="$1"
recipe_path=`target/release/find_recipe $recipe_name`
fi
if [ -d "$ROOT/$recipe_path" ]
then
export COOKBOOK_RECIPE="${ROOT}/$recipe_path"
TARGET_DIR="${COOKBOOK_RECIPE}/target/${TARGET}"
mkdir -p "${TARGET_DIR}"
export COOKBOOK_BUILD="${TARGET_DIR}/build"
export COOKBOOK_STAGE="${TARGET_DIR}/stage"
export COOKBOOK_SOURCE="${COOKBOOK_RECIPE}/source"
export COOKBOOK_SYSROOT="${TARGET_DIR}/sysroot"
export PKG_CONFIG_ALLOW_CROSS=1
export PKG_CONFIG_PATH=
export PKG_CONFIG_LIBDIR="${COOKBOOK_SYSROOT}/lib/pkgconfig"
export PKG_CONFIG_SYSROOT_DIR="${COOKBOOK_SYSROOT}"
cd "${COOKBOOK_RECIPE}"
ops=()
for arg in "${@:2}"
do
if [ "$arg" == "--debug" ]
then
DEBUG=1
else
ops[${#ops[@]}]="$arg"
fi
done
for i in "${ops[@]}"
do
op "$recipe_name" "$i"
done
elif [ "$IGNORE_ERROR" != "1" ]
then
echo "cook.sh: recipe '$recipe_name' at not found" >&2
exit 1
fi
else
usage "{package}"
fi

View File

@ -10,7 +10,16 @@ else
recipes="$@"
fi
for recipe_path in $recipes
for recipe in $recipes
do
./cook.sh "$recipe_path" unfetch
if (echo "$recipe" | grep '.*/.*' >/dev/null); then
recipe_name=$(basename "$recipe")
recipe_path="$recipe"
else
recipe_name="$recipe"
recipe_path=`target/release/find_recipe $recipe`
fi
rm -rfv "$recipe_path"/source "$recipe_path"/source.tar
done