Commit ad144b3e authored by Michele Carignani's avatar Michele Carignani
Browse files

Downloads and compiles titan correctly. The binaries are available at /usr/share/titan/bin

parents
Loading
Loading
Loading
Loading
Loading

.jenkins.sh

0 → 100644
+3 −0
Original line number Diff line number Diff line
#!/bin/bash

docker build --tag titan-docker .

Dockerfile

0 → 100644
+73 −0
Original line number Diff line number Diff line
# Copyright ETSI 2018
# See: https://forge.etsi.org/etsi-forge-copyright-statement.txt

FROM gcc:latest

MAINTAINER ETSI-CTI

LABEL description="Titan Docker Image"

ENV TERM=linux
ENV HOSTNAME docker-titan

RUN echo "docker-titan" > /etc/hostname
RUN DEBIAN_FRONTEND=noninteractive apt-get update 
RUN DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade -y 
# RUN DEBIAN_FRONTEND=noninteractive apt-get autoremove -y 
# RUN DEBIAN_FRONTEND=noninteractive apt-get autoclean -y 
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \
      autoconf \
      bison \
      build-essential \
      cmake \
      curl \
      doxygen \
      emacs \
      expect \
      flex \
      gdb \ 
      git-core \
      gnutls-bin \
      libglib2.0-dev \
      libpcap-dev \
      libgcrypt-dev \
      libncurses5-dev \
      libssl-dev \
      libxml2-dev \
      pkg-config \
      sudo \
      sshpass \
      unzip \
      wget \
    && DEBIAN_FRONTEND=noninteractive apt-get autoremove -y \
    && DEBIAN_FRONTEND=noninteractive apt-get autoclean -y

ADD scripts/devenv.bash.ubuntu /home/root/devenv.bash
ADD scripts/build_titan.bash /opt/titan-build/dev/build_titan.bash
RUN chmod +x /opt/titan-build/dev/build_titan.bash

ADD scripts/titan_repos.txt /opt/titan-build/dev/titan_repos.txt

RUN mkdir -p /opt/titan-build   
RUN cd /opt/titan-build \
    && mkdir -p bin lib include dev tmp frameworks docs 

RUN cd /home/root \
    && export TITAN_HOME=/home/root \
    && echo "---- RUNNING devenv.bash" \
    && . /home/root/devenv.bash \
    && echo "" >> /home/root/.bashrc \
    && echo "---- RUNNING devenv.bash  and adding it to bashrc" \
    && echo ". ./devenv.bash" >> /home/root/.bashrc \
    && echo "" >> /home/root/.bashrc \
    && echo "----  Compiling" \
    && cd /opt/titan-build/dev \
    && TOP=$(pwd) ./build_titan.bash

RUN . /home/root/devenv.bash

# RUN ttcn3_compiler -v

CMD bash

# That's all Floks

Readme.md

0 → 100644
+14 −0
Original line number Diff line number Diff line
# Titan-Docker 

Build and run Titan in a Docker environment

## Contact information

Email at cti_support at etsi dot org

## License

Unless specified otherwise, the content of this repository and the files contained are released under the ETSI Software License.
See the attached LICENSE file or visit
https://forge.etsi.org/etsi-software-license
 No newline at end of file
+107 −0
Original line number Diff line number Diff line
#!/bin/bash
# Copyright ETSI 2018
# See: https://forge.etsi.org/etsi-forge-copyright-statement.txt

set -e
#set -vx

# clear

if [ -z "${TOP}" ]
then
    echo "Failed, TOP variable not defined, exit"
    exit 1
fi

CURDIR=`pwd`
TITAN_DIR=${TOP}/../titan

# Move to the right directory
if [ ! -d ${TITAN_DIR} ]
then
    echo "Titan directory does not exist, create it"
    # Create TITAN directories
    mkdir -p ${TITAN_DIR}
    if [ ! "$?" -eq "0" ]
    then
        echo "Failed, TOP variable not defined, exit"
        exit 2
    fi
    cd ${TITAN_DIR}
    # Clone all TITAN repositories
    if [ ! -f ${CURDIR}/titan_repos.txt ]
    then
        echo "${HOME_BIN}/titan_repos.txt file does not exist, exit"
        rm -fr ${TOP}
        rm -fr ${TOP}/..
        exit 3
    fi
    TITAN_REPOS=`cat ${CURDIR}/titan_repos.txt`
    for i in ${TITAN_REPOS};
    do
        git clone $i
        if [ ! "$?" -eq "0" ]
        then
            echo "Failed to clone $i, exit"
            exit 4
        fi
    done
else
	 echo "Titan directory does exist"
    cd ${TITAN_DIR}
    echo "TITAN DIR: $(pwd)"
    ls -l
    # Update github folders
    DIRS=`find . -type d -name ".git" -exec dirname {} \;`
    for i in ${DIRS};
    do
        echo "Processing $i..."
        cd $i
        git fetch
        if [ ! "$?" -eq "0" ]
        then
            echo "Failed to fetch $i, continue"
        else 
            git pull
            if [ ! "$?" -eq "0" ]
            then
        echo "Failed to pull $i, continue"
            fi
    fi
        cd -
    done
fi


# Build TITAN core
export JNI=no
export GUI=no
export DEBUG=no
export GEN_PDF=no
if [ -d ${TTCN3_DIR} ]
then
    rm -fr ${TTCN3_DIR}
fi
mkdir -p ${TTCN3_DIR}
cd ./titan.core
/bin/cat <<EOF > Makefile.personal
JNI:=no
GUI:=no
DEBUG:=no
GEN_PDF:=no
EOF

echo "Starting build..."
make clean
if [ "${OSTYPE}" == "cygwin" ]
then
    make -j
else
    make
fi
make install
echo "Build done"

# Go back to initial directory
cd ${CURDIR}
exit 0
+66 −0
Original line number Diff line number Diff line
#!/bin/bash

# Turn on debug mode
#set -vx

set -e

# Colors and Prompt
#export PS1="\w\$ "
#export PS1="\D{%Y-%m-%d %H:%M:%S} \w\n\$ "

export EDITOR=emacs
set -o emacs

# Home working directories
export HOME_FRAMEWORKS=${HOME}/frameworks
export HOME_LIB=${HOME}/lib
export HOME_BIN=${HOME}/bin
export HOME_ETC=${HOME}/etc
export HOME_TMP=${HOME}/tmp
export HOME_DOCS=${HOME}/docs

# Home common include directory
export HOME_INC=${HOME}/include

# Update PATH environment variable
export PATH=${HOME_BIN}:${PATH}

# Update LD_LIBRARY_PATH environment variable
if [ "${LD_LIBRARY_PATH}" == "" ]
then
    export LD_LIBRARY_PATH=${HOME_LIB}:/usr/local/lib
else 
    export LD_LIBRARY_PATH=${HOME_LIB}:/usr/local/lib:${LD_LIBRARY_PATH}
fi


# Add JAVA support
export JAVA_VERSION=1.8.0_92
export JAVA_JDK=jdk${JAVA_VERSION}
if [ -d "${HOME_FRAMEWORKS}/${JAVA_JDK}" ]
then
    export JAVA_HOME=${HOME_FRAMEWORKS}/${JAVA_JDK}/bin
else
    unset JAVA_VERSION
    unset JAVA_JDK
fi

# Add TITAN support
export TOP=${HOME_FRAMEWORKS}/titan/titan.core
export TTCN3_DIR=${TOP}/Install
if [ -d ${TTCN3_DIR} ]
then
    export TTCN3_BROWSER=mozilla
    export PATH=${TTCN3_DIR}/bin:${PATH}
    export LD_LIBRARY_PATH=${TTCN3_DIR}/lib:${LD_LIBRARY_PATH}
    export MANPATH=${TTCN3_DIR}/man:${MANPATH}
    export TTCN3_LICENSE_FILE=${TTCN3_DIR}/etc/license/license.dat
    export PATH_DEV_TTCN=${HOME}/dev/ttcn3
    # ITS support
    export PATH_DEV_ITS=${HOME}/TriesAndDelete/etsi_its
    # Emergency Communication support
    export PATH_DEV_EMCOM=${HOME}/TriesAndDelete/etsi_emcom
fi

export BROWSER=netsurf