#!/bin/sh
# we build:
# ucspi-ssl-0.70.tar.gz

CWD=`pwd`

test -d ucspi-ssl-0.70 && rm -rf ucspi-ssl-0.70
mkdir -p "$DST/bin" "$DST/man/man1" 
ut ucspi-ssl-0.70.tar.gz
cd host/superscript.com/net
cat ../../../ucspi-ssl-0.70-ucspitls-0.1.patch |patch -p0
cd ucspi-ssl-0.70/src

echo "$CC $CFLAGS -L$SSL/lib "    > conf-cc
echo "$CC $CFLAGS -L$SSL/lib -s"  > conf-ld
echo "-I $SSL/include" > conf-ssl
echo "$DST/bin"        > conf-tcpbin
echo "$DST"            > conf-home
echo "/etc/certs"      > conf-cadir

cd ..
mkdir -p compile
echo -n > compile/home
./package/compile base
cd command

for i in *; do
 rm -f "$DST/bin/$i" "/command/$i"
 cp -f $i "$DST/bin/$i"
 ln -s "$DST/bin/$i" "/command/$i"
 strip -R .note -R .comment "$DST/bin/$i" 2>/dev/null
done

sync
