# OpenSSL - a toolkit implementing SSL v2/v3 and TLS v1 protocols as
#           well as a full-strength general purpose cryptography
#           library.
# http://www.openssl.org/

[buildout]
extends =
  ../ca-certificates/buildout.cfg
  ../coreutils/buildout.cfg
  ../patch/buildout.cfg
  ../perl/buildout.cfg
  ../zlib/buildout.cfg

parts =
  openssl-output

[openssl]
recipe = slapos.recipe.cmmi
url = https://www.openssl.org/source/openssl-1.0.1m.tar.gz
md5sum = d143d1555d842a069cb7cc34ba745a06
patch-binary = ${patch:location}/bin/patch
patches =
  ${:_profile_base_location_}/openssl-nodoc.patch#b4887a7b4e18402447bc6227d2493b92
  ${:_profile_base_location_}/openssl-exlibs.patch#dfb8979460d6d75f2d23d1ea83bbb40a
patch-options = -p0
configure-command = ./config
configure-options =
  -I${zlib:location}/include
  -L${zlib:location}/lib
  --openssldir=${buildout:parts-directory}/${:_buildout_section_name_}/etc/ssl
  --prefix=${buildout:parts-directory}/${:_buildout_section_name_}
  --libdir=lib
  shared no-idea no-mdc2 no-rc5 zlib
  -Wl,-rpath=${zlib:location}/lib -Wl,-rpath=${buildout:parts-directory}/${:_buildout_section_name_}/lib
  && make depend

# it seems that parallel build sometimes fails for openssl.
make-options =
  -j1
make-targets =
  all install_sw && rm -f ${buildout:parts-directory}/${:_buildout_section_name_}/etc/ssl/certs/* && for i in ${ca-certificates:location}/certs/*/*.crt; do ln -sv $i ${buildout:parts-directory}/${:_buildout_section_name_}/etc/ssl/certs/`${buildout:parts-directory}/${:_buildout_section_name_}/bin/openssl x509 -hash -noout -in $i`.0; done; true
environment =
  PERL=${perl:location}/bin/perl

[openssl-output]
# Shared binary location to ease migration
recipe = plone.recipe.command
stop-on-error = true
update-command = ${:command}
command = ${coreutils-output:test} -x ${:openssl}
openssl = ${openssl:location}/bin/openssl
