268 lines
6.6 KiB
Bash
268 lines
6.6 KiB
Bash
|
#!/bin/bash
|
||
|
|
||
|
MAIN_FOLDER="$(readlink -f .)"
|
||
|
if [ -z ${P_BUILD} ]; then "Please set P_BUILD variable."; exit 1; fi;
|
||
|
if [ -z ${P_OUT} ]; then "Please set P_OUT variable."; exit 1; fi;
|
||
|
|
||
|
printStep()
|
||
|
{
|
||
|
local comment=$1
|
||
|
echo " "
|
||
|
echo " !! !! ${comment} !! !! "
|
||
|
}
|
||
|
|
||
|
buildPackage()
|
||
|
{
|
||
|
cd ${MAIN_FOLDER}
|
||
|
|
||
|
echo "cp -rf packages/$1/include/$1 ./include/"
|
||
|
cp -rf packages/$1/include/$1 ./include/ 2>/dev/null
|
||
|
|
||
|
local headers=`ls include/*.h`
|
||
|
for header in ${headers}
|
||
|
do
|
||
|
if [ -d packages/$1/include/ ]
|
||
|
then
|
||
|
cp -fr ${header} packages/$1/include/ 2>/dev/null
|
||
|
fi
|
||
|
done
|
||
|
|
||
|
printStep "MAKE $1"
|
||
|
|
||
|
echo "mkdir ./packages/$1/build"
|
||
|
mkdir -p ./packages/$1/build
|
||
|
|
||
|
echo "cd ./packages/$1/build"
|
||
|
cd ./packages/$1/build
|
||
|
|
||
|
cmake ..
|
||
|
|
||
|
make -j$(nproc)
|
||
|
local libs=`ls *.so`
|
||
|
for lib in ${libs}
|
||
|
do
|
||
|
echo "cp ${lib} ${P_OUT}"
|
||
|
cp ${lib} ${P_OUT}
|
||
|
done
|
||
|
|
||
|
cd ${MAIN_FOLDER}
|
||
|
}
|
||
|
|
||
|
clean()
|
||
|
{
|
||
|
local packages=`ls packages/`
|
||
|
for package in ${packages}
|
||
|
do
|
||
|
rm -rf packages/${package}/build
|
||
|
done
|
||
|
rm -rf ${P_BUILD}
|
||
|
}
|
||
|
|
||
|
taskqueue()
|
||
|
{
|
||
|
echo "cp -rf packages/tools/include/tools packages/taskqueue/include/"
|
||
|
cp -rf packages/tools/include/tools packages/taskqueue/include/
|
||
|
buildPackage "taskqueue"
|
||
|
}
|
||
|
|
||
|
types()
|
||
|
{
|
||
|
echo "cp -rf packages/tools/include/tools packages/types/include/"
|
||
|
cp -rf packages/tools/include/tools packages/types/include/
|
||
|
buildPackage "types"
|
||
|
}
|
||
|
|
||
|
logger()
|
||
|
{
|
||
|
echo "cp -rf packages/types/include/types packages/logger/include/"
|
||
|
cp -rf packages/types/include/types packages/logger/include/
|
||
|
buildPackage "logger"
|
||
|
}
|
||
|
|
||
|
settings()
|
||
|
{
|
||
|
echo "cp -rf packages/inithelper/include/inithelper packages/settings/include/"
|
||
|
cp -rf packages/inithelper/include/inithelper packages/settings/include/
|
||
|
echo "cp -rf packages/logger/include/logger packages/settings/include/"
|
||
|
cp -rf packages/logger/include/logger packages/settings/include/
|
||
|
buildPackage "settings"
|
||
|
}
|
||
|
|
||
|
cash()
|
||
|
{
|
||
|
echo "cp -rf packages/settings/include/settings packages/cash/include/"
|
||
|
cp -rf packages/settings/include/settings packages/cash/include/
|
||
|
echo "cp -rf packages/inithelper/include/inithelper packages/cash/include/"
|
||
|
cp -rf packages/inithelper/include/inithelper packages/cash/include/
|
||
|
echo "cp -rf packages/logger/include/logger packages/cash/include/"
|
||
|
cp -rf packages/logger/include/logger packages/cash/include/
|
||
|
echo "cp -rf packages/tools/include/tools packages/cash/include/"
|
||
|
cp -rf packages/tools/include/tools packages/cash/include/
|
||
|
buildPackage "cash"
|
||
|
}
|
||
|
|
||
|
legacy()
|
||
|
{
|
||
|
mkdir -p packages/legacy/lib
|
||
|
|
||
|
echo "Resolve .so legacy dependecies"
|
||
|
cp ${P_OUT}/libsettings.so ./packages/legacy/lib/
|
||
|
cp ${P_OUT}/liblogger.so ./packages/legacy/lib/
|
||
|
cp ${P_OUT}/libinithelper.so ./packages/legacy/lib/
|
||
|
cp ${P_OUT}/libtools.so ./packages/legacy/lib/
|
||
|
cp ${P_OUT}/libtypes.so ./packages/legacy/lib/
|
||
|
|
||
|
echo "cp -rf packages/inithelper/include/inithelper/ packages/legacy/legacy/include/"
|
||
|
cp -rf packages/inithelper/include/inithelper/ packages/legacy/legacy/include/
|
||
|
echo "cp -rf packages/settings/include/settings/ packages/legacy/legacy/include/"
|
||
|
cp -rf packages/settings/include/settings/ packages/legacy/legacy/include/
|
||
|
|
||
|
cp -rf packages/legacy/legacy/include ./include/legacy 2>/dev/null
|
||
|
|
||
|
buildPackage "legacy"
|
||
|
|
||
|
mv -f packages/legacy/build/selector ${P_OUT}
|
||
|
}
|
||
|
|
||
|
mfc()
|
||
|
{
|
||
|
echo "cp -rf packages/logger/include/logger packages/mfc/include/"
|
||
|
cp -rf packages/logger/include/logger packages/mfc/include/
|
||
|
buildPackage "mfc"
|
||
|
}
|
||
|
|
||
|
td()
|
||
|
{
|
||
|
echo "cp -rf packages/tools/include/tools packages/td/include/"
|
||
|
cp -rf packages/tools/include/tools packages/td/include/
|
||
|
echo "cp -rf packages/taskqueue/include/taskqueue packages/td/include/"
|
||
|
cp -rf packages/taskqueue/include/taskqueue packages/td/include/
|
||
|
buildPackage "td"
|
||
|
}
|
||
|
|
||
|
wdm()
|
||
|
{
|
||
|
mkdir -p packages/wdm/lib
|
||
|
|
||
|
echo "Resolve .so wdm dependecies"
|
||
|
cp ${P_OUT}/libsettings.so packages/wdm/lib
|
||
|
cp ${P_OUT}/liblogger.so packages/wdm/lib
|
||
|
cp ${P_OUT}/libinithelper.so packages/wdm/lib
|
||
|
cp ${P_OUT}/libtools.so packages/wdm/lib
|
||
|
cp ${P_OUT}/libtypes.so packages/wdm/lib
|
||
|
cp ${P_OUT}/libintface.so packages/wdm/lib
|
||
|
|
||
|
echo "cp -rf packages/settings/include/settings packages/wdm/include/"
|
||
|
cp -rf packages/settings/include/settings packages/wdm/include/
|
||
|
echo "cp -rf packages/logger/include/logger packages/wdm/include/"
|
||
|
cp -rf packages/logger/include/logger packages/wdm/include/
|
||
|
echo "cp -rf packages/inithelper/include/inithelper/ packages/wdm/include/"
|
||
|
cp -rf packages/inithelper/include/inithelper/ packages/wdm/include/
|
||
|
echo "cp -rf packages/settings/include/settings/ packages/wdm/include/"
|
||
|
cp -rf packages/settings/include/settings/ packages/wdm/include/
|
||
|
echo "cp -rf packages/legacy/legacy/include/ packages/wdm/include/legacy"
|
||
|
cp -rf packages/legacy/legacy/include/ packages/wdm/include/legacy
|
||
|
echo "cp -rf packages/round/include/round packages/wdm/include/"
|
||
|
cp -rf packages/round/include/round packages/wdm/include/
|
||
|
buildPackage "wdm"
|
||
|
}
|
||
|
|
||
|
buildLibraries()
|
||
|
{
|
||
|
buildPackage "round"
|
||
|
buildPackage "inithelper"
|
||
|
buildPackage "tools"
|
||
|
taskqueue
|
||
|
types
|
||
|
logger
|
||
|
settings
|
||
|
cash
|
||
|
legacy
|
||
|
mfc
|
||
|
td
|
||
|
wdm
|
||
|
}
|
||
|
|
||
|
core()
|
||
|
{
|
||
|
mkdir -p ${P_BUILD}
|
||
|
|
||
|
cmake -B ${P_BUILD} -DP_OUT=${P_OUT}
|
||
|
|
||
|
cd ${P_BUILD}
|
||
|
make -j$(nproc)
|
||
|
}
|
||
|
|
||
|
buildAll()
|
||
|
{
|
||
|
buildLibraries
|
||
|
cd ${MAIN_FOLDER}
|
||
|
|
||
|
echo " "
|
||
|
echo " "
|
||
|
printStep "CORE"
|
||
|
echo " "
|
||
|
echo " "
|
||
|
|
||
|
core $2
|
||
|
}
|
||
|
|
||
|
main()
|
||
|
{
|
||
|
# Expecting either 'virt' or 'real' in $2 for core
|
||
|
# 'virt' proceeds to build virtual version with emulators
|
||
|
# 'real' proceeds to build production version with real stuff
|
||
|
#
|
||
|
# !! isn't implemented here !!
|
||
|
|
||
|
mkdir -p ${P_BUILD}
|
||
|
mkdir -p ${P_OUT}
|
||
|
|
||
|
flag=$1
|
||
|
if [ -z ${flag} ]
|
||
|
then
|
||
|
buildAll $2
|
||
|
elif [ "$flag" == "libs" ]
|
||
|
then
|
||
|
buildLibraries
|
||
|
elif [ "$flag" == "core" ]
|
||
|
then
|
||
|
core $2
|
||
|
elif [ "$flag" == "clean" ]
|
||
|
then
|
||
|
clean
|
||
|
elif [ "$flag" == "taskqueue" ]
|
||
|
then
|
||
|
taskqueue
|
||
|
elif [ "$flag" == "types" ]
|
||
|
then
|
||
|
types
|
||
|
elif [ "$flag" == "logger" ]
|
||
|
then
|
||
|
logger
|
||
|
elif [ "$flag" == "settings" ]
|
||
|
then
|
||
|
settings
|
||
|
elif [ "$flag" == "cash" ]
|
||
|
then
|
||
|
cash
|
||
|
elif [ "$flag" == "legacy" ]
|
||
|
then
|
||
|
legacy
|
||
|
elif [ "$flag" == "mfc" ]
|
||
|
then
|
||
|
mfc
|
||
|
elif [ "$flag" == "td" ]
|
||
|
then
|
||
|
td
|
||
|
elif [ "$flag" == "wdm" ]
|
||
|
then
|
||
|
wdm
|
||
|
elif [ -d "./packages/${flag}" ]
|
||
|
then
|
||
|
buildPackage $flag
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
main $1 $2
|