8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-26 08:43:03 +01:00
firebird-mirror/src/misc/writeBuildNum.sh

163 lines
3.8 KiB
Bash
Raw Normal View History

2001-08-15 10:44:11 +02:00
#!/bin/sh
2009-04-13 03:46:26 +02:00
# This file is used both to rebuild the header file and to set the
2001-08-15 10:44:11 +02:00
# environment variables on the config call
2010-06-05 02:48:45 +02:00
BuildVersion="$Id: writeBuildNum.sh,v 1.28732 2010/05/29 13:12:08 fsg Exp $"
2001-08-15 10:44:11 +02:00
2015-07-03 13:48:21 +02:00
BuildType=V
2009-10-12 07:25:40 +02:00
MajorVer=3
MinorVer=0
2018-02-05 17:41:54 +01:00
RevNo=4
2018-07-12 02:03:37 +02:00
BuildNum=33008
2004-10-18 01:51:11 +02:00
2010-10-12 10:02:57 +02:00
NowAt=`pwd`
cd `dirname $0`
Root=`pwd`
cd $NowAt
Root=`dirname $Root`
Root=`dirname $Root`
if [ "$SPECIAL_BUILD_SUFFIX" = "" ]; then
2004-10-18 01:51:11 +02:00
# Normal builds
2016-04-07 22:22:22 +02:00
SuffixKind=""
2008-01-15 20:18:32 +01:00
SuffixVer=""
BuildSuffix="Firebird 3.0"
[ "$SuffixKind" = "" ] || BuildSuffix="$BuildSuffix $SuffixKind"
[ "$SuffixVer" = "" ] || BuildSuffix="$BuildSuffix $SuffixVer"
FIREBIRD_PACKAGE_VERSION="$SuffixKind$SuffixVer"
[ "$FIREBIRD_PACKAGE_VERSION" = "" ] && FIREBIRD_PACKAGE_VERSION=0
2004-10-18 01:51:11 +02:00
PRODUCT_VER_STRING="$MajorVer.$MinorVer.$RevNo.$BuildNum"
else
# Special builds (daily snapshots, etc)
2009-10-12 07:25:40 +02:00
BuildSuffix="Firebird 3.0 $SPECIAL_BUILD_SUFFIX"
2004-10-18 01:51:11 +02:00
FIREBIRD_PACKAGE_VERSION=$SPECIAL_BUILD_SUFFIX
PRODUCT_VER_STRING="$MajorVer.$MinorVer.$RevNo.$BuildNum-$SPECIAL_BUILD_SUFFIX"
fi
FIREBIRD_PACKAGE_VERSION=`echo $FIREBIRD_PACKAGE_VERSION | tr -d '[ ]'`
2001-08-15 10:44:11 +02:00
FIREBIRD_VERSION="$MajorVer.$MinorVer.$RevNo"
FILE_VER_STRING="WI-$BuildType$MajorVer.$MinorVer.$RevNo.$BuildNum"
FILE_VER_NUMBER="$MajorVer, $MinorVer, $RevNo, $BuildNum"
2009-04-13 03:46:26 +02:00
if [ $# -eq 3 ]
then
headerFile=$2
tempfile=$3;
else
tempfile=gen/test.header.txt
headerFile=src/jrd/build_no.h;
fi
2001-08-15 10:44:11 +02:00
#______________________________________________________________________________
# Routine to build a new jrd/build_no.h file. If required.
rebuildHeaderFile() {
cat > $tempfile <<eof
/*
2009-04-13 03:46:26 +02:00
FILE GENERATED BY src/misc/writeBuildNum.sh
*** DO NOT EDIT ***
2001-08-15 10:44:11 +02:00
TO CHANGE ANY INFORMATION IN HERE PLEASE
EDIT src/misc/writeBuildNum.sh
2009-04-13 03:46:26 +02:00
FORMAL BUILD NUMBER:$BuildNum
2001-08-15 10:44:11 +02:00
*/
#define PRODUCT_VER_STRING "$PRODUCT_VER_STRING"
#define FILE_VER_STRING "$FILE_VER_STRING"
#define LICENSE_VER_STRING "$FILE_VER_STRING"
#define FILE_VER_NUMBER $FILE_VER_NUMBER
#define FB_MAJOR_VER "$MajorVer"
#define FB_MINOR_VER "$MinorVer"
#define FB_REV_NO "$RevNo"
#define FB_BUILD_NO "$BuildNum"
#define FB_BUILD_TYPE "$BuildType"
#define FB_BUILD_SUFFIX "$BuildSuffix"
eof
cmp -s $headerFile $tempfile
2001-08-15 10:44:11 +02:00
Result=$?
if [ $Result -lt 0 ]
then
2009-10-15 12:04:54 +02:00
echo "error comparing $tempfile and $headerFile"
2001-08-15 10:44:11 +02:00
elif [ $Result -gt 0 ]
then
echo "updating header file $headerFile"
cp $tempfile $headerFile
else
echo "files are identical"
fi
}
#______________________________________________________________________________
# Routine to build a new gen/make.version file.
createMakeVersion() {
2010-10-12 10:02:57 +02:00
OdsH="${Root}/src/jrd/ods.h"
Mini="/tmp/miniods.h"
TestCpp="/tmp/test.cpp"
AOut="/tmp/a.out"
grep ODS_VERSION $OdsH | grep -v ENCODE_ODS >$Mini
cat >$TestCpp <<eof
#include <stdlib.h>
typedef unsigned short USHORT;
#include "$Mini"
2010-11-21 22:21:59 +01:00
int main()
{ return ODS_VERSION; }
2010-10-12 10:02:57 +02:00
eof
[ -z "$CXX" ] && CXX=g++
$CXX $TestCpp -o $AOut
if [ -x $AOut ]
then
$AOut
OdsVersion=$?
else
OdsVersion=0
fi
rm -f $Mini $TestCpp $AOut
cat >$1 <<eof
2009-04-13 03:46:26 +02:00
# FILE GENERATED BY src/misc/writeBuildNum.sh
# *** DO NOT EDIT ***
# TO CHANGE ANY INFORMATION IN HERE PLEASE
# EDIT src/misc/writeBuildNum.sh
2009-04-13 03:46:26 +02:00
# FORMAL BUILD NUMBER:$BuildNum
MajorVer = $MajorVer
MinorVer = $MinorVer
RevNo = $RevNo
2010-08-10 12:42:11 +02:00
BuildNum = $BuildNum
BuildType = $BuildType
BuildSuffix = $BuildSuffix
2001-08-15 10:44:11 +02:00
2010-08-10 12:42:11 +02:00
PackageVersion = $FIREBIRD_PACKAGE_VERSION
FirebirdVersion = $FIREBIRD_VERSION
2010-10-12 10:02:57 +02:00
OdsVersion = $OdsVersion
eof
}
2001-08-15 10:44:11 +02:00
if [ "$1" = "rebuildHeader" ]
2001-08-15 10:44:11 +02:00
then
rebuildHeaderFile
elif [ "$1" = "createMakeVersion" ]
then
if [ -z "$2" ]
then createMakeVersion gen/Make.Version
else createMakeVersion "$2"
fi
2002-07-05 14:07:14 +02:00
elif [ "$1" = "--version" ]
then
2002-07-05 15:10:29 +02:00
echo ""
2002-07-05 14:22:58 +02:00
echo "Build Version : " $BuildType$PRODUCT_VER_STRING $BuildSuffix
2002-07-05 15:10:29 +02:00
echo ""
2002-07-05 15:02:57 +02:00
#echo "($BuildVersion)"
echo "(`echo $BuildVersion | cut -c3-60` )"
2001-08-15 10:44:11 +02:00
fi