Created
January 12, 2016 08:29
-
-
Save vincenthsu/cc919cca666080f6fea8 to your computer and use it in GitHub Desktop.
build and commit to svn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PLATFORM=linux-x86_64 | |
BIN_LIST=(analyzer manager recorder rtsp-server vsd) | |
LIB_LIST=(libvs/libvs.so \ | |
analyzer/import/linux-x86/bir_core/lib/*.so* \ | |
analyzer/import/linux-x86/iod_core/lib/*.so* \ | |
analyzer/import/linux-x86/IVAStreamLib/*.so*) | |
if [ ! $(pwd | grep scripts) ] ; then | |
echo "Please execute at scripts folder" | |
exit | |
fi | |
# Get project name | |
if [ -z "$1" ]; then | |
echo "Project name not set." | |
echo "Format: release_$PLATFORM <project name>" | |
exit | |
fi | |
PROJECT="$1" | |
# Directory path | |
CUR_DIR=$PWD | |
SRC_DIR=$CUR_DIR/.. | |
# Get SVN revision | |
cd $SRC_DIR | |
REVISION=$(svn info -rHEAD | grep -m 1 "Last\ Changed\ Rev" | cut -d' ' -f4) | |
URL=$(svn info -rHEAD | grep -m 1 "URL:" | cut -d' ' -f2) | |
DATE_OF_REVISION=$(svn info -rHEAD | grep -m 1 'Last\ Changed\ Date' | sed s'/Last Changed Date:\ //'g) | |
cd CUR_DIR | |
# Read verion number | |
while IFS=. read MAJOR MINOR BUILD ; do | |
VERSION="$MAJOR.$MINOR.$BUILD.$REVISION" | |
done < $SRC_DIR/VERSION.txt | |
# Directory path | |
OUT_DIR=$SRC_DIR/../outputs | |
DST_DIR=$OUT_DIR/$PROJECT/$PLATFORM/$VERSION | |
DOCS_DIR=$DST_DIR/docs | |
INSTALL_DIR=$DST_DIR/install | |
OPT_DIR=$INSTALL_DIR/opt/ivar | |
BIN_DIR=$OPT_DIR/bin | |
LIB_DIR=$OPT_DIR/lib | |
ETC_DIR=$OPT_DIR/etc | |
VAR_DIR=$OPT_DIR/var | |
PREBUILTS_DIR=$SRC_DIR/prebuilts/$PLATFORM | |
# Build all projects | |
cd $SRC_DIR | |
make clean | |
make -j | |
cd $CUR_DIR | |
# Create folders | |
echo "Create folders" | |
mkdir -p $DST_DIR | |
mkdir -p $DOCS_DIR | |
mkdir -p $INSTALL_DIR | |
mkdir -p $BIN_DIR | |
mkdir -p $LIB_DIR | |
mkdir -p $ETC_DIR | |
mkdir -p $VAR_DIR | |
# Copy prebuilts | |
echo "Copy prebuilts" | |
cp -aR $PREBUILTS_DIR/* $INSTALL_DIR | |
# Copy binaries | |
echo "Copy binaries" | |
for bin in ${BIN_LIST[*]} ; do | |
cp -aR $SRC_DIR/$bin/$bin $BIN_DIR | |
done | |
# Copy libraries | |
echo "Copy libraries" | |
for lib in ${LIB_LIST[*]} ; do | |
cp -aR $SRC_DIR/$lib $LIB_DIR | |
done | |
# Modify permissions | |
chmod -R 755 $BIN_DIR | |
chmod -R 644 $LIB_DIR/* | |
# Copy install scripts | |
cp $CUR_DIR/install_$PLATFORM.sh $DST_DIR/install.sh | |
cp $SRC_DIR/README.md $DOCS_DIR | |
# Tar all files | |
cd $DST_DIR/.. | |
tar -cvzf $VERSION.tar.gz $VERSION | |
rm -rf $DST_DIR | |
# Commit to SVN outputs | |
svn add --parents $VERSION.tar.gz | |
cd $OUT_DIR | |
svn commit -m "IVAR Release: $VERSION" | |
echo -e "Reselse version: $MAJOR.$MINOR.$BUILD.$REVISION\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment