summaryrefslogtreecommitdiffstats
path: root/build_env
blob: 46cb18fdd899fcc84d94d7def876dde316440997 (plain)
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

#
# Note: The GF_CONF_OPTS (configure) options will only be used for dev or
# test builds.  For RPM builds the configure options are defined in the
# glusterfs.spec.in file. ASAN is not enabled by for RPMs as it degrades
# performance.  In specific instances it can be enabled simply be appending
# the --with-asan option in the %build step of the spec file.
#

GF_CONF_OPTS="--localstatedir=/var --sysconfdir /var/lib --prefix /usr --libdir /usr/lib64 \
             --enable-fusermount --enable-api --with-jemalloc  \
             --with-ipv6-default --with-fbextras --disable-tiering"

if [ -x /usr/lib/rpm/redhat/dist.sh ]; then
  REDHAT_MAJOR=$(/usr/lib/rpm/redhat/dist.sh --distnum)
else
  REDHAT_MAJOR=0
fi

# Enable systemd support on CentOS >= 7
if [ $REDHAT_MAJOR -ge 7 ]; then
    GF_CONF_OPTS="$GF_CONF_OPTS --with-systemd"
fi
export GF_CONF_OPTS

ASAN_ENABLED=${ASAN_ENABLED:=0}
# Check if ASAN is enabled
if [ "$ASAN_ENABLED" -eq "1" ]; then
    GF_CONF_OPTS="$GF_CONF_OPTS --with-asan"
fi

if [ $REDHAT_MAJOR -eq "7" ]; then
  GCC_BIN="/opt/rh/devtoolset-4/root/usr/bin/gcc"
  GCC_LIB="/opt/rh/devtoolset-4/root/lib64"
  DESTDIR='/' # pycompile is finicky in centos7 if --destdir is passed nothing.
elif [ $REDHAT_MAJOR -eq "6" ]; then
  ENGSHARE_GCC_PATH="/mnt/vol/engshare/third-party2/gcc"
  GCC_BIN="$ENGSHARE_GCC_PATH/4.9.x/centos6-native/108cf83/bin/gcc"
  GCC_LIB="$ENGSHARE_GCC_PATH/4.9.x/centos6-native/108cf83/lib64"
else
  echo "Centos $REDHAT_MAJOR is not currently supported"
  exit 1
fi

export LIB_DIR="$GCC_LIB"
export CC="$GCC_BIN"

#export CC="/mnt/vol/engshare/third-party2/gcc/4.9.x/centos6-native/108cf83/bin/gcc"

# If you think this should all be done in configure.ac you'd be 100%
# correct; aside from the fact that it simply doesn't work when done there :).
# You'll find the debug symbols are not present in resultant binaries nor is
# the code un-optimized.
export CFLAGS="-O0 -ggdb -fPIC -Wall -Werror -L${LIB_DIR}"