makerel 2.37 KB
Newer Older
1
#!/bin/bash
2
. bash_helper_functions
3

4
5
# If the first argument to this script is the word major then the 
# major version number is updated and the minor is set back to 0.
6
7
8
9
10
11
12
13

report_failure ()
{
    echo "  **** failed to complete **** "
    exit 1
}


14
./testenv_rel || report_failure
15
16
17
18



REVNUM_FILE=.logger_revnum
19
CHANGESET_ID=`hg id -i | sed -e 's/\+//'`
20

21
22
rm -rf release || report_failure
mkdir release || report_failure
23
24
25
26


if [ "$1" = "major" ] 
    then
27
    MAJOR_NUM=`echo $MAJOR_NUM+1|bc`
28
29
    MINOR_NUM=0 
else 
30
    MINOR_NUM=`echo $MINOR_NUM+1|bc`
31
fi;
32
33
34
set_dlib_version MAJOR $MAJOR_NUM
set_dlib_version MINOR $MINOR_NUM
set_dlib_version PATCH 0 
35
36

RELEASE=${MAJOR_NUM}.${MINOR_NUM} 
37
38
39
40
# Commit changes to the version numbers so that the makedocs script will use them.
echo Create Mercurial tags and commit release
hg tag v$RELEASE || report_failure
hg commit -m "Created release v$RELEASE" || report_failure
41

42
./makedocs makerel || exit 1
43

44
echo $CHANGESET_ID > $REVNUM_FILE
45
46
47
set_dlib_version PATCH 99 
hg commit -m "Record last changeset and set PATCH version to 99"

48
49
50
51
52

cd release || report_failure
RELDIR=`echo dlib-$RELEASE`
mkdir $RELDIR
cd $RELDIR || report_failure
53
cp -r ../../docs/cache/* . || report_failure
54
55

echo Version: $RELEASE >> dlib/README.txt
56
echo "Date:    `date`" >> dlib/README.txt
57
echo Mercurial Revision ID: $CHANGESET_ID >> dlib/README.txt
58
59
60
61
62
63



WEBPAGE=`echo dlib_webpage-$RELEASE.tar`
SOURCE_ZIP=`echo $RELDIR.zip`
SOURCE_TAR=`echo $RELDIR.tar`
64
tar -C ../../docs/chm -cf - docs/ documentation.html | tar -xf - || report_failure
65
66
67
68
cd .. || report_failure

tar -cf $SOURCE_TAR $RELDIR  || report_failure
# flip everything to MS-DOS line endings 
69
70
#find $RELDIR -name "*.cpp" -or -name "*.h" -or -name "*.txt" -or -name "*.html" -or -name "*.py" | xargs flip -m
find $RELDIR -name "*.cpp" -or -name "*.h" -or -name "*.txt" -or -name "*.html" -or -name "*.py" | xargs unix2dos &> /dev/null 
71

72
scp davis@home.dlib.net:dlib_win_python/* $RELDIR/python_examples || report_failure
73
zip -r9 $SOURCE_ZIP $RELDIR > /dev/null || report_failure
74
tar -C ../docs -cf $WEBPAGE web || report_failure
75
76
77
78
79
80
81
82
bzip2 $SOURCE_TAR || report_failure
bzip2 $WEBPAGE || report_failure

rm -rf $RELDIR

wine ../docs/chm/htmlhelp/hhc.exe ../docs/chm/lib.hhp 
mv ../docs/chm/help.chm dlib_documentation-$RELEASE.chm || report_failure

Davis King's avatar
Davis King committed
83
84
85
86
87
88
89

mkdir v$RELEASE
mv dlib_documentation-$RELEASE.chm v$RELEASE
mv $SOURCE_TAR.bz2 v$RELEASE
mv $SOURCE_ZIP v$RELEASE


90
91