# 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.2i.tar.gz
md5sum = 678374e63f8df456a697d3e5e5a931fb
location = ${buildout:parts-directory}/${:_buildout_section_name_}
# 'prefix' option to override --openssldir/--prefix (which is useful
# when combined with INSTALL_PREFIX). Used by slapos.package.git/obs
prefix = ${:location}
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.2d-parallel-build.patch#e4cf66a48a85a0da68fd4842e6fab54b
patch-options = -p1
configure-command = ./config
configure-options =
  -I${zlib:location}/include
  -L${zlib:location}/lib
  --openssldir=${:prefix}/etc/ssl
  --prefix=${:prefix}
  --libdir=lib
  shared no-idea no-mdc2 no-rc5 zlib
  -Wl,-rpath=${zlib:location}/lib -Wl,-rpath=${:location}/lib
  && make depend
make-targets =
  install_sw && x=${:location}/etc/ssl/certs && rm -f $x/* &&
  for i in ${ca-certificates:location}/certs/*/*.crt; do
    ln -sv $i $x/`${:location}/bin/openssl x509 -hash -noout -in $i`.0
  ; done
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