aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/build-otp
blob: ad0eb0735912e92b3f32cda0272aa8aae0d29fa7 (plain) (blame)
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
#!/bin/bash

function progress {
    local file=$1
    ls=$(ls -l $file)
    while [ true ]; do
	sleep 10
	new_ls=$(ls -l $file)
	if [ "$new_ls" != "$ls" ]; then
	    echo -n "."
	fi
        ls="$new_ls"
    done
}

function do_and_log {
    log="logs/latest-log.$$"
    echo "" >$log
    echo -n "$1..."
    (progress $log) &
    pid=$!
    disown
    if ./otp_build $2 $3 >$log 2>&1; then
	kill $pid >/dev/null 2>&1
        echo " done."
    else
	kill $pid >/dev/null 2>&1
        echo " failed."
        tail -n 200 $log
        echo "*** Failed ***"
        exit 1
    fi
}

if [ ! -d "logs" ]; then
    mkdir logs
fi

do_and_log "Autoconfing" autoconf
do_and_log "Configuring" configure
do_and_log "Building OTP" boot -a

if [ $1 = "release" ]; then
    do_and_log "Releasing OTP" release -a
fi

exit 0