#!/bin/sh -
#
# build script for 1.3
#
# If it's given a buildname it creates a subdirectory and places a build in it,
# otherwise it just creates the docs and class files.
#

WINDOWTITLE='Bouncy Castle Cryptography 1.19 API Specification'
HEADER='<b>Bouncy Castle Cryptography 1.19</b>'
DOCTITLE='Bouncy Castle 1.19 API Specification'

if test "$1" != ""
then
    echo "making Mail release"

    mkdir bcmail-jdk14-$1
    tar cf - index.html LICENSE.html CONTRIBUTORS.html releasenotes.html specifications.html src/org/bouncycastle/mail src/org/bouncycastle/cms | (cd bcmail-jdk14-$1; tar xf -)
    (
    cd bcmail-jdk14-$1; mkdir classes; mkdir docs;

    javadoc -windowtitle "$WINDOWTITLE" -doctitle "$DOCTITLE" \
        -header "$HEADER" -group "Core Packages" "org.bouncycastle*" \
        -group "Example Packages" "example*" -classpath classes:../jce-jdk14-$1/classes \
        -d docs -sourcepath src \
        org.bouncycastle.cms \
        org.bouncycastle.cms.test \
        org.bouncycastle.mail.smime \
        org.bouncycastle.mail.smime.handlers \
        org.bouncycastle.mail.smime.examples \
        org.bouncycastle.mail.smime.test > /dev/null \

    echo "compiling"

    (cd src/org/bouncycastle; javac -d ../../../classes -classpath ../../../classes:../../../src:../../../../jce-jdk14-$1/classes */*.java */*/*.java */*/*/*.java)
    cat > classes/mail.mf <<%
Manifest-Version: 1.0
Extension-Name: org.bouncycastle.bcmail
Specification-Vendor: BouncyCastle.org
Specification-Version: 1.1
Implementation-Vendor-Id: org.bouncycastle
Implementation-Vendor: BouncyCastle.org
Implementation-Version: 1.19.0
%

    (cd classes; jar cmf mail.mf ../../bcmail-jdk14-$1.jar org)
    )

    (2>&1 find bcmail-jdk14-$1 -name CVS -exec rm -rf \{\} \;) > /dev/null
fi
