#!/bin/bash

[ -d openssl-0.9.8n ] && rm -r openssl-0.9.8n
tar xzvf openssl-0.9.8n.tar.gz
cd openssl-0.9.8n
patch -p0 < ../openssl.optsx86.diff
./config --prefix=/usr/local --openssldir=/usr/local/etc/ssl shared
make
make INSTALL_PREFIX=/mnt/hda2/pkg install

cd /mnt/hda2/pkg
find $TMPDIR | xargs file | grep "executable" | grep ELF | grep "not stripped" | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
find $TMPDIR | xargs file | grep "shared object" | grep ELF | grep "not stripped" | cut -f 1 -d : | xargs strip -g 2> /dev/null


