2015-07-02 14:04:14 +02:00
|
|
|
#!/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}"
|
2015-07-02 14:04:14 +02:00
|
|
|
|
|
|
|
DIST_DIR="${BASE_DIR}/dist"
|
|
|
|
SRC_DIR="${BASE_DIR}/src"
|
2015-08-20 12:09:15 +02:00
|
|
|
PROJECT_NAME=${1}
|
2015-08-20 16:29:36 +02:00
|
|
|
BUILD_BRANCH=${2}
|
|
|
|
BUILD_DIR=${3}
|
2015-08-20 17:35:43 +02:00
|
|
|
BUILD_TAG=${4}
|
2015-07-02 14:04:14 +02:00
|
|
|
|
2015-08-20 12:09:15 +02:00
|
|
|
function build_project()
|
|
|
|
{
|
2015-07-02 14:04:14 +02:00
|
|
|
|
2015-08-20 12:09:15 +02:00
|
|
|
info "Building project '${PROJECT_NAME}'..."
|
2015-07-02 14:04:14 +02:00
|
|
|
|
2015-08-20 12:09:15 +02:00
|
|
|
set_opt project_name "${PROJECT_NAME}"
|
|
|
|
set_opt build_dir "${BUILD_DIR}"
|
2015-08-20 16:29:36 +02:00
|
|
|
set_opt build_branch "${BUILD_BRANCH}"
|
2015-08-20 17:35:43 +02:00
|
|
|
set_opt build_tag "${BUILD_TAG}"
|
2015-07-02 17:01:26 +02:00
|
|
|
|
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-07-02 14:04:14 +02:00
|
|
|
|
2015-08-20 12:09:15 +02:00
|
|
|
# Copy sources to workspace
|
|
|
|
cd ${SRC_DIR}
|
|
|
|
cp -r ${SRC_DIR}/. "${workspace}"
|
2015-07-02 17:01:26 +02:00
|
|
|
|
2015-08-20 12:09:15 +02:00
|
|
|
exec_hooks "prebuild" "${workspace}"
|
2015-07-02 14:04:14 +02:00
|
|
|
|
2015-08-20 12:09:15 +02:00
|
|
|
cd "${workspace}"
|
2015-09-23 16:54:53 +02:00
|
|
|
|
2015-09-23 21:59:29 +02:00
|
|
|
dpkg-buildpackage -b 2> >(error) 1> >(info)
|
2015-07-02 14:04:14 +02:00
|
|
|
|
|
|
|
if [ $? != 0 ]; then
|
2015-07-04 13:28:43 +02:00
|
|
|
fatal "The build process has not completed successfuly !"
|
2015-07-02 14:04:14 +02:00
|
|
|
fi
|
|
|
|
|
2015-08-20 12:09:15 +02:00
|
|
|
exec_hooks "postbuild" "${workspace}"
|
2015-07-02 14:04:14 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-08-20 12:09:15 +02:00
|
|
|
build_project
|