termux-packages/scripts/build/get_source/termux_download_src_archive.sh
Henrik Grimler 4e902a41a5 building packages: create termux_step_get_source function
Calls termux_git_clone_src if TERMUX_PKG_SRCURL ends with .git, and
termux_download_src_archive and termux_extract_src_archive otherwise.
termux_step_extract_package has been split up into the latter two
functions.

termux_step_post_extract_package has been renamed to
termux_step_post_get_source to reflect these changes.
2020-07-21 10:14:00 +02:00

20 lines
761 B
Bash

termux_download_src_archive() {
if [ -z "${TERMUX_PKG_SRCURL:=""}" ] || [ "${TERMUX_PKG_SKIP_SRC_EXTRACT-false}" = "true" ] || [ "$TERMUX_PKG_METAPACKAGE" = "true" ]; then
return
fi
local PKG_SRCURL=(${TERMUX_PKG_SRCURL[@]})
local PKG_SHA256=(${TERMUX_PKG_SHA256[@]})
if [ ! ${#PKG_SRCURL[@]} == ${#PKG_SHA256[@]} ] && [ ! ${#PKG_SHA256[@]} == 0 ]; then
termux_error_exit "Error: length of TERMUX_PKG_SRCURL isn't equal to length of TERMUX_PKG_SHA256."
fi
for i in $(seq 0 $(( ${#PKG_SRCURL[@]}-1 ))); do
local file="$TERMUX_PKG_CACHEDIR/$(basename "${PKG_SRCURL[$i]}")"
if [ "${PKG_SHA256[$i]}" == "" ]; then
termux_download "${PKG_SRCURL[$i]}" "$file"
else
termux_download "${PKG_SRCURL[$i]}" "$file" "${PKG_SHA256[$i]}"
fi
done
}