improve compiled

This commit is contained in:
David Young
2026-03-17 15:24:19 -06:00
parent b914b865d8
commit 3b6d69887e
2 changed files with 38 additions and 6 deletions

View File

@@ -106,27 +106,59 @@ fetch_source() {
if [ -n "$git_url" ]; then
echo " Cloning $git_url..."
git clone "$git_url" "$src_dir"
elif [ -n "$wget_url" ]; then
echo " Downloading $wget_url..."
wget -q "$wget_url" -P "$TMP_DIR"
local filename="${wget_url##*/}"
tar -xf "$TMP_DIR/$filename" -C "$src_dir" --strip-components=1
rm -f "$TMP_DIR/$filename"
local filepath="$TMP_DIR/$filename"
wget -q "$wget_url" -O "$filepath"
echo " Extracting $filename..."
case "$filename" in
*.zip)
unzip -q "$filepath" -d "$TMP_DIR"
local extracted
extracted=$(unzip -qql "$filepath" | head -n1 | awk '{print $NF}' | cut -d/ -f1)
mv "$TMP_DIR/$extracted" "$src_dir"
;;
*.tar.gz|*.tgz)
tar -xzf "$filepath" -C "$src_dir" --strip-components=1
;;
*.tar.bz2)
tar -xjf "$filepath" -C "$src_dir" --strip-components=1
;;
*.tar.xz)
tar -xJf "$filepath" -C "$src_dir" --strip-components=1
;;
*)
echo " Error: unknown file type for $filename"
exit 1
;;
esac
rm -f "$filepath"
else
echo " Error: no git or wget URL specified for $app"
exit 1
fi
}
# Parse and run steps for a given app
# cd into source directory and run steps
run_steps() {
local app="$1"
local steps="$2"
local src_dir="$TMP_DIR/$app"
echo " Building $app..."
if [ ! -d "$src_dir" ]; then
echo " Error: source directory $src_dir not found."
exit 1
fi
echo " Changing into $src_dir..."
cd "$src_dir"
echo " Building $app..."
IFS=',' read -ra step_list <<< "$steps"
for step in "${step_list[@]}"; do
step=$(echo "$step" | xargs)