#!/bin/bash -
. RELEASE
SRCFILES=srcfiles.in
create_dsp()
{
projname="$1" match="$2" sources="$3" dsptemplate="$4" extra_cppflags="$5" release_libs="$6" debug_libs="$7" lib_suffix="$8" proj_type="$9" proj_guid="${10}"
if [ ! "$proj_type" ] ; then
proj_type=dsp
fi
srctemplate="$BUILDDIR/srcfile_$proj_type.src"
rsrctemplate="$BUILDDIR/rsrcfile_$proj_type.src"
dspoutput=$BUILDDIR/$projname.$proj_type
postbuild=$dspoutput.postbuild
if [ ! -f $postbuild ] ; then
postbuild=/dev/null
fi
rm -f $dspoutput.insert
for srcpath in `egrep "$match" $sources | sed -e 's/[ ].*//'`
do
set - `echo $srcpath | sed -e 's;\(.*\)/;../\\1 ;' \
-e "s;$BUILDDIR;.;" \
-e 's;/;\\\\\\\\;g'`
srcdir="$1"
srcfile="$2"
if [ "${srcfile##*.}" = "rc" -a "$proj_type" = "vcproj" ] ; then
inptemplate=$rsrctemplate
else
inptemplate=$srctemplate
fi
sed -e "s/@srcdir@/$srcdir/g" \
-e "s/@srcfile@/$srcfile/g" \
< $inptemplate >> $dspoutput.insert
done
sed -e "/@SOURCE_FILES@/r$dspoutput.insert" \
-e "/@SOURCE_FILES@/d" \
-e "/@POST_BUILD@/r$postbuild" \
-e "/@POST_BUILD@/d" \
-e "s/@project_name@/$projname/g" \
-e "s/@bin_rel_dest@/Release/g" \
-e "s/@lib_rel_dest@/Release/g" \
-e "s/@bin_debug_dest@/Debug/g" \
-e "s/@lib_debug_dest@/Debug/g" \
-e "s,@extra_cppflags@,$extra_cppflags,g" \
-e "s,@release_libs@,$release_libs,g" \
-e "s,@debug_libs@,$debug_libs,g" \
-e "s,@lib_suffix@,$lib_suffix,g" \
-e "s/@DB_VERSION_MAJOR@/$DB_VERSION_MAJOR/g" \
-e "s/@DB_VERSION_MINOR@/$DB_VERSION_MINOR/g" \
-e "s/@PROJ_GUID@/$proj_guid/g" \
< $dsptemplate > $dspoutput.new
(unix2dos.exe $dspoutput.new) >/dev/null 2>&1
cmp $dspoutput.new $dspoutput > /dev/null 2>&1 ||
(echo "Building $dspoutput" && rm -f $dspoutput &&
cp $dspoutput.new $dspoutput && chmod 664 $dspoutput)
rm -f $dspoutput.insert $dspoutput.new
}
TMPA=/tmp/swindsp$$a
trap "rm -f $TMPA; exit 1" 1 2 3 15
sed -e "s/#.*$//" \
-e "/^[ ]*$/d" \
-e "s/[ ][ ]*/ /" \
-e "s/[ ]*$//" \
-e "/[ ]/!d" \
-e "s/$/ /" < $SRCFILES > $TMPA
MODULES="`sed -e 's/^[^ ]* //' < $TMPA | tr ' ' '\012' | sort | uniq`"
for module in $MODULES
do
case "$module" in
dynamic )
BUILDDIR=../build_windows
create_dsp db_dll " $module " $TMPA $BUILDDIR/dynamic_dsp.src \
'' 'ws2_32.lib' 'ws2_32.lib'
;;
small )
BUILDDIR=../build_windows
create_dsp db_small " $module " $TMPA $BUILDDIR/static_dsp.src \
'/D "HAVE_SMALLBUILD"' '' '' _small
;;
static )
BUILDDIR=../build_windows
create_dsp db_static " $module " $TMPA $BUILDDIR/static_dsp.src
;;
ce)
BUILDDIR=../build_wince
create_dsp db_static " $module " $TMPA \
../build_wince/static_vcp.src '' '' '' '' vcp
create_dsp db_static " $module " $TMPA \
../build_wince/static_vcproj.src '' '' '' '' vcproj \
"4AB4958F-8DD0-49B5-8C02-014B5637C59A"
;;
ce_small)
BUILDDIR=../build_wince
create_dsp db_small " $module " $TMPA \
../build_wince/static_vcp.src '/D "HAVE_SMALLBUILD"' \
'' '' _small vcp
create_dsp db_small " $module " $TMPA \
../build_wince/static_vcproj.src 'HAVE_SMALLBUILD' \
'' '' _small vcproj "6A2849DA-8F7C-4B50-BDAE-AE7752EF8213"
;;
java )
BUILDDIR=../build_windows
create_dsp db_java " $module " $TMPA $BUILDDIR/dynamic_dsp.src '' \
'libdb@DB_VERSION_MAJOR@@DB_VERSION_MINOR@.lib' \
'libdb@DB_VERSION_MAJOR@@DB_VERSION_MINOR@d.lib' _java
;;
tcl )
BUILDDIR=../build_windows
create_dsp db_tcl " $module " $TMPA $BUILDDIR/dynamic_dsp.src \
'/D "DB_TCL_SUPPORT"' \
'libdb@DB_VERSION_MAJOR@@DB_VERSION_MINOR@.lib tcl84.lib' \
'libdb@DB_VERSION_MAJOR@@DB_VERSION_MINOR@d.lib tcl84g.lib' _tcl
;;
testutil )
BUILDDIR=../build_windows
create_dsp db_test " $module " $TMPA $BUILDDIR/app_dsp.src \
'' '/out:"dbkill.exe"' '/out:"dbkill.exe"'
;;
app=* )
BUILDDIR=../build_windows
appname=`echo $module | sed -e 's/^app=//'`
case "$appname" in
ex_rep_base )
libs='ws2_32.lib'
;;
* )
libs=''
;;
esac
case "$appname" in
wce_tpcb )
BUILDDIR=../build_wince
create_dsp $appname " $module " $TMPA \
../build_wince/app_vcp.src '/D "__NO_SYSTEM_INCLUDES"' \
'' '' '' vcp
create_dsp $appname " $module " $TMPA \
../build_wince/app_vcproj.src '__NO_SYSTEM_INCLUDES' \
'' '' '' vcproj "F2CE670A-ABAE-414A-9A17-8079AB58613F"
BUILDDIR=../build_windows
;;
* )
create_dsp $appname " $module " $TMPA $BUILDDIR/app_dsp.src \
'' $libs $libs
;;
esac
;;
brew|s60|vx|vxsmall )
;;
* )
echo \
"s_windows_dsp: module name $module in $SRCFILES is unknown type"
;;
esac
done
rm -f $TMPA