Skip to content
update_its_project.bash 17.3 KiB
Newer Older
garciay's avatar
garciay committed
#!/bin/bash

# Debug mode
#set -e
Yann Garcia's avatar
Yann Garcia committed
#set -vx
garciay's avatar
garciay committed

# Usage: sudo ./update_project.bash
# TODO Use git clone in temporary directory

garciay's avatar
garciay committed
OLDPWD=`pwd`

# Execution path
RUN_PATH="${0%/*}"

if [ "${VALIDATION_DIR}" == "" ]
then
    VALIDATION_DIR=${HOME}
fi

garciay's avatar
garciay committed
CHOWN_USER_GROUP=${USER}:${USER}
Yann Garcia's avatar
Yann Garcia committed
SRC_ITS_PATH=${HOME}/dev/TTF0002_Its
garciay's avatar
garciay committed

if [ "${PATH_DEV_ITS}" == "" ]
garciay's avatar
garciay committed
then
    PATH_DEV_ITS=${HOME}/dev/etsi_its
garciay's avatar
garciay committed
fi
garciay's avatar
garciay committed

garciay's avatar
garciay committed
if [ -d ${PATH_DEV_ITS} ]
garciay's avatar
garciay committed
then
    if [ -f ${HOME}/tmp/etsi_its.tar.bz2 ]
garciay's avatar
garciay committed
    then
        mv ${HOME}/tmp/etsi_its.tar.bz2 ${HOME}/tmp/etsi_its.tar.`date +'%Y%m%d'`.bz2
garciay's avatar
garciay committed
    fi
garciay's avatar
garciay committed
    find ${PATH_DEV_ITS} -name "*.o" -exec rm {} \;
    tar jhcvf ${HOME}/tmp/etsi_its.tar.bz2 ${PATH_DEV_ITS}
garciay's avatar
garciay committed
    rm -fr ${PATH_DEV_ITS}
garciay's avatar
garciay committed
fi

# Check if target directory exist
garciay's avatar
garciay committed
if [ ! -d ${PATH_DEV_ITS} ]
garciay's avatar
garciay committed
then
    mkdir -p ${PATH_DEV_ITS}/asn1/ ${PATH_DEV_ITS}/ttcn/LibIts/asn1/ ${PATH_DEV_ITS}/include ${PATH_DEV_ITS}/bin ${PATH_DEV_ITS}/lib ${PATH_DEV_ITS}/objs ${PATH_DEV_ITS}/src ${PATH_DEV_ITS}/docs
garciay's avatar
garciay committed
fi

garciay's avatar
garciay committed
# Update ASN.1 files
echo 'Updating ASN.1 files'
ASN1_SRC_PATH=${SRC_ITS_PATH}/ttcn/LibIts/asn1
ASN1_DST_PATH=${PATH_DEV_ITS}/ttcn/LibIts/asn1
garciay's avatar
garciay committed
NB_DEL=`echo ${ASN1_SRC_PATH} | awk -F"/" '{print NF + 1}'`
#ASN1_DIR_LIST=`find ${ASN1_SRC_PATH} -type d -not -path "*/.svn*" | cut -sd / -f${NB_DEL}-`
ASN1_DIR_LIST="CAM DENM EVCSN EV-RSR IS ITS-Container Security"
garciay's avatar
garciay committed
for i in ${ASN1_DIR_LIST}
do
    ASN1_SUBDIR_LIST=`find $ASN1_SRC_PATH/$i -type d | cut -sd / -f${NB_DEL}-`
    for j in ${ASN1_SUBDIR_LIST}
garciay's avatar
garciay committed
    do
        if [ ! -d ${ASN1_DST_PATH}/$j ]
        then
            mkdir ${ASN1_DST_PATH}/$j
            chmod 775 ${ASN1_DST_PATH}/$j
        fi
        for k in `ls ${ASN1_SRC_PATH}/$j/*.asn`
        do
            cp $k ${ASN1_DST_PATH}/$j
        done
garciay's avatar
garciay committed
    done
done
cp ${SRC_ITS_PATH}/asn1/Makefile ${PATH_DEV_ITS}/asn1
garciay's avatar
garciay committed
cp ${SRC_ITS_PATH}/asn1/*.c.diff ${PATH_DEV_ITS}/asn1
garciay's avatar
garciay committed

# Update testdata
echo 'Updating testdata'
FWK_SRC_PATH=${SRC_ITS_PATH}/testdata
FWK_DST_PATH=${PATH_DEV_ITS}
if [ -d ${FWK_SRC_PATH} ]
then
    cp -Rp ${FWK_SRC_PATH} ${FWK_DST_PATH}
fi
garciay's avatar
garciay committed

# Update ETSI Framework files
echo 'Updating ETSI Framework files'
garciay's avatar
garciay committed
FWK_SRC_PATH=${SRC_ITS_PATH}/ccsrc
FWK_DST_PATH=${PATH_DEV_ITS}/framework
garciay's avatar
garciay committed
mkdir -p ${FWK_DST_PATH}/src ${FWK_DST_PATH}/include
chmod -R 775 ${FWK_DST_PATH}
# Create link to TITAN Abstract_Socket
ln -sf $TOP/../titan.TestPorts.Common_Components.Abstract_Socket/src/Abstract_Socket.cc ${FWK_DST_PATH}/src/Abstract_Socket.cc
ln -sf $TOP/../titan.TestPorts.Common_Components.Abstract_Socket/src/Abstract_Socket.hh ${FWK_DST_PATH}/include/Abstract_Socket.hh
FWK_DIR_LIST_HH=`find ${FWK_SRC_PATH}/Protocols/ -name "*.h*" -type f`
FWK_DIR_LIST_THH=`find ${FWK_SRC_PATH}/Protocols/ -name "*.t.h*" -type f`
FWK_DIR_LIST_CC=`find ${FWK_SRC_PATH}/Protocols/ -name "*.c*" -type f`
FWK_DIR_LIST_L=`find ${FWK_SRC_PATH}/Protocols/ -name "*.l" -type f`
FWK_DIR_LIST_Y=`find ${FWK_SRC_PATH}/Protocols/ -name "*.y" -type f`
for i in ${FWK_DIR_LIST_HH}
do
garciay's avatar
garciay committed
    if [ `basename $i` != BTPPort.hh ]
    then
garciay's avatar
garciay committed
        cp $i ${FWK_DST_PATH}/include
garciay's avatar
garciay committed
    fi
garciay's avatar
garciay committed
done
for i in ${FWK_DIR_LIST_THH}
do
garciay's avatar
garciay committed
    if [ `basename $i` != BTPPort.hh ]
    then
garciay's avatar
garciay committed
        cp $i ${FWK_DST_PATH}/include
garciay's avatar
garciay committed
    fi
garciay's avatar
garciay committed
done
for i in ${FWK_DIR_LIST_CC}
do
garciay's avatar
garciay committed
    if [ `basename $i` != BTPPort.cc ]
    then
garciay's avatar
garciay committed
        cp $i ${FWK_DST_PATH}/src
garciay's avatar
garciay committed
    fi
garciay's avatar
garciay committed
done
if [ "${FWK_DIR_LIST_L}" != "" ]
then
    for i in ${FWK_DIR_LIST_L}
    do
garciay's avatar
garciay committed
        cp $i ${FWK_DST_PATH}/src
garciay's avatar
garciay committed
    done
fi
if [ "${FWK_DIR_LIST_Y}" != "" ]
then
    for i in ${FWK_DIR_LIST_Y}
    do
garciay's avatar
garciay committed
        cp $i ${FWK_DST_PATH}/src
garciay's avatar
garciay committed
    done
fi
FWK_DIR_LIST_HH=`find ${FWK_SRC_PATH}/Framework/ -name "*.h*" -type f`
FWK_DIR_LIST_CC=`find ${FWK_SRC_PATH}/Framework/ -name "*.c*" -type f`
for i in ${FWK_DIR_LIST_HH}
do
    cp $i ${FWK_DST_PATH}/include
done
for i in ${FWK_DIR_LIST_CC}
do
    cp $i ${FWK_DST_PATH}/src
done
garciay's avatar
garciay committed
FWK_DIR_LIST_HH=`find ${FWK_SRC_PATH}/loggers/ -name "*.h*" -type f`
FWK_DIR_LIST_CC=`find ${FWK_SRC_PATH}/loggers/ -name "*.c*" -type f`
for i in ${FWK_DIR_LIST_HH}
do
    cp $i ${FWK_DST_PATH}/include
done
for i in ${FWK_DIR_LIST_CC}
do
    cp $i ${FWK_DST_PATH}/src
done
FWK_DIR_LIST_HH=`find ${FWK_SRC_PATH}/Asn1c/ -name "*.h*" -type f`
FWK_DIR_LIST_CC=`find ${FWK_SRC_PATH}/Asn1c/ -name "*.c*" -type f`
for i in ${FWK_DIR_LIST_HH}
do
    cp $i ${FWK_DST_PATH}/include
done
for i in ${FWK_DIR_LIST_CC}
do
    cp $i ${FWK_DST_PATH}/src
done
garciay's avatar
garciay committed

# Update ATS TTCN-3 files
echo 'Update TTCN-3 files'
garciay's avatar
garciay committed
TTCN_3_ORG_PATH=${SRC_ITS_PATH}/ttcn
TTCN_3_DST_PATH=${PATH_DEV_ITS}/src
CC_SRC_PATH=${SRC_ITS_PATH}/ccsrc
garciay's avatar
garciay committed
TTCN_3_ATS_LIST='AtsAutoInterop AtsCAM AtsDENM AtsBTP AtsGeoNetworking AtsSecurity AtsRSUsSimulator LibCommon/ttcn AtsGenCert AtsPki AtsIVIM AtsSremSsem AtsMapemSpatem'
garciay's avatar
garciay committed
for i in ${TTCN_3_ATS_LIST}
do
    if [ ! -d ${TTCN_3_DST_PATH}/$i ]
    then
garciay's avatar
garciay committed
        mkdir -p ${TTCN_3_DST_PATH}/$i/bin ${TTCN_3_DST_PATH}/$i/lib ${TTCN_3_DST_PATH}/$i/src ${TTCN_3_DST_PATH}/$i/include ${TTCN_3_DST_PATH}/$i/ttcn ${TTCN_3_DST_PATH}/$i/objs ${TTCN_3_DST_PATH}/$i/etc ${TTCN_3_DST_PATH}/$i/docs
        chmod -R 775 ${TTCN_3_DST_PATH}/$i
garciay's avatar
garciay committed
    fi
    cp ${TTCN_3_ORG_PATH}/$i/*.ttcn ${TTCN_3_DST_PATH}/$i/ttcn
    cp ${TTCN_3_ORG_PATH}/../etc/$i/*.cfg ${TTCN_3_DST_PATH}/$i/etc
Yann Garcia's avatar
Yann Garcia committed
    cp ${TTCN_3_ORG_PATH}/../etc/$i/*.cfg_ ${TTCN_3_DST_PATH}/$i/etc
garciay's avatar
garciay committed
    cp ${TTCN_3_ORG_PATH}/../docs/$i/o2.cfg ${TTCN_3_DST_PATH}/$i/docs
done

# Update libraries & CC files
garciay's avatar
garciay committed
TTCN_3_LIB_LIST='Common BTP CAM DENM GeoNetworking Ipv6OverGeoNetworking Security MapemSpatem IVIM SremSsem AtsRSUsSimulator Http Pki'
garciay's avatar
garciay committed
for i in ${TTCN_3_LIB_LIST}
do
garciay's avatar
garciay committed
    if [ ! -d ${TTCN_3_DST_PATH}/LibIts/$i ]
garciay's avatar
garciay committed
    then
garciay's avatar
garciay committed
        mkdir -p ${TTCN_3_DST_PATH}/LibIts/$i/docs ${TTCN_3_DST_PATH}/LibIts/$i/src ${TTCN_3_DST_PATH}/LibIts/$i/include ${TTCN_3_DST_PATH}/LibIts/$i/ttcn
garciay's avatar
garciay committed
    fi
    cp ${TTCN_3_ORG_PATH}/LibIts/ttcn/$i/*.ttcn ${TTCN_3_DST_PATH}/LibIts/$i/ttcn
garciay's avatar
garciay committed
    # Update CC files
garciay's avatar
garciay committed
    if [ "$i" == "Common" ]
garciay's avatar
garciay committed
    then
garciay's avatar
garciay committed
        cp ${CC_SRC_PATH}/Externals/LibItsCommon_externals.cc ${TTCN_3_DST_PATH}/LibIts/$i/src
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/*.cc ${TTCN_3_DST_PATH}/LibIts/$i/src
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/*.hh ${TTCN_3_DST_PATH}/LibIts/$i/include
garciay's avatar
garciay committed
    elif [ "$i" == "BTP" ]
    then
garciay's avatar
garciay committed
        cp ${CC_SRC_PATH}/EncDec/LibItsBtp_Encdec.cc ${TTCN_3_DST_PATH}/LibIts/$i/src
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/BTP_ports/*.cc ${TTCN_3_DST_PATH}/LibIts/$i/src
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/BTP_ports/*.hh ${TTCN_3_DST_PATH}/LibIts/$i/include
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/BTP_ports/*.partC ${TTCN_3_DST_PATH}/LibIts/$i/src
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/BTP_ports/*.partH ${TTCN_3_DST_PATH}/LibIts/$i/include
garciay's avatar
garciay committed
    elif [ "$i" == "CAM" ]
    then
garciay's avatar
garciay committed
        cp ${CC_SRC_PATH}/EncDec/LibItsCam_Encdec.cc ${TTCN_3_DST_PATH}/LibIts/$i/src
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/CAM_ports/*.cc ${TTCN_3_DST_PATH}/LibIts/$i/src
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/CAM_ports/*.hh ${TTCN_3_DST_PATH}/LibIts/$i/include
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/CAM_ports/*.partC ${TTCN_3_DST_PATH}/LibIts/$i/src
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/CAM_ports/*.partH ${TTCN_3_DST_PATH}/LibIts/$i/include
garciay's avatar
garciay committed
    elif [ "$i" == "DENM" ]
    then
garciay's avatar
garciay committed
        cp ${CC_SRC_PATH}/EncDec/LibItsDenm_Encdec.cc ${TTCN_3_DST_PATH}/LibIts/$i/src
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/DENM_ports/*.cc ${TTCN_3_DST_PATH}/LibIts/$i/src
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/DENM_ports/*.hh ${TTCN_3_DST_PATH}/LibIts/$i/include
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/DENM_ports/*.partC ${TTCN_3_DST_PATH}/LibIts/$i/src
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/DENM_ports/*.partH ${TTCN_3_DST_PATH}/LibIts/$i/include
garciay's avatar
garciay committed
    elif [ "$i" == "GeoNetworking" ]
    then
garciay's avatar
garciay committed
        cp ${CC_SRC_PATH}/EncDec/LibItsGeoNetworking_Encdec.cc ${TTCN_3_DST_PATH}/LibIts/$i/src
        cp ${CC_SRC_PATH}/Externals/LibItsGeoNetworking_externals.cc ${TTCN_3_DST_PATH}/LibIts/$i/src
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/GN_ports/*.cc ${TTCN_3_DST_PATH}/LibIts/$i/src
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/GN_ports/*.hh ${TTCN_3_DST_PATH}/LibIts/$i/include
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/GN_ports/*.partC ${TTCN_3_DST_PATH}/LibIts/$i/src
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/GN_ports/*.partH ${TTCN_3_DST_PATH}/LibIts/$i/include
garciay's avatar
garciay committed
    elif [ "$i" == "Ipv6OverGeoNetworking" ]
    then
garciay's avatar
garciay committed
        cp ${CC_SRC_PATH}/EncDec/LibItsIpv6OverGeoNetworking_Encdec.cc ${TTCN_3_DST_PATH}/LibIts/$i/src
        cp ${CC_SRC_PATH}/Externals/LibItsIpv6OverGeoNetworking_externals.cc ${TTCN_3_DST_PATH}/LibIts/$i/src
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/IPv6oGN_ports/*.cc ${TTCN_3_DST_PATH}/LibIts/$i/src
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/IPv6oGN_ports/*.hh ${TTCN_3_DST_PATH}/LibIts/$i/include
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/*.hh ${TTCN_3_DST_PATH}/LibIts/$i/include
garciay's avatar
garciay committed
    elif [ "$i" == "Security" ]
    then
garciay's avatar
garciay committed
        cp ${CC_SRC_PATH}/EncDec/LibItsSecurity_Encdec.cc ${TTCN_3_DST_PATH}/LibIts/$i/src
        cp ${CC_SRC_PATH}/Externals/LibItsSecurity_externals.cc ${TTCN_3_DST_PATH}/LibIts/$i/src
garciay's avatar
garciay committed
    elif [ "$i" == "Http" ]
    then
garciay's avatar
garciay committed
        cp ${CC_SRC_PATH}/EncDec/LibItsHttp_Encdec.cc ${TTCN_3_DST_PATH}/LibIts/$i/src
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/Http_ports/*.cc ${TTCN_3_DST_PATH}/LibIts/$i/src
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/Http_ports/*.hh ${TTCN_3_DST_PATH}/LibIts/$i/include
garciay's avatar
garciay committed
    elif [ "$i" == "Pki" ]
    then
garciay's avatar
garciay committed
        cp ${CC_SRC_PATH}/EncDec/LibItsPki_Encdec.cc ${TTCN_3_DST_PATH}/LibIts/$i/src
#        cp ${CC_SRC_PATH}/EncDec/LibItsSecurity_Encdec.cc ${TTCN_3_DST_PATH}/LibIts/$i/src
#        cp ${CC_SRC_PATH}/Externals/LibItsSecurity_externals.cc ${TTCN_3_DST_PATH}/LibIts/$i/src
garciay's avatar
garciay committed
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/Pki_ports/*.cc ${TTCN_3_DST_PATH}/LibIts/$i/src
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/Pki_ports/*.hh ${TTCN_3_DST_PATH}/LibIts/$i/include
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/Pki_ports/*.partC ${TTCN_3_DST_PATH}/LibIts/$i/src
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/Pki_ports/*.partH ${TTCN_3_DST_PATH}/LibIts/$i/include
garciay's avatar
garciay committed
    elif [ "$i" == "MapemSpatem" ]
    then
garciay's avatar
garciay committed
      cp ${CC_SRC_PATH}/EncDec/LibItsMapemSpatem_Encdec.cc ${TTCN_3_DST_PATH}/LibIts/$i/src
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/MapemSpatem_ports/*.cc ${TTCN_3_DST_PATH}/LibIts/$i/src
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/MapemSpatem_ports/*.hh ${TTCN_3_DST_PATH}/LibIts/$i/include
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/MapemSpatem_ports/*.partC ${TTCN_3_DST_PATH}/LibIts/$i/src
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/MapemSpatem_ports/*.partH ${TTCN_3_DST_PATH}/LibIts/$i/include
garciay's avatar
garciay committed
    elif [ "$i" == "IVIM" ]
    then
garciay's avatar
garciay committed
        cp ${CC_SRC_PATH}/EncDec/LibItsIvim_Encdec.cc ${TTCN_3_DST_PATH}/LibIts/$i/src
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/IVIM_ports/*.cc ${TTCN_3_DST_PATH}/LibIts/$i/src
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/IVIM_ports/*.hh ${TTCN_3_DST_PATH}/LibIts/$i/include
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/IVIM_ports/*.partC ${TTCN_3_DST_PATH}/LibIts/$i/src
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/IVIM_ports/*.partH ${TTCN_3_DST_PATH}/LibIts/$i/include
garciay's avatar
garciay committed
    elif [ "$i" == "SremSsem" ]
    then
garciay's avatar
garciay committed
        cp ${CC_SRC_PATH}/EncDec/LibItsSremSsem_Encdec.cc ${TTCN_3_DST_PATH}/LibIts/$i/src
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/SremSsem_ports/*.cc ${TTCN_3_DST_PATH}/LibIts/$i/src
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/SremSsem_ports/*.hh ${TTCN_3_DST_PATH}/LibIts/$i/include
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/SremSsem_ports/*.partC ${TTCN_3_DST_PATH}/LibIts/$i/src
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/SremSsem_ports/*.partH ${TTCN_3_DST_PATH}/LibIts/$i/include
garciay's avatar
garciay committed
    elif [ "$i" == "AtsRSUsSimulator" ]
    then
garciay's avatar
garciay committed
        cp ${CC_SRC_PATH}/Externals/AtsRSUsSimulator_externals.cc ${TTCN_3_DST_PATH}/$i/src
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/RSUsSimulator_ports/*.cc ${TTCN_3_DST_PATH}/$i/src
        cp ${CC_SRC_PATH}/Ports/LibIts_ports/RSUsSimulator_ports/*.hh ${TTCN_3_DST_PATH}/$i/include
garciay's avatar
garciay committed
    fi
done

# Generate Bison parsers is any
cd ${FWK_DST_PATH}/src
if [ "${FWK_DIR_LIST_Y}" != "" ]
then
    for i in ${FWK_DIR_LIST_Y}
    do
        BASE_NAME=$(basename "$i" .y)
garciay's avatar
garciay committed
        bison ${BASE_NAME}.y --defines=../include/${BASE_NAME}.h -o${BASE_NAME}.c
garciay's avatar
garciay committed
    done
fi
if [ "${FWK_DIR_LIST_L}" != "" ]
then
    for i in ${FWK_DIR_LIST_L}
    do
        BASE_NAME=$(basename "$i" .l)
garciay's avatar
garciay committed
        lex -o${BASE_NAME}_flex.c ${BASE_NAME}.l
garciay's avatar
garciay committed
    done
fi
cd -

# Apply patches
garciay's avatar
garciay committed
PATH_PATCHES=`pwd`
garciay's avatar
garciay committed
if [ -d ${PATH_PATCHES} ]
then
garciay's avatar
garciay committed
    # Patch ASN1C Makefile
    # Update GeoNetworking
    cp ${PATH_PATCHES}/geonw_generate_makefile.bash ${PATH_DEV_ITS}/src/AtsGeoNetworking/bin
garciay's avatar
garciay committed
    cp ${PATH_PATCHES}/run_mtc.bash ${PATH_DEV_ITS}/src/AtsGeoNetworking/bin
    cp ${PATH_PATCHES}/run_ptcs.bash ${PATH_DEV_ITS}/src/AtsGeoNetworking/bin
    cp ${PATH_PATCHES}/run_all.bash ${PATH_DEV_ITS}/src/AtsGeoNetworking/bin
garciay's avatar
garciay committed
    # Update BTP
    cp ${PATH_PATCHES}/btp_generate_makefile.bash ${PATH_DEV_ITS}/src/AtsBTP/bin
    ${RUN_PATH}/etsi_its_patches/asn1c_patch.bash ${ASN1_DST_PATH}/../Makefile
    # Update CAM
    cp ${PATH_PATCHES}/cam_generate_makefile.bash ${PATH_DEV_ITS}/src/AtsCAM/bin
garciay's avatar
garciay committed
    cp ${PATH_PATCHES}/run_mtc.bash ${PATH_DEV_ITS}/src/AtsCAM/bin
    cp ${PATH_PATCHES}/run_ptcs.bash ${PATH_DEV_ITS}/src/AtsCAM/bin
    cp ${PATH_PATCHES}/run_all.bash ${PATH_DEV_ITS}/src/AtsCAM/bin
garciay's avatar
garciay committed
    # Update DENM
    cp ${PATH_PATCHES}/denm_generate_makefile.bash ${PATH_DEV_ITS}/src/AtsDENM/bin
garciay's avatar
garciay committed
    cp ${PATH_PATCHES}/run_mtc.bash ${PATH_DEV_ITS}/src/AtsDENM/bin
    cp ${PATH_PATCHES}/run_ptcs.bash ${PATH_DEV_ITS}/src/AtsDENM/bin
    cp ${PATH_PATCHES}/run_all.bash ${PATH_DEV_ITS}/src/AtsDENM/bin
garciay's avatar
garciay committed
    # Update RSUsSimulator
    cp ${PATH_PATCHES}/rsusimulator_generate_makefile.bash ${PATH_DEV_ITS}/src/AtsRSUsSimulator/bin
garciay's avatar
garciay committed
    cp ${PATH_PATCHES}/run_mtc.bash ${PATH_DEV_ITS}/src/AtsRSUsSimulator/bin
    cp ${PATH_PATCHES}/run_ptcs.bash ${PATH_DEV_ITS}/src/AtsRSUsSimulator/bin
    cp ${PATH_PATCHES}/run_all.bash ${PATH_DEV_ITS}/src/AtsRSUsSimulator/bin
garciay's avatar
garciay committed
    # Update AutoInterop
garciay's avatar
garciay committed
    cp ${CC_SRC_PATH}/Ports/LibIts_ports/AutoInterop_ports/*.cc ${TTCN_3_DST_PATH}/AtsAutoInterop/src
    cp ${CC_SRC_PATH}/Ports/LibIts_ports/AutoInterop_ports/*.hh ${TTCN_3_DST_PATH}/AtsAutoInterop/include
garciay's avatar
garciay committed
    cp ${PATH_PATCHES}/autointerop_generate_makefile.bash  ${PATH_DEV_ITS}/src/AtsAutoInterop/bin
garciay's avatar
garciay committed
    cp ${PATH_PATCHES}/run_mtc.bash ${PATH_DEV_ITS}/src/AtsAutoInterop/bin
    cp ${PATH_PATCHES}/run_ptcs.bash ${PATH_DEV_ITS}/src/AtsAutoInterop/bin
    cp ${PATH_PATCHES}/run_all.bash ${PATH_DEV_ITS}/src/AtsAutoInterop/bin
garciay's avatar
garciay committed
    # Update Security
    cp ${PATH_PATCHES}/security_generate_makefile.bash ${PATH_DEV_ITS}/src/AtsSecurity/bin
garciay's avatar
garciay committed
    cp ${PATH_PATCHES}/run_mtc.bash ${PATH_DEV_ITS}/src/AtsSecurity/bin
    cp ${PATH_PATCHES}/run_ptcs.bash ${PATH_DEV_ITS}/src/AtsSecurity/bin
    cp ${PATH_PATCHES}/run_all.bash ${PATH_DEV_ITS}/src/AtsSecurity/bin
garciay's avatar
garciay committed
    # Update GenCert
    cp ${PATH_PATCHES}/gencert_generate_makefile.bash ${PATH_DEV_ITS}/src/AtsGenCert/bin
garciay's avatar
garciay committed
    cp ${PATH_PATCHES}/run_mtc.bash ${PATH_DEV_ITS}/src/AtsGenCert/bin
    cp ${PATH_PATCHES}/run_ptcs.bash ${PATH_DEV_ITS}/src/AtsGenCert/bin
    cp ${PATH_PATCHES}/run_all.bash ${PATH_DEV_ITS}/src/AtsGenCert/bin
garciay's avatar
garciay committed
    # Update Pki
    cp ${PATH_PATCHES}/pki_generate_makefile.bash ${PATH_DEV_ITS}/src/AtsPki/bin
garciay's avatar
garciay committed
    cp ${PATH_PATCHES}/run_mtc.bash ${PATH_DEV_ITS}/src/AtsPki/bin
    cp ${PATH_PATCHES}/run_ptcs.bash ${PATH_DEV_ITS}/src/AtsPki/bin
    cp ${PATH_PATCHES}/run_all.bash ${PATH_DEV_ITS}/src/AtsPki/bin
garciay's avatar
garciay committed
fi

# Set rights
garciay's avatar
garciay committed
find ${PATH_DEV_ITS} -type f -exec chmod 664 {} \;
find ${PATH_DEV_ITS} -name "*.bash" -type f -exec chmod 775 {} \;
find ${PATH_DEV_ITS} -type d -exec chmod 775 {} \;
chown -R ${CHOWN_USER_GROUP} ${PATH_DEV_ITS}
garciay's avatar
garciay committed

# Rename ASN.1 files containing '-' with '_' due to TITAN asn2ttcn tool
mv ${PATH_DEV_ITS}/ttcn/LibIts/asn1/CAM/CAM-PDU-Descriptions.asn ${PATH_DEV_ITS}/ttcn/LibIts/asn1/CAM/CAM_PDU_Descriptions.asn
mv ${PATH_DEV_ITS}/ttcn/LibIts/asn1/DENM/DENM-PDU-Descriptions.asn ${PATH_DEV_ITS}/ttcn/LibIts/asn1/DENM/DENM_PDU_Descriptions.asn
mv ${PATH_DEV_ITS}/ttcn/LibIts/asn1/EVCSN/EVCSN-PDU-Descriptions.asn ${PATH_DEV_ITS}/ttcn/LibIts/asn1/EVCSN/EVCSN_PDU_Descriptions.asn
mv ${PATH_DEV_ITS}/ttcn/LibIts/asn1/EV-RSR/EV-RSR-PDU-Descriptions.asn ${PATH_DEV_ITS}/ttcn/LibIts/asn1/EV-RSR/EV_RSR_PDU_Descriptions.asn
mv ${PATH_DEV_ITS}/ttcn/LibIts/asn1/ITS-Container/ITS-Container.asn ${PATH_DEV_ITS}/ttcn/LibIts/asn1/ITS-Container/ITS_Container.asn
mv ${PATH_DEV_ITS}/ttcn/LibIts/asn1/Security/TS102921/EtsiTs102941MessagesItss-OptionalPrivacy.asn ${PATH_DEV_ITS}/ttcn/LibIts/asn1/Security/TS102921/EtsiTs102941MessagesItss_OptionalPrivacy.asn
garciay's avatar
garciay committed
# Build libAsn1
mkdir ${PATH_DEV_ITS}/bin/asn1
cd ${PATH_DEV_ITS}/bin/asn1
make CC=gcc -f ${PATH_DEV_ITS}/asn1/Makefile
garciay's avatar
garciay committed
# Remove useless ASN.1 files
rm -fr ${PATH_DEV_ITS}/ttcn/LibIts/asn1/IS/ISO_TS_19091/original
garciay's avatar
garciay committed
rm -f ${PATH_DEV_ITS}/ttcn/LibIts/asn1/Security/TS102921/EtsiTs102941MessagesItss.asn
garciay's avatar
garciay committed
rm -f ${PATH_DEV_ITS}/ttcn/LibIts/asn1/Security/TS102921/MessagesItss_OptionalPrivacy.asn
garciay's avatar
garciay committed
cd -
if [ ! -d ${PATH_DEV_ITS}/include/asn1 ]
then
    mkdir ${PATH_DEV_ITS}/include/asn1
else
    for i in `find ${PATH_DEV_ITS}/include/asn1 -name "*.h"`;
    do
garciay's avatar
garciay committed
      rm $i
garciay's avatar
garciay committed
    done
fi
for i in `find ${PATH_DEV_ITS}/bin/asn1 -name "*.h"`
do
    cp $i ${PATH_DEV_ITS}/include/asn1
done
ln -sf ${PATH_DEV_ITS}/bin/asn1/libItsAsn.so ${PATH_DEV_ITS}/lib/libItsAsn.so
ls -ltr ${PATH_DEV_ITS}/lib
echo ${LD_LIBRARY_PATH}
garciay's avatar
garciay committed
#cp ${HOME}/frameworks/asn1c/skeletons/ANY.h ${PATH_DEV_ITS}/include/asn1
garciay's avatar
garciay committed
cd ${OLDPWD}

exit 0