Exemple #1
0
def make():
    if not is_main_platform():
        make_xp()
        return

    base_dir = base.get_script_dir() + "/../../core/Common/3dParty/v8"
    if ("ios" == config.option("platform")):
        return

    if (-1 != config.option("platform").find("android")):
        base.cmd_in_dir(base_dir + "/android", "python", ["./make.py"])
        if (-1 == config.option("platform").find("linux")) and (
                -1 == config.option("platform").find("mac")) and (
                    -1 == config.option("platform").find("win")):
            return

    print("[fetch & build]: v8")
    old_env = dict(os.environ)

    old_cur = os.getcwd()
    os.chdir(base_dir)

    if ("windows" == base.host_platform()):
        base.set_env("DEPOT_TOOLS_WIN_TOOLCHAIN", "0")
        base.set_env("GYP_MSVS_VERSION", "2015")

    base.common_check_version("v8", "1", clean)

    if not base.is_dir("v8/out.gn"):
        clean()

    if not base.is_dir("depot_tools"):
        base.cmd(
            "git",
            ["clone", "http://120.92.49.206:3232/chromiumsrc/depot_tools.git"])
        if ("windows" == base.host_platform()):
            # hack for 32 bit system!!!
            if base.is_file("depot_tools/cipd.ps1"):
                base.replaceInFile("depot_tools/cipd.ps1", "windows-386",
                                   "windows-amd64")
        if base.is_file("depot_tools/fetch_configs/v8.py"):
            base.replaceInFile("depot_tools/fetch_configs/v8.py",
                               "https://chromium.googlesource.com/v8/v8.git",
                               "https://gitee.com/mirrors/V8.git")

    os.environ[
        "PATH"] = base_dir + "/depot_tools" + os.pathsep + os.environ["PATH"]

    if not base.is_dir("v8/out.gn"):
        base.cmd("gclient")

    # --------------------------------------------------------------------------
    # fetch
    if not base.is_dir("v8"):
        base.cmd("./depot_tools/fetch", ["v8"], True)
        os.chdir(base_dir + "/v8")
        base.cmd("git", ["checkout", "-b", "6.0", "branch-heads/6.0"], True)
        os.chdir(base_dir)

    # --------------------------------------------------------------------------
    # correct
    if not base.is_dir("v8/out.gn"):

        # windows hack (delete later) ----------------------
        if ("windows" == base.host_platform()):
            base.delete_dir_with_access_error("v8/buildtools/win")
            base.cmd("git", ["config", "--system", "core.longpaths", "true"])
            base.cmd("gclient", ["sync", "--force"], True)
        else:
            base.cmd("gclient", ["sync"], True)

        # normal version !!!
        #base.cmd("gclient", ["sync"], True)
        # --------------------------------------------------

        if ("linux" == base.host_platform()):
            if base.is_dir("v8/third_party/binutils/Linux_x64/Release"):
                base.delete_dir("v8/third_party/binutils/Linux_x64/Release")
            if base.is_dir("v8/third_party/binutils/Linux_ia32/Release"):
                base.delete_dir("v8/third_party/binutils/Linux_ia32/Release")

            base.cmd("gclient", ["sync", "--no-history"])

            if base.is_dir("v8/third_party/binutils/Linux_x64/Release/bin"):
                for file in os.listdir(
                        "v8/third_party/binutils/Linux_x64/Release/bin"):
                    name = file.split("/")[-1]
                    if ("ld.gold" != name):
                        base.cmd("mv", [
                            "v8/third_party/binutils/Linux_x64/Release/bin/" +
                            name,
                            "v8/third_party/binutils/Linux_x64/Release/bin/old_"
                            + name
                        ])
                        base.cmd("ln", [
                            "-s", "/usr/bin/" + name,
                            "v8/third_party/binutils/Linux_x64/Release/bin/" +
                            name
                        ])

            if base.is_dir("v8/third_party/binutils/Linux_ia32/Release/bin"):
                for file in os.listdir(
                        "v8/third_party/binutils/Linux_ia32/Release/bin"):
                    name = file.split("/")[-1]
                    if ("ld.gold" != name):
                        base.cmd("mv", [
                            "v8/third_party/binutils/Linux_ia32/Release/bin/" +
                            name,
                            "v8/third_party/binutils/Linux_ia32/Release/bin/old_"
                            + name
                        ])
                        base.cmd("ln", [
                            "-s", "/usr/bin/" + name,
                            "v8/third_party/binutils/Linux_ia32/Release/bin/" +
                            name
                        ])

        if ("windows" == base.host_platform()):
            base.replaceInFile("v8/build/config/win/BUILD.gn", ":static_crt",
                               ":dynamic_crt")
        if ("mac" == base.host_platform()):
            base.replaceInFile(
                "v8/build/config/mac/mac_sdk.gni",
                "if (mac_sdk_version != mac_sdk_min_build_override",
                "if (false && mac_sdk_version != mac_sdk_min_build_override")
            base.replaceInFile("v8/build/mac/find_sdk.py",
                               "^MacOSX(10\\.\\d+)\\.sdk$",
                               "^MacOSX(1\\d\\.\\d+)\\.sdk$")

    # --------------------------------------------------------------------------
    # build
    os.chdir("v8")

    base_args64 = "target_cpu=\\\"x64\\\" v8_target_cpu=\\\"x64\\\" v8_static_library=true is_component_build=false v8_use_snapshot=false"
    base_args32 = "target_cpu=\\\"x86\\\" v8_target_cpu=\\\"x86\\\" v8_static_library=true is_component_build=false v8_use_snapshot=false"

    if config.check_option("platform", "linux_64"):
        base.cmd2("gn", [
            "gen", "out.gn/linux_64", "--args=\"is_debug=false " +
            base_args64 + " is_clang=" + is_use_clang() +
            " use_sysroot=false treat_warnings_as_errors=false\""
        ])
        base.cmd("ninja", ["-C", "out.gn/linux_64"])

    if config.check_option("platform", "linux_32"):
        base.cmd2("gn", [
            "gen", "out.gn/linux_32", "--args=\"is_debug=false " +
            base_args32 + " is_clang=" + is_use_clang() +
            " use_sysroot=false treat_warnings_as_errors=false\""
        ])
        base.cmd("ninja", ["-C", "out.gn/linux_32"])

    if config.check_option("platform", "mac_64"):
        base.cmd2("gn", [
            "gen", "out.gn/mac_64",
            "--args=\"is_debug=false " + base_args64 + "\""
        ])
        base.cmd("ninja", ["-C", "out.gn/mac_64"])

    if config.check_option("platform", "win_64"):
        if (-1 != config.option("config").lower().find("debug")):
            base.cmd2("gn", [
                "gen", "out.gn/win_64/debug",
                "--args=\"is_debug=true " + base_args64 + " is_clang=false\""
            ])
            base.cmd("ninja", ["-C", "out.gn/win_64/debug"])

        base.cmd2("gn", [
            "gen", "out.gn/win_64/release",
            "--args=\"is_debug=false " + base_args64 + " is_clang=false\""
        ])
        base.cmd("ninja", ["-C", "out.gn/win_64/release"])

    if config.check_option("platform", "win_32"):
        if (-1 != config.option("config").lower().find("debug")):
            base.cmd2("gn", [
                "gen", "out.gn/win_32/debug",
                "--args=\"is_debug=true " + base_args32 + " is_clang=false\""
            ])
            base.cmd("ninja", ["-C", "out.gn/win_32/debug"])

        base.cmd2("gn", [
            "gen", "out.gn/win_32/release",
            "--args=\"is_debug=false " + base_args32 + " is_clang=false\""
        ])
        base.cmd("ninja", ["-C", "out.gn/win_32/release"])

    os.chdir(old_cur)
    os.environ.clear()
    os.environ.update(old_env)

    make_xp()
    return
Exemple #2
0
def make():
  print("[fetch & build]: v8")

  base_dir = base.get_script_dir() + "/../../core/Common/3dParty/v8"
  old_cur = os.getcwd()
  os.chdir(base_dir)

  if ("windows" == base.host_platform()):
    base.set_env("DEPOT_TOOLS_WIN_TOOLCHAIN", "0")
    base.set_env("GYP_MSVS_VERSION", "2015")

  if not base.is_dir("depot_tools"):
    base.cmd("git", ["clone", "https://chromium.googlesource.com/chromium/tools/depot_tools.git"])
  else:
    os.chdir(base_dir + "/depot_tools")
    base.cmd("git", ["reset", "--hard"])
    os.chdir(base_dir)

  os.environ["PATH"] = base_dir + "/depot_tools" + os.pathsep + os.environ["PATH"]

  if not base.is_dir("v8/out.gn"):
    base.delete_file("./.gclient")
    base.delete_file("./.gclient_entries")
    base.delete_dir("./.cipd")
    base.cmd("gclient")

  # --------------------------------------------------------------------------
  # fetch
  if not base.is_dir("v8"):
    base.cmd("./depot_tools/fetch", ["v8"], True)
    os.chdir(base_dir + "/v8")
    base.cmd("git", ["checkout", "-b", "6.0", "branch-heads/6.0"], True)
    os.chdir(base_dir)

  # --------------------------------------------------------------------------
  # correct
  if not base.is_dir("v8/out.gn"):
    base.cmd("gclient", ["sync"], True)

    if ("linux" == base.host_platform()):
      if base.is_dir("v8/third_party/binutils/Linux_x64/Release"):
        base.delete_dir("v8/third_party/binutils/Linux_x64/Release")
      if base.is_dir("v8/third_party/binutils/Linux_ia32/Release"):
        base.delete_dir("v8/third_party/binutils/Linux_ia32/Release")

      base.cmd("gclient", ["sync", "--no-history"])

      if base.is_dir("v8/third_party/binutils/Linux_x64/Release/bin"):
        for file in os.listdir("v8/third_party/binutils/Linux_x64/Release/bin"):
          name = file.split("/")[-1]
          if ("ld.gold" != name):
            base.cmd("mv", ["v8/third_party/binutils/Linux_x64/Release/bin/" + name, "v8/third_party/binutils/Linux_x64/Release/bin/old_" + name])
            base.cmd("ln", ["-s", "/usr/bin/" + name, "v8/third_party/binutils/Linux_x64/Release/bin/" + name])

      if base.is_dir("v8/third_party/binutils/Linux_ia32/Release/bin"):
        for file in os.listdir("v8/third_party/binutils/Linux_ia32/Release/bin"):
          name = file.split("/")[-1]
          if ("ld.gold" != name):
            base.cmd("mv", ["v8/third_party/binutils/Linux_ia32/Release/bin/" + name, "v8/third_party/binutils/Linux_ia32/Release/bin/old_" + name])
            base.cmd("ln", ["-s", "/usr/bin/" + name, "v8/third_party/binutils/Linux_ia32/Release/bin/" + name])

    if ("windows" == base.host_platform()):
      base.replaceInFile("v8/build/config/win/BUILD.gn", ":static_crt", ":dynamic_crt")
    if ("mac" == base.host_platform()):
      base.replaceInFile("v8/build/config/mac/mac_sdk.gni", "if (mac_sdk_version != mac_sdk_min_build_override", "if (false && mac_sdk_version != mac_sdk_min_build_override")  

  # --------------------------------------------------------------------------
  # build
  os.chdir("v8")

  base_args64 = "target_cpu=\\\"x64\\\" v8_target_cpu=\\\"x64\\\" v8_static_library=true is_component_build=false v8_use_snapshot=false"
  base_args32 = "target_cpu=\\\"x86\\\" v8_target_cpu=\\\"x86\\\" v8_static_library=true is_component_build=false v8_use_snapshot=false"

  if config.check_option("platform", "linux_64"):
    base.cmd2("gn", ["gen", "out.gn/linux_64", "--args=\"is_debug=false " + base_args64 + " is_clang=false use_sysroot=false\""])
    base.cmd("ninja", ["-C", "out.gn/linux_64"])

  if config.check_option("platform", "linux_32"):
    base.cmd2("gn", ["gen", "out.gn/linux_32", "--args=\"is_debug=false " + base_args32 + " is_clang=false use_sysroot=false\""])
    base.cmd("ninja", ["-C", "out.gn/linux_32"])

  if config.check_option("platform", "mac_64"):
    base.cmd2("gn", ["gen", "out.gn/mac_64", "--args=\"is_debug=false " + base_args64 + "\""])
    base.cmd("ninja", ["-C", "out.gn/mac_64"])

  if config.check_option("platform", "win_64"):
    if (-1 != config.option("config").lower().find("debug")):
      base.cmd2("gn", ["gen", "out.gn/win_64/debug", "--args=\"is_debug=true " + base_args64 + " is_clang=false\""])
      base.cmd("ninja", ["-C", "out.gn/win_64/debug"])      

    base.cmd2("gn", ["gen", "out.gn/win_64/release", "--args=\"is_debug=false " + base_args64 + " is_clang=false\""])
    base.cmd("ninja", ["-C", "out.gn/win_64/release"])

  if config.check_option("platform", "win_32"):
    if (-1 != config.option("config").lower().find("debug")):
      base.cmd2("gn", ["gen", "out.gn/win_32/debug", "--args=\"is_debug=true " + base_args32 + " is_clang=false\""])
      base.cmd("ninja", ["-C", "out.gn/win_32/debug"])    

    base.cmd2("gn", ["gen", "out.gn/win_32/release", "--args=\"is_debug=false " + base_args32 + " is_clang=false\""])
    base.cmd("ninja", ["-C", "out.gn/win_32/release"])

  os.chdir(old_cur)

  if config.check_option("platform", "win_64_xp") or config.check_option("platform", "win_32_xp"):
    make_xp()

  return
Exemple #3
0
def make():
  if not is_main_platform():
    make_xp()
    return

  if ("ios" == config.option("platform")):
    return

  print("[fetch & build]: v8")

  base_dir = base.get_script_dir() + "/../../core/Common/3dParty/v8"
  old_cur = os.getcwd()
  os.chdir(base_dir)

  if ("windows" == base.host_platform()):
    base.set_env("DEPOT_TOOLS_WIN_TOOLCHAIN", "0")
    base.set_env("GYP_MSVS_VERSION", "2015")

  base.common_check_version("v8", "1", clean)

  if not base.is_dir("v8/out.gn"):
    clean()

  if not base.is_dir("depot_tools"):
    base.cmd("git", ["clone", "https://chromium.googlesource.com/chromium/tools/depot_tools.git"])
    if ("windows" == base.host_platform()):
      # hack for 32 bit system!!!
      base.replaceInFile("depot_tools/cipd.ps1", "windows-386", "windows-amd64")

  os.environ["PATH"] = base_dir + "/depot_tools" + os.pathsep + os.environ["PATH"]

  if "ppc64" in platform.machine():
    os.environ["VPYTHON_BYPASS"] = "******"

  if not base.is_dir("v8/out.gn"):
    base.cmd("gclient")

  # --------------------------------------------------------------------------
  # fetch
  if not base.is_dir("v8"):
    base.cmd("./depot_tools/fetch", ["v8"], True)
    os.chdir(base_dir + "/v8")
    base.cmd("git", ["checkout", "-b", "6.0", "branch-heads/6.0"], True)
    os.chdir(base_dir)

  # --------------------------------------------------------------------------
  # correct
  if not base.is_dir("v8/out.gn"):
    base.cmd("gclient", ["sync"], True)

    if ("linux" == base.host_platform()):
      if base.is_dir("v8/third_party/binutils/Linux_x64/Release"):
        base.delete_dir("v8/third_party/binutils/Linux_x64/Release")
      if base.is_dir("v8/third_party/binutils/Linux_ppc64/Release"):
        base.delete_dir("v8/third_party/binutils/Linux_ppc64/Release")
      if base.is_dir("v8/third_party/binutils/Linux_ia32/Release"):
        base.delete_dir("v8/third_party/binutils/Linux_ia32/Release")

      base.cmd("gclient", ["sync", "--no-history"])

      if base.is_dir("v8/third_party/binutils/Linux_x64/Release/bin"):
        for file in os.listdir("v8/third_party/binutils/Linux_x64/Release/bin"):
          name = file.split("/")[-1]
          if ("ld.gold" != name):
            base.cmd("mv", ["v8/third_party/binutils/Linux_x64/Release/bin/" + name, "v8/third_party/binutils/Linux_x64/Release/bin/old_" + name])
            base.cmd("ln", ["-s", "/usr/bin/" + name, "v8/third_party/binutils/Linux_x64/Release/bin/" + name])

      if base.is_dir("v8/third_party/binutils/Linux_ppc64/Release/bin"):
        for file in os.listdir("v8/third_party/binutils/Linux_ppc64/Release/bin"):
          name = file.split("/")[-1]
          if ("ld.gold" != name):
            base.cmd("mv", ["v8/third_party/binutils/Linux_ppc64/Release/bin/" + name, "v8/third_party/binutils/Linux_ppc64/Release/bin/old_" + name])
            base.cmd("ln", ["-s", "/usr/bin/" + name, "v8/third_party/binutils/Linux_ppc64/Release/bin/" + name])

      if base.is_dir("v8/third_party/binutils/Linux_ia32/Release/bin"):
        for file in os.listdir("v8/third_party/binutils/Linux_ia32/Release/bin"):
          name = file.split("/")[-1]
          if ("ld.gold" != name):
            base.cmd("mv", ["v8/third_party/binutils/Linux_ia32/Release/bin/" + name, "v8/third_party/binutils/Linux_ia32/Release/bin/old_" + name])
            base.cmd("ln", ["-s", "/usr/bin/" + name, "v8/third_party/binutils/Linux_ia32/Release/bin/" + name])

    if ("windows" == base.host_platform()):
      base.replaceInFile("v8/build/config/win/BUILD.gn", ":static_crt", ":dynamic_crt")
    if ("mac" == base.host_platform()):
      base.replaceInFile("v8/build/config/mac/mac_sdk.gni", "if (mac_sdk_version != mac_sdk_min_build_override", "if (false && mac_sdk_version != mac_sdk_min_build_override")  

  if "ppc64" in platform.machine():
    # Google's gn and ninja binaries won't work, they're x86 only by Google fiat.
    # Remove them and use the system binaries...
    try:
      os.remove(base_dir + "/depot_tools/gn")
    except:
      pass
    try:
      os.remove(base_dir + "/depot_tools/ninja")
    except:
      pass

  # --------------------------------------------------------------------------
  # build
  os.chdir("v8")

  if "ppc64le" in platform.machine():
    base_args64 = "target_cpu=\\\"ppc64\\\" v8_target_cpu=\\\"ppc64\\\" v8_static_library=true is_component_build=false v8_use_snapshot=false"
  else:
    base_args64 = "target_cpu=\\\"x64\\\" v8_target_cpu=\\\"x64\\\" v8_static_library=true is_component_build=false v8_use_snapshot=false"
  base_args32 = "target_cpu=\\\"x86\\\" v8_target_cpu=\\\"x86\\\" v8_static_library=true is_component_build=false v8_use_snapshot=false"

  if config.check_option("platform", "linux_64"):
    base.cmd2("gn", ["gen", "out.gn/linux_64", "--args=\"is_debug=false " + base_args64 + " is_clang=false use_sysroot=false treat_warnings_as_errors=false\""])
    base.cmd("ninja", ["-C", "out.gn/linux_64"])

  if config.check_option("platform", "linux_32"):
    base.cmd2("gn", ["gen", "out.gn/linux_32", "--args=\"is_debug=false " + base_args32 + " is_clang=false use_sysroot=false\""])
    base.cmd("ninja", ["-C", "out.gn/linux_32"])

  if config.check_option("platform", "mac_64"):
    base.cmd2("gn", ["gen", "out.gn/mac_64", "--args=\"is_debug=false " + base_args64 + "\""])
    base.cmd("ninja", ["-C", "out.gn/mac_64"])

  if config.check_option("platform", "win_64"):
    if (-1 != config.option("config").lower().find("debug")):
      base.cmd2("gn", ["gen", "out.gn/win_64/debug", "--args=\"is_debug=true " + base_args64 + " is_clang=false\""])
      base.cmd("ninja", ["-C", "out.gn/win_64/debug"])      

    base.cmd2("gn", ["gen", "out.gn/win_64/release", "--args=\"is_debug=false " + base_args64 + " is_clang=false\""])
    base.cmd("ninja", ["-C", "out.gn/win_64/release"])

  if config.check_option("platform", "win_32"):
    if (-1 != config.option("config").lower().find("debug")):
      base.cmd2("gn", ["gen", "out.gn/win_32/debug", "--args=\"is_debug=true " + base_args32 + " is_clang=false\""])
      base.cmd("ninja", ["-C", "out.gn/win_32/debug"])    

    base.cmd2("gn", ["gen", "out.gn/win_32/release", "--args=\"is_debug=false " + base_args32 + " is_clang=false\""])
    base.cmd("ninja", ["-C", "out.gn/win_32/release"])

  os.chdir(old_cur)

  make_xp()

  return
if not base.is_dir(base_dir):
    base.create_dir(base_dir)

os.chdir(base_dir)
if not base.is_dir("depot_tools"):
    base.cmd("git", [
        "clone",
        "https://chromium.googlesource.com/chromium/tools/depot_tools.git"
    ])

os.environ[
    "PATH"] = base_dir + "/depot_tools" + os.pathsep + os.environ["PATH"]

if not base.is_dir("v8"):
    base.cmd("./depot_tools/fetch", ["v8"], True)
    base.cmd("./depot_tools/gclient", ["sync", "-r", "8.7.220.25"], True)
    base.cmd("gclient", ["sync", "--force"], True)

os.chdir("v8")

gn_args = [
    "target_cpu=\\\"x64\\\"", "v8_target_cpu=\\\"x64\\\"",
    "v8_static_library=true", "is_component_build=false", "v8_monolithic=true",
    "v8_use_external_startup_data=false", "use_custom_libcxx=false",
    "is_debug=false"
]

base.cmd2("gn",
          ["gen", "out.gn/mac_64", "--args=\"" + " ".join(gn_args) + "\""])
base.cmd("ninja", ["-C", "out.gn/mac_64"])