summaryrefslogtreecommitdiff
path: root/scripts/include/common.sh
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-01-28 02:08:21 +0300
committerAndrei Karas <akaras@inbox.ru>2017-01-28 02:08:21 +0300
commit20af205803e349a183dd57a6704db88c0e40c284 (patch)
tree4107067c0d5055eabdbb9c9c8a992d2d9f46009b /scripts/include/common.sh
parent02c7c7a3fd2fb0109675353c90b5caa14ada96d6 (diff)
downloadspm-20af205803e349a183dd57a6704db88c0e40c284.tar.gz
spm-20af205803e349a183dd57a6704db88c0e40c284.tar.bz2
spm-20af205803e349a183dd57a6704db88c0e40c284.tar.xz
spm-20af205803e349a183dd57a6704db88c0e40c284.zip
Remove function package_build from packages, and use shared package_build based on variables.
Diffstat (limited to 'scripts/include/common.sh')
-rw-r--r--scripts/include/common.sh47
1 files changed, 44 insertions, 3 deletions
diff --git a/scripts/include/common.sh b/scripts/include/common.sh
index 21f00f2..d446c1e 100644
--- a/scripts/include/common.sh
+++ b/scripts/include/common.sh
@@ -57,6 +57,7 @@ function common_package_init {
export packagefile="${package}.sh"
export SRCTYPE="git"
export DEFAULT_BRANCH="master"
+ export AUTORECONF_FLAGS="-i"
if [ ! -f "../packages/${packagefile}" ]; then
echo "Error: Package '${package}' not exists."
@@ -93,18 +94,24 @@ function env_man {
}
function run_autoreconf {
+ flags="$*"
+ if [[ "${flags}" == "" ]]; then
+ flags="${AUTORECONF_FLAGS}"
+ fi
cd "${srcdir}"
check_error $?
echo "make distclean"
make distclean
- echo "autoreconf $*"
- autoreconf $*
+ echo "autoreconf ${flags}"
+ autoreconf ${flags}
check_error $?
+ unset flags
}
function run_src_script {
cd "${srcdir}"
check_error $?
+ echo $*
$*
check_error $?
}
@@ -237,6 +244,7 @@ function repack_paths {
}
function package_use {
+ echo "package_use"
repack_paths "$ENV_PATH" "PATH"
repack_paths "$ENV_LD_LIBRARY_PATH" "LD_LIBRARY_PATH"
repack_paths "$ENV_PKG_CONFIG_PATH" "PKG_CONFIG_PATH"
@@ -250,7 +258,6 @@ function common_use_package {
echo "#!/bin/bash" >"${envfile}"
check_error $?
echo "" >>"${envfile}"
- echo "package_use"
package_use
check_error $?
echo "\$*" >>"${envfile}"
@@ -260,10 +267,12 @@ function common_use_package {
}
function package_get_source {
+ echo "package_get_source"
run_clone "${SRCURL}"
}
function package_update_source {
+ echo "package_update_source"
cd "../src/${package}"
if [ -d .git ]; then
echo "git fetch origin"
@@ -282,3 +291,35 @@ function common_clean_destination {
echo "clean ${bindir}"
rm -rf "${bindir}"
}
+
+function package_build {
+ echo "package_build"
+ run_switch_branch
+
+ if [[ "$ENABLE_SAME_DIR_BUILD" != "" ]]; then
+ run_enable_same_dir_build
+ fi
+ if [[ "$SRC_INIT_COMMAND" != "" ]]; then
+ run_src_script "$SRC_INIT_COMMAND"
+ fi
+
+ case "$BUILD_TYPE" in
+ automake)
+ run_autoreconf
+ run_configure
+ ;;
+ configure)
+ run_configure
+ ;;
+ cmake)
+ run_cmake
+ ;;
+ *)
+ echo "Error: unknown BUILD_TYPE. Valid values: automake, configure, cmake"
+ exit 1
+ ;;
+ esac
+
+ run_make
+ run_make_install
+}