-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.sh
executable file
·56 lines (45 loc) · 1.79 KB
/
build.sh
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
#!/bin/bash
#
# Helper script for installing and building CRAFT the first time.
#
# environment variables
CRAFT_ROOT="$(pwd)"
EXTERN_ROOT="$CRAFT_ROOT/extern"
DYNINST_ROOT="$EXTERN_ROOT/dyninst"
PIN_ROOT="$EXTERN_ROOT/pin-2.14-71313-gcc.4.4.7-linux"
PIN_FILE="pin-2.14-71313-gcc.4.4.7-linux.tar.gz"
PLATFORM="x86_64-unknown-linux2.4"
SETUP_SH="env-setup.sh"
# create extern folder
mkdir -p "$EXTERN_ROOT"
# clone the Dyninst repository
( cd "$EXTERN_ROOT" && \
git clone https://github.com/dyninst/dyninst.git dyninst)
# build a known compatible version of Dyninst
( cd "$DYNINST_ROOT" && \
git checkout v9.1.0 && \
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=$DYNINST_ROOT/$PLATFORM . && \
make install -j16 )
# download and extract Pin (for XED)
( cd "$EXTERN_ROOT" && \
curl -O https://software.intel.com/sites/landingpage/pintool/downloads/$PIN_FILE && \
tar -xf "$PIN_FILE" && \
rm "$PIN_FILE" )
# add XED location to CRAFT makefile
XED_PATH="$(sed -e "s:\/:\\\/:g" <<< "$PIN_ROOT")\/extras\/xed-intel64"
sed -i -e "s/^XED_KIT=.*$/XED_KIT=$XED_PATH/" Makefile
# build CRAFT
export DYNINST_ROOT
export PLATFORM
make -j16
# build viewer (requires Java 1.6 or higher)
( cd viewer && make )
# create environment setup script
echo "#!/bin/bash" >"$SETUP_SH"
echo "export PLATFORM=\"$PLATFORM\"" >>"$SETUP_SH"
echo "export DYNINST_ROOT=\"$DYNINST_ROOT\"" >>"$SETUP_SH"
echo "export PATH=\"$CRAFT_ROOT/$PLATFORM:$CRAFT_ROOT/scripts:\$PATH\"" >>"$SETUP_SH"
echo "export LD_LIBRARY_PATH=\"$CRAFT_ROOT/$PLATFORM/:$DYNINST_ROOT/$PLATFORM/lib:.:\$LD_LIBRARY_PATH\"" >>"$SETUP_SH"
echo "export DYNINSTAPI_RT_LIB=\"$DYNINST_ROOT/$PLATFORM/lib/libdyninstAPI_RT.so\"" >>"$SETUP_SH"
chmod +x "$SETUP_SH"
echo "Build complete. Don't forget to 'source $SETUP_SH' before you run anything."