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}
|
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-10-22 14:02:51 +02:00
|
|
|
info "Building project '${PROJECT_NAME}' for ${TARGET_ARCH} architecture..."
|
2015-07-02 14:04:14 +02:00
|
|
|
|
2015-10-29 17:40:26 +01:00
|
|
|
load_default_opts
|
|
|
|
|
2015-08-20 12:09:15 +02:00
|
|
|
set_opt project_name "${PROJECT_NAME}"
|
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-10-29 17:40:26 +01:00
|
|
|
local workspace=$(mktemp -d)/${PROJECT_NAME}
|
2015-08-20 12:09:15 +02:00
|
|
|
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-10-22 16:55:54 +02:00
|
|
|
dpkg-buildpackage -b -a "${TARGET_ARCH}" 2> >(stderr) 1> >(stdout)
|
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
|