Commit a414ba06 authored by Ivan Pozdeev's avatar Ivan Pozdeev
Browse files

Split off build environment configuration to a dedicated file

Resolution option 2-1 for https://github.com/matthew-brett/multibuild/issues/116
parent b9071fc7
......@@ -50,6 +50,7 @@ functions and variables in earlier scripts:
* multibuild/common_utils.sh
* multibuild/osx_utils.sh
* env_vars.sh
* multibuild/configure_build.sh
* multibuild/library_builders.sh
* config.sh
......@@ -80,6 +81,7 @@ following bash scripts:
* multibuild/common_utils.sh
* multibuild/manylinux_utils.sh
* env_vars.sh
* multibuild/configure_build.sh
* multibuild/library_builders.sh
* config.sh
......@@ -321,10 +323,11 @@ To use these scripts
Optionally you can specify a different location for ``config.sh`` file with
the ``$CONFIG_PATH`` environment variable.
* Optionally, create an ``env_vars.sh`` file to set defaults for any build
environment variables used in ``library_builders.sh``. In Linux, they cannot
be just set in the global environment because the build runs in Docker, so
only the variables explicitly passed to ``docker run`` are propagated.
* Optionally, create an ``env_vars.sh`` file to override the defaults for any
environment variables used by ``configure_build.sh``/``library_builders.sh``.
In Linux, they cannot be just set in the initial environment because the
build runs in Docker, so only the variables explicitly passed to
``docker run`` are propagated.
Likewise, you can specify a different location for the file by setting the
the ``$ENV_VARS_PATH`` environment variable.
......
# Find, load common utilities
# Defines IS_OSX, fetch_unpack
MULTIBUILD_DIR=$(dirname "${BASH_SOURCE[0]}")
source $MULTIBUILD_DIR/common_utils.sh
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}"
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"
......@@ -24,6 +24,7 @@ MULTIBUILD_DIR=$(dirname "${BASH_SOURCE[0]}")
# These routines also source common_utils.sh
source $MULTIBUILD_DIR/manylinux_utils.sh
if [ -r "$ENV_VARS_PATH" ]; then source "$ENV_VARS_PATH"; fi
source $MULTIBUILD_DIR/configure_build.sh
source $MULTIBUILD_DIR/library_builders.sh
if [ "$USE_CCACHE" == "1" ]; then
......
# Find, load common utilities
# Defines IS_OSX, fetch_unpack
#Functions and environment variables to build various
#native libraries commonly used as dependencies
MULTIBUILD_DIR=$(dirname "${BASH_SOURCE[0]}")
source $MULTIBUILD_DIR/common_utils.sh
source $MULTIBUILD_DIR/_gfortran_utils.sh
# For OpenBLAS
PLAT="${PLAT:x86_64}"
GF_LIB_URL="https://3f23b170c54c2533c070-1c8a9b3114517dc5fe17b7c3f8c63a43.ssl.cf2.rackcdn.com"
# Recipes for building some libraries
......@@ -45,20 +44,8 @@ OPENSSL_HASH=ce07195b659e75f4e1db43552860070061f156a98bb37b672b101ba6e3ddf30c
OPENSSL_DOWNLOAD_URL=https://www.openssl.org/source
BUILD_PREFIX="${BUILD_PREFIX:-/usr/local}"
ARCHIVE_SDIR=${ARCHIVE_DIR:-archives}
# Set default library compilation flags for OSX
# IS_OSX 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}"
fi
function build_simple {
# Example: build_simple libpng $LIBPNG_VERSION \
......
......@@ -2,6 +2,7 @@
# Smoke test
export BUILD_PREFIX="${PWD}/builds"
rm_mkdir $BUILD_PREFIX
source configure_build.sh
source library_builders.sh
# set -e -x
......
......@@ -11,6 +11,7 @@ ENV_VARS_PATH=${ENV_VARS_PATH:-env_vars.sh}
# These load common_utils.sh
source $MULTIBUILD_DIR/osx_utils.sh
if [ -r "$ENV_VARS_PATH" ]; then source "$ENV_VARS_PATH"; fi
source $MULTIBUILD_DIR/configure_build.sh
source $MULTIBUILD_DIR/library_builders.sh
# NB - config.sh sourced at end of this function.
......
......@@ -10,7 +10,3 @@ if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
else
source $MULTIBUILD_DIR/travis_linux_steps.sh
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"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment