mirror of
https://github.com/ONLYOFFICE/build_tools.git
synced 2026-04-07 14:06:31 +08:00
Refactoring
This commit is contained in:
@ -89,16 +89,15 @@ def make():
|
||||
correct_install_includes_win(base_dir, "win_32")
|
||||
|
||||
if config.check_option("platform", "linux_64") and not base.is_dir("../build/linux_64"):
|
||||
addon_config = []
|
||||
addon_compile = []
|
||||
if "1" == config.option("use-clang"):
|
||||
base.cmd("./bootstrap.sh", ["--with-libraries=filesystem,system,date_time,regex", "--with-toolset=clang"])
|
||||
else:
|
||||
base.cmd("./bootstrap.sh", ["--with-libraries=filesystem,system,date_time,regex"])
|
||||
addon_config = ["--with-toolset=clang"]
|
||||
addon_compile = ["cxxflags=-stdlib=libc++", "linkflags=-stdlib=libc++", "define=_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION"]
|
||||
base.cmd("./bootstrap.sh", ["--with-libraries=filesystem,system,date_time,regex"] + addon_config)
|
||||
base.cmd("./b2", ["headers"])
|
||||
base.cmd("./b2", ["--clean"])
|
||||
if "1" == config.option("use-clang"):
|
||||
base.cmd("./b2", ["--prefix=./../build/linux_64", "link=static", "cxxflags=-fPIC", "cxxflags=-stdlib=libc++", "linkflags=-stdlib=libc++","define=_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION", "install"])
|
||||
else:
|
||||
base.cmd("./b2", ["--prefix=./../build/linux_64", "link=static", "cxxflags=-fPIC", "install"])
|
||||
base.cmd("./b2", ["--prefix=./../build/linux_64", "link=static", "cxxflags=-fPIC"] + addon_compile + ["install"])
|
||||
# TODO: support x86
|
||||
|
||||
if config.check_option("platform", "linux_arm64") and not base.is_dir("../build/linux_arm64"):
|
||||
|
||||
@ -89,13 +89,13 @@ def make():
|
||||
if not base.is_dir(base_dir + "/linux_64"):
|
||||
base.create_dir(base_dir + "/icu/cross_build")
|
||||
os.chdir("icu/cross_build")
|
||||
base.cmd("./../source/runConfigureICU", ["Linux", "--prefix=" + base_dir + "/icu/cross_build_install"])
|
||||
command_configure = "./../source/runConfigureICU"
|
||||
command_compile_addon = "-static-libstdc++ -static-libgcc"
|
||||
if "1" == config.option("use-clang"):
|
||||
base.cmd2("CXXFLAGS=-stdlib=libc++ ./../source/runConfigureICU", ["Linux", "--prefix=" + base_dir + "/icu/cross_build_install"])
|
||||
base.replaceInFile("./../source/icudefs.mk.in", "LDFLAGS = @LDFLAGS@ $(RPATHLDFLAGS)", "LDFLAGS = @LDFLAGS@ $(RPATHLDFLAGS) -stdlib=libc++")
|
||||
else:
|
||||
base.replaceInFile("./../source/icudefs.mk.in", "LDFLAGS = @LDFLAGS@ $(RPATHLDFLAGS)", "LDFLAGS = @LDFLAGS@ $(RPATHLDFLAGS) -static-libstdc++ -static-libgcc")
|
||||
base.cmd("./../source/runConfigureICU", ["Linux", "--prefix=" + base_dir + "/icu/cross_build_install"])
|
||||
command_configure = "CXXFLAGS=-stdlib=libc++ " + command_configure
|
||||
command_compile_addon = "-stdlib=libc++"
|
||||
base.cmd(command_configure, ["Linux", "--prefix=" + base_dir + "/icu/cross_build_install"])
|
||||
base.replaceInFile("./../source/icudefs.mk.in", "LDFLAGS = @LDFLAGS@ $(RPATHLDFLAGS)", "LDFLAGS = @LDFLAGS@ $(RPATHLDFLAGS) " + command_compile_addon)
|
||||
base.cmd("make", ["-j4"])
|
||||
base.cmd("make", ["install"], True)
|
||||
base.create_dir(base_dir + "/linux_64")
|
||||
|
||||
@ -52,11 +52,20 @@ def make_args(args, platform, is_64=True, is_debug=False):
|
||||
else:
|
||||
args_copy.append("is_debug=false")
|
||||
|
||||
linux_clang = False
|
||||
if (platform == "linux"):
|
||||
args_copy.append("is_clang=true")
|
||||
if "1" == config.option("use-clang"):
|
||||
gn_args.append("use_sysroot=true")
|
||||
linux_clang = True
|
||||
else:
|
||||
gn_args.append("use_sysroot=false")
|
||||
if (platform == "windows"):
|
||||
args_copy.append("is_clang=false")
|
||||
|
||||
if linux_clang != True:
|
||||
gn_args.append("use_custom_libcxx=false")
|
||||
|
||||
return "--args=\"" + " ".join(args_copy) + "\""
|
||||
|
||||
def ninja_windows_make(args, is_64=True, is_debug=False):
|
||||
@ -162,12 +171,6 @@ def make():
|
||||
"v8_use_external_startup_data=false",
|
||||
"treat_warnings_as_errors=false"]
|
||||
|
||||
if "1" == config.option("use-clang"):
|
||||
gn_args.append("use_sysroot=true")
|
||||
else:
|
||||
gn_args.append("use_custom_libcxx=false")
|
||||
gn_args.append("use_sysroot=false")
|
||||
|
||||
if config.check_option("platform", "linux_64"):
|
||||
base.cmd2("gn", ["gen", "out.gn/linux_64", make_args(gn_args, "linux")])
|
||||
base.cmd("ninja", ["-C", "out.gn/linux_64"])
|
||||
|
||||
Reference in New Issue
Block a user