1#!/bin/sh
2# $Id: $
3#
4# Build the distribution package.
5. RELEASE || exit 1
6
7# A version string can be specified on the command line (e.g., "20080219").
8# Otherwise, use the standard X.X.X format.
9VERSION=${1:-${DB_VERSION_MAJOR}.${DB_VERSION_MINOR}.${DB_VERSION_PATCH}}
10
11# Use "ustar" as the archiver
12TAR=ustar
13
14# Set root directory where we do the work, can be anywhere.
15D=`pwd`/../release
16R="$D/db-${VERSION}"
17RNC="$D/db-$VERSION.NC"
18
19# Create directory, remove any previous release tree.
20rm -rf $R $RNC
21mkdir -p $R
22
23# Copy the CVS files in the current tree to $R
24hg archive $R
25
26# Build the documentation.
27cd $R/dist && sh s_javadoc
28
29# Remove source directories we don't distribute.
30cd $R && rm -rf build_brew_x build_s60_x
31cd $R && rm -rf java/src/com/sleepycat/xa
32cd $R && rm -rf rpc_* dbinc/db_server_int.h dbinc_auto/rpc*.h
33cd $R && rm -rf test/TODO test/upgrade test/scr036 test_erlang
34cd $R && rm -rf test_perf test_purify test_repmgr
35cd $R && rm -rf test_server test_stl/ms_examples test_stl/stlport
36cd $R && rm -rf test_vxworks
37cd $R && find . -name '.hg*' | xargs rm -f
38cd $R && find . -name 'tags' | xargs rm -f
39
40# Create symbolic links and cscope output, fix permissions.
41#cd $R/dist && sh s_perm
42#cd $R/dist && sh s_cscope
43
44# Build a regular version and smoke test.
45### cd $R && rm -rf build_run && mkdir build_run
46### cd $R/build_run && ../dist/configure && make >& mklog
47### cd $R/build_run && make ex_access && echo "test" | ./ex_access
48# Check the install
49### cd $R/build_run && make prefix=`pwd`/BDB install
50
51# Build a small-footprint version and smoke test.
52### cd $R && rm -rf build_run && mkdir build_run
53### cd $R/build_run && ../dist/configure --enable-smallbuild && make >& mklog
54### cd $R/build_run && make ex_access && echo "test" | ./ex_access
55
56# Remove the build directory
57### cd $R && rm -rf build_run
58
59# Fix permissions
60cd $R && find . -type d | xargs chmod 775
61cd $R && find . -type f | xargs chmod 444
62cd $R && chmod 664 build_windows/*.dsp build_windows/*vcproj
63cd $R && chmod 664 csharp/doc/libdb_dotnet*.XML
64cd $R/dist && sh s_perm
65
66# Check for file names differing only in case.
67cd $R && find . | sort -f | uniq -ic | sed '/1 /d'
68
69# Create the crypto tar archive release.
70T="$D/db-$VERSION.tar.gz"
71cd $D && $TAR czf $T -find db-$VERSION -chown 100 -chgrp 100
72chmod 444 $T
73
74# Create the non-crypto tree.
75cd $D && mv -i db-$VERSION $RNC && $TAR xzf $T
76cd $RNC/dist && sh s_crypto
77
78cd $RNC && find . -type d | xargs chmod 775
79cd $RNC && find . -type f | xargs chmod 444
80cd $RNC && chmod 664 build_windows/*.dsp
81cd $RNC/dist && sh s_perm
82
83# Create the non-crypto tar archive release.
84T="$D/db-$VERSION.NC.tar.gz"
85cd $RNC/.. && $TAR czf $T -find db-$VERSION.NC -chown 100 -chgrp 100
86chmod 444 $T
87
88t=__tmp
89cd $R && awk '{print $0 "\r"}' < LICENSE > $t && rm -f LICENSE && cp $t LICENSE && rm -f $t
90cd $R && awk '{print $0 "\r"}' < README > $t && rm -f README && cp $t README && rm -f $t
91cd $RNC && awk '{print $0 "\r"}' < LICENSE > $t && rm -f LICENSE && cp $t LICENSE && rm -f $t
92cd $RNC && awk '{print $0 "\r"}' < README > $t && rm -f README && cp $t README && rm -f $t
93
94# Create the crypto zip archive release.
95T="$D/db-$VERSION.zip"
96cd $R/.. && rm -f $T && zip -q -r $T db-$VERSION
97chmod 444 $T
98
99# Create the non-crypto zip archive release.
100T="$D/db-$VERSION.NC.zip"
101cd $RNC/.. && rm -f $T && zip -q -r $T db-$VERSION.NC 
102chmod 444 $T
103
104rm -f $R $RNC
105