Skip to content

Commit

Permalink
build_helper: Optionally allow building without jemalloc (#14)
Browse files Browse the repository at this point in the history
Summary:
As a workaround for facebook/folly#976, modify build_helper.sh to allow disabling jemalloc use by passing the appropriate argument to the cmake invocation on folly.
Pull Request resolved: #14

Reviewed By: mjoras

Differential Revision: D15521328

Pulled By: udippant

fbshipit-source-id: 75a5f5abd99fd50fa939d32da99153ede9d8804e
  • Loading branch information
akshayknarayan authored and facebook-github-bot committed May 29, 2019
1 parent 2040a13 commit b336524
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions build_helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,22 @@ cat 1>&2 <<EOF
Usage ${0##*/} [-h|?] [-p PATH] [-i INSTALL_PREFIX]
-p BUILD_DIR (optional): Path of the base dir for mvfst
-i INSTALL_PREFIX (optional): install prefix path
-m (optional): Build folly without jemalloc
-h|? Show this help message
EOF
}

while getopts ":hp:i:" arg; do
while getopts ":hp:i:m" arg; do
case $arg in
p)
BUILD_DIR="${OPTARG}"
;;
i)
INSTALL_PREFIX="${OPTARG}"
;;
m)
MVFST_FOLLY_USE_JEMALLOC="n"
;;
h | *) # Display help.
usage
exit 0
Expand All @@ -46,6 +50,12 @@ if [ -z "${BUILD_DIR-}" ] ; then
mkdir -p $BUILD_DIR
fi

if [[ ! -z $MVFST_FOLLY_USE_JEMALLOC ]]; then
if [[ "$MVFST_FOLLY_USE_JEMALLOC" != "n" ]]; then
unset $MVFST_FOLLY_USE_JEMALLOC
fi
fi

### configure necessary build and install directories

cd $BUILD_DIR || exit
Expand Down Expand Up @@ -157,10 +167,20 @@ function setup_folly() {
echo -e "${COLOR_GREEN}Building Folly ${COLOR_OFF}"
mkdir -p "$FOLLY_BUILD_DIR"
cd "$FOLLY_BUILD_DIR" || exit
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_PREFIX_PATH="$FOLLY_INSTALL_DIR" \
-DCMAKE_INSTALL_PREFIX="$FOLLY_INSTALL_DIR" \
..

# check for environment variable. If
if [[ -z $MVFST_FOLLY_USE_JEMALLOC ]]; then
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_PREFIX_PATH="$FOLLY_INSTALL_DIR" \
-DCMAKE_INSTALL_PREFIX="$FOLLY_INSTALL_DIR" \
..
else
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_PREFIX_PATH="$FOLLY_INSTALL_DIR" \
-DCMAKE_INSTALL_PREFIX="$FOLLY_INSTALL_DIR" \
-DFOLLY_USE_JEMALLOC=0 \
..
fi
make -j "$nproc"
make install
echo -e "${COLOR_GREEN}Folly is installed ${COLOR_OFF}"
Expand Down

0 comments on commit b336524

Please sign in to comment.