configure_build.sh 1.25 KB
Newer Older
1
2
3
4
5
# Find, load common utilities
# Defines IS_OSX, fetch_unpack
MULTIBUILD_DIR=$(dirname "${BASH_SOURCE[0]}")
source $MULTIBUILD_DIR/common_utils.sh

6
7
8
9
10
11
# Only source configure_build once
if [ -n "$CONFIGURE_BUILD_SOURCED" ]; then
    return
fi
CONFIGURE_BUILD_SOURCED=1

12
13
14
15
16
17
18
19
20
21
22
23
24
PLAT="${PLAT:x86_64}"
BUILD_PREFIX="${BUILD_PREFIX:-/usr/local}"

# Default compilation flags for OSX
# IS_OSX is defined in common_utils.sh
if [ -n "$IS_OSX" ]; then
    # Dual arch build by default
    ARCH_FLAGS=${ARCH_FLAGS:-"-arch i386 -arch x86_64"}
    # Only set CFLAGS, FFLAGS if they are not already defined.  Build functions
    # can override the arch flags by setting CFLAGS, FFLAGS
    export CFLAGS="${CFLAGS:-$ARCH_FLAGS}"
    export CXXFLAGS="${CXXFLAGS:-$ARCH_FLAGS}"
    export FFLAGS="${FFLAGS:-$ARCH_FLAGS}"
25
26
27

    # Disable homebrew auto-update
    export HOMEBREW_NO_AUTO_UPDATE=1
Uwe L. Korn's avatar
Uwe L. Korn committed
28
29
30
31
32
33
34
else
    # Strip all binaries after compilation.
    STRIP_FLAGS=${STRIP_FLAGS:-"-Wl,-strip-all"}

    export CFLAGS="${CFLAGS:-$STRIP_FLAGS}"
    export CXXFLAGS="${CXXFLAGS:-$STRIP_FLAGS}"
    export FFLAGS="${FFLAGS:-$STRIP_FLAGS}"
35
36
37
38
39
fi

# Promote BUILD_PREFIX on search path to any newly built libs
export CPPFLAGS="-L$BUILD_PREFIX/include $CPPFLAGS"
export LIBRARY_PATH="$BUILD_PREFIX/lib:$LIBRARY_PATH"