1# $Id: buildrel,v 12.39 2008/01/17 18:18:05 bostic Exp $
2#
3# Build the distribution package.
4#
5# A set of commands intended to be cut-and-pasted into a csh window.
6
7# Set the major, minor & patch values
8# !!! You'll need to edit these commands.
9setenv MAJOR	4
10setenv MINOR	XXX
11setenv PATCH	XXX
12
13# Set root directory where we do the work, can be anywhere.
14setenv D	~/berkeleydb
15setenv R	$D/db-${MAJOR}.${MINOR}.${PATCH}
16
17# Remove any previous release tree.
18rm -rf $R
19
20# Check out a BDB tree from CVS and rename as the release tree.
21rm -rf $R.tmp && mkdir $R.tmp && cd $R.tmp &&\
22    cvs -q co db > /dev/null && mv -i db $R && cd $R && rm -rf $R.tmp
23
24# Update the change log patch number -- there's 1 location to update in
25# the change log "table of contents", and 2 in the Change Log itself.
26cd $R/docs_src/ref/changelog && vi toc.so ${MAJOR}.${MINOR}.html
27
28# Update the release number.
29cd $R/dist &&\
30    (echo "/^DB_VERSION_MAJOR/s/=.*/=$MAJOR/" &&\
31     echo "/^DB_VERSION_MINOR/s/=.*/=$MINOR/" &&\
32     echo "/^DB_VERSION_PATCH/s/=.*/=$PATCH/" &&\
33     echo w &&\
34     echo q) | ed RELEASE > /dev/null
35setenv VERSION `sh -c '. RELEASE; echo $DB_VERSION'`
36echo "Berkeley DB release $VERSION."
37
38# Build auto-generated files.
39cd $R/dist && sh s_all
40
41# Commit all of the changes in to CVS.
42cd $R && cvs -q commit -m "$VERSION release snapshot"
43
44# Remove the CVS files.
45cd $R && find . -name CVS | xargs rm -rf
46
47# Build the documentation.
48cd $R/docs_src && sh build clean && sh build |& sed '/.html$/d'
49
50# Remove source directories we don't distribute.
51cd $R && rm -rf build_brew_x build_s60_x
52cd $R && rm -rf java/src/com/sleepycat/xa
53cd $R && rm -rf rpc_server/java
54cd $R && rm -rf test/TODO test/upgrade test_erlang test_perf test_purify
55cd $R && rm -rf test_rep test_server test_vxworks
56cd $R && find . -name '.cvsignore' | xargs rm -f
57
58# Create symbolic links and cscope output, fix permissions.
59cd $R/dist && sh s_perm
60cd $R/dist && sh s_cscope
61cd $R/dist && sh s_symlink
62
63# Build a version and smoke test.
64setenv DBCONF	"~db/bin/dbconf thread"
65cd $R && rm -rf build_run && mkdir build_run
66cd $R/build_run && $DBCONF && make >& mklog
67cd $R/build_run && make ex_access && ./ex_access
68
69# Check the install
70cd $R/build_run && make prefix=`pwd`/BDB install
71
72# Build a small-footprint version and smoke test.
73cd $R && rm -rf build_run && mkdir build_run
74cd $R/build_run && ../dist/configure --enable-smallbuild && make >& mklog
75cd $R/build_run && make ex_access && ./ex_access
76
77# Remove the build directory
78cd $R && rm -rf build_run
79
80# ACQUIRE ROOT PRIVILEGES
81cd $R && find . -type d | xargs chmod 775
82cd $R && find . -type f | xargs chmod 444
83cd $R && chmod 664 build_windows/*.dsp
84cd $R/dist && sh s_perm
85chown -R 100 $R
86chgrp -R 100 $R
87# DISCARD ROOT PRIVILEGES
88
89# Check for file names differing only in case.
90cd $R && find . | sort -f | uniq -ic | sed '/1 /d'
91
92# Create the crypto tar archive release.
93setenv T "$R/../db-$VERSION.tar.gz"
94cd $R/.. && tar cf - db-$VERSION | gzip --best > $T
95chmod 444 $T
96
97# Check the path length.
98gzcat $T | tar tf - |\
99awk '{ if (length() > 99) print "Path length: " length() " bytes: " $0;}'
100
101# Create the non-crypto tree.
102setenv RNC "$R/../db-$VERSION.NC"
103rm -rf $RNC $R/../__TMP && mkdir $R/../__TMP
104cd $R/../__TMP && gzcat $T | pax -r && mv -i db-$VERSION $RNC
105cd $R && rm -rf $R/../__TMP
106cd $RNC/dist && sh s_crypto
107
108# ACQUIRE ROOT PRIVILEGES
109cd $RNC && find . -type d | xargs chmod 775
110cd $RNC && find . -type f | xargs chmod 444
111cd $RNC && chmod 664 build_windows/*.dsp
112cd $RNC/dist && sh s_perm
113chown -R 100 $RNC
114chgrp -R 100 $RNC
115# DISCARD ROOT PRIVILEGES
116
117# Create the non-crypto tar archive release.
118setenv T "$R/../db-$VERSION.NC.tar.gz"
119cd $RNC/.. && tar cf - db-$VERSION.NC | gzip --best > $T
120chmod 444 $T
121
122# Check the path length.
123gzcat $T | tar tf - |\
124awk '{ if (length() > 99) print "Path length: " length() " bytes: " $0;}'
125
126# Remove tags files.  They're large and we don't want to store symbolic links
127# in the zip archive for portability reasons.
128#
129# Modify the text files to have Windows end-of-line characters.
130# ACQUIRE ROOT PRIVILEGES
131cd $R && rm -f `find . -name 'tags'`
132cd $RNC && rm -f `find . -name 'tags'`
133
134set t=__tmp
135cd $R && awk '{print $0 "\r"}' < LICENSE > $t && cp $t LICENSE && rm -f $t
136cd $R && awk '{print $0 "\r"}' < README > $t && cp $t README && rm -f $t
137cd $RNC && awk '{print $0 "\r"}' < LICENSE > $t && cp $t LICENSE && rm -f $t
138cd $RNC && awk '{print $0 "\r"}' < README > $t && cp $t README && rm -f $t
139# DISCARD ROOT PRIVILEGES
140
141# Create the crypto zip archive release.
142setenv T "$R/../db-$VERSION.zip"
143cd $R/.. && zip -q -r - db-$VERSION > $T
144chmod 444 $T
145
146# Create the non-crypto zip archive release.
147setenv T "$R/../db-$VERSION.NC.zip"
148cd $RNC/.. && zip -q -r - db-$VERSION.NC > $T
149chmod 444 $T
150