1#!/bin/bash
2
3LOGDIR=$1
4DIR=$PWD
5TMPDIR=/tmp/logs
6
7if [ -e $TMPDIR ]; then
8	echo "$TMPDIR exists - cannot prepare build trees"
9	exit 1
10fi
11mkdir $TMPDIR
12echo "Preparing separate build trees for hostapd/wpa_supplicant"
13cd ../../..
14git archive --format=tar --prefix=hostap/ HEAD > $TMPDIR/hostap.tar
15cd $DIR
16cat ../../../wpa_supplicant/.config > $TMPDIR/wpa_supplicant.config
17echo "CONFIG_CODE_COVERAGE=y" >> $TMPDIR/wpa_supplicant.config
18cat ../../../hostapd/.config > $TMPDIR/hostapd.config
19echo "CONFIG_CODE_COVERAGE=y" >> $TMPDIR/hostapd.config
20
21cd $TMPDIR
22tar xf hostap.tar
23mv hostap alt-wpa_supplicant
24mv wpa_supplicant.config alt-wpa_supplicant/wpa_supplicant/.config
25tar xf hostap.tar
26mv hostap alt-hostapd
27cp hostapd.config alt-hostapd/hostapd/.config
28tar xf hostap.tar
29mv hostap alt-hostapd-as
30cp hostapd.config alt-hostapd-as/hostapd/.config
31tar xf hostap.tar
32mv hostap alt-hlr_auc_gw
33mv hostapd.config alt-hlr_auc_gw/hostapd/.config
34rm hostap.tar
35
36cd $TMPDIR/alt-wpa_supplicant/wpa_supplicant
37echo "Building wpa_supplicant"
38make -j8 > /dev/null
39
40cd $TMPDIR/alt-hostapd/hostapd
41echo "Building hostapd"
42make -j8 hostapd hostapd_cli > /dev/null
43
44cd $TMPDIR/alt-hostapd-as/hostapd
45echo "Building hostapd (AS)"
46make -j8 hostapd hostapd_cli > /dev/null
47
48cd $TMPDIR/alt-hlr_auc_gw/hostapd
49echo "Building hlr_auc_gw"
50make -j8 hlr_auc_gw > /dev/null
51
52cd $DIR
53
54mv $TMPDIR/alt-wpa_supplicant $LOGDIR
55mv $TMPDIR/alt-hostapd $LOGDIR
56mv $TMPDIR/alt-hostapd-as $LOGDIR
57mv $TMPDIR/alt-hlr_auc_gw $LOGDIR
58