cedapackage
#!/bin/bash
# Package the ceda core libraries to allow ceda based C++ applications to be developed on
# a Linux platform, without providing full access to the proprietary ceda source code
#
if [ "$#" -ne 2 ]; then
echo "Usage: cedapackage [Debug|Release] [version]"
exit 1
fi
PLATFORM=Linuxx64
CONFIG=$1
VERSION=$2
# It is assumed the ceda source code repository has been downloaded under ~/developer/_root_
CEDA_SOURCE_ROOT=~/developer/_root_
# build artefats folder for building the ceda core libraries before they are packaged
BUILD_CEDA_CORE=~/developer/build_ceda_core
# The workspace used to build the ceda core libraries (not including examples and test projects)
WORKSPACE=wsCedaCore
# Location for where to package up the ceda core libraries and header files
CEDA_PKG=~/developer/ceda
echo "========================================================================="
echo Packaging the ceda core libraries version $VERSION on $PLATFORM...
mkdir -p $BUILD_CEDA_CORE/build
cp $CEDA_SOURCE_ROOT/Ceda/_BUILD/Init/CedaWorkspaceXcpps/$WORKSPACE.xcpp $BUILD_CEDA_CORE/build
cp $CEDA_SOURCE_ROOT/Ceda/_BUILD/Init/CedaWorkspaceXcpps/build_local.xcpp $BUILD_CEDA_CORE/build
cp $CEDA_SOURCE_ROOT/Ceda/_BUILD/Init/$PLATFORM/XcppConfig/selectcompiler.xcpp $BUILD_CEDA_CORE/build
cd $BUILD_CEDA_CORE/build
echo "----------------- Generating $WORKSPACE.xcws make files --------------------"
~/bin/Xcpp $WORKSPACE.xcpp mode=gen
echo "----------------- making the ceda core libraries --------------------"
if [ "$CONFIG" == "Release" ]; then
make r
else
make d
fi
if [ $? -ne 0 ]; then
echo "make failed, exiting" >&2
exit 1
fi
echo "----------------- copying ceda core files to the pkg area --------------------"
mkdir -p $CEDA_PKG/lib/$PLATFORM/$CONFIG
cp -r $BUILD_CEDA_CORE/lib/$PLATFORM/$CONFIG/* $CEDA_PKG/lib/$PLATFORM/$CONFIG
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
cp -r $CEDA_SOURCE_ROOT/Ceda/_BUILD/XcppConfig $CEDA_PKG
cp -r $CEDA_SOURCE_ROOT/Ceda/_BUILD/Init/$PLATFORM/XcppConfig $CEDA_PKG
echo "----------------- copying ceda examples to the pkg area --------------------"
mkdir -p $CEDA_PKG/examples/Ceda/Core/Lss
cp -r $CEDA_SOURCE_ROOT/Ceda/Core/Lss/exLss $CEDA_PKG/examples/Ceda/Core/Lss
mkdir -p $CEDA_PKG/examples/Ceda/Core/Thread
cp -r $CEDA_SOURCE_ROOT/Ceda/Core/Thread/exThread $CEDA_PKG/examples/Ceda/Core/Thread
mkdir -p $CEDA_PKG/examples/Ceda/Core/Object
cp -r $CEDA_SOURCE_ROOT/Ceda/Core/Object/exObject $CEDA_PKG/examples/Ceda/Core/Object
mkdir -p $CEDA_PKG/examples/Ceda/Core/CedaScript
cp -r $CEDA_SOURCE_ROOT/Ceda/Core/CedaScript/exCedaScript $CEDA_PKG/examples/Ceda/Core/CedaScript
mkdir -p $CEDA_PKG/examples/Ceda/Core/PersistStore
cp -r $CEDA_SOURCE_ROOT/Ceda/Core/PersistStore/exPersistStore $CEDA_PKG/examples/Ceda/Core/PersistStore
cp -r $CEDA_SOURCE_ROOT/Ceda/Core/PersistStore/lxPersistStore $CEDA_PKG/examples/Ceda/Core/PersistStore
mkdir -p $CEDA_PKG/examples/Ceda/Core/Rmi
cp -r $CEDA_SOURCE_ROOT/Ceda/Core/Rmi/exRmi $CEDA_PKG/examples/Ceda/Core/Rmi
mkdir -p $CEDA_PKG/examples/Ceda/Core/Operation
cp -r $CEDA_SOURCE_ROOT/Ceda/Core/Operation/exOperation $CEDA_PKG/examples/Ceda/Core/Operation
cp -r $CEDA_SOURCE_ROOT/Ceda/Core/Operation/lxOperation $CEDA_PKG/examples/Ceda/Core/Operation
mkdir -p $CEDA_PKG/examples/Ceda/Core/Python
cp -r $CEDA_SOURCE_ROOT/Ceda/Core/Python/exPython $CEDA_PKG/examples/Ceda/Core/Python
cp -r $CEDA_SOURCE_ROOT/Ceda/Core/Python/exPython2 $CEDA_PKG/examples/Ceda/Core/Python
touch $CEDA_PKG/examples/.xcwsroot
cp $CEDA_SOURCE_ROOT/Ceda/Core/wsExamples.xcws $CEDA_PKG/examples/Ceda/Core
mkdir -p $CEDA_PKG/examples/config
cp -r $CEDA_SOURCE_ROOT/Ceda/_BUILD/Init/$PLATFORM/CedaCoreExamplesConfig/* $CEDA_PKG/examples/config
cp $CEDA_SOURCE_ROOT/Ceda/_BUILD/Init/$PLATFORM/CedaCoreExamplesConfig/build_examples $CEDA_PKG
chmod 755 $CEDA_PKG/build_examples
echo "----------------- make tar ball --------------------"
tar -C $CEDA_PKG -cvzf ~/developer/ceda-$VERSION.tar.gz .
echo "Packaging ceda core libraries $VERSION on $PLATFORM completed"
echo "========================================================================="
cd $CEDA_PKG
./build_examples $CONFIG
if [ $? -ne 0 ]; then
echo "build examples failed, exiting" >&2
exit 1
fi
echo "----------------- Package pyceda $VERSION --------------------"
cp -r ~/developer/_root_/Ceda/Core/Python/pyceda_package ~/developer
sed -i -e "s/0.0/$VERSION/g" ~/developer/pyceda_package/setup.py
cp ~/developer/ceda/lib/$PLATFORM/$CONFIG/*.so ~/developer/pyceda_package/pyceda/lib/linux
cd ~/developer
tree pyceda_package/
cd ~/developer/pyceda_package
python setup.py sdist
sudo python setup.py install
sha1sum ~/developer/ceda-$VERSION.tar.gz
sha1sum ~/developer/pyceda_package/dist/pyceda-$VERSION.tar.gz
cd ~/developer
wput -nc -u ceda-$VERSION.tar.gz ftp://cedanet:pw@www.cedanet.com.au/public_html/ceda/xcpp/linux/
cd ~/developer/pyceda_package/dist
wput -nc -u pyceda-$VERSION.tar.gz ftp://cedanet:pw@www.cedanet.com.au/public_html/ceda/xcpp/linux/
echo "Packaging pyceda $VERSION on $PLATFORM completed"
echo "========================================================================="