48 lines
1017 B
Bash
Executable File
48 lines
1017 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_DIR=${3}
|
|
BUILD_TAG=${4}
|
|
|
|
function build_project()
|
|
{
|
|
|
|
info "Building project '${PROJECT_NAME}' for ${TARGET_ARCH} architecture..."
|
|
|
|
set_opt project_name "${PROJECT_NAME}"
|
|
set_opt build_dir "${BUILD_DIR}"
|
|
set_opt build_branch "${BUILD_BRANCH}"
|
|
set_opt build_tag "${BUILD_TAG}"
|
|
|
|
local workspace=$(mktemp -p ${BUILD_DIR} -d)/${PROJECT_NAME}
|
|
info "Build dir is ${workspace}"
|
|
mkdir -p "${workspace}"
|
|
|
|
# Copy sources to workspace
|
|
cd ${SRC_DIR}
|
|
cp -r ${SRC_DIR}/. "${workspace}"
|
|
|
|
exec_hooks "prebuild" "${workspace}"
|
|
|
|
cd "${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
|