diff options
Diffstat (limited to 'WebKitLibraries/win/tools/scripts/auto-version.sh')
-rwxr-xr-x | WebKitLibraries/win/tools/scripts/auto-version.sh | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/WebKitLibraries/win/tools/scripts/auto-version.sh b/WebKitLibraries/win/tools/scripts/auto-version.sh index cbdc1af..acb1c61 100755 --- a/WebKitLibraries/win/tools/scripts/auto-version.sh +++ b/WebKitLibraries/win/tools/scripts/auto-version.sh @@ -32,14 +32,21 @@ chomp() eval $1=\$value; } -FALLBACK_VERSION_PATH=`cygpath -u "$WEBKITLIBRARIESDIR\\tools\\scripts\\VERSION"` +if [[ -n "$WEBKITLIBRARIESDIR" ]]; then + FALLBACK_VERSION_PATH=`cygpath -u "$WEBKITLIBRARIESDIR\\tools\\scripts\\VERSION"` + FALLBACK_VERSION=$(cat "$FALLBACK_VERSION_PATH"); + + COPYRIGHT_END_YEAR_PATH=`cygpath -u "$WEBKITLIBRARIESDIR\\tools\\scripts\\COPYRIGHT-END-YEAR"` + COPYRIGHT_END_YEAR=$(cat "$COPYRIGHT_END_YEAR_PATH"); + chomp COPYRIGHT_END_YEAR +fi + OUTPUT_FILE=$(cygpath -u "$1")/include/autoversion.h mkdir -p "$(dirname "$OUTPUT_FILE")" # Take the initial version number from RC_PROJECTSOURCEVERSION if it # exists, otherwise fall back to the version number stored in the source. ENVIRONMENT_VERSION="$RC_PROJECTSOURCEVERSION"; -FALLBACK_VERSION=$(cat "$FALLBACK_VERSION_PATH"); PROPOSED_VERSION=${ENVIRONMENT_VERSION:-$FALLBACK_VERSION} chomp PROPOSED_VERSION @@ -53,7 +60,7 @@ BUILD_TINY_VERSION=$(echo "$PROPOSED_VERSION.." | cut -d '.' -f 3) # Cut the major component down to three characters by dropping any # extra leading digits, then adjust the major version portion of the # version string to match. -CHARACTERS_TO_DROP=$(( ${#BUILD_MAJOR_VERSION} - 3 )) +CHARACTERS_TO_DROP=$(( ${#BUILD_MAJOR_VERSION} > 3 ? ${#BUILD_MAJOR_VERSION} - 3 : 0 )) BUILD_MAJOR_VERSION=${BUILD_MAJOR_VERSION:$CHARACTERS_TO_DROP} PROPOSED_VERSION=${PROPOSED_VERSION:$CHARACTERS_TO_DROP} @@ -87,10 +94,6 @@ if [ -z ${ENVIRONMENT_VERSION} ]; then VERSION_TEXT="${VERSION_TEXT_SHORT} ${USER} - ${BUILD_DATE} - r${SVN_REVISION}" fi -COPYRIGHT_END_YEAR_PATH=`cygpath -u "$WEBKITLIBRARIESDIR\\tools\\scripts\\COPYRIGHT-END-YEAR"` -COPYRIGHT_END_YEAR=$(cat "$COPYRIGHT_END_YEAR_PATH"); -chomp COPYRIGHT_END_YEAR - cat > "$OUTPUT_FILE" <<EOF #define __VERSION_TEXT__ "${VERSION_TEXT}" #define __BUILD_NUMBER__ "${VERSION_TEXT}" @@ -103,5 +106,10 @@ cat > "$OUTPUT_FILE" <<EOF #define __BUILD_NUMBER_MINOR__ ${BUILD_MINOR_VERSION} #define __BUILD_NUMBER_VARIANT__ ${BUILD_TINY_VERSION} #define __SVN_REVISION__ ${SVN_REVISION} +EOF + +if [[ -n "${COPYRIGHT_END_YEAR}" ]]; then +cat >> "$OUTPUT_FILE" <<EOF #define __COPYRIGHT_YEAR_END_TEXT__ "${COPYRIGHT_END_YEAR}" EOF +fi |