10 # Build the distribution package.
11 . ./RELEASE || die "Can't read the RELEASE file"
14 # 0 is none, 1 is local dir, 2 is remote dir
25 if [ ! $# -gt 0 ]; then
26 die "csharp_doc_dir param requires argument."
30 if [ ! -f $CSHARP_DOC_SRC ]; then
31 die "CSharp doc archive must exist."
35 if [ ! $# -gt 0 ]; then
36 die "csharp_doc_dir param requires argument."
39 CSHARP_DOC_LOCATION=2;;
41 echo "Doing a test run - this may contain changes that aren't\
42 reflected in a tag, so the package won't be reproducible."
48 # A version string can be specified on the command line (e.g., "20080219").
49 # Otherwise, use the standard X.X.X format.
50 VERSION=${1:-${DB_VERSION_MAJOR}.${DB_VERSION_MINOR}.${DB_VERSION_PATCH}}
52 # Use "ustar" as the archiver
55 # Set root directory where we do the work, can be anywhere.
59 RNC="$D/db-$VERSION.NC"
60 DOCS=`pwd`/../../docs_books-5.3
61 DB_ADDONS=`pwd`/../../db_addons-5.3
63 if [ ! -d $DB_ADDONS ]; then
64 echo "buildpkg requires a db_addons repository at the same level as the db repository."
68 # Create directory, remove any previous release tree.
72 echo "Removed old release build from $R"
74 # Copy the files in the current tip to $R
77 # If doing a test run, apply any local changes to the new tree.
78 if [ $test_run != 0 ]; then
79 hg diff | patch -p1 -d $R
82 echo "Created hg archive in $R"
84 if [ "$nodocs" = true ] ; then
87 [ -d $DOCS ] || die "buildpkg requires a docs_books repository at the same level as the db repository."
89 # Check that the doc repo is up to date, and create a tag if necessary.
94 die "Failed updating the docs_books repository."
96 has_tag=`hg tags | grep "db-${VERSION}"`
97 if [ "$has_tag" = "" ]; then
98 hg tag "db-${VERSION}"
101 hg up -r "db-${VERSION}"
104 # Build a copy of the documentation in the release tree.
106 sh s_docs db-${VERSION} $DOCS
110 die "Failed generating documentation."
113 # Copy in the C sharp doc.
114 if [ $CSHARP_DOC_LOCATION -eq 2 ]; then
115 scp $CSHARP_DOC_SRC .
116 CSHARP_DOC_SRC="csharp_docs.tgz"
117 if [ ! -f $CSHARP_DOC_SRC ]; then
118 echo "WARNING: Invalid csharp doc file - csharp_docs.tgz expected."
121 if [ $CSHARP_DOC_LOCATION -eq 0 -o ! -f $CSHARP_DOC_SRC ]; then
122 echo "WARNING: No csharp docs, skipping."
123 CSHARP_DOC_LOCATION=0
125 if [ $CSHARP_DOC_LOCATION != 0 ]; then
126 rm -rf $R/docs/csharp
127 mkdir -p $R/docs/csharp
128 $TAR zxf $CSHARP_DOC_SRC -C $R/docs/csharp
131 # Build the Java documentation.
132 cd $R/dist && sh s_javadoc
135 # Pull a copy of the JDBC and ODBC libraries into the package.
136 # Build the ADO.NET package, including moving the ADO.NET doc built above
138 # Tell the script where to look for packages.
139 cd $R/dist && sh s_sql_drivers ../../../..
140 # Warn if s_sql_drivers didn't move its docs.
141 if [ -e "$R/docs/bdb-sql-ado" ]; then
142 echo "WARNING: ADO.NET doc is still in the non ADO.NET package."
147 # Pull a copy of the bfile directory into the package.
151 echo "Failed updating the db_addons repository. Exiting."
157 SQL_EXT_DIR=$R/lang/sql/sqlite/ext
158 if [ ! -d $SQL_EXT_DIR ]; then
159 mkdir -p $SQL_EXT_DIR
161 if [ -d $SQL_EXT_DIR/bfile ]; then
162 rm -rf $SQL_EXT_DIR/bfile
164 cp -rp $DB_ADDONS/bfile $SQL_EXT_DIR
166 # Remove source directories we don't distribute.
167 cd $R && rm -rf test/tcl/TODO test/upgrade test/scr036 test/erlang
168 cd $R && rm -rf test/perf test/purify test/repmgr
169 cd $R && rm -rf test/server test/stl test/vxworks
170 cd $R && find . -name '.hg*' | xargs rm -f
171 cd $R && find . -name 'tags' | xargs rm -f
173 # Create symbolic links and cscope output, fix permissions.
174 #cd $R/dist && sh s_perm
175 #cd $R/dist && sh s_cscope
177 # Build a regular version and smoke test.
178 ### cd $R && rm -rf build_run && mkdir build_run
179 ### cd $R/build_run && ../dist/configure && make >& mklog
180 ### cd $R/build_run && make ex_access && echo "test" | ./ex_access
182 ### cd $R/build_run && make prefix=`pwd`/BDB install
184 # Build a small-footprint version and smoke test.
185 ### cd $R && rm -rf build_run && mkdir build_run
186 ### cd $R/build_run && ../dist/configure --enable-smallbuild && make >& mklog
187 ### cd $R/build_run && make ex_access && echo "test" | ./ex_access
189 # Remove the build directory
190 ### cd $R && rm -rf build_run
192 (cd $R/dist && ./s_perm)
194 # Check for file names differing only in case.
195 cd $R && find . | sort -f | uniq -ic | sed '/1 /d'
197 # Create the crypto tar archive release.
198 T="$D/db-$VERSION.tar.gz"
200 cd $D || die "Can't find $D"
201 # Move package files in db-$VERSION/release to current directory so that
202 # regular packages won't includes generated package twice.
203 if [ -d "db-$VERSION/release" ]; then
204 mv db-$VERSION/release/* .
205 rm -rf db-$VERSION/release
207 $TAR czf $T -find db-$VERSION -chown 100 -chgrp 100
210 # Create the non-crypto tree.
211 cd $D && mv -i db-$VERSION $RNC && $TAR xzf $T
212 cd $RNC/dist && sh s_crypto
214 (cd $RNC/dist && ./s_perm)
216 # Create the non-crypto tar archive release.
217 T="$D/db-$VERSION.NC.tar.gz"
219 cd $RNC/.. && $TAR czf $T -find db-$VERSION.NC -chown 100 -chgrp 100
223 cd $R && awk '{print $0 "\r"}' < LICENSE > $t && rm -f LICENSE && cp $t LICENSE
224 cd $R && awk '{print $0 "\r"}' < README > $t && rm -f README && cp $t README && rm $t
225 cd $RNC && awk '{print $0 "\r"}' < LICENSE > $t && rm -f LICENSE && cp $t LICENSE
226 cd $RNC && awk '{print $0 "\r"}' < README > $t && rm -f README && cp $t README && rm $t
228 # Create the crypto zip archive release.
229 T="$D/db-$VERSION.zip"
231 cd $R/.. && rm -f $T && zip -q -r $T db-$VERSION
234 # Create the non-crypto zip archive release.
235 T="$D/db-$VERSION.NC.zip"
237 cd $RNC/.. && rm -f $T && zip -q -r $T db-$VERSION.NC
242 if [ "$TAG_CREATED" = "true" ]; then
243 echo "Created a tag in docs_books repository. Please push."