macOS: Generate correct framework and Info.plist version numbers (issue #1969)

This commit is contained in:
Marshall Greenblatt 2017-02-06 18:15:42 -05:00
parent fda2f34c75
commit aa398d8798
2 changed files with 57 additions and 9 deletions

View File

@ -120,6 +120,7 @@ if (is_mac) {
import("//build/config/mac/rules.gni")
import("//build_overrides/v8.gni")
import("//build/mac/tweak_info_plist.gni")
import("//build/util/version.gni")
import("//media/cdm/ppapi/cdm_paths.gni")
}
if (is_win) {
@ -164,8 +165,45 @@ if (is_mac) {
#
if (is_mac) {
# TODO(cef): Generate this value using version.py.
cef_version = "99.77.34.5"
cef_commit_number = exec_script(
"//cef/tools/commit_number.py",
[ rebase_path("//cef", root_build_dir) ],
"trim string", [])
cef_version_file = "//cef/VERSION"
# The tweak_info_plist.py script requires a version number with 4 parts. CEF
# uses a version number with 3 parts so just set the last part to 0.
cef_plist_version = exec_script(
"//build/util/version.py",
[
"-f",
rebase_path(cef_version_file, root_build_dir),
"-f",
rebase_path(chrome_version_file, root_build_dir),
"-t",
"@CEF_MAJOR@.@BUILD@.${cef_commit_number}.0",
],
"trim string",
[ cef_version_file, chrome_version_file ])
# Need to be creative to match dylib version formatting requirements.
cef_dylib_version = exec_script(
"//build/util/version.py",
[
"-f",
rebase_path(cef_version_file, root_build_dir),
"-f",
rebase_path(chrome_version_file, root_build_dir),
"-t",
"@CEF_MAJOR@${cef_commit_number}.@BUILD_HI@.@BUILD_LO@",
"-e",
"BUILD_HI=int(BUILD)/256",
"-e",
"BUILD_LO=int(BUILD)%256",
],
"trim string",
[ cef_version_file, chrome_version_file ])
}
# Read file lists from gypi files. The gypi_to_gn.py script does not support
@ -1178,7 +1216,7 @@ if (is_mac) {
"--keystone=0",
"--scm=1",
"--version",
cef_version,
cef_plist_version,
"--branding",
cef_framework_name,
]
@ -1265,7 +1303,13 @@ if (is_mac) {
# on one of the executables. However install_name_tool only operates
# in-place, which is problematic to express in GN. Instead, use rpath-based
# loading.
ldflags = [ "-Wl,-install_name,@rpath/Frameworks/$output_name.framework/$output_name" ]
ldflags = [
"-Wl,-install_name,@rpath/Frameworks/$output_name.framework/$output_name",
"-compatibility_version",
cef_dylib_version,
"-current_version",
cef_dylib_version,
]
if (is_component_build) {
# Set up the rpath for the framework so that it can find dylibs in the
@ -1345,7 +1389,7 @@ if (is_mac) {
"--keystone=0",
"--scm=0",
"--version",
cef_version,
cef_plist_version,
]
}
@ -1396,7 +1440,7 @@ if (is_mac) {
args = [
"--scm=1",
"--version",
cef_version,
cef_plist_version,
]
}

View File

@ -11,7 +11,11 @@ if __name__ != "__main__":
sys.stderr.write('This file cannot be loaded as a module!')
sys.exit()
if git.is_checkout('.'):
sys.stdout.write(git.get_commit_number())
if len(sys.argv) < 2:
raise Exception('Path expected on command-line')
path = sys.argv[1]
if git.is_checkout(path):
sys.stdout.write(git.get_commit_number(path))
else:
raise Exception('Not a valid checkout')
raise Exception('Not a valid checkout: ' + path)