[buildout]
extends =
  ../cmake/buildout.cfg
  ../mbedtls/buildout.cfg
  ../pkgconfig/buildout.cfg
  ../lksctp-tools/buildout.cfg
  ../libconfig/buildout.cfg
  ../boost-lib/buildout.cfg
  ../fftw3/buildout.cfg

parts =
  srsLTE

[srsLTE]
recipe = slapos.recipe.cmmi
url = https://github.com/srsLTE/srsLTE/archive/release_18_09.zip
md5sum = d9007ff9bd03ba67c6ed8acfd9bf2a7a 
pre-configure = 
  mkdir -p build
configure-command = cd build && ${cmake:location}/bin/cmake ../  

make-binary =
make-targets= cd build &&
    make DESTDIR=@@LOCATION@@ -j1 install


configure-options = 
  -DCMAKE_C_FLAGS="${:CMAKE_CFLAGS}"
  -DCMAKE_CXX_FLAGS="${:CMAKE_CFLAGS}"
  -DCMAKE_INSTALL_RPATH=${:CMAKE_LIBRARY_PATH}
  -DCMAKE_INCLUDE_PATH=${mbedtls:location}/include
  -DCMAKE_LIBRARY_PATH=${mbedtls:location}/lib

CMAKE_CFLAGS = -I${bzip2:location}/include -I${fftw3:location}/include -I${mbedtls:location}/include -I${lksctp-tools:location}/include -I${libconfig:location}/include -I${boost-lib:location}/include 
CMAKE_LIBRARY_PATH = ${bzip2:location}/lib:${mbedtls:location}/lib:${lksctp-tools:location}/lib:${libconfig:location}/lib:${boost-lib:location}/lib:${fftw3:location}/lib

environment =
  CMAKE_INSTALL_PREFIX=${buildout:directory}/bin
  CMAKE_PROGRAM_PATH=${cmake:location}/bin
  CMAKE_INCLUDE_PATH=${bzip2:location}/include:${mbedtls:location}/include:${lksctp-tools:location}/include:${libconfig:location}/include:${boost-lib:location}/include:${fftw3:location}/include
  CMAKE_LIBRARY_PATH=${:CMAKE_LIBRARY_PATH}
  CPPFLAGS=${:CMAKE_CFLAGS}
  LDFLAGS=-L${bzip2:location}/lib -L${mbedtls:location}/lib -L${lksctp-tools:location}/lib -L${libconfig:location}/lib -L${boost-lib:location}/lib -L${fftw3:location}/lib
  PATH=${cmake:location}/bin:${pkgconfig:location}/bin:%(PATH)s
