postcedaandroid
#!/bin/bash
# Package the ceda core libraries to allow ceda based C++ applications to be developed on
# an Android platform, without providing full access to the proprietary ceda source code
#
# At the moment the ceda core libs are build manually using Android Studio. This needs to be
# done before running this script
if [ "$#" -ne 2 ]; then
echo "Usage: postcedaandroid [Debug|Release] [version]"
exit 1
fi
PLATFORM=Android
CONFIG=$1
VERSION=$2
# It is assumed the ceda source code repository has been downloaded under ~/developer/_root_
CEDA_SOURCE_ROOT=~/developer/_root_
# Location for where to package up the ceda core libraries and header files
CEDA_PKG=~/developer/ceda-android
# build artefats folder for building the ceda core libraries before they are packaged
BUILD_CEDA_CORE=~/developer/build_ceda_core_android
echo "========================================================================="
echo Packaging the ceda core libraries version $VERSION on $PLATFORM...
echo "----------------- copying ceda core files to the pkg area --------------------"
mkdir -p $CEDA_PKG/include
cp -r $BUILD_CEDA_CORE/include/* $CEDA_PKG/include
mkdir -p $CEDA_PKG/export
cp -r $BUILD_CEDA_CORE/export/* $CEDA_PKG/export
touch $CEDA_PKG/export/.xcwsroot
cp $CEDA_SOURCE_ROOT/Ceda/BaseDefaults.xcpjh $CEDA_PKG/export/Ceda
cp $CEDA_SOURCE_ROOT/Ceda/BaseCppCompilerDefaults.xcpjh $CEDA_PKG/export/Ceda
cp $CEDA_SOURCE_ROOT/Ceda/BaseResourceCompilerDefaults.xcpjh $CEDA_PKG/export/Ceda
cp $CEDA_SOURCE_ROOT/Ceda/BaseLinkerDefaults.xcpjh $CEDA_PKG/export/Ceda
cp $CEDA_SOURCE_ROOT/Ceda/link_*.xcpjh $CEDA_PKG/export/Ceda
mkdir -p $CEDA_PKG/XcppConfig
cp -r $CEDA_SOURCE_ROOT/Ceda/_BUILD/XcppConfig $CEDA_PKG
cp -r $CEDA_SOURCE_ROOT/Ceda/_BUILD/Init/$PLATFORM/XcppConfig $CEDA_PKG
mkdir -p $CEDA_PKG/lib/arm64-v8a/Debug
mkdir -p $CEDA_PKG/lib/arm64-v8a/Release
declare -a cedalibs=("cxUtils" "cxThread" "cxLss" "cxSocket" "cxMessage" "cxObject" "cxPersistStore" "cxRmi" "cxOperation" "cxWorkingSetIpc")
for i in "${cedalibs[@]}"
do
echo "Copying library $i"
cp $CEDA_SOURCE_ROOT/Ceda/_BUILD/Init/Android/CedaCoreLibs/app/build/intermediates/cmake/debug/obj/arm64-v8a/lib$i.so $CEDA_PKG/lib/arm64-v8a/Debug
cp $CEDA_SOURCE_ROOT/Ceda/_BUILD/Init/Android/CedaCoreLibs/app/build/intermediates/cmake/release/obj/arm64-v8a/lib$i.so $CEDA_PKG/lib/arm64-v8a/Release
done
echo "----------------- make tar ball --------------------"
tar -C $CEDA_PKG -cvzf ~/developer/ceda-android-$VERSION.tar.gz .
echo "----------------- coping tar ball to the cedanet website as www.cedanet.com.au/public_html/ceda/xcpp/android/ceda-android-$VERSION.tar.gz --------------------"
cd ~/developer
wput -nc -u ceda-android-$VERSION.tar.gz ftp://cedanet:pw@www.cedanet.com.au/public_html/ceda/xcpp/android/
echo "Packaging ceda core libraries $VERSION on $PLATFORM completed"
echo "========================================================================="