Tamarin/lib/build.sh

48 lines
962 B
Bash
Raw Normal View History

#!/usr/bin/env bash
2015-08-20 12:09:15 +02:00
LIB_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
export TAMARIN_UTIL="${LIB_DIR}/util.sh"
source "${TAMARIN_UTIL}"
DIST_DIR="${BASE_DIR}/dist"
SRC_DIR="${BASE_DIR}/src"
2015-08-20 12:09:15 +02:00
PROJECT_NAME=${1}
BUILD_BRANCH=${2}
BUILD_DIR=${3}
2015-08-20 17:35:43 +02:00
BUILD_TAG=${4}
2015-08-20 12:09:15 +02:00
function build_project()
{
2015-08-20 12:09:15 +02:00
info "Building project '${PROJECT_NAME}'..."
2015-08-20 12:09:15 +02:00
set_opt project_name "${PROJECT_NAME}"
set_opt build_dir "${BUILD_DIR}"
set_opt build_branch "${BUILD_BRANCH}"
2015-08-20 17:35:43 +02:00
set_opt build_tag "${BUILD_TAG}"
2015-08-20 12:09:15 +02:00
local workspace=$(mktemp -p ${BUILD_DIR} -d)/${PROJECT_NAME}
info "Build dir is ${workspace}"
mkdir -p "${workspace}"
2015-08-20 12:09:15 +02:00
# Copy sources to workspace
cd ${SRC_DIR}
cp -r ${SRC_DIR}/. "${workspace}"
2015-08-20 12:09:15 +02:00
exec_hooks "prebuild" "${workspace}"
2015-08-20 12:09:15 +02:00
cd "${workspace}"
2015-09-23 21:59:29 +02:00
dpkg-buildpackage -b 2> >(error) 1> >(info)
if [ $? != 0 ]; then
fatal "The build process has not completed successfuly !"
fi
2015-08-20 12:09:15 +02:00
exec_hooks "postbuild" "${workspace}"
}
2015-08-20 12:09:15 +02:00
build_project