Blame build/win32/compile-resource

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