-
Notifications
You must be signed in to change notification settings - Fork 3
/
deps.sh
executable file
·68 lines (55 loc) · 1.17 KB
/
deps.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
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
set -e
#
# Sets up jemalloc dependency
#
SCRIPT_DIR=`dirname "$0"`
JEMALLOC_DIR=jemalloc
usage="Example: $1 [args] setup jemalloc \n
-f, --force \t force clean and setup everything\n
-h, --help \t this usage information message\n"
# parse cli
for i in "$@"
do
case $i in
-f| --force)
FORCE=1
;;
-h|--help)
echo -e $usage
exit
;;
*) # unknown option
echo "Unknown Option: $i"
echo -e $usage
exit
;;
esac
done
pushd ${SCRIPT_DIR}
# clean
if [[ $FORCE ]];
then
rm -rf ${JEMALLOC_DIR}
fi
# Initialize & setup jemalloc
if [ ! -d ${JEMALLOC_DIR} ]; then
git submodule update --init ${JEMALLOC_DIR}
fi
# build
pushd ${JEMALLOC_DIR}
if [[ $FORCE ]]; then rm -rf build; fi
autoconf
mkdir -p build
pushd build
../configure --with-jemalloc-prefix=rmlib_je_ --config-cache --disable-cxx
make -j$(nproc)
popd
# save paths
JE_BUILD_DIR=`pwd`/build
echo "-L${JE_BUILD_DIR}/lib -Wl,-rpath,${JE_BUILD_DIR}/lib -ljemalloc" > je_libs
echo "${JE_BUILD_DIR}/lib/libjemalloc_pic.a" > je_static_libs
echo "-I${JE_BUILD_DIR}/include" > je_includes
popd
# other deps
sudo apt-get install binutils # for addr2line