Add BSD license file
[platform/upstream/db4.git] / dist / buildpkg
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.
9 VERSION=${1:-${DB_VERSION_MAJOR}.${DB_VERSION_MINOR}.${DB_VERSION_PATCH}}
10
11 # Use "ustar" as the archiver
12 TAR=ustar
13
14 # Set root directory where we do the work, can be anywhere.
15 D=`pwd`/../release
16 R="$D/db-${VERSION}"
17 RNC="$D/db-$VERSION.NC"
18
19 # Create directory, remove any previous release tree.
20 rm -rf $R $RNC
21 mkdir -p $R
22
23 # Copy the CVS files in the current tree to $R
24 hg archive $R
25
26 # Build the documentation.
27 cd $R/dist && sh s_javadoc
28
29 # Remove source directories we don't distribute.
30 cd $R && rm -rf build_brew_x build_s60_x
31 cd $R && rm -rf java/src/com/sleepycat/xa
32 cd $R && rm -rf rpc_* dbinc/db_server_int.h dbinc_auto/rpc*.h
33 cd $R && rm -rf test/TODO test/upgrade test/scr036 test_erlang
34 cd $R && rm -rf test_perf test_purify test_repmgr
35 cd $R && rm -rf test_server test_stl/ms_examples test_stl/stlport
36 cd $R && rm -rf test_vxworks
37 cd $R && find . -name '.hg*' | xargs rm -f
38 cd $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
60 cd $R && find . -type d | xargs chmod 775
61 cd $R && find . -type f | xargs chmod 444
62 cd $R && chmod 664 build_windows/*.dsp build_windows/*vcproj
63 cd $R && chmod 664 csharp/doc/libdb_dotnet*.XML
64 cd $R/dist && sh s_perm
65
66 # Check for file names differing only in case.
67 cd $R && find . | sort -f | uniq -ic | sed '/1 /d'
68
69 # Create the crypto tar archive release.
70 T="$D/db-$VERSION.tar.gz"
71 cd $D && $TAR czf $T -find db-$VERSION -chown 100 -chgrp 100
72 chmod 444 $T
73
74 # Create the non-crypto tree.
75 cd $D && mv -i db-$VERSION $RNC && $TAR xzf $T
76 cd $RNC/dist && sh s_crypto
77
78 cd $RNC && find . -type d | xargs chmod 775
79 cd $RNC && find . -type f | xargs chmod 444
80 cd $RNC && chmod 664 build_windows/*.dsp
81 cd $RNC/dist && sh s_perm
82
83 # Create the non-crypto tar archive release.
84 T="$D/db-$VERSION.NC.tar.gz"
85 cd $RNC/.. && $TAR czf $T -find db-$VERSION.NC -chown 100 -chgrp 100
86 chmod 444 $T
87
88 t=__tmp
89 cd $R && awk '{print $0 "\r"}' < LICENSE > $t && rm -f LICENSE && cp $t LICENSE && rm -f $t
90 cd $R && awk '{print $0 "\r"}' < README > $t && rm -f README && cp $t README && rm -f $t
91 cd $RNC && awk '{print $0 "\r"}' < LICENSE > $t && rm -f LICENSE && cp $t LICENSE && rm -f $t
92 cd $RNC && awk '{print $0 "\r"}' < README > $t && rm -f README && cp $t README && rm -f $t
93
94 # Create the crypto zip archive release.
95 T="$D/db-$VERSION.zip"
96 cd $R/.. && rm -f $T && zip -q -r $T db-$VERSION
97 chmod 444 $T
98
99 # Create the non-crypto zip archive release.
100 T="$D/db-$VERSION.NC.zip"
101 cd $RNC/.. && rm -f $T && zip -q -r $T db-$VERSION.NC 
102 chmod 444 $T
103
104 rm -f $R $RNC