summaryrefslogtreecommitdiffstats
path: root/chrome/tools/build/linux/version.sh
diff options
context:
space:
mode:
authormmoss@chromium.org <mmoss@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-24 18:03:55 +0000
committermmoss@chromium.org <mmoss@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-24 18:03:55 +0000
commit6d4da12a46fe044a8e476c72fd6f6538e28aec21 (patch)
treeff04034426388fb2327a30abd0fa32652b6fc34e /chrome/tools/build/linux/version.sh
parent3b9a32f0cf51bca46ed58b1afb2ac33d1d668a96 (diff)
downloadchromium_src-6d4da12a46fe044a8e476c72fd6f6538e28aec21.zip
chromium_src-6d4da12a46fe044a8e476c72fd6f6538e28aec21.tar.gz
chromium_src-6d4da12a46fe044a8e476c72fd6f6538e28aec21.tar.bz2
Generate header file of Linux version information (currently gyp-only).
This isn't yet #included in file_version_info_linux.cc since we haven't officially cutover to the gyp build. BUG=8132 Review URL: http://codereview.chromium.org/45028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12369 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/tools/build/linux/version.sh')
-rwxr-xr-xchrome/tools/build/linux/version.sh50
1 files changed, 50 insertions, 0 deletions
diff --git a/chrome/tools/build/linux/version.sh b/chrome/tools/build/linux/version.sh
new file mode 100755
index 0000000..2b6bb61
--- /dev/null
+++ b/chrome/tools/build/linux/version.sh
@@ -0,0 +1,50 @@
+#!/bin/sh
+#
+# Copyright (c) 2009 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# TODO(mmoss) This is (mostly) just a conversion to sh syntax of
+# tools/build/win/version.bat. Rewrite both as common python.
+
+TMPL="$1"
+OUTFILE="$2"
+CHROMEDIR="$3"
+
+# Load version digits as environment variables.
+source "$CHROMEDIR/VERSION"
+
+# Load branding strings as environment variables
+DISTRIBUTION="chromium"
+if [ "$CHROMIUM_BUILD" = "_google_chrome" ]; then
+ DISTRIBUTION="google_chrome"
+fi
+# Make sure the string values are quoted.
+eval $(sed -e 's/\([^=]*\)=\(.*\)/\1="\2"/' \
+ "$CHROMEDIR/app/theme/$DISTRIBUTION/BRANDING")
+
+# Determine the current repository revision number.
+LASTCHANGE=$(svn info 2>/dev/null | grep "Revision:" | cut -d" " -f2-)
+if [ -z "$LASTCHANGE" ]; then
+ # Maybe it's a git client
+ LASTCHANGE=$(git-svn info 2>/dev/null | grep "Revision:" | cut -d" " -f2-)
+fi
+
+OFFICIAL_BUILD="false"
+if [ "$CHROME_BUILD_TYPE" = "_official" ]; then
+ OFFICIAL_BUILD="true"
+fi
+
+# TODO(mmoss) Make sure no sed special chars in substitutions.
+sed -e "s/@MAJOR@/$MAJOR/" \
+ -e "s/@MINOR@/$MINOR/" \
+ -e "s/@BUILD@/$BUILD/" \
+ -e "s/@PATCH@/$PATCH/" \
+ -e "s/@COMPANY_FULLNAME@/$COMPANY_FULLNAME/" \
+ -e "s/@COMPANY_SHORTNAME@/$COMPANY_SHORTNAME/" \
+ -e "s/@PRODUCT_FULLNAME@/$PRODUCT_FULLNAME/" \
+ -e "s/@PRODUCT_SHORTNAME@/$PRODUCT_SHORTNAME/" \
+ -e "s/@PRODUCT_EXE@/$PRODUCT_EXE/" \
+ -e "s/@COPYRIGHT@/$COPYRIGHT/" \
+ -e "s/@OFFICIAL_BUILD@/$OFFICIAL_BUILD/" \
+ -e "s/@LASTCHANGE@/$LASTCHANGE/" "$TMPL" > "$OUTFILE"