Tamarin/lib/build.sh

48 lines
985 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}
2015-08-20 17:35:43 +02:00
BUILD_TAG=${4}
2015-08-20 12:09:15 +02:00
function build_project()
{
2015-10-22 14:02:51 +02:00
info "Building project '${PROJECT_NAME}' for ${TARGET_ARCH} architecture..."
# Initalize opts
2015-08-20 12:09:15 +02:00
set_opt project_name "${PROJECT_NAME}"
set_opt build_branch "${BUILD_BRANCH}"
2015-08-20 17:35:43 +02:00
set_opt build_tag "${BUILD_TAG}"
local workspace=$(mktemp -d)/${PROJECT_NAME}
2015-08-20 12:09:15 +02:00
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}"
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
2015-08-20 12:09:15 +02:00
exec_hooks "postbuild" "${workspace}"
}
2015-08-20 12:09:15 +02:00
build_project