#!/bin/bash

project_name="farm_svr_git"
project_home="/root/.jenkins/workspace/farm_svr_git/"
ctfoproj_home="/root/.jenkins/workspace/ctfoproj/"


yes | cp ${ctfoproj_home}/lib/*.a ${project_home}../dblibs/ctfolibs/lib/
yes | cp -r ${ctfoproj_home}/include/* ${project_home}../dblibs/ctfolibs/include/


make

mkdir -p dev/bin dev/conf/ws
mkdir -p pro/bin pro/conf/ws
if [ -f farm_svr ];then
	cp farm_svr dev/bin/
	cp farm_svr pro/bin/
else
	echo "build error"
	exit 1
fi
cp ../conf/dev/farm_svr.conf dev/conf/ws/
cp ../conf/pro/farm_svr.conf pro/conf/ws/
tar -zcf farm_svr_dev.tar.gz dev/
tar -zcf farm_svr_pro.tar.gz pro/


#build bdw_svr
mkdir -p /home/repo/build/${project_name}/${BUILD_NUMBER}/dev
mkdir -p /home/repo/build/${project_name}/${BUILD_NUMBER}/pro
scp ${project_home}farm_svr_git/farm_svr_dev.tar.gz /home/repo/build/${project_name}/${BUILD_NUMBER}/dev
scp ${project_home}farm_svr_git/farm_svr_pro.tar.gz /home/repo/build/${project_name}/${BUILD_NUMBER}/pro