diff options
author | Javier <dev.git@javispedro.com> | 2024-10-05 00:58:12 +0200 |
---|---|---|
committer | Javier <dev.git@javispedro.com> | 2024-10-05 00:59:23 +0200 |
commit | ac93b512709187b8b29dbdb1c454813b6bb255ab (patch) | |
tree | 1a5d2dc1750ed299a0058db3a0345381e6fbd692 /scripts | |
parent | c2bffa687813222bc3f8fcc3c9e4bf92672fe7fa (diff) | |
download | vmusic-ac93b512709187b8b29dbdb1c454813b6bb255ab.tar.gz vmusic-ac93b512709187b8b29dbdb1c454813b6bb255ab.zip |
autogenerate version headers from VirtualBox.src contents
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/generate_version_headers.sh | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/scripts/generate_version_headers.sh b/scripts/generate_version_headers.sh new file mode 100755 index 0000000..91dd6ff --- /dev/null +++ b/scripts/generate_version_headers.sh @@ -0,0 +1,64 @@ +#!/bin/sh + +# Generates the {version,revision,product}-generated.h header files from the VirtualBox version contained in VirtualBox.src +# These headers are required when including any VirtualBox.src header. +# This script itself comes mostly from export_modules.sh script in VirtualBox. + +PATH_ROOT=VirtualBox.src +PATH_TMP=obj + +VBOX_VERSION_MAJOR=`sed -e "s/^ *VBOX_VERSION_MAJOR *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Version.kmk` +VBOX_VERSION_MINOR=`sed -e "s/^ *VBOX_VERSION_MINOR *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Version.kmk` +VBOX_VERSION_BUILD=`sed -e "s/^ *VBOX_VERSION_BUILD *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Version.kmk` +VBOX_VERSION_STRING=$VBOX_VERSION_MAJOR.$VBOX_VERSION_MINOR.$VBOX_VERSION_BUILD +VBOX_VERSION_BUILD=`sed -e "s/^ *VBOX_VERSION_BUILD *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Version.kmk` +VBOX_SVN_CONFIG_REV=`sed -e 's/^ *VBOX_SVN_REV_CONFIG_FALLBACK *:= \+\$(patsubst *%:,, *\$Rev: *\([0-9]\+\) *\$ *) */\1/;t;d' $PATH_ROOT/Config.kmk` +VBOX_SVN_VERSION_REV=`sed -e 's/^ *VBOX_SVN_REV_VERSION_FALLBACK *:= \+\$(patsubst *%:,, *\$Rev: *\([0-9]\+\) *\$ *) */\1/;t;d' $PATH_ROOT/Version.kmk` + +if [ -n "$OVERRIDE_SVN_REV" ]; then + VBOX_SVN_REV=$OVERRIDE_SVN_REV +elif [ "$VBOX_SVN_CONFIG_REV" -gt "$VBOX_SVN_VERSION_REV" ]; then + VBOX_SVN_REV=$VBOX_SVN_CONFIG_REV +else + VBOX_SVN_REV=$VBOX_SVN_VERSION_REV +fi +VBOX_VENDOR=`sed -e 's/^ *VBOX_VENDOR *= \+\(.\+\)/\1/;t;d' $PATH_ROOT/Config.kmk` +VBOX_VENDOR_SHORT=`sed -e 's/^ *VBOX_VENDOR_SHORT *= \+\(.\+\)/\1/;t;d' $PATH_ROOT/Config.kmk` +VBOX_PRODUCT=`sed -e 's/^ *VBOX_PRODUCT *= \+\(.\+\)/\1/;t;d' $PATH_ROOT/Config.kmk` +VBOX_C_YEAR=`date +%Y` +VBOX_WITH_PCI_PASSTHROUGH=`sed -e '/^ *VBOX_WITH_PCI_PASSTHROUGH *[:]\?= */!d' -e 's/ *#.*$//' -e 's/^.*= *//' $PATH_ROOT/Config.kmk` + +# Create auto-generated version file, needed by all modules +echo "#ifndef ___version_generated_h___" > $PATH_TMP/version-generated.h +echo "#define ___version_generated_h___" >> $PATH_TMP/version-generated.h +echo "" >> $PATH_TMP/version-generated.h +echo "#define VBOX_VERSION_MAJOR $VBOX_VERSION_MAJOR" >> $PATH_TMP/version-generated.h +echo "#define VBOX_VERSION_MINOR $VBOX_VERSION_MINOR" >> $PATH_TMP/version-generated.h +echo "#define VBOX_VERSION_BUILD $VBOX_VERSION_BUILD" >> $PATH_TMP/version-generated.h +echo "#define VBOX_VERSION_STRING_RAW \"$VBOX_VERSION_MAJOR.$VBOX_VERSION_MINOR.$VBOX_VERSION_BUILD\"" >> $PATH_TMP/version-generated.h +echo "#define VBOX_VERSION_STRING \"$VBOX_VERSION_STRING\"" >> $PATH_TMP/version-generated.h +echo "#define VBOX_API_VERSION_STRING \"${VBOX_VERSION_MAJOR}_${VBOX_VERSION_MINOR}\"" >> $PATH_TMP/version-generated.h +[ -n "$EXTRA_VERSION_STRING" ] && echo "#define VBOX_EXTRA_VERSION_STRING \" ${EXTRA_VERSION_STRING}\"" >> $PATH_TMP/version-generated.h +echo "#define VBOX_PRIVATE_BUILD_DESC \"Private build with export_modules\"" >> $PATH_TMP/version-generated.h +echo "" >> $PATH_TMP/version-generated.h +echo "#endif" >> $PATH_TMP/version-generated.h + +# Create auto-generated revision file, needed by all modules +echo "#ifndef __revision_generated_h__" > $PATH_TMP/revision-generated.h +echo "#define __revision_generated_h__" >> $PATH_TMP/revision-generated.h +echo "" >> $PATH_TMP/revision-generated.h +echo "#define VBOX_SVN_REV $VBOX_SVN_REV" >> $PATH_TMP/revision-generated.h +echo "" >> $PATH_TMP/revision-generated.h +echo "#endif" >> $PATH_TMP/revision-generated.h + +# Create auto-generated product file, needed by all modules +echo "#ifndef ___product_generated_h___" > $PATH_TMP/product-generated.h +echo "#define ___product_generated_h___" >> $PATH_TMP/product-generated.h +echo "" >> $PATH_TMP/product-generated.h +echo "#define VBOX_VENDOR \"$VBOX_VENDOR\"" >> $PATH_TMP/product-generated.h +echo "#define VBOX_VENDOR_SHORT \"$VBOX_VENDOR_SHORT\"" >> $PATH_TMP/product-generated.h +echo "" >> $PATH_TMP/product-generated.h +echo "#define VBOX_PRODUCT \"$VBOX_PRODUCT\"" >> $PATH_TMP/product-generated.h +echo "#define VBOX_C_YEAR \"$VBOX_C_YEAR\"" >> $PATH_TMP/product-generated.h +echo "" >> $PATH_TMP/product-generated.h +echo "#endif" >> $PATH_TMP/product-generated.h |