Add BSD license file
[platform/upstream/db4.git] / dist / vx_buildcd
1 #!/bin/sh
2 #       $Id$
3 #
4 # Build the Setup SDK CD image on the VxWorks host machine.
5
6 . ./RELEASE
7
8 B=`pwd`
9 B=$B/..
10 D=$B/dist/vx_setup
11 C=$D/db.CD
12 Q=/export/home/sue/SetupSDK
13 S=$Q/resource/mfg/setup
14 W=sun4-solaris2
15
16 symdoc=$D/docs/BerkeleyDB.$DB_VERSION_MAJOR.$DB_VERSION_MINOR.$DB_VERSION_PATCH
17 symdb=$D/windlink/sleepycat/BerkeleyDB.$DB_VERSION_MAJOR.$DB_VERSION_MINOR.$DB_VERSION_PATCH
18 rm -rf $D/docs $D/windlink
19 mkdir $D/docs $D/windlink $D/windlink/sleepycat
20 ln -s $B/docs $symdoc
21 ln -s $B $symdb
22
23 s=/tmp/__db_a
24 t=/tmp/__db_b
25
26 #
27 # Remove the old CD directory if it is there.
28 if test -d $C; then
29         echo "$C cannot exist."
30         echo "As root, execute 'rm -rf $C'"
31         echo "and then rerun the script"
32         exit 1
33 fi
34
35 #
36 # Check for absolute pathnames in the project files.
37 # That is bad, but Tornado insists on putting them in
38 # whenever you add new files.
39 #
40 rm -f $t
41 f=`find $B/build_vxworks -name \*.wpj -print`
42 for i in $f; do
43         grep -l -- "$B" $i >> $t
44 done
45 if test -s $t; then
46         echo "The following files contain absolute pathnames."
47         echo "They must be fixed before building the CD image:"
48         cat $t
49         exit 1
50 fi
51
52 #
53 # NOTE: We reuse the same sed script over several files.
54 #
55 cat <<ENDOFSEDTEXT > $s
56 s/@DB_VERSION_MAJOR@/$DB_VERSION_MAJOR/g
57 s/@DB_VERSION_MINOR@/$DB_VERSION_MINOR/g
58 s/@DB_VERSION_PATCH@/$DB_VERSION_PATCH/g
59 s#@DB_SETUP_DIR@#$D#g
60 ENDOFSEDTEXT
61
62 f=$D/setup.pool
63 (sed -f $s $D/vx_setup.in) > $t
64     (echo "Building $f" && rm -f $f && cp $t $f)
65
66 f=$D/README.TXT
67 (sed -f $s $D/README.in) > $t
68     (echo "Building $f" && rm -f $f && cp $t $f)
69
70 f=$D/CONFIG.TCL
71 (sed -f $s $D/CONFIG.in) > $t
72     (echo "Building $f" && rm -f $f && cp $t $f)
73
74 f=$D/filelist.demo
75 (sed -f $s $D/vx_demofile.in) > $t
76     (echo "Building $f" && rm -f $f && cp $t $f)
77
78 # Copy files into the SetupSDK area.
79 (cd $D && cp README.TXT $S)
80 (cd $D && cp LICENSE.TXT $S)
81 (cd $D && cp CONFIG.TCL $S/RESOURCE/TCL)
82 (cd $D && cp SETUP.BMP $S/RESOURCE/BITMAPS)
83
84 #
85 # NOTE: The contents of LIB must be on one, long, single line.
86 # Even preserving it with a \ doesn't work for htmlBook.
87 #
88 f=../docs/LIB
89 (echo "Building $f" && rm -f $f)
90 cat <<ENDOFLIBTEXT >> $f
91 {BerkeleyDB.$DB_VERSION_MAJOR.$DB_VERSION_MINOR.$DB_VERSION_PATCH} {Berkeley DB} {<b>BerkeleyDB.$DB_VERSION_MAJOR.$DB_VERSION_MINOR.$DB_VERSION_PATCH</b>} {<b><a href="./index.html">BerkeleyDB.$DB_VERSION_MAJOR.$DB_VERSION_MINOR.$DB_VERSION_PATCH</a></b>} {BerkeleyDB} {} {} {}
92 ENDOFLIBTEXT
93
94 #
95 # Start generating the file list.
96 f=$D/filelist.all
97
98 #
99 # Just put everything into the image.  But we only want to find regular
100 # files; we cannot have all the directories listed too.
101 #
102 # NOTE:  This find is overly aggressive in getting files, particularly
103 # for the 'windlink/sleepycat' files.  We actually end up with 3 sets of the
104 # documentation, the "real" ones in 'docs/BerkeleyDB*', the set found
105 # via 'windlink/sleepycat/Berk*/docs' and the one found via our symlink in
106 # 'windlink/sleepycat/Berk*/dist/vx_setup/docs/Berk*'.
107 #
108 # However, we waste a little disk space so that the expression below
109 # is trivial and we don't have to maintain it as new files/directories
110 # are added to DB.
111 #
112 (cd $D && find docs/BerkeleyDB.$DB_VERSION_MAJOR.$DB_VERSION_MINOR.$DB_VERSION_PATCH/ -follow -name \* -type f -print) > $t
113 (cd $D && find windlink/sleepycat/BerkeleyDB.$DB_VERSION_MAJOR.$DB_VERSION_MINOR.$DB_VERSION_PATCH/ -follow -name docs -prune -o -type f -print) >> $t
114 (echo "Building $f" && rm -f $f && cp $t $f)
115 #
116 # Finally build the CD image!
117 #
118 env PATH=$Q/$W/bin:$PATH QMS_BASE=$Q WIND_HOST_TYPE=$W \
119 pool mfg -d $C -v -nokey BerkeleyDB.$DB_VERSION_MAJOR.$DB_VERSION_MINOR < $D/setup.pool