[buildout]
extends =
  %BUILDOUT_URL%

# Don't load extensions
extensions = 

extends-cache= extends-cache
download-cache= download-cache

# Uguu, upstream buildout.cfg must be patched as it works the other way
# around from a packager point of view at least, thus at the end static
# path, such as Python HOME directory, are wrong...
#
# Currently:
# ./configure --prefix=BUILD_DIRECTORY && make install
# Instead of:
# ./configure --prefix=INSTALL_DIRECTORY && make install DESTDIR=BUILD_DIRECTORY
[python2.7]
configure-options +=
  --prefix=%TARGET_DIRECTORY%/parts/${:_buildout_section_name_}
environment +=
  DESTDIR=%BUILD_ROOT_DIRECTORY%

[gettext]
# Add gettext library path to RPATH as its binaries are used to build
# glib for example
environment =
  PATH=${perl:location}/bin:${lunzip:location}/bin:%(PATH)s
  CPPFLAGS=-I${libxml2:location}/include -I${zlib:location}/include -I${ncurses:location}/include
  LDFLAGS=-L${libxml2:location}/lib -Wl,-rpath=${libxml2:location}/lib -L${zlib:location}/lib -Wl,-rpath=${zlib:location}/lib -L${ncurses:location}/lib -Wl,-rpath=${ncurses:location}/lib -Wl,-rpath=%BUILD_DIRECTORY%/parts/${:_buildout_section_name_}/lib

[bison]
configure-options +=
  --prefix=%TARGET_DIRECTORY%/parts/${:_buildout_section_name_}
make-options +=
  DESTDIR=%BUILD_ROOT_DIRECTORY%

[dbus]
configure-options +=
  --prefix=%TARGET_DIRECTORY%/parts/${:_buildout_section_name_}
make-options +=
  DESTDIR=%BUILD_ROOT_DIRECTORY%
environment +=
  LDFLAGS=-L${libexpat:location}/lib -L${buildout:parts-directory}/${:_buildout_section_name_}/lib -Wl,-rpath=${buildout:parts-directory}/${:_buildout_section_name_}/lib
  LD_LIBRARY_PATH=${buildout:parts-directory}/${:_buildout_section_name_}/lib
post-install =
  mkdir -p %BUILD_DIRECTORY%/parts/${:_buildout_section_name_}/var/run/dbus

[dbus-glib]
environment +=
  CPPFLAGS=-I${libexpat:location}/include -I${dbus:location}/include/dbus-1.0 -I${dbus:location}/lib/dbus-1.0/include
  LDFLAGS=-L${libexpat:location}/lib -L${gettext:location}/lib -Wl,-rpath=${zlib:location}/lib -L${dbus:location}/lib -Wl,-rpath=${dbus:location}/lib
  LD_LIBRARY_PATH=${dbus:location}/lib

[dbus-python]
pre-configure =
  sed -i 's#/opt/slapos/parts/dbus/lib/libdbus-1.la#${dbus:location}/lib/libdbus-1.la#' ${dbus-glib:location}/lib/libdbus-glib-1.la
environment +=
  LD_LIBRARY_PATH=${dbus:location}/lib
  LDFLAGS=-L${glib:location}/lib -Wl,-rpath=${glib:location}/lib -L${dbus:location}/lib -Wl,-rpath=${dbus:location}/lib
post-install =
  sed -i 's#${dbus:location}/lib/libdbus-1.la#/opt/slapos/parts/dbus/lib/libdbus-1.la#' ${dbus-glib:location}/lib/libdbus-glib-1.la

[openssl]
# HTTPS is not work on debian 6 where the package is originally
# prepared to be upload.
#url = http://www.openssl.org/source/openssl-1.0.2d.tar.gz
#url = http://ftp.vim.org/security/openssl/openssl-1.0.2d.tar.gz
url = http://www.openssl.org/source/openssl-1.0.2e.tar.gz

prefix = %TARGET_DIRECTORY%/parts/${:_buildout_section_name_}
make-options +=
  INSTALL_PREFIX=%BUILD_ROOT_DIRECTORY%


[bison-go]
<= bison
configure-options =
  --prefix=${buildout:parts-directory}/${:_buildout_section_name_}
make-options =

[gobject-introspection]
pre-configure =
  sed -i 's#!/opt/slapos/parts/python2.7/bin/python2.7#!${python2.7:location}/bin/python2.7#' ${python2.7:location}/bin/python-config
  libtoolize -c -f
  aclocal -I${pkgconfig:location}/share/aclocal -I${gettext:location}/share/aclocal -I${libtool:location}/share/aclocal
  ./autogen.sh
configure-options +=
  --enable-shared
environment +=
  PATH=${autoconf:location}/bin:${automake:location}/bin:${pkgconfig:location}/bin:${libtool:location}/bin:${intltool:location}/bin:${gettext:location}/bin:${glib:location}/bin:${flex:location}/bin:${bison-go:location}/bin:%(PATH)s
  GIR_DIR=${buildout:parts-directory}/${:_buildout_section_name_}/share/gir-1.0
  CPPFLAGS=-I${glib:location}/include/glib-2.0 -I${glib:location}/lib/glib-2.0/include -I${python2.7:location}/include/python2.7
  LDFLAGS=-L${glib:location}/lib -Wl,-rpath=${glib:location}/lib -L${libffi:location}/lib -Wl,-rpath=${libffi:location}/lib -lffi -L${python2.7:location}/lib

post-install = 
  sed -i 's#!${python2.7:location}/bin/python2.7#!/opt/slapos/parts/python2.7/bin/python2.7#' ${python2.7:location}/bin/python-config
  rm -rf ${bison-go:location}

[pygobject3]
pre-configure +=
  sed -i 's#!/opt/slapos/parts/python2.7/bin/python2.7#!${python2.7:location}/bin/python2.7#' ${python2.7:location}/bin/python-config
environment +=
  CPPFLAGS=-I${glib:location}/include/glib-2.0 -I${glib:location}/lib/glib-2.0/include -I${gettext:location}/include -I${libffi:location}/include -I${python2.7:location}/include/python2.7
  LDFLAGS=-L${glib:location}/lib -Wl,-rpath=${glib:location}/lib -L${gettext:location}/lib -Wl,-rpath=${gettext:location}/lib -L${python2.7:location}/lib
post-install =
  sed -i 's#!${python2.7:location}/bin/python2.7#!/opt/slapos/parts/python2.7/bin/python2.7#' ${python2.7:location}/bin/python-config

[ncurses]
configure-options =
  --prefix=${buildout:parts-directory}/${:_buildout_section_name_}
  --with-shared
  --without-ada
  --without-manpages
  --without-tests
  --without-normal
  --without-debug
  --without-gpm
  --enable-rpath

[versions]
cliff = 1.4.5
slapos.core = 1.3.15
zc.buildout = 2.5.0.post1
