#!/bin/bash
export PERL=

if [ `uname` == Darwin ]; then
    ./Configure darwin64-x86_64-cc shared enable-ssl2 --prefix=$PREFIX
else
    ./config shared enable-ssl2 --prefix=$PREFIX
fi

if [ `uname` == Linux ]; then
    make CC="gcc $CFLAGS" SHARED_LDFLAGS="$LDFLAGS -pie" V=1
    make install MAKEFLAGS=-e SHARED_LDFLAGS="$LDFLAGS"
else
    make CC="gcc $CFLAGS $LDFLAGS"
    make install
fi

cd $PREFIX/ssl
cp $RECIPE_DIR/cacert.pem .
ln -s cacert.pem cert.pem
rm -rf man
rm $PREFIX/lib/libcrypto.a
rm $PREFIX/lib/libssl.a
