|
|
e14835 |
#!/bin/bash
|
|
|
e14835 |
|
|
|
3b09af |
|
|
|
3b09af |
#
|
|
|
3b09af |
# Input environment variables
|
|
|
3b09af |
#
|
|
|
3b09af |
# PLATFORM - target platform (linux or windows)
|
|
|
3b09af |
# ARCH - bits (32 or 64)
|
|
|
3b09af |
# NATIVE_PLATFORM - folder name for store compiled utilities for build-time (debian, fedora, etc)
|
|
|
3b09af |
# NATIVE_ARCH - ^^^ bits (32 or 64)
|
|
|
3b09af |
# THREADS - amount of simultaneous threads for build process
|
|
|
3b09af |
# PACKET_BUILD_DIR - output directory (optional)
|
|
|
3b09af |
#
|
|
|
3b09af |
|
|
|
e14835 |
|
|
|
3b09af |
# check options
|
|
|
3b09af |
|
|
|
3b09af |
if [ -z "$NATIVE_PLATFORM" ]; then
|
|
|
3b09af |
NATIVE_PLATFORM="default"
|
|
|
3b09af |
fi
|
|
|
3b09af |
|
|
|
3b09af |
if [ -z "$NATIVE_ARCH" ]; then
|
|
|
3b09af |
NATIVE_ARCH=`uname -m`
|
|
|
3b09af |
if [ "$NATIVE_ARCH" = "x86_64" ]; then
|
|
|
3b09af |
NATIVE_ARCH="64"
|
|
|
3b09af |
elif [ "$NATIVE_ARCH" = "i686" ]; then
|
|
|
3b09af |
NATIVE_ARCH="32"
|
|
|
3b09af |
fi
|
|
|
3b09af |
fi
|
|
|
3b09af |
|
|
|
3b09af |
if [ -z "$TARGET_PLATFORM" ]; then
|
|
|
3b09af |
TARGET_PLATFORM="$NATIVE_PLATFORM"
|
|
|
3b09af |
fi
|
|
|
3b09af |
|
|
|
3b09af |
if [ -z "$ARCH" ]; then
|
|
|
3b09af |
ARCH="$NATIVE_ARCH"
|
|
|
e14835 |
fi
|
|
|
e14835 |
|
|
|
e14835 |
if [ -z "$THREADS" ]; then
|
|
|
3b09af |
THREADS=8
|
|
|
e14835 |
fi
|
|
|
e14835 |
|
|
|
3b09af |
export NATIVE_PLATFORM
|
|
|
3b09af |
export NATIVE_ARCH
|
|
|
3b09af |
export PLATFORM
|
|
|
3b09af |
export ARCH
|
|
|
3b09af |
export THREADS
|
|
|
e14835 |
|
|
|
e14835 |
# root
|
|
|
e14835 |
|
|
|
e7b20d |
ROOT_DIR=$(cd `dirname "$0"`; pwd)
|
|
|
e14835 |
ROOT_DIR=`dirname "$ROOT_DIR"`
|
|
|
e14835 |
ROOT_DIR=`dirname "$ROOT_DIR"`
|
|
|
e14835 |
export ROOT_DIR
|
|
|
e14835 |
|
|
|
e14835 |
# dirs
|
|
|
e14835 |
|
|
|
e14835 |
export SCRIPT_DIR=$ROOT_DIR/script
|
|
|
e14835 |
export COMMON_SCRIPT_DIR=$SCRIPT_DIR/common
|
|
|
e14835 |
export INCLUDE_SCRIPT_DIR=$SCRIPT_DIR/include
|
|
|
e14835 |
export PACKET_SCRIPT_DIR=$SCRIPT_DIR/packet
|
|
|
3b09af |
if [ -z "$PACKET_BUILD_DIR" ]; then
|
|
|
3b09af |
export PACKET_BUILD_DIR=$ROOT_DIR/packet
|
|
|
dd482a |
fi
|
|
|
3b09af |
export PACKET_DIR=$PACKET_BUILD_DIR/$PLATFORM-$ARCH
|
|
|
3b09af |
export NATIVE_PACKET_DIR=$PACKET_BUILD_DIR/$NATIVE_PLATFORM-$NATIVE_ARCH-native
|
|
|
dd482a |
|
|
|
efc424 |
# toolchain
|
|
|
efc424 |
|
|
|
3b09af |
export TOOLCHAIN_SCRIPT_DIR=$SCRIPT_DIR/toolchain
|
|
|
3b09af |
export NATIVE_TOOLCHAIN_SCRIPT="$TOOLCHAIN_SCRIPT_DIR/none.sh"
|
|
|
3b09af |
export TOOLCHAIN_SCRIPT="$TOOLCHAIN_SCRIPT_DIR/$PLATFORM-$ARCH.sh"
|
|
|
3b09af |
if [ ! -f "$TOOLCHAIN_SCRIPT" ]; then
|
|
|
3b09af |
TOOLCHAIN_SCRIPT=$NATIVE_TOOLCHAIN_SCRIPT
|
|
|
efc424 |
fi
|
|
|
efc424 |
|
|
|
3b09af |
# work vars
|
|
|
3b09af |
|
|
|
3b09af |
IS_NATIVE=
|
|
|
7f8f8f |
DRY_RUN=
|
|
|
bce30d |
FORCE=
|
|
|
bce30d |
CLEAN_BEFORE_DO=
|
|
|
7f8f8f |
NO_CHECK_DEPS=
|
|
|
7f8f8f |
declare -A COMPLETION_STATUS
|
|
|
7f8f8f |
|
|
|
3b09af |
|
|
|
e14835 |
#
|
|
|
e14835 |
# Fairy Tale
|
|
|
e14835 |
#
|
|
|
e14835 |
# Once upon time in faraway...
|
|
|
e14835 |
#
|
|
|
e14835 |
# Function dependency:
|
|
|
e14835 |
#
|
|
|
3b09af |
# 1. download
|
|
|
3b09af |
# |
|
|
|
3b09af |
# 2. unpack
|
|
|
3b09af |
# |
|
|
|
3b09af |
# | env^
|
|
|
3b09af |
# | |
|
|
|
3b09af |
# 3. | envdeps
|
|
|
3b09af |
# | | | |
|
|
|
3b09af |
# env^^ | | | |
|
|
|
3b09af |
# | | | | |
|
|
|
3b09af |
# | env_native^ | | | |
|
|
|
3b09af |
# | | | | | |
|
|
|
3b09af |
# 4. envdeps_native | | | |
|
|
|
3b09af |
# | | | | | | |
|
|
|
3b09af |
# 5. | | build | |
|
|
|
e7fa50 |
# | | | | | |
|
|
|
e7fa50 |
# 7. | --install | (you see the direct connection 'build' with 'license', trust me)
|
|
|
e7fa50 |
# | | || | |
|
|
|
e7fa50 |
# 8. | | || env
|
|
|
e7fa50 |
# | | || | |
|
|
|
e7fa50 |
# | | || | envdeps*
|
|
|
e7fa50 |
# | | || |
|
|
|
e7fa50 |
# | | || envdeps_native**
|
|
|
e7fa50 |
# | | ||
|
|
|
e7fa50 |
# 9. env_native | ||
|
|
|
e7fa50 |
# | | ||
|
|
|
e7fa50 |
# envdeps_native* | ||
|
|
|
e7fa50 |
# | ||
|
|
|
e7fa50 |
# 10. | license
|
|
|
e7fa50 |
# | |
|
|
|
e7fa50 |
# | | env_release^
|
|
|
e7fa50 |
# | | |
|
|
|
e7fa50 |
# 11. | | envdeps_release
|
|
|
e7fa50 |
# | | | |
|
|
|
e7fa50 |
# 12. install_release |
|
|
|
3b09af |
# | |
|
|
|
e7fa50 |
# 13. env_release
|
|
|
3b09af |
# |
|
|
|
3b09af |
# envdeps_release*
|
|
|
e14835 |
#
|
|
|
3b09af |
|
|
|
e14835 |
|
|
|
7f8f8f |
FUNC_DEPS_download=""
|
|
|
7f8f8f |
FUNC_DEPS_unpack="download"
|
|
|
7f8f8f |
FUNC_DEPS_envdeps="-env"
|
|
|
3b09af |
FUNC_DEPS_envdeps_native="--env -env_native"
|
|
|
3b09af |
FUNC_DEPS_build="envdeps envdeps_native unpack"
|
|
|
e7fa50 |
FUNC_DEPS_install="envdeps envdeps_native build"
|
|
|
427aed |
FUNC_DEPS_env="envdeps install"
|
|
|
3b09af |
FUNC_DEPS_env_native="envdeps_native"
|
|
|
e7fa50 |
FUNC_DEPS_license="build install"
|
|
|
7f8f8f |
FUNC_DEPS_envdeps_release="-env_release"
|
|
|
e7fa50 |
FUNC_DEPS_install_release="envdeps_release install license"
|
|
|
427aed |
FUNC_DEPS_env_release="envdeps_release install_release"
|
|
|
7f8f8f |
|
|
|
e14835 |
|
|
|
3b09af |
# helpers
|
|
|
3b09af |
|
|
|
e7fa50 |
source "$COMMON_SCRIPT_DIR/helpers.sh"
|
|
|
99b145 |
|
|
|
f17b54 |
# initial system vars
|
|
|
f17b54 |
|
|
|
f17b54 |
unset VARS_TO_RESTORE
|
|
|
f17b54 |
vars_clear "TC_"
|
|
|
f17b54 |
vars_clear "INITIAL_"
|
|
|
f17b54 |
vars_backup "INITIAL_"
|
|
|
99b145 |
|
|
|
3b09af |
# internal functions
|
|
|
3b09af |
|
|
|
e14835 |
message() {
|
|
|
3b09af |
local MESSAGE=$1
|
|
|
3b09af |
echo " ------ $MESSAGE"
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
7f8f8f |
try_do_nothing() {
|
|
|
7f8f8f |
if [ -z "$DRY_RUN" ]; then
|
|
|
7f8f8f |
return 1
|
|
|
7f8f8f |
fi
|
|
|
7f8f8f |
set_done $1 $2
|
|
|
7f8f8f |
}
|
|
|
7f8f8f |
|
|
|
e14835 |
set_done() {
|
|
|
3b09af |
local PACKET=$1
|
|
|
3b09af |
local FUNC=$2
|
|
|
3b09af |
local COMPLETION_KEY="$PLATFORM:$ARCH:$PACKET:$FUNC"
|
|
|
7f8f8f |
if [ -z "$DRY_RUN" ]; then
|
|
|
3b09af |
touch "$PACKET_DIR/$PACKET/$FUNC.done"
|
|
|
7f8f8f |
fi
|
|
|
7f8f8f |
COMPLETION_STATUS[$COMPLETION_KEY]=complete
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
e14835 |
set_undone_silent() {
|
|
|
3b09af |
local PACKET=$1
|
|
|
3b09af |
local FUNC=$2
|
|
|
3b09af |
local COMPLETION_KEY="$PLATFORM:$ARCH:$PACKET:$FUNC"
|
|
|
7f8f8f |
if [ -z "$DRY_RUN" ]; then
|
|
|
3b09af |
rm -f $PACKET_DIR/$PACKET/$FUNC.*.done
|
|
|
3b09af |
rm -f "$PACKET_DIR/$PACKET/$FUNC.done"
|
|
|
7f8f8f |
fi
|
|
|
7f8f8f |
COMPLETION_STATUS[$COMPLETION_KEY]=incomplete
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
e14835 |
set_undone() {
|
|
|
3b09af |
local PACKET=$1
|
|
|
3b09af |
local FUNC=$2
|
|
|
3b09af |
message "$PACKET set_undone $FUNC"
|
|
|
3b09af |
set_undone_silent $PACKET $FUNC
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
e14835 |
clean_packet_directory_silent() {
|
|
|
3b09af |
local PACKET=$1
|
|
|
3b09af |
local FUNC=$2
|
|
|
3b09af |
set_undone_silent $PACKET $FUNC
|
|
|
3b09af |
try_do_nothing $PACKET $FUNC && return 0
|
|
|
3b09af |
rm -rf "$PACKET_DIR/$PACKET/$FUNC"
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
e14835 |
clean_packet_directory() {
|
|
|
3b09af |
local PACKET=$1
|
|
|
3b09af |
local FUNC=$2
|
|
|
3b09af |
message "$PACKET clean $FUNC"
|
|
|
3b09af |
clean_packet_directory_silent $PACKET $FUNC
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
e14835 |
check_packet_function() {
|
|
|
3b09af |
local PACKET=$1
|
|
|
3b09af |
local FUNC=$2
|
|
|
bce30d |
if [ ! -z "$FORCE" ]; then
|
|
|
bce30d |
return 1
|
|
|
bce30d |
fi
|
|
|
3b09af |
if [ ! -f "$PACKET_DIR/$PACKET/$FUNC.done" ]; then
|
|
|
e14835 |
return 1
|
|
|
e14835 |
fi
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
e14835 |
prepare_build() {
|
|
|
e14835 |
if ! copy "$UNPACK_PACKET_DIR" "$BUILD_PACKET_DIR"; then
|
|
|
e14835 |
return 1
|
|
|
e14835 |
fi
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
d32e1c |
prepare_install() {
|
|
|
ec0475 |
if ls $BUILD_PACKET_DIR/version-* 1> /dev/null 2>&1; then
|
|
|
ec0475 |
cp --remove-destination $BUILD_PACKET_DIR/version-* "$INSTALL_PACKET_DIR/" || true
|
|
|
ec0475 |
fi
|
|
|
e7fa50 |
}
|
|
|
e7fa50 |
|
|
|
e7fa50 |
prepare_license() {
|
|
|
e7fa50 |
rm -f "$LICENSE_PACKET_DIR/"*
|
|
|
d32e1c |
}
|
|
|
d32e1c |
|
|
|
d32e1c |
prepare_install_release() {
|
|
|
ec0475 |
if ls $INSTALL_PACKET_DIR/version-* 1> /dev/null 2>&1; then
|
|
|
ec0475 |
cp --remove-destination $INSTALL_PACKET_DIR/version-* "$INSTALL_RELEASE_PACKET_DIR/" || true
|
|
|
ec0475 |
fi
|
|
|
e7fa50 |
mkdir -p "$INSTALL_RELEASE_PACKET_DIR/license" || return 1
|
|
|
e7fa50 |
copy "$LICENSE_PACKET_DIR" "$INSTALL_RELEASE_PACKET_DIR/license" || return 1
|
|
|
d32e1c |
}
|
|
|
d32e1c |
|
|
|
e14835 |
set_environment_vars() {
|
|
|
f17b54 |
|
|
|
f17b54 |
for VAR in $VARS_TO_RESTORE; do
|
|
|
f17b54 |
VAR_FROM="INITIAL_$VAR"
|
|
|
f17b54 |
if [ -z ${!VAR_FROM+x} ]; then
|
|
|
f17b54 |
unset $VAR
|
|
|
f17b54 |
else
|
|
|
cc53b4 |
eval export $VAR='${!VAR_FROM}'
|
|
|
f17b54 |
fi
|
|
|
f17b54 |
done
|
|
|
f17b54 |
|
|
|
f17b54 |
|
|
|
f17b54 |
VARS_TO_RESTORE=
|
|
|
f17b54 |
for VAR in $(allvars); do
|
|
|
f17b54 |
if [[ "$VAR" = TC_* ]]; then
|
|
|
cc53b4 |
VARS_TO_RESTORE="$VARS_TO_RESTORE ${VAR#TC_}"
|
|
|
f17b54 |
fi
|
|
|
f17b54 |
done
|
|
|
f17b54 |
vars_restore "TC_" "export"
|
|
|
f17b54 |
|
|
|
f17b54 |
|
|
|
e14835 |
export NAME=$1
|
|
|
e14835 |
|
|
|
99b145 |
export CURRENT_PACKET_DIR="$PACKET_DIR/$NAME"
|
|
|
99b145 |
export FILES_PACKET_DIR="$PACKET_SCRIPT_DIR/$NAME.files"
|
|
|
99b145 |
export DOWNLOAD_PACKET_DIR="$CURRENT_PACKET_DIR/download"
|
|
|
99b145 |
export UNPACK_PACKET_DIR="$CURRENT_PACKET_DIR/unpack"
|
|
|
99b145 |
export ENVDEPS_PACKET_DIR="$CURRENT_PACKET_DIR/envdeps"
|
|
|
99b145 |
export ENVDEPS_NATIVE_PACKET_DIR="$CURRENT_PACKET_DIR/envdeps_native"
|
|
|
99b145 |
export BUILD_PACKET_DIR="$CURRENT_PACKET_DIR/build"
|
|
|
99b145 |
export LICENSE_PACKET_DIR="$CURRENT_PACKET_DIR/license"
|
|
|
99b145 |
export INSTALL_PACKET_DIR="$CURRENT_PACKET_DIR/install"
|
|
|
99b145 |
export INSTALL_RELEASE_PACKET_DIR="$CURRENT_PACKET_DIR/install_release"
|
|
|
99b145 |
export ENV_PACKET_DIR="$CURRENT_PACKET_DIR/env"
|
|
|
99b145 |
export ENV_NATIVE_PACKET_DIR="$CURRENT_PACKET_DIR/env_native"
|
|
|
99b145 |
export ENVDEPS_RELEASE_PACKET_DIR="$CURRENT_PACKET_DIR/envdeps_release"
|
|
|
99b145 |
export ENV_RELEASE_PACKET_DIR="$CURRENT_PACKET_DIR/env_release"
|
|
|
e14835 |
|
|
|
3b09af |
export PATH="\
|
|
|
3b09af |
$ENVDEPS_NATIVE_PACKET_DIR/bin:\
|
|
|
3b09af |
$ENV_NATIVE_PACKET_DIR/bin:\
|
|
|
3b09af |
$ENVDEPS_PACKET_DIR/bin:\
|
|
|
3b09af |
$ENV_PACKET_DIR/bin:\
|
|
|
f17b54 |
$TC_PATH"
|
|
|
3b09af |
|
|
|
3b09af |
export LD_LIBRARY_PATH="\
|
|
|
3b09af |
$ENVDEPS_NATIVE_PACKET_DIR/lib:\
|
|
|
3b09af |
$ENVDEPS_NATIVE_PACKET_DIR/lib64\
|
|
|
3b09af |
$ENV_NATIVE_PACKET_DIR/lib:\
|
|
|
3b09af |
$ENV_NATIVE_PACKET_DIR/lib64:\
|
|
|
3b09af |
$ENVDEPS_PACKET_DIR/lib:\
|
|
|
3b09af |
$ENVDEPS_PACKET_DIR/lib64:\
|
|
|
3b09af |
$ENV_PACKET_DIR/lib:\
|
|
|
3b09af |
$ENV_PACKET_DIR/lib64:\
|
|
|
f17b54 |
$TC_LD_LIBRARY_PATH"
|
|
|
f17b54 |
|
|
|
f17b54 |
export LDFLAGS="-L$ENVDEPS_PACKET_DIR/lib -L$ENVDEPS_PACKET_DIR/lib64 $TC_LDFLAGS"
|
|
|
f17b54 |
export CFLAGS="-I$ENVDEPS_PACKET_DIR/include $TC_CFLAGS"
|
|
|
f17b54 |
export CPPFLAGS="-I$ENVDEPS_PACKET_DIR/include $TC_CPPFLAGS"
|
|
|
f17b54 |
export CXXFLAGS="-I$ENVDEPS_PACKET_DIR/include $TC_CXXFLAGS"
|
|
|
132b2e |
export PKG_CONFIG_PATH="$ENVDEPS_PACKET_DIR/lib/pkgconfig:$ENVDEPS_PACKET_DIR/lib64/pkgconfig:$ENVDEPS_PACKET_DIR/share/pkgconfig:$TC_PKG_CONFIG_PATH"
|
|
|
132b2e |
export PKG_CONFIG_LIBDIR="$ENVDEPS_PACKET_DIR/lib:$ENVDEPS_PACKET_DIR/lib64:$TC_PKG_CONFIG_LIBDIR"
|
|
|
cf8c28 |
export PKG_CONFIG_SYSROOT_DIR="/"
|
|
|
f17b54 |
export XDG_DATA_DIRS="$ENVDEPS_PACKET_DIR/share:$TC_XDG_DATA_DIRS"
|
|
|
f17b54 |
export ACLOCAL_PATH="$ENVDEPS_PACKET_DIR/share/aclocal:$TC_ACLOCAL_PATH"
|
|
|
f17b54 |
export CMAKE_INCLUDE_PATH="$ENVDEPS_PACKET_DIR/include:$TC_CMAKE_INCLUDE_PATH"
|
|
|
f17b54 |
export CMAKE_LIBRARY_PATH="$ENVDEPS_PACKET_DIR/lib:$ENVDEPS_PACKET_DIR/lib64:$TC_CMAKE_LIBRARY_PATH"
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
e14835 |
call_packet_function() {
|
|
|
e14835 |
local NAME=$1
|
|
|
e14835 |
local FUNC=$2
|
|
|
e14835 |
local PREPARE_FUNC=$3
|
|
|
e14835 |
local FINALIZE_FUNC=$4
|
|
|
7f8f8f |
local COMPARE_RESULTS=$5
|
|
|
e14835 |
|
|
|
e14835 |
set_environment_vars $NAME
|
|
|
e14835 |
|
|
|
e14835 |
local FUNC_NAME=pk$FUNC
|
|
|
e14835 |
local FUNC_CURRENT_PACKET_DIR=$CURRENT_PACKET_DIR/$FUNC
|
|
|
e14835 |
|
|
|
e14835 |
message "$NAME $FUNC"
|
|
|
7f8f8f |
try_do_nothing $NAME $FUNC && return 0
|
|
|
b22744 |
echo "${DRY_RUN_DONE[@]}"
|
|
|
b22744 |
|
|
|
b22744 |
local PREV_HASH=
|
|
|
b22744 |
if [ "$COMPARE_RESULTS" = "compare_results" ]; then
|
|
|
b22744 |
if check_packet_function $NAME $FUNC; then
|
|
|
b22744 |
PREV_HASH=`sha512dir "$FUNC_CURRENT_PACKET_DIR"`
|
|
|
b22744 |
[ ! $? -eq 0 ] && return 1
|
|
|
b22744 |
echo "sha512: $PREV_HASH"
|
|
|
b22744 |
fi
|
|
|
cf8c28 |
else
|
|
|
b22744 |
set_undone_silent $NAME $FUNC
|
|
|
b22744 |
fi
|
|
|
e14835 |
|
|
|
e14835 |
mkdir -p $FUNC_CURRENT_PACKET_DIR
|
|
|
e14835 |
cd $FUNC_CURRENT_PACKET_DIR
|
|
|
e14835 |
|
|
|
69b66f |
source $INCLUDE_SCRIPT_DIR/inc-pkall-none.sh
|
|
|
7f8f8f |
[ ! $? -eq 0 ] && return 1
|
|
|
e14835 |
source "$PACKET_SCRIPT_DIR/$NAME.sh"
|
|
|
e14835 |
[ ! $? -eq 0 ] && return 1
|
|
|
e14835 |
|
|
|
e14835 |
if [ ! -z "$PREPARE_FUNC" ]; then
|
|
|
e14835 |
if ! "$PREPARE_FUNC"; then
|
|
|
e14835 |
return 1
|
|
|
e14835 |
fi
|
|
|
e14835 |
fi
|
|
|
e14835 |
|
|
|
e14835 |
if ! "$FUNC_NAME"; then
|
|
|
e14835 |
return 1
|
|
|
e14835 |
fi
|
|
|
e14835 |
|
|
|
e14835 |
if [ ! -z "$FINALIZE_FUNC" ]; then
|
|
|
e14835 |
if ! "$FINALIZE_FUNC"; then
|
|
|
e14835 |
return 1
|
|
|
e14835 |
fi
|
|
|
e14835 |
fi
|
|
|
e14835 |
|
|
|
b22744 |
if [ ! -z "$PREV_HASH" ]; then
|
|
|
b22744 |
local HASH=`sha512dir "$FUNC_CURRENT_PACKET_DIR"`
|
|
|
b22744 |
[ ! $? -eq 0 ] && return 1
|
|
|
b22744 |
echo "sha512: $HASH"
|
|
|
b22744 |
if [ "$HASH" = "$PREV_HASH" ]; then
|
|
|
b22744 |
message "$NAME $FUNC - not changed"
|
|
|
b22744 |
return 0
|
|
|
b22744 |
else
|
|
|
b22744 |
message "$NAME $FUNC - changed"
|
|
|
b22744 |
fi
|
|
|
b22744 |
fi
|
|
|
7f8f8f |
|
|
|
e14835 |
set_done $NAME $FUNC
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
e14835 |
foreach_deps() {
|
|
|
e14835 |
local NAME=$1
|
|
|
e14835 |
local FUNC=$2
|
|
|
e14835 |
local RECURSIVE=$3
|
|
|
3b09af |
local NATIVE=$4
|
|
|
3b09af |
local WAS_NATIVE=$IS_NATIVE
|
|
|
e14835 |
|
|
|
7f8f8f |
source $INCLUDE_SCRIPT_DIR/inc-pkall-none.sh
|
|
|
7f8f8f |
[ ! $? -eq 0 ] && return 1
|
|
|
7f8f8f |
source "$PACKET_SCRIPT_DIR/$NAME.sh"
|
|
|
e14835 |
[ ! $? -eq 0 ] && return 1
|
|
|
3b09af |
if [ ! -z "$WAS_NATIVE" ]; then
|
|
|
3b09af |
DEPS="$DEPS $DEPS_NATIVE"
|
|
|
3b09af |
DEPS_NATIVE=
|
|
|
3b09af |
fi
|
|
|
3b09af |
|
|
|
e14835 |
local CURRENT_DEPS=$DEPS
|
|
|
3b09af |
local CURRENT_DEPS_NATIVE=$DEPS_NATIVE
|
|
|
3b09af |
local PROCESS_SELF=""
|
|
|
3b09af |
if [ "$NATIVE" = "native" ]; then
|
|
|
3b09af |
CURRENT_DEPS=$DEPS_NATIVE
|
|
|
cc53b4 |
if [ ! -z "$TC_HOST" ]; then
|
|
|
3b09af |
PROCESS_SELF="process_self"
|
|
|
3b09af |
fi
|
|
|
3b09af |
fi
|
|
|
3b09af |
|
|
|
e14835 |
for DEP in $CURRENT_DEPS; do
|
|
|
3b09af |
if [ ! -z "$DEP" ] && [ "$DEP" != "$NAME" -o "$PROCESS_SELF" = "process_self" ]; then
|
|
|
3b09af |
local DEP_LOCAL=$DEP
|
|
|
3b09af |
if [ "$RECURSIVE" = "recursive" ]; then
|
|
|
3b09af |
if ! foreach_deps "$DEP_LOCAL" "$FUNC" "$RECURSIVE"; then
|
|
|
3b09af |
return 1
|
|
|
3b09af |
fi
|
|
|
3b09af |
fi
|
|
|
e14835 |
if ! "$FUNC" "$DEP_LOCAL" "$NAME"; then
|
|
|
e14835 |
return 1
|
|
|
e14835 |
fi
|
|
|
e14835 |
fi
|
|
|
3b09af |
done
|
|
|
3b09af |
|
|
|
3b09af |
if [ "$RECURSIVE" = "recursive" ]; then
|
|
|
3b09af |
for DEP in $CURRENT_DEPS_NATIVE; do
|
|
|
cc53b4 |
if [ ! -z "$DEP" ] && [ "$DEP" != "$NAME" -o ! -z "$TC_HOST" ]; then
|
|
|
3b09af |
local DEP_LOCAL=$DEP
|
|
|
3b09af |
if ! native foreach_deps "$DEP_LOCAL" "$FUNC" "$RECURSIVE"; then
|
|
|
3b09af |
return 1
|
|
|
3b09af |
fi
|
|
|
3b09af |
if ! native "$FUNC" "$DEP_LOCAL" "$NAME"; then
|
|
|
3b09af |
return 1
|
|
|
3b09af |
fi
|
|
|
3b09af |
fi
|
|
|
3b09af |
done
|
|
|
3b09af |
fi
|
|
|
3b09af |
}
|
|
|
3b09af |
|
|
|
3b09af |
set_toolchain() {
|
|
|
3b09af |
if [ "$1" = "native" ]; then
|
|
|
3b09af |
IS_NATIVE=1
|
|
|
3b09af |
if [ ! "$2" = "silent" ]; then
|
|
|
3b09af |
echo " --- set toolchain $NATIVE_PLATFORM-$NATIVE_ARCH (native)"
|
|
|
3b09af |
fi
|
|
|
3b09af |
source $NATIVE_TOOLCHAIN_SCRIPT
|
|
|
3b09af |
else
|
|
|
3b09af |
IS_NATIVE=
|
|
|
3b09af |
if [ ! "$2" = "silent" ]; then
|
|
|
3b09af |
echo " --- set toolchain $PLATFORM-$ARCH (target)"
|
|
|
3b09af |
fi
|
|
|
3b09af |
source $NATIVE_TOOLCHAIN_SCRIPT
|
|
|
3b09af |
source $TOOLCHAIN_SCRIPT
|
|
|
3b09af |
fi
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
7f8f8f |
is_complete() {
|
|
|
3b09af |
local NAME=$1
|
|
|
3b09af |
local FUNC=$2
|
|
|
3b09af |
|
|
|
3b09af |
local WAS_NATIVE=$IS_NATIVE
|
|
|
3b09af |
local WAS_PLATFORM=$PLATFORM
|
|
|
3b09af |
local WAS_ARCH=$ARCH
|
|
|
3b09af |
local WAS_PACKET_DIR=$PACKET_DIR
|
|
|
3b09af |
local PROCESS_SELF=""
|
|
|
cc53b4 |
if [ ! -z "$TC_HOST" ]; then
|
|
|
3b09af |
PROCESS_SELF="process_self"
|
|
|
3b09af |
fi
|
|
|
3b09af |
|
|
|
3b09af |
local SUBFUNCS_VAR_NAME=FUNC_DEPS_$FUNC
|
|
|
7f8f8f |
local SUBFUNCS=${!SUBFUNCS_VAR_NAME}
|
|
|
3b09af |
local COMPLETION_KEY="$PLATFORM:$ARCH:$NAME:$FUNC"
|
|
|
3b09af |
if [ ! -z ${COMPLETION_STATUS[$COMPLETION_KEY]} ]; then
|
|
|
3b09af |
if [ "${COMPLETION_STATUS[$COMPLETION_KEY]}" = "complete" ]; then
|
|
|
3b09af |
return 0
|
|
|
3b09af |
else
|
|
|
3b09af |
return 1
|
|
|
3b09af |
fi
|
|
|
3b09af |
fi
|
|
|
7f8f8f |
|
|
|
3b09af |
COMPLETION_STATUS[$COMPLETION_KEY]=incomplete
|
|
|
3b09af |
|
|
|
3b09af |
if ! check_packet_function $1 $2; then
|
|
|
3b09af |
return 1
|
|
|
3b09af |
fi
|
|
|
3b09af |
if [ ! -z "$NO_CHECK_DEPS" ]; then
|
|
|
3b09af |
COMPLETION_STATUS[$COMPLETION_KEY]=complete
|
|
|
3b09af |
return 0
|
|
|
3b09af |
fi
|
|
|
3b09af |
|
|
|
3b09af |
source $INCLUDE_SCRIPT_DIR/inc-pkall-none.sh
|
|
|
7f8f8f |
[ ! $? -eq 0 ] && return 1
|
|
|
7f8f8f |
source "$PACKET_SCRIPT_DIR/$NAME.sh"
|
|
|
7f8f8f |
[ ! $? -eq 0 ] && return 1
|
|
|
3b09af |
if [ ! -z "$WAS_NATIVE" ]; then
|
|
|
3b09af |
DEPS="$DEPS $DEPS_NATIVE"
|
|
|
3b09af |
DEPS_NATIVE=
|
|
|
3b09af |
fi
|
|
|
7f8f8f |
|
|
|
3b09af |
local FAIL=
|
|
|
3b09af |
local CURRENT_DEPS="$DEPS"
|
|
|
3b09af |
local CURRENT_DEPS_NATIVE="$DEPS_NATIVE"
|
|
|
3b09af |
for SUBFUNC in $SUBFUNCS; do
|
|
|
3b09af |
local SUBFUNC_LOCAL=$SUBFUNC
|
|
|
3b09af |
if [ "${SUBFUNC_LOCAL:0:2}" = "--" ]; then
|
|
|
3b09af |
if [ ! -z "$CURRENT_DEPS_NATIVE" ]; then
|
|
|
3b09af |
SUBFUNC_LOCAL=${SUBFUNC_LOCAL:2}
|
|
|
3b09af |
if [ -z "$WAS_NATIVE" ]; then
|
|
|
3b09af |
set_toolchain "native" "silent"
|
|
|
3b09af |
PLATFORM=$NATIVE_PLATFORM
|
|
|
3b09af |
ARCH=$NATIVE_ARCH
|
|
|
3b09af |
PACKET_DIR=$NATIVE_PACKET_DIR
|
|
|
3b09af |
fi
|
|
|
3b09af |
for DEP in $CURRENT_DEPS_NATIVE; do
|
|
|
3b09af |
if [ ! -z "$DEP" ] && [ "$DEP" != "$NAME" -o "$PROCESS_SELF" = "process_self" ]; then
|
|
|
3b09af |
local DEP_LOCAL=$DEP
|
|
|
3b09af |
if ! is_complete $DEP_LOCAL $SUBFUNC_LOCAL; then
|
|
|
3b09af |
FAIL=1
|
|
|
3b09af |
break
|
|
|
3b09af |
fi
|
|
|
3b09af |
if [ "$WAS_PACKET_DIR/$NAME/$FUNC.done" -ot "$PACKET_DIR/$DEP_LOCAL/$SUBFUNC_LOCAL.done" ]; then
|
|
|
3b09af |
FAIL=1
|
|
|
3b09af |
break
|
|
|
3b09af |
fi
|
|
|
3b09af |
fi
|
|
|
3b09af |
done
|
|
|
3b09af |
if [ -z "$WAS_NATIVE" ]; then
|
|
|
3b09af |
PLATFORM=$WAS_PLATFORM
|
|
|
3b09af |
ARCH=$WAS_ARCH
|
|
|
3b09af |
PACKET_DIR=$WAS_PACKET_DIR
|
|
|
3b09af |
set_toolchain "" "silent"
|
|
|
3b09af |
fi
|
|
|
3b09af |
if [ ! -z "$FAIL" ]; then
|
|
|
3b09af |
return 1
|
|
|
3b09af |
fi
|
|
|
3b09af |
fi
|
|
|
3b09af |
elif [ "${SUBFUNC_LOCAL:0:1}" = "-" ]; then
|
|
|
3b09af |
SUBFUNC_LOCAL=${SUBFUNC_LOCAL:1}
|
|
|
3b09af |
for DEP in $CURRENT_DEPS; do
|
|
|
3b09af |
if [ ! -z "$DEP" ] && [ "$DEP" != "$NAME" ]; then
|
|
|
3b09af |
local DEP_LOCAL=$DEP
|
|
|
3b09af |
if ! is_complete $DEP_LOCAL $SUBFUNC_LOCAL; then
|
|
|
3b09af |
return 1
|
|
|
3b09af |
fi
|
|
|
3b09af |
if [ "$PACKET_DIR/$NAME/$FUNC.done" -ot "$PACKET_DIR/$DEP_LOCAL/$SUBFUNC_LOCAL.done" ]; then
|
|
|
3b09af |
return 1
|
|
|
3b09af |
fi
|
|
|
3b09af |
fi
|
|
|
3b09af |
done
|
|
|
3b09af |
else
|
|
|
3b09af |
if ! is_complete $NAME $SUBFUNC_LOCAL; then
|
|
|
3b09af |
return 1
|
|
|
3b09af |
fi
|
|
|
3b09af |
if [ "$PACKET_DIR/$NAME/$FUNC.done" -ot "$PACKET_DIR/$NAME/$SUBFUNC_LOCAL.done" ]; then
|
|
|
3b09af |
return 1
|
|
|
3b09af |
fi
|
|
|
3b09af |
fi
|
|
|
3b09af |
done
|
|
|
7f8f8f |
|
|
|
3b09af |
COMPLETION_STATUS[$COMPLETION_KEY]=complete
|
|
|
7f8f8f |
}
|
|
|
7f8f8f |
|
|
|
7f8f8f |
prepare() {
|
|
|
3b09af |
local NAME=$1
|
|
|
3b09af |
local FUNC=$2
|
|
|
3b09af |
|
|
|
3b09af |
local WAS_NATIVE=$IS_NATIVE
|
|
|
3b09af |
local WAS_PLATFORM=$PLATFORM
|
|
|
3b09af |
local WAS_ARCH=$ARCH
|
|
|
3b09af |
local WAS_PACKET_DIR=$PACKET_DIR
|
|
|
3b09af |
local PROCESS_SELF=""
|
|
|
cc53b4 |
if [ ! -z "$TC_HOST" ]; then
|
|
|
3b09af |
PROCESS_SELF="process_self"
|
|
|
3b09af |
fi
|
|
|
3b09af |
|
|
|
3b09af |
local SUBFUNCS_VAR_NAME=FUNC_DEPS_$FUNC
|
|
|
7f8f8f |
local SUBFUNCS=${!SUBFUNCS_VAR_NAME}
|
|
|
7f8f8f |
|
|
|
3b09af |
source $INCLUDE_SCRIPT_DIR/inc-pkall-none.sh
|
|
|
7f8f8f |
[ ! $? -eq 0 ] && return 1
|
|
|
7f8f8f |
source "$PACKET_SCRIPT_DIR/$NAME.sh"
|
|
|
7f8f8f |
[ ! $? -eq 0 ] && return 1
|
|
|
3b09af |
if [ ! -z "$WAS_NATIVE" ]; then
|
|
|
3b09af |
DEPS="$DEPS $DEPS_NATIVE"
|
|
|
3b09af |
DEPS_NATIVE=
|
|
|
3b09af |
fi
|
|
|
3b09af |
local FAIL=
|
|
|
3b09af |
local CURRENT_DEPS="$DEPS"
|
|
|
3b09af |
local CURRENT_DEPS_NATIVE="$DEPS_NATIVE"
|
|
|
3b09af |
for SUBFUNC in $SUBFUNCS; do
|
|
|
3b09af |
local SUBFUNC_LOCAL=$SUBFUNC
|
|
|
3b09af |
if [ "${SUBFUNC_LOCAL:0:2}" = "--" ]; then
|
|
|
3b09af |
if [ ! -z "$CURRENT_DEPS_NATIVE" ]; then
|
|
|
3b09af |
SUBFUNC_LOCAL=${SUBFUNC_LOCAL:2}
|
|
|
3b09af |
if [ -z "$WAS_NATIVE" ]; then
|
|
|
3b09af |
set_toolchain "native"
|
|
|
3b09af |
PLATFORM=$NATIVE_PLATFORM
|
|
|
3b09af |
ARCH=$NATIVE_ARCH
|
|
|
3b09af |
PACKET_DIR=$NATIVE_PACKET_DIR
|
|
|
3b09af |
fi
|
|
|
3b09af |
for DEP in $CURRENT_DEPS_NATIVE; do
|
|
|
3b09af |
if [ ! -z "$DEP" ] && [ "$DEP" != "$NAME" -o "$PROCESS_SELF" = "process_self" ]; then
|
|
|
3b09af |
if ! $SUBFUNC_LOCAL $DEP; then
|
|
|
3b09af |
FAIL=1
|
|
|
3b09af |
break
|
|
|
3b09af |
fi
|
|
|
3b09af |
fi
|
|
|
3b09af |
done
|
|
|
3b09af |
if [ -z "$WAS_NATIVE" ]; then
|
|
|
3b09af |
PLATFORM=$WAS_PLATFORM
|
|
|
3b09af |
ARCH=$WAS_ARCH
|
|
|
3b09af |
PACKET_DIR="$WAS_PACKET_DIR"
|
|
|
3b09af |
set_toolchain
|
|
|
3b09af |
fi
|
|
|
3b09af |
if [ ! -z "$FAIL" ]; then
|
|
|
3b09af |
return 1
|
|
|
3b09af |
fi
|
|
|
3b09af |
fi
|
|
|
3b09af |
elif [ "${SUBFUNC_LOCAL:0:1}" = "-" ]; then
|
|
|
3b09af |
SUBFUNC_LOCAL=${SUBFUNC_LOCAL:1}
|
|
|
3b09af |
for DEP in $CURRENT_DEPS; do
|
|
|
3b09af |
if [ ! -z "$DEP" ] && [ "$DEP" != "$NAME" ]; then
|
|
|
3b09af |
if ! $SUBFUNC_LOCAL $DEP; then
|
|
|
3b09af |
return 1
|
|
|
3b09af |
fi
|
|
|
3b09af |
fi
|
|
|
3b09af |
done
|
|
|
3b09af |
elif ! $SUBFUNC_LOCAL $NAME; then
|
|
|
3b09af |
return 1
|
|
|
3b09af |
fi
|
|
|
3b09af |
done
|
|
|
3b09af |
|
|
|
3b09af |
if [ ! -z "$CLEAN_BEFORE_DO" ]; then
|
|
|
3b09af |
if ! clean_packet_directory $NAME $FUNC; then
|
|
|
3b09af |
return 1
|
|
|
3b09af |
fi
|
|
|
3b09af |
fi
|
|
|
7f8f8f |
}
|
|
|
7f8f8f |
|
|
|
e14835 |
add_envdeps() {
|
|
|
e14835 |
if ! copy "$PACKET_DIR/$1/env" "$PACKET_DIR/$2/envdeps"; then
|
|
|
e14835 |
return 1
|
|
|
e14835 |
fi
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
3b09af |
add_envdeps_native() {
|
|
|
3b09af |
if ! copy "$PACKET_DIR/$1/env_native" "$PACKET_DIR/$2/envdeps_native"; then
|
|
|
3b09af |
return 1
|
|
|
3b09af |
fi
|
|
|
3b09af |
}
|
|
|
3b09af |
|
|
|
3b09af |
add_envdeps_native_cross() {
|
|
|
3b09af |
if ! copy "$NATIVE_PACKET_DIR/$1/env" "$PACKET_DIR/$2/envdeps_native"; then
|
|
|
3b09af |
return 1
|
|
|
3b09af |
fi
|
|
|
3b09af |
}
|
|
|
3b09af |
|
|
|
e14835 |
add_envdeps_release() {
|
|
|
99b145 |
if ! copy "$PACKET_DIR/$1/env_release" "$PACKET_DIR/$2/envdeps_release"; then
|
|
|
99b145 |
return 1
|
|
|
99b145 |
fi
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
3b09af |
# functions
|
|
|
3b09af |
|
|
|
7f8f8f |
update() {
|
|
|
7f8f8f |
local NAME=$1
|
|
|
7f8f8f |
prepare $NAME download || return 1
|
|
|
7f8f8f |
call_packet_function $NAME download "" "" compare_results || return 1
|
|
|
7f8f8f |
}
|
|
|
7f8f8f |
|
|
|
e14835 |
download() {
|
|
|
7f8f8f |
local NAME=$1
|
|
|
7f8f8f |
is_complete $NAME download && return 0
|
|
|
7f8f8f |
prepare $NAME download || return 1
|
|
|
7f8f8f |
call_packet_function $NAME download || return 1
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
e14835 |
unpack() {
|
|
|
7f8f8f |
local NAME=$1
|
|
|
7f8f8f |
is_complete $NAME unpack && return 0
|
|
|
7f8f8f |
prepare $NAME unpack || return 1
|
|
|
7f8f8f |
call_packet_function $NAME unpack || return 1
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
e14835 |
envdeps() {
|
|
|
e14835 |
local NAME=$1
|
|
|
7f8f8f |
is_complete $NAME envdeps && return 0
|
|
|
99b145 |
prepare $NAME envdeps || return 1
|
|
|
e14835 |
|
|
|
e14835 |
message "$NAME envdeps"
|
|
|
7f8f8f |
try_do_nothing $NAME envdeps && return 0
|
|
|
e14835 |
|
|
|
e14835 |
clean_packet_directory_silent $NAME envdeps
|
|
|
e14835 |
mkdir -p "$PACKET_DIR/$NAME/envdeps"
|
|
|
99b145 |
if ! foreach_deps $NAME add_envdeps; then
|
|
|
99b145 |
return 1
|
|
|
99b145 |
fi
|
|
|
99b145 |
set_done $NAME envdeps
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
3b09af |
envdeps_native() {
|
|
|
3b09af |
local NAME=$1
|
|
|
3b09af |
is_complete $NAME envdeps_native && return 0
|
|
|
3b09af |
prepare $NAME envdeps_native || return 1
|
|
|
3b09af |
|
|
|
3b09af |
message "$NAME envdeps_native"
|
|
|
3b09af |
try_do_nothing $NAME envdeps_native && return 0
|
|
|
3b09af |
|
|
|
3b09af |
clean_packet_directory_silent $NAME envdeps_native
|
|
|
3b09af |
mkdir -p "$PACKET_DIR/$NAME/envdeps_native"
|
|
|
3b09af |
if ! foreach_deps $NAME add_envdeps_native; then
|
|
|
3b09af |
return 1
|
|
|
3b09af |
fi
|
|
|
3b09af |
if ! foreach_deps $NAME add_envdeps_native_cross "" "native"; then
|
|
|
3b09af |
return 1
|
|
|
3b09af |
fi
|
|
|
3b09af |
set_done $NAME envdeps_native
|
|
|
3b09af |
}
|
|
|
3b09af |
|
|
|
e14835 |
build() {
|
|
|
7f8f8f |
local NAME=$1
|
|
|
7f8f8f |
is_complete $NAME build && return 0
|
|
|
7f8f8f |
prepare $NAME build || return 1
|
|
|
7f8f8f |
call_packet_function $NAME build prepare_build || return 1
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
e14835 |
install() {
|
|
|
7f8f8f |
local NAME=$1
|
|
|
7f8f8f |
is_complete $NAME install && return 0
|
|
|
7f8f8f |
prepare $NAME install || return 1
|
|
|
d32e1c |
call_packet_function $NAME install prepare_install || return 1
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
e14835 |
env() {
|
|
|
e14835 |
local NAME=$1
|
|
|
7f8f8f |
is_complete $NAME env && return 0
|
|
|
7f8f8f |
prepare $NAME env || return 1
|
|
|
e14835 |
|
|
|
e14835 |
message "$NAME env"
|
|
|
7f8f8f |
try_do_nothing $NAME env && return 0
|
|
|
99b145 |
|
|
|
e14835 |
clean_packet_directory_silent $NAME env
|
|
|
e14835 |
mkdir -p "$PACKET_DIR/$NAME/env"
|
|
|
99b145 |
copy "$PACKET_DIR/$NAME/envdeps" "$PACKET_DIR/$NAME/env" || return 1
|
|
|
99b145 |
copy "$PACKET_DIR/$NAME/install" "$PACKET_DIR/$NAME/env" || return 1
|
|
|
99b145 |
|
|
|
99b145 |
set_done $NAME env
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
3b09af |
env_native() {
|
|
|
3b09af |
local NAME=$1
|
|
|
3b09af |
is_complete $NAME env_native && return 0
|
|
|
3b09af |
prepare $NAME env_native || return 1
|
|
|
3b09af |
|
|
|
3b09af |
message "$NAME env_native"
|
|
|
3b09af |
try_do_nothing $NAME env_native && return 0
|
|
|
3b09af |
|
|
|
3b09af |
clean_packet_directory_silent $NAME env_native
|
|
|
3b09af |
mkdir -p "$PACKET_DIR/$NAME/env_native"
|
|
|
3b09af |
if ! copy "$PACKET_DIR/$NAME/envdeps_native" "$PACKET_DIR/$NAME/env_native"; then
|
|
|
3b09af |
return 1
|
|
|
3b09af |
fi
|
|
|
3b09af |
set_done $NAME env_native
|
|
|
3b09af |
}
|
|
|
3b09af |
|
|
|
e7fa50 |
license() {
|
|
|
e7fa50 |
local NAME=$1
|
|
|
e7fa50 |
is_complete $NAME license && return 0
|
|
|
e7fa50 |
prepare $NAME license || return 1
|
|
|
e7fa50 |
call_packet_function $NAME license prepare_license || return 1
|
|
|
e7fa50 |
}
|
|
|
e7fa50 |
|
|
|
e14835 |
envdeps_release() {
|
|
|
e14835 |
local NAME=$1
|
|
|
7f8f8f |
is_complete $NAME envdeps_release && return 0
|
|
|
99b145 |
prepare $NAME envdeps_release || return 1
|
|
|
e14835 |
|
|
|
99b145 |
message "$NAME envdeps_release"
|
|
|
7f8f8f |
try_do_nothing $NAME envdeps_release && return 0
|
|
|
e14835 |
|
|
|
e14835 |
clean_packet_directory_silent $NAME envdeps_release
|
|
|
e14835 |
mkdir -p "$PACKET_DIR/$NAME/envdeps_release"
|
|
|
99b145 |
if ! foreach_deps $NAME add_envdeps_release; then
|
|
|
99b145 |
return 1
|
|
|
99b145 |
fi
|
|
|
99b145 |
set_done $NAME envdeps_release
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
b0fa99 |
install_release() {
|
|
|
7f8f8f |
local NAME=$1
|
|
|
7f8f8f |
is_complete $NAME install_release && return 0
|
|
|
7f8f8f |
prepare $NAME install_release || return 1
|
|
|
d32e1c |
call_packet_function $NAME install_release prepare_install_release || return 1
|
|
|
b0fa99 |
}
|
|
|
b0fa99 |
|
|
|
e14835 |
env_release() {
|
|
|
e14835 |
local NAME=$1
|
|
|
7f8f8f |
is_complete $NAME env_release && return 0
|
|
|
7f8f8f |
prepare $NAME env_release || return 1
|
|
|
e14835 |
|
|
|
99b145 |
message "$NAME env_release"
|
|
|
7f8f8f |
try_do_nothing $NAME env_release && return 0
|
|
|
99b145 |
|
|
|
e14835 |
clean_packet_directory_silent $NAME env_release
|
|
|
e14835 |
mkdir -p "$PACKET_DIR/$NAME/env_release"
|
|
|
99b145 |
copy "$PACKET_DIR/$NAME/envdeps_release" "$PACKET_DIR/$NAME/env_release" || return 1
|
|
|
99b145 |
copy "$PACKET_DIR/$NAME/install_release" "$PACKET_DIR/$NAME/env_release" || return 1
|
|
|
99b145 |
|
|
|
99b145 |
set_done $NAME env_release
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
e14835 |
|
|
|
e14835 |
#
|
|
|
e14835 |
|
|
|
e14835 |
clean_download() {
|
|
|
e14835 |
clean_packet_directory $1 download
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
e14835 |
clean_unpack() {
|
|
|
cf8c28 |
clean_packet_directory $1 unpack
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
e14835 |
clean_envdeps() {
|
|
|
e14835 |
clean_packet_directory $1 envdeps
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
3b09af |
clean_envdeps_native() {
|
|
|
3b09af |
clean_packet_directory $1 envdeps_native
|
|
|
3b09af |
}
|
|
|
3b09af |
|
|
|
e14835 |
clean_build() {
|
|
|
e14835 |
clean_packet_directory $1 build
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
e14835 |
clean_install() {
|
|
|
e14835 |
clean_packet_directory $1 install
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
e14835 |
clean_env() {
|
|
|
e14835 |
clean_packet_directory $1 env
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
3b09af |
clean_env_native() {
|
|
|
3b09af |
clean_packet_directory $1 env_native
|
|
|
3b09af |
}
|
|
|
3b09af |
|
|
|
e7fa50 |
clean_license() {
|
|
|
e7fa50 |
clean_packet_directory $1 license
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
e14835 |
clean_envdeps_release() {
|
|
|
e14835 |
clean_packet_directory $1 envdeps_release
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
e7fa50 |
clean_install_release() {
|
|
|
e7fa50 |
clean_packet_directory $1 install_release
|
|
|
e7fa50 |
}
|
|
|
e7fa50 |
|
|
|
e14835 |
clean_env_release() {
|
|
|
e14835 |
clean_packet_directory $1 env_release
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
1dcb0e |
clean_all_env() {
|
|
|
1dcb0e |
clean_envdeps $1
|
|
|
3b09af |
clean_envdeps_native $1
|
|
|
e7fa50 |
clean_install $1
|
|
|
1dcb0e |
clean_env $1
|
|
|
3b09af |
clean_env_native $1
|
|
|
e7fa50 |
clean_license $1
|
|
|
e14835 |
clean_envdeps_release $1
|
|
|
e7fa50 |
clean_install_release $1
|
|
|
e14835 |
clean_env_release $1
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
dd482a |
clean_all_install() {
|
|
|
dd482a |
clean_build $1
|
|
|
1dcb0e |
clean_all_env $1
|
|
|
dd482a |
}
|
|
|
dd482a |
|
|
|
1dcb0e |
clean_all_unpack() {
|
|
|
1dcb0e |
clean_download $1
|
|
|
1dcb0e |
clean_unpack $1
|
|
|
1dcb0e |
}
|
|
|
1dcb0e |
|
|
|
1dcb0e |
clean() {
|
|
|
3b09af |
message "$1 clean all"
|
|
|
3b09af |
try_do_nothing $NAME clean_all && return 0
|
|
|
223f41 |
rm -rf "$PACKET_DIR/$1"
|
|
|
1cbd1f |
}
|
|
|
1cbd1f |
|
|
|
e14835 |
#
|
|
|
e14835 |
|
|
|
e14835 |
set_undone_download() {
|
|
|
e14835 |
set_undone $1 download
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
e14835 |
set_undone_unpack() {
|
|
|
e14835 |
set_undone $1 download
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
e14835 |
set_undone_envdeps() {
|
|
|
e14835 |
set_undone $1 envdeps
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
3b09af |
set_undone_envdeps_native() {
|
|
|
3b09af |
set_undone $1 envdeps_native
|
|
|
3b09af |
}
|
|
|
3b09af |
|
|
|
e14835 |
set_undone_build() {
|
|
|
e14835 |
set_undone $1 build
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
e14835 |
set_undone_install() {
|
|
|
e14835 |
set_undone $1 install
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
e14835 |
set_undone_env() {
|
|
|
e14835 |
set_undone $1 env
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
3b09af |
set_undone_env_native() {
|
|
|
3b09af |
set_undone $1 env_native
|
|
|
3b09af |
}
|
|
|
3b09af |
|
|
|
e7fa50 |
set_undone_license() {
|
|
|
e7fa50 |
set_undone $1 license
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
e14835 |
set_undone_envdeps_release() {
|
|
|
e14835 |
set_undone $1 envdeps_release
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
e7fa50 |
set_undone_install_release() {
|
|
|
e7fa50 |
set_undone $1 install_release
|
|
|
e7fa50 |
}
|
|
|
e7fa50 |
|
|
|
e14835 |
set_undone_env_release() {
|
|
|
e14835 |
set_undone $1 env_release
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
1dcb0e |
set_undone_all_env() {
|
|
|
1dcb0e |
set_undone_envdeps $1
|
|
|
3b09af |
set_undone_envdeps_native $1
|
|
|
e7fa50 |
set_undone_install $1
|
|
|
1dcb0e |
set_undone_env $1
|
|
|
3b09af |
set_undone_env_native $1
|
|
|
e7fa50 |
set_undone_license $1
|
|
|
e14835 |
set_undone_envdeps_release $1
|
|
|
e7fa50 |
set_undone_install_release $1
|
|
|
e14835 |
set_undone_env_release $1
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
1dcb0e |
set_undone_all_install() {
|
|
|
1dcb0e |
set_undone_build $1
|
|
|
1dcb0e |
set_undone_all_env $1
|
|
|
1dcb0e |
}
|
|
|
1dcb0e |
|
|
|
1dcb0e |
set_undone_all_unpack() {
|
|
|
1dcb0e |
set_undone_download $1
|
|
|
1dcb0e |
set_undone_unpack $1
|
|
|
1dcb0e |
}
|
|
|
1dcb0e |
|
|
|
1dcb0e |
set_undone_all() {
|
|
|
1dcb0e |
set_undone_all_unpack $1
|
|
|
1dcb0e |
set_undone_all_install $1
|
|
|
1dcb0e |
}
|
|
|
1dcb0e |
|
|
|
e14835 |
#
|
|
|
e14835 |
|
|
|
e14835 |
with_deps() {
|
|
|
e14835 |
if ! foreach_deps "$2" "$1" "recursive"; then
|
|
|
e14835 |
return 1
|
|
|
e14835 |
fi
|
|
|
3b09af |
if ! foreach_deps "$2" "$1" "recursive" "native"; then
|
|
|
3b09af |
return 1
|
|
|
3b09af |
fi
|
|
|
e14835 |
if ! "$1" "$2"; then
|
|
|
e14835 |
return 1
|
|
|
e14835 |
fi
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
e14835 |
shell() {
|
|
|
d42249 |
echo "Set environment for $1"
|
|
|
e14835 |
set_environment_vars $1
|
|
|
e14835 |
cd $PACKET_DIR/$1
|
|
|
d42249 |
if [ -z "${*:2}" ]; then
|
|
|
223f41 |
/bin/bash -i
|
|
|
223f41 |
else
|
|
|
d42249 |
"${@:2}"
|
|
|
223f41 |
fi
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
e14835 |
dry_run() {
|
|
|
e14835 |
DRY_RUN=1
|
|
|
e14835 |
"$@"
|
|
|
e14835 |
}
|
|
|
e14835 |
|
|
|
7f8f8f |
no_check_deps() {
|
|
|
7f8f8f |
NO_CHECK_DEPS=1
|
|
|
7f8f8f |
"$@"
|
|
|
7f8f8f |
}
|
|
|
7f8f8f |
|
|
|
bce30d |
force() {
|
|
|
bce30d |
FORCE=1
|
|
|
bce30d |
"$@"
|
|
|
bce30d |
}
|
|
|
bce30d |
|
|
|
bce30d |
clean_before_do() {
|
|
|
bce30d |
CLEAN_BEFORE_DO=1
|
|
|
bce30d |
"$@"
|
|
|
bce30d |
}
|
|
|
bce30d |
|
|
|
3b09af |
native() {
|
|
|
3b09af |
local ARGS="$@"
|
|
|
cf8c28 |
local LOCAL_ERROR=0
|
|
|
3b09af |
if [ ! -z "$IS_NATIVE" ]; then
|
|
|
3b09af |
$ARGS
|
|
|
3b09af |
else
|
|
|
3b09af |
local WAS_PLATFORM=$PLATFORM
|
|
|
3b09af |
local WAS_ARCH=$ARCH
|
|
|
3b09af |
local WAS_PACKET_DIR=$PACKET_DIR
|
|
|
3b09af |
|
|
|
3b09af |
set_toolchain "native"
|
|
|
3b09af |
PLATFORM=$NATIVE_PLATFORM
|
|
|
3b09af |
ARCH=$NATIVE_ARCH
|
|
|
3b09af |
PACKET_DIR=$NATIVE_PACKET_DIR
|
|
|
3b09af |
if [ ! -z "$NAME" ]; then
|
|
|
3b09af |
set_environment_vars $NAME
|
|
|
3b09af |
fi
|
|
|
3b09af |
|
|
|
3b09af |
$ARGS
|
|
|
cf8c28 |
LOCAL_ERROR=$?
|
|
|
3b09af |
|
|
|
3b09af |
PLATFORM=$WAS_PLATFORM
|
|
|
3b09af |
ARCH=$WAS_ARCH
|
|
|
3b09af |
PACKET_DIR=$WAS_PACKET_DIR
|
|
|
3b09af |
set_toolchain
|
|
|
3b09af |
if [ ! -z "$NAME" ]; then
|
|
|
3b09af |
set_environment_vars $NAME
|
|
|
3b09af |
fi
|
|
|
3b09af |
fi
|
|
|
cf8c28 |
return $LOCAL_ERROR
|
|
|
cf8c28 |
}
|
|
|
cf8c28 |
|
|
|
cf8c28 |
native_at_place() {
|
|
|
cf8c28 |
local ARGS="$@"
|
|
|
cf8c28 |
local LOCAL_ERROR=0
|
|
|
cf8c28 |
if [ ! -z "$IS_NATIVE" ]; then
|
|
|
cf8c28 |
$ARGS
|
|
|
cf8c28 |
else
|
|
|
cf8c28 |
local WAS_PLATFORM=$PLATFORM
|
|
|
cf8c28 |
local WAS_ARCH=$ARCH
|
|
|
cf8c28 |
|
|
|
cf8c28 |
set_toolchain "native"
|
|
|
cf8c28 |
PLATFORM=$NATIVE_PLATFORM
|
|
|
cf8c28 |
ARCH=$NATIVE_ARCH
|
|
|
cf8c28 |
if [ ! -z "$NAME" ]; then
|
|
|
cf8c28 |
set_environment_vars $NAME
|
|
|
cf8c28 |
fi
|
|
|
cf8c28 |
|
|
|
cf8c28 |
$ARGS
|
|
|
cf8c28 |
LOCAL_ERROR=$?
|
|
|
cf8c28 |
|
|
|
cf8c28 |
PLATFORM=$WAS_PLATFORM
|
|
|
cf8c28 |
ARCH=$WAS_ARCH
|
|
|
cf8c28 |
set_toolchain
|
|
|
cf8c28 |
if [ ! -z "$NAME" ]; then
|
|
|
cf8c28 |
set_environment_vars $NAME
|
|
|
cf8c28 |
fi
|
|
|
cf8c28 |
fi
|
|
|
cf8c28 |
return $LOCAL_ERROR
|
|
|
3b09af |
}
|
|
|
3b09af |
|
|
|
99b145 |
foreach_packet() {
|
|
|
99b145 |
local COMMAND=$1
|
|
|
99b145 |
local FILE=
|
|
|
99b145 |
ls -1 "$PACKET_SCRIPT_DIR" | grep -e \\.sh$ | while read FILE; do
|
|
|
99b145 |
if ! $COMMAND "${FILE:0:-3}" ${@:2}; then
|
|
|
99b145 |
return 1
|
|
|
99b145 |
fi
|
|
|
99b145 |
done
|
|
|
99b145 |
}
|
|
|
99b145 |
|
|
|
5ef601 |
chain() {
|
|
|
5ef601 |
local ARG
|
|
|
5ef601 |
local CNT=1
|
|
|
5ef601 |
for ARG in "$@"; do
|
|
|
5ef601 |
if [ "${@:CNT:1}" = "chain" ]; then
|
|
|
5ef601 |
break;
|
|
|
5ef601 |
fi
|
|
|
5ef601 |
CNT=$((CNT+1))
|
|
|
5ef601 |
done
|
|
|
5ef601 |
if ! "${@:0:CNT}"; then return 1; fi
|
|
|
5ef601 |
if ! "${@:CNT}"; then return 1; fi
|
|
|
5ef601 |
}
|
|
|
99b145 |
|
|
|
3b09af |
set_toolchain
|
|
|
e14835 |
"$@"
|
|
|
7f8f8f |
|