2012-01-19 15:28:48 +00:00
|
|
|
// Copyright 2012 the V8 project authors. All rights reserved.
|
2014-05-05 07:02:13 +00:00
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
2009-04-30 09:29:15 +00:00
|
|
|
|
2014-06-03 08:12:43 +00:00
|
|
|
#include "src/v8.h"
|
2009-04-30 09:29:15 +00:00
|
|
|
|
2014-06-03 08:12:43 +00:00
|
|
|
#include "src/version.h"
|
2009-04-30 09:29:15 +00:00
|
|
|
|
|
|
|
// These macros define the version number for the current version.
|
2013-04-23 08:58:23 +00:00
|
|
|
// NOTE these macros are used by some of the tool scripts and the build
|
|
|
|
// system so their names cannot be changed without changing the scripts.
|
2010-12-07 11:31:57 +00:00
|
|
|
#define MAJOR_VERSION 3
|
2014-05-09 11:17:45 +00:00
|
|
|
#define MINOR_VERSION 27
|
2014-05-05 07:02:13 +00:00
|
|
|
#define BUILD_NUMBER 9999
|
2009-04-30 09:29:15 +00:00
|
|
|
#define PATCH_LEVEL 0
|
2011-03-18 20:35:07 +00:00
|
|
|
// Use 1 for candidates and 0 otherwise.
|
|
|
|
// (Boolean macro values are not supported by all preprocessors.)
|
2014-05-05 07:02:13 +00:00
|
|
|
#define IS_CANDIDATE_VERSION 1
|
2009-04-30 09:29:15 +00:00
|
|
|
|
2013-04-23 08:58:23 +00:00
|
|
|
// Define SONAME to have the build system put a specific SONAME into the
|
2009-04-30 09:29:15 +00:00
|
|
|
// shared library instead the generic SONAME generated from the V8 version
|
2013-04-23 08:58:23 +00:00
|
|
|
// number. This define is mainly used by the build system script.
|
2009-04-30 09:29:15 +00:00
|
|
|
#define SONAME ""
|
|
|
|
|
2011-03-18 20:35:07 +00:00
|
|
|
#if IS_CANDIDATE_VERSION
|
|
|
|
#define CANDIDATE_STRING " (candidate)"
|
|
|
|
#else
|
|
|
|
#define CANDIDATE_STRING ""
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define SX(x) #x
|
|
|
|
#define S(x) SX(x)
|
|
|
|
|
|
|
|
#if PATCH_LEVEL > 0
|
|
|
|
#define VERSION_STRING \
|
|
|
|
S(MAJOR_VERSION) "." S(MINOR_VERSION) "." S(BUILD_NUMBER) "." \
|
|
|
|
S(PATCH_LEVEL) CANDIDATE_STRING
|
|
|
|
#else
|
|
|
|
#define VERSION_STRING \
|
|
|
|
S(MAJOR_VERSION) "." S(MINOR_VERSION) "." S(BUILD_NUMBER) \
|
|
|
|
CANDIDATE_STRING
|
|
|
|
#endif
|
|
|
|
|
2009-05-25 10:05:56 +00:00
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
2009-04-30 09:29:15 +00:00
|
|
|
|
|
|
|
int Version::major_ = MAJOR_VERSION;
|
|
|
|
int Version::minor_ = MINOR_VERSION;
|
|
|
|
int Version::build_ = BUILD_NUMBER;
|
|
|
|
int Version::patch_ = PATCH_LEVEL;
|
2011-03-18 20:35:07 +00:00
|
|
|
bool Version::candidate_ = (IS_CANDIDATE_VERSION != 0);
|
2009-04-30 09:29:15 +00:00
|
|
|
const char* Version::soname_ = SONAME;
|
2011-03-18 20:35:07 +00:00
|
|
|
const char* Version::version_string_ = VERSION_STRING;
|
2009-04-30 09:29:15 +00:00
|
|
|
|
|
|
|
// Calculate the V8 version string.
|
|
|
|
void Version::GetString(Vector<char> str) {
|
|
|
|
const char* candidate = IsCandidate() ? " (candidate)" : "";
|
2010-12-07 11:31:57 +00:00
|
|
|
#ifdef USE_SIMULATOR
|
|
|
|
const char* is_simulator = " SIMULATOR";
|
|
|
|
#else
|
|
|
|
const char* is_simulator = "";
|
|
|
|
#endif // USE_SIMULATOR
|
2009-04-30 09:29:15 +00:00
|
|
|
if (GetPatch() > 0) {
|
2010-12-07 11:31:57 +00:00
|
|
|
OS::SNPrintF(str, "%d.%d.%d.%d%s%s",
|
|
|
|
GetMajor(), GetMinor(), GetBuild(), GetPatch(), candidate,
|
|
|
|
is_simulator);
|
2009-04-30 09:29:15 +00:00
|
|
|
} else {
|
2010-12-07 11:31:57 +00:00
|
|
|
OS::SNPrintF(str, "%d.%d.%d%s%s",
|
|
|
|
GetMajor(), GetMinor(), GetBuild(), candidate,
|
|
|
|
is_simulator);
|
2009-04-30 09:29:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Calculate the SONAME for the V8 shared library.
|
|
|
|
void Version::GetSONAME(Vector<char> str) {
|
|
|
|
if (soname_ == NULL || *soname_ == '\0') {
|
|
|
|
// Generate generic SONAME if no specific SONAME is defined.
|
|
|
|
const char* candidate = IsCandidate() ? "-candidate" : "";
|
|
|
|
if (GetPatch() > 0) {
|
|
|
|
OS::SNPrintF(str, "libv8-%d.%d.%d.%d%s.so",
|
|
|
|
GetMajor(), GetMinor(), GetBuild(), GetPatch(), candidate);
|
|
|
|
} else {
|
|
|
|
OS::SNPrintF(str, "libv8-%d.%d.%d%s.so",
|
|
|
|
GetMajor(), GetMinor(), GetBuild(), candidate);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Use specific SONAME.
|
|
|
|
OS::SNPrintF(str, "%s", soname_);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} } // namespace v8::internal
|