0
0
mirror of https://github.com/termux/termux-packages.git synced 2024-11-23 14:56:16 +00:00
termux-packages/scripts/build/termux_step_make_install.sh
Henrik Grimler 9e90d1b31a
tree-wide: rename TERMUX_MAKE_PROCESSES to TERMUX_PKG_MAKE_PROCESSES
Some packages have issues with parallel builds and need to set
TERMUX_MAKE_PROCESSES=1. All other build variables that package
recipes set are prefixed with TERMUX_PKG, use that for MAKE_PROCESSES
as well for consistency.

%ci:no-build
2024-06-16 11:16:22 +02:00

37 lines
1.4 KiB
Bash

# shellcheck disable=SC2086
termux_step_make_install() {
[ "$TERMUX_PKG_METAPACKAGE" = "true" ] && return
if test -f build.ninja; then
ninja -j $TERMUX_PKG_MAKE_PROCESSES install
elif test -f setup.py || test -f pyproject.toml || test -f setup.cfg; then
pip install --no-deps . --prefix $TERMUX_PREFIX
elif ls ./*.cabal &>/dev/null; then
# Workaround until `cabal install` is fixed.
while read -r bin; do
[[ -f "$bin" ]] || termux_error_exit "'$bin', no such file. Has build completed?"
echo "INFO: Installing '$bin' component..."
cp "$bin" "$TERMUX_PREFIX/bin"
done< <(cat ./dist-newstyle/cache/plan.json | jq -r '."install-plan"[]|select(."component-name"? and (."component-name"|test("exe:.*")) and (.style == "local") )|."bin-file"')
elif ls ./*akefile &>/dev/null || [ -n "$TERMUX_PKG_EXTRA_MAKE_ARGS" ]; then
: "${TERMUX_PKG_MAKE_INSTALL_TARGET:="install"}"
# Some packages have problem with parallell install, and it does not buy much, so use -j 1.
if [ -z "$TERMUX_PKG_EXTRA_MAKE_ARGS" ]; then
make -j 1 ${TERMUX_PKG_MAKE_INSTALL_TARGET}
else
make -j 1 ${TERMUX_PKG_EXTRA_MAKE_ARGS} ${TERMUX_PKG_MAKE_INSTALL_TARGET}
fi
elif test -f Cargo.toml; then
termux_setup_rust
cargo install \
--jobs $TERMUX_PKG_MAKE_PROCESSES \
--path . \
--force \
--locked \
--no-track \
--target $CARGO_TARGET_NAME \
--root $TERMUX_PREFIX \
$TERMUX_PKG_EXTRA_CONFIGURE_ARGS
fi
}