XQuilla/wintools/s_projects
2020-02-17 22:17:06 +01:00

49 lines
1.6 KiB
Text
Executable file

#
# This script drives construction of Visual Studio (version 7.1) projects
# files, using an xquery script (genproject.template),an input XML
# document, and a file containing a list of project names.
#
# xml document input template
CONFIG_INPUT=xqilla.template.xml
# temporary xml document, post-sed-replacement
CONFIG_OUTPUT=xqilla.xml
# substitute some variables in the XML document template
sed -f lib_paths.sed < $CONFIG_INPUT > $CONFIG_OUTPUT
# find the xqilla command line tool
XQILLA=`which xqilla`
if [ ! -x "$XQILLA" ]; then
XQILLA="../xqilla"
fi
if [ ! -x "$XQILLA" ]; then
XQILLA="../build/xqilla"
fi
if [ ! -x "$XQILLA" ]; then
echo "XQilla executable not found. Maybe you need to add it to the path?"
exit 1
fi
echo XQILLA = $XQILLA
# generate the VC7.1 and VC8 project files
$XQILLA -u genproject.xq -v projectFile "$CONFIG_OUTPUT" -v outputPath "../Win32Projects"
# generate srcfiles.in, which gets used to create VC6 project files
$XQILLA gensrcfiles.xq -v projectFile "$CONFIG_OUTPUT" -o srcfiles.in
# Post process the VC7.1 files to put the "Name" attribute first,
# since VC7.1 doesn't use a proper XML parser :-(
for file in `ls ../Win32Projects/VC7.1/*.vcproj ../Win32Projects/VC8/*.vcproj`
do
# This only works if the start elements are always on a single line.
#
# attrs before "Name" attrs after "Name"
# |-------| |-------|
sed -i -e 's/<\([^/>][^> ]*\)\([^>]*\) Name="\([^"]*\)"\([^>]*\)>/<\1 Name="\3"\2\4>/' $file
# |-------------| |-------|
# element name value of "Name" attr
done