Tamarin/lib/build.sh

48 lines
985 B
Bash
Executable File

#!/usr/bin/env bash
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"
PROJECT_NAME=${1}
BUILD_BRANCH=${2}
BUILD_TAG=${4}
function build_project()
{
info "Building project '${PROJECT_NAME}' for ${TARGET_ARCH} architecture..."
# Initalize opts
set_opt project_name "${PROJECT_NAME}"
set_opt build_branch "${BUILD_BRANCH}"
set_opt build_tag "${BUILD_TAG}"
local workspace=$(mktemp -d)/${PROJECT_NAME}
info "Build dir is ${workspace}"
mkdir -p "${workspace}"
# Copy sources to workspace
cd ${SRC_DIR}
cp -r ${SRC_DIR}/. "${workspace}"
cd "$workspace"
load_local_opts
exec_hooks "prebuild" "${workspace}"
dpkg-buildpackage -b -a"${TARGET_ARCH}" 2> >(stderr) 1> >(stdout)
if [ $? != 0 ]; then
fatal "The build process has not completed successfuly !"
fi
exec_hooks "postbuild" "${workspace}"
}
build_project