# 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.2c.tar.gz
md5sum = 8c8d81a9ae7005276e486702edbcd4b6
patch-binary = ${patch:location}/bin/patch
patches =
  ${:_profile_base_location_}/openssl-nodoc.patch#a78c14908fe9ec624b1fb9fa97e01bb9
  ${:_profile_base_location_}/openssl-exlibs.patch#fba5c873cf974ba80a973be41da3c738
  ${:_profile_base_location_}/openssl-1.0.2a-parallel-build.patch#2a79dd064f610860857b50a41eace64d
patch-options = -p1
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
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