mirror of https://gitee.com/openkylin/enchant.git
47 lines
1.6 KiB
Plaintext
47 lines
1.6 KiB
Plaintext
|
#!/bin/sh
|
||
|
|
||
|
# Script to compile a resource file for a DLL if there is a .rc file
|
||
|
# for it. The resource source file is supposed to contain a version
|
||
|
# info section, that uses the string BUILDNUMBER as the least
|
||
|
# significant part of the version numbers. This script replaces that
|
||
|
# string with a "build number" before compiling the binary resource
|
||
|
# file. The build number is kept between builds in a "stamp" file, and
|
||
|
# incremented each time. (If there is no stamp file, build number 0 is
|
||
|
# used.) The intention is that only the "official" maintainer of a DLL
|
||
|
# keeps such a stamp file, and thus the DLLs he releases have
|
||
|
# increasing version number resources, which can be used by an
|
||
|
# installer program to decide whether to replace an existing DLL with
|
||
|
# the same name.
|
||
|
|
||
|
# This is just my (tml@iki.fi) idea, if somebody comes up with a
|
||
|
# better way to generate version number resources, don't hesitate to
|
||
|
# suggest.
|
||
|
|
||
|
# The command line arguments are:
|
||
|
# $1: the name of the .rc file to check
|
||
|
# $2: the name of the resource object file to produce, if the rc file exists
|
||
|
|
||
|
# Check if we have a resource file for this DLL.
|
||
|
rcfile=$1
|
||
|
resfile=$2
|
||
|
if [ -f $rcfile ]; then
|
||
|
# Check if we have a build number stamp file.
|
||
|
basename=`basename $rcfile .rc`
|
||
|
if [ -f $basename-build.stamp ]; then
|
||
|
read number <$basename-build.stamp
|
||
|
buildnumber=$[number]
|
||
|
echo Build number $buildnumber
|
||
|
rm -rf $basename-build.stamp
|
||
|
else
|
||
|
echo Using zero as build number
|
||
|
buildnumber=0
|
||
|
fi
|
||
|
|
||
|
m4 -DBUILDNUMBER=$buildnumber <$rcfile >$$.rc &&
|
||
|
${WINDRES-windres} $$.rc $resfile &&
|
||
|
rm $$.rc
|
||
|
else
|
||
|
# Return failure
|
||
|
exit 1
|
||
|
fi
|