-
Notifications
You must be signed in to change notification settings - Fork 1
/
rcompile
executable file
·65 lines (55 loc) · 1.29 KB
/
rcompile
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
56
57
58
59
60
61
62
63
64
#!/bin/bash
#
# Usage:
# rcompile OPTIONS
# Options:
# -l S2E_PATH s2e source folder
# -h HOST_NAME host name
# -r S2E_PATH s2e source folder on host
# -b BUILD_PATH build folder on host
# Example:
# rcompile -l ~/workspace/s2e -h vader1 -r '~/workspace/s2e' -b '~/workspace/build'
#
set -e -u
#
#
#
BUILD_TYPE='debug'
TOOLS_OPTS='ENABLE_OPTIMIZED=0 REQUIRES_RTTI=1'
OPTIND=1
while getopts "l:h:r:b:" opt; do
case "$opt" in
l)
LOCAL_S2E=${OPTARG}
;;
h)
REMOTE_HOST=${OPTARG}
;;
r)
REMOTE_S2E=${OPTARG}
;;
b)
REMOTE_BUILD=${OPTARG}
;;
esac
done
shift $((OPTIND-1))
#
#
#
rsync -avz --delete --exclude='.*' ${LOCAL_S2E}/ ${REMOTE_HOST}:${REMOTE_S2E}
CMD="
if [ ! -d ${REMOTE_BUILD} ]; then
mkdir -p ${REMOTE_BUILD} &&
cd ${REMOTE_BUILD} &&
make -f ${REMOTE_S2E}/Makefile all-${BUILD_TYPE} guest-tools;
else
export CPLUS_INCLUDE_PATH=/usr/include:/usr/include/x86_64-linux-gnu:/usr/include/x86_64-linux-gnu/c++/4.8 &&
make -j16 -C ${REMOTE_BUILD}/qemu-${BUILD_TYPE};
make -j16 -C ${REMOTE_BUILD}/tools-${BUILD_TYPE} ${TOOLS_OPTS};
fi
"
# Expand paths for sed
LOCAL_S2E=$(echo ${LOCAL_S2E})
REMOTE_S2E=$(ssh ${REMOTE_HOST} echo ${REMOTE_S2E})
ssh ${REMOTE_HOST} ${CMD} 2>&1 | sed -l "s#${REMOTE_S2E}#${LOCAL_S2E}#g"