[buildout]
extends =
  ../patch/buildout.cfg
  ../perl/buildout.cfg

parts =
  openblas

extends =
  ../gcc/buildout.cfg

[openblas]
recipe = slapos.recipe.cmmi
url = http://github.com/xianyi/OpenBLAS/archive/v0.2.18.tar.gz
md5sum = 805e7f660877d588ea7e3792cda2ee65
patch-options = -p0
patches =
  ${:_profile_base_location_}/disable_openmp_if_single_core.patch#ee553ccaf9dd4bc37374588e49956f62

build-common-options = BINARY="$(uname -m | grep -q x86_64 && echo 64 || echo 32)" NO_STATIC=1 USE_OPENMP=1 USE_THREAD=1

# You can specify more options with openblas:build-ext-options parameter.
# Example :
# * to build generic binary that supports multiple architecture in one binary
#   DYNAMIC_ARCH=1
# * to specify target explicitly
#   (see https://github.com/xianyi/OpenBLAS/blob/v0.2.15/TargetList.txt )
#   TARGET=HASWELL
build-ext-options =

# First try with auto-detected target and if it fails try TARGET=GENERIC.
configure-command =
  make ${:build-common-options} ${:build-ext-options} || (make -j1 clean && make ${:build-common-options} TARGET=GENERIC)
make-options =
  dummy
make-targets =
  PREFIX="${buildout:parts-directory}/${:_buildout_section_name_}" install
environment =
  PATH=${gcc:location}/bin:${patch:location}/bin:${perl:location}/bin:%(PATH)s
  LD_LIBRARY_PATH=${gcc:location}/lib:${gcc:location}/lib64
  LDFLAGS=-Wl,-rpath=${gcc:location}/lib -Wl,-rpath=${gcc:location}/lib64
