~ubuntu-branches/ubuntu/edgy/rpm/edgy

« back to all changes in this revision

Viewing changes to db/dist/s_win32_dsp

  • Committer: Bazaar Package Importer
  • Author(s): Joey Hess
  • Date: 2002-01-22 20:56:57 UTC
  • Revision ID: james.westby@ubuntu.com-20020122205657-l74j50mr9z8ofcl5
Tags: upstream-4.0.3
ImportĀ upstreamĀ versionĀ 4.0.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh -
 
2
#       $Id: s_win32_dsp,v 1.5 2001/05/27 14:03:33 bostic Exp $
 
3
#
 
4
# Build Windows/32 .dsp files.
 
5
 
 
6
. RELEASE
 
7
 
 
8
BUILDDIR=../build_win32
 
9
SRCFILES=srcfiles.in
 
10
 
 
11
create_dsp()
 
12
{
 
13
    projname="$1"       # name of the .dsp file
 
14
    match="$2"          # the string used to egrep the $sources file
 
15
    sources="$3"        # a modified version of $SRCFILES to facilitate matches
 
16
    dsptemplate="$4"    # overall template file for the .dsp
 
17
    srctemplate="$5"    # template file for the src file fragments
 
18
 
 
19
    dspoutput=$BUILDDIR/$projname.dsp
 
20
 
 
21
    rm -f $dspoutput.insert
 
22
    for srcpath in `egrep "$match" $sources | sed -e 's/[       ].*//'`
 
23
    do
 
24
        # take the path name and break it up, converting / to \\.
 
25
        # so many backslashes needed because of shell quoting and
 
26
        # sed quoting -- we'll end up with two backslashes for every
 
27
        # forward slash, but we need that when feeding that to the
 
28
        # later sed command.
 
29
        set - `echo $srcpath | sed -e 's;\(.*\)/;../\\1 ;' \
 
30
            -e 's;../build_win32;.;' \
 
31
            -e 's;/;\\\\\\\\;g'`
 
32
        srcdir="$1"
 
33
        srcfile="$2"
 
34
        sed -e "s/@srcdir@/$srcdir/g" \
 
35
            -e "s/@srcfile@/$srcfile/g" \
 
36
            < $srctemplate >> $dspoutput.insert
 
37
    done
 
38
    sed -e "/@SOURCE_FILES@/r$dspoutput.insert" \
 
39
        -e "/@SOURCE_FILES@/d" \
 
40
        -e "s/@project_name@/$projname/g" \
 
41
        -e "s/@DB_VERSION_MAJOR@/$DB_VERSION_MAJOR/g" \
 
42
        -e "s/@DB_VERSION_MINOR@/$DB_VERSION_MINOR/g" \
 
43
      < $dsptemplate > $dspoutput.new
 
44
    cmp $dspoutput.new $dspoutput > /dev/null 2>&1 ||
 
45
        (echo "Building $dspoutput" && rm -f $dspoutput &&
 
46
            cp $dspoutput.new $dspoutput && chmod 444 $dspoutput)
 
47
    rm -f $dspoutput.insert $dspoutput.new
 
48
}
 
49
 
 
50
TMPA=/tmp/swin32dsp$$a
 
51
trap "rm -f $TMPA; exit 1" 1 2 3 15 
 
52
 
 
53
# create a copy of the srcfiles with comments and 'skip' lines removed.
 
54
# add a space at the end of each list of modules so that each module
 
55
# can be unambiguously matched e.g. ' dynamic '
 
56
#
 
57
sed -e "s/#.*$//" \
 
58
    -e "/^[     ]*$/d" \
 
59
    -e "s/[     ][      ]*/ /" \
 
60
    -e "s/[     ]*$//" \
 
61
    -e "/ skip$/d" \
 
62
    -e "s/$/ /" < $SRCFILES > $TMPA
 
63
 
 
64
# get a list of all modules mentioned
 
65
#
 
66
MODULES="`sed -e 's/^[^ ]* //' < $TMPA \
 
67
    | tr ' ' '\012' | sort | uniq`"
 
68
 
 
69
for module in $MODULES
 
70
do
 
71
    case "$module" in
 
72
    dynamic )
 
73
        create_dsp db_dll " $module " $TMPA \
 
74
                $BUILDDIR/dynamic_dsp.src $BUILDDIR/srcfile_dsp.src
 
75
        ;;
 
76
    java )
 
77
        create_dsp db_java " $module " $TMPA \
 
78
                $BUILDDIR/java_dsp.src $BUILDDIR/srcfile_dsp.src
 
79
        ;;
 
80
    tcl )
 
81
        create_dsp db_tcl " $module " $TMPA \
 
82
                $BUILDDIR/tcl_dsp.src $BUILDDIR/srcfile_dsp.src
 
83
        ;;
 
84
    testutil )
 
85
        create_dsp db_test " $module " $TMPA \
 
86
                $BUILDDIR/db_test.src $BUILDDIR/srcfile_dsp.src
 
87
        ;;
 
88
    static )
 
89
        create_dsp db_static " $module " $TMPA \
 
90
                $BUILDDIR/static_dsp.src $BUILDDIR/srcfile_dsp.src
 
91
        ;;
 
92
    app=* )
 
93
        appname=`echo $module | sed -e 's/^app=//'`
 
94
        create_dsp $appname " $module " $TMPA \
 
95
                $BUILDDIR/app_dsp.src $BUILDDIR/srcfile_dsp.src
 
96
        ;;
 
97
    * )
 
98
        echo "s_win32_dsp: module name $module in $SRCFILES is unknown type"
 
99
        ;;
 
100
    esac
 
101
done
 
102
 
 
103
rm -f $TMPA