-
Notifications
You must be signed in to change notification settings - Fork 73
/
build_jemalloc.sh
executable file
·52 lines (47 loc) · 1.32 KB
/
build_jemalloc.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
#!/usr/bin/env bash
# =============================================================================
# FILENAME : build_jemalloc.sh
# AUTHOR : Michael Yan
# CREATION : 2023-03-18
# Script to build jemalloc with specified version.
#
# This script will the do the following steps
# 1. Create working directory
# 2. clone the jemalloc source
# 3. checkout the desired release version
# 4. configure, build and install
# =============================================================================
set -e
if [ "$#" -ne 1 ]
then
echo "Usage: $0 <jemalloc version>"
echo " For example, \"$0 5.3.0\""
echo " Please refer to https://github.com/jemalloc/jemalloc"
exit 1
fi
PROJECT_FOLDER=$(pwd)
release_tag=$1
echo "Current project folder is $PROJECT_FOLDER"
build_folder=$PROJECT_FOLDER/build
mkdir -p $build_folder
cd $build_folder
scr_dir="jemalloc"
if [ ! -d $scr_dir ]
then
echo "cloning jemalloc ..."
git clone https://github.com/jemalloc/jemalloc.git
fi
cd $scr_dir
echo "checkout $release_tag"
branch_name=jemalloc-$release_tag
if [ -n "$(git branch --list ${branch_name})" ]
then
echo "Branch name $branch_name already exists; checkout"
git checkout $branch_name
else
git checkout tags/$release_tag -b $branch_name
fi
echo "building..."
./autogen.sh
./configure
make clean && make -j 4 && sudo make install