-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
55 lines (43 loc) · 981 Bytes
/
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
# modify from how2heap's glibc_build.sh
# YOU SHOULD FIRST
#+sudo apt install bear
#+for generating the compile_commands.json file
if [[ $# < 2 ]]; then
echo "Usage: $0 version #make-threads"
exit 1
fi
VERSION=$1
SRC="./glibc_src"
BUILD="$SRC"_"$VERSION"_build
# Get glibc source
if [ -d "$SRC" ]; then
cd $SRC
git pull --all
else
# may be you have to set http_proxy
git clone http://sourceware.org/git/glibc.git "$SRC"
cd "$SRC"
git pull --all
fi
# Checkout release
git rev-parse --verify --quiet "refs/remotes/origin/release/$1/master"
if [[ $? != 0 ]]; then
echo "Error: Glibc version does not seem to exists"
exit 1
fi
git checkout "release/$1/master" -f
cd -
# Build
mkdir -p $BUILD
cd "$BUILD" && rm -rf ./*
../"$SRC"/configure --prefix=/usr
bear make -j "$2"
cd -
echo -e "\n"
echo "Finish!"
echo "SOURCE_DIRECTORY:"
echo "$PWD"/`basename $SRC`
echo "BUILD_DIRECTORY:"
echo $PWD/`basename $BUILD`
echo -e "\n"