File: build.sh

package info (click to toggle)
trantor 1.5.20%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,076 kB
  • sloc: cpp: 16,997; sh: 42; makefile: 8
file content (55 lines) | stat: -rwxr-xr-x 942 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env bash

#building trantor
function build_trantor() {

    #Saving current directory
    current_dir="${PWD}"

    #The folder we will build
    build_dir='./build'
    if [ -d $build_dir ]; then
        echo "Deleted folder: ${build_dir}"
        rm -rf $build_dir
    fi

    #Creating building folder
    echo "Created building folder: ${build_dir}"
    mkdir $build_dir

    echo "Entering folder: ${build_dir}"
    cd $build_dir

    echo "Start building trantor ..."
    if [ $1 -eq 1 ]; then
        cmake .. -DBUILD_TESTING=on
    else
        cmake ..
    fi

    #If errors then exit
    if [ "$?" != "0" ]; then
        exit -1
    fi

    make

    #If errors then exit
    if [ "$?" != "0" ]; then
        exit -1
    fi

    echo "Installing ..."
    sudo make install

    #Reback current directory
    cd $current_dir
    exit 0
    #Ok!
}

if [ "$1" = "-t" ]; then
    build_trantor 1
else
    build_trantor 0
fi