mirror of
https://github.com/ONLYOFFICE/build_tools.git
synced 2026-04-07 14:06:31 +08:00
Compare commits
38 Commits
v9.1.0.136
...
feature/li
| Author | SHA1 | Date | |
|---|---|---|---|
| 9df7f6e290 | |||
| 88c57a8b80 | |||
| 435c878e9c | |||
| d1d3d18ff7 | |||
| 63499a9023 | |||
| 73abede467 | |||
| c7adedec3a | |||
| 6d95071a76 | |||
| 089bba3b84 | |||
| a69ca88a5a | |||
| 2a6ff76fb4 | |||
| a155a9ae8d | |||
| 2378bb91fd | |||
| 18605dc68f | |||
| 5004a30908 | |||
| 33e41ed704 | |||
| 1f4c88a489 | |||
| 283977f014 | |||
| e71e0bee74 | |||
| fe9847f246 | |||
| f79bfd099b | |||
| 3ec9b4dba5 | |||
| 0c7348fc89 | |||
| 97b615c36a | |||
| 59f95f52ce | |||
| ba04810793 | |||
| aea03d8554 | |||
| 09247281ef | |||
| 7b31d85c7c | |||
| 3ad5b9d05d | |||
| 894f23b292 | |||
| b46d6075e4 | |||
| e349f3dba2 | |||
| 559837ee13 | |||
| e700a98963 | |||
| 9635b8c08f | |||
| 878057972b | |||
| 1f7a7fc452 |
@ -5,13 +5,15 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
|
||||
RUN apt-get -y update && \
|
||||
apt-get -y install tar \
|
||||
sudo
|
||||
sudo \
|
||||
wget
|
||||
|
||||
ADD . /build_tools
|
||||
WORKDIR /build_tools
|
||||
|
||||
RUN mkdir -p /opt/python3 && \
|
||||
tar -xzf /build_tools/tools/linux/python3.tar.gz -C /opt/python3 --strip-components=1
|
||||
wget -P /opt/python3/ https://github.com/ONLYOFFICE-data/build_tools_data/raw/refs/heads/master/python/python3.tar.gz && \
|
||||
tar -xzf /opt/python3/python3.tar.gz -C /opt/python3 --strip-components=1
|
||||
|
||||
ENV PATH="/opt/python3/bin:${PATH}"
|
||||
|
||||
|
||||
5
make.py
5
make.py
@ -19,8 +19,6 @@ import make_common
|
||||
import develop
|
||||
import argparse
|
||||
|
||||
base.check_python()
|
||||
|
||||
parser = argparse.ArgumentParser(description="options")
|
||||
parser.add_argument("--build-only-branding", action="store_true")
|
||||
args = parser.parse_args()
|
||||
@ -30,6 +28,7 @@ if (args.build_only_branding):
|
||||
|
||||
# parse configuration
|
||||
config.parse()
|
||||
base.check_python()
|
||||
|
||||
base_dir = base.get_script_dir(__file__)
|
||||
|
||||
@ -92,8 +91,6 @@ if config.check_option("module", "desktop"):
|
||||
config.extend_option("config", "updmodule")
|
||||
base.set_env("DESKTOP_URL_UPDATES_MAIN_CHANNEL", "https://download.onlyoffice.com/install/desktop/editors/windows/onlyoffice/appcast.json")
|
||||
base.set_env("DESKTOP_URL_UPDATES_DEV_CHANNEL", "https://download.onlyoffice.com/install/desktop/editors/windows/onlyoffice/appcastdev.json")
|
||||
base.set_env("DESKTOP_URL_INSTALL_CHANNEL", "https://download.onlyoffice.com/install/desktop/editors/windows/distrib/onlyoffice/<file>")
|
||||
base.set_env("DESKTOP_URL_INSTALL_DEV_CHANNEL", "https://download.onlyoffice.com/install/desktop/editors/windows/onlyoffice/onlineinstallerdev/<file>")
|
||||
|
||||
# build
|
||||
build_sln.make()
|
||||
|
||||
@ -917,8 +917,9 @@ def qt_copy_icu(out):
|
||||
prefix = config.option("sysroot")
|
||||
else:
|
||||
prefix = ""
|
||||
postfixes += ["/x86_64-linux-gnu"]
|
||||
postfixes += ["/i386-linux-gnu"]
|
||||
|
||||
postfixes += ["/x86_64-linux-gnu"]
|
||||
postfixes += ["/i386-linux-gnu"]
|
||||
|
||||
for postfix in postfixes:
|
||||
tests += [prefix + "/lib" + postfix]
|
||||
@ -1349,25 +1350,24 @@ def mac_correct_rpath_x2t(dir):
|
||||
mac_correct_rpath_library("DocxRenderer", ["UnicodeConverter", "kernel", "graphics"])
|
||||
mac_correct_rpath_library("IWorkFile", ["UnicodeConverter", "kernel"])
|
||||
mac_correct_rpath_library("HWPFile", ["UnicodeConverter", "kernel", "graphics"])
|
||||
cmd("chmod", ["-v", "+x", "./x2t"])
|
||||
cmd("install_name_tool", ["-add_rpath", "@executable_path", "./x2t"], True)
|
||||
mac_correct_rpath_binary("./x2t", mac_icu_libs + ["UnicodeConverter", "kernel", "kernel_network", "graphics", "PdfFile", "XpsFile", "OFDFile", "DjVuFile", "HtmlFile2", "Fb2File", "EpubFile", "doctrenderer", "DocxRenderer", "IWorkFile", "HWPFile"])
|
||||
|
||||
def correct_core_executable(name, libs):
|
||||
cmd("chmod", ["-v", "+x", name])
|
||||
cmd("install_name_tool", ["-add_rpath", "@executable_path", name], True)
|
||||
mac_correct_rpath_binary(name, mac_icu_libs + libs)
|
||||
return
|
||||
|
||||
correct_core_executable("x2t", ["UnicodeConverter", "kernel", "kernel_network", "graphics", "PdfFile", "XpsFile", "OFDFile", "DjVuFile", "HtmlFile2", "Fb2File", "EpubFile", "doctrenderer", "DocxRenderer", "IWorkFile", "HWPFile"])
|
||||
if is_file("./allfontsgen"):
|
||||
cmd("chmod", ["-v", "+x", "./allfontsgen"])
|
||||
cmd("install_name_tool", ["-add_rpath", "@executable_path", "./allfontsgen"], True)
|
||||
mac_correct_rpath_binary("./allfontsgen", mac_icu_libs + ["UnicodeConverter", "kernel", "graphics"])
|
||||
correct_core_executable("allfontsgen", ["UnicodeConverter", "kernel", "graphics"])
|
||||
if is_file("./allthemesgen"):
|
||||
cmd("chmod", ["-v", "+x", "./allthemesgen"])
|
||||
cmd("install_name_tool", ["-add_rpath", "@executable_path", "./allthemesgen"], True)
|
||||
mac_correct_rpath_binary("./allthemesgen", mac_icu_libs + ["UnicodeConverter", "kernel", "graphics", "kernel_network", "doctrenderer", "PdfFile", "XpsFile", "OFDFile", "DjVuFile", "DocxRenderer"])
|
||||
correct_core_executable("allthemesgen", ["UnicodeConverter", "kernel", "graphics", "kernel_network", "doctrenderer", "PdfFile", "XpsFile", "OFDFile", "DjVuFile", "DocxRenderer"])
|
||||
if is_file("./pluginsmanager"):
|
||||
cmd("chmod", ["-v", "+x", "./pluginsmanager"])
|
||||
cmd("install_name_tool", ["-add_rpath", "@executable_path", "./pluginsmanager"], True)
|
||||
mac_correct_rpath_binary("./pluginsmanager", mac_icu_libs + ["UnicodeConverter", "kernel", "kernel_network"])
|
||||
correct_core_executable("pluginsmanager", ["UnicodeConverter", "kernel", "kernel_network"])
|
||||
if is_file("./vboxtester"):
|
||||
cmd("chmod", ["-v", "+x", "./vboxtester"])
|
||||
cmd("install_name_tool", ["-add_rpath", "@executable_path", "./vboxtester"], True)
|
||||
mac_correct_rpath_binary("./vboxtester", mac_icu_libs + ["UnicodeConverter", "kernel", "kernel_network"])
|
||||
correct_core_executable("vboxtester", ["UnicodeConverter", "kernel", "kernel_network"])
|
||||
if is_file("./x2ttester"):
|
||||
correct_core_executable("x2ttester", ["UnicodeConverter", "kernel", "graphics"])
|
||||
os.chdir(cur_dir)
|
||||
return
|
||||
|
||||
@ -1887,6 +1887,25 @@ def check_module_version(actual_version, clear_func):
|
||||
clear_func()
|
||||
return
|
||||
|
||||
|
||||
def set_sysroot_env():
|
||||
global ENV_BEFORE_SYSROOT
|
||||
ENV_BEFORE_SYSROOT = dict(os.environ)
|
||||
if "linux" == host_platform() and config.option("sysroot") != "":
|
||||
os.environ['PATH'] = config.option("sysroot") + "/usr/bin:" + get_env("PATH")
|
||||
os.environ['LD_LIBRARY_PATH'] = config.get_custom_sysroot_lib()
|
||||
os.environ['QMAKE_CUSTOM_SYSROOT'] = config.option("sysroot")
|
||||
os.environ['PKG_CONFIG_PATH'] = config.get_custom_sysroot_lib() + "/pkgconfig"
|
||||
os.environ['CC'] = config.get_custom_sysroot_bin() + "/gcc"
|
||||
os.environ['CXX'] = config.get_custom_sysroot_bin() + "/g++"
|
||||
os.environ['CFLAGS'] = "--sysroot=" + config.option("sysroot")
|
||||
os.environ['CXXFLAGS'] = "--sysroot=" + config.option("sysroot")
|
||||
check_python()
|
||||
|
||||
def restore_sysroot_env():
|
||||
os.environ.clear()
|
||||
os.environ.update(ENV_BEFORE_SYSROOT)
|
||||
|
||||
def check_python():
|
||||
if ("linux" != host_platform()):
|
||||
return
|
||||
|
||||
@ -26,6 +26,7 @@ import hyphen
|
||||
import googletest
|
||||
import libvlc
|
||||
import heif
|
||||
import webp
|
||||
|
||||
def check_android_ndk_macos_arm(dir):
|
||||
if base.is_dir(dir + "/darwin-x86_64") and not base.is_dir(dir + "/darwin-arm64"):
|
||||
@ -55,6 +56,7 @@ def make():
|
||||
googletest.make()
|
||||
oo_brotli.make()
|
||||
heif.make()
|
||||
webp.make()
|
||||
|
||||
if config.check_option("build-libvlc", "1"):
|
||||
libvlc.make()
|
||||
|
||||
@ -9,11 +9,24 @@ import qmake
|
||||
|
||||
def make(src_dir, modules, build_platform="android", qmake_addon=""):
|
||||
old_cur = os.getcwd()
|
||||
old_env = dict(os.environ)
|
||||
b2_addon = ""
|
||||
|
||||
print("boost-headers...")
|
||||
base.cmd("./bootstrap.sh", ["--with-libraries=system"])
|
||||
base.cmd("./b2", ["--prefix=./../build/" + build_platform, "headers", "install"])
|
||||
|
||||
|
||||
# for b2 checks
|
||||
if config.option("sysroot") != "":
|
||||
base.set_sysroot_env()
|
||||
b2_addon = "cflags=\"--sysroot=" + config.option("sysroot") + "\""
|
||||
b2_addon = "cxxflags=\"--sysroot=" + config.option("sysroot") + "\""
|
||||
b2_addon = "linkflags=\"--sysroot=" + config.option("sysroot") + "\""
|
||||
|
||||
base.cmd("./bootstrap.sh", ["--with-libraries=system"])
|
||||
base.cmd("./b2", ["--prefix=./../build/" + build_platform, "headers", "install", b2_addon])
|
||||
|
||||
if config.option("sysroot") != "":
|
||||
base.restore_sysroot_env()
|
||||
|
||||
for module in modules:
|
||||
print("boost-module: " + module + " ...")
|
||||
module_dir = src_dir + "/libs/" + module
|
||||
@ -40,6 +53,8 @@ def make(src_dir, modules, build_platform="android", qmake_addon=""):
|
||||
base.save_as_script(module_dir + "/" + module + ".pro", pro_file_content)
|
||||
os.chdir(module_dir)
|
||||
qmake.make_all_platforms(module_dir + "/" + module + ".pro", qmake_addon)
|
||||
|
||||
|
||||
os.environ.clear()
|
||||
os.environ.update(old_env)
|
||||
os.chdir(old_cur)
|
||||
return
|
||||
|
||||
@ -31,6 +31,7 @@ OLD_ENV = dict()
|
||||
def setup_custom_sysroot_env() -> str:
|
||||
env_vars = []
|
||||
env_vars += ['LD_LIBRARY_PATH=\"' + config.get_custom_sysroot_lib() + "\""]
|
||||
env_vars += ['PATH=\"' + config.option("sysroot") + "/usr/bin:" + base.get_env("PATH") + "\""]
|
||||
env_vars += ['CC=\"' + config.get_custom_sysroot_bin() + "/gcc\""]
|
||||
env_vars += ['CXX=\"' + config.get_custom_sysroot_bin() + "/g++\""]
|
||||
env_vars += ['AR=\"' + config.get_custom_sysroot_bin() + "/ar\""]
|
||||
@ -38,13 +39,13 @@ def setup_custom_sysroot_env() -> str:
|
||||
env_vars += ['CFLAGS=\"' + "--sysroot=" + config.option("sysroot") + "\""]
|
||||
env_vars += ['CXXFLAGS=\"' + "--sysroot=" + config.option("sysroot") + "\""]
|
||||
env_vars += ['LDFLAGS=\"' + "--sysroot=" + config.option("sysroot") + "\""]
|
||||
|
||||
|
||||
env_str = ""
|
||||
for env_var in env_vars:
|
||||
env_str += env_var + " "
|
||||
|
||||
|
||||
return env_str
|
||||
|
||||
|
||||
def get_vs_version():
|
||||
vs_version = "14 2015"
|
||||
if config.option("vs-version") == "2019":
|
||||
@ -124,13 +125,13 @@ def build_with_cmake(platform, cmake_args, build_type):
|
||||
cmake_args_ext += get_cmake_args_android("x86", "16")
|
||||
elif platform == "android_x86_64":
|
||||
cmake_args_ext += get_cmake_args_android("x86_64", "21")
|
||||
|
||||
|
||||
# env setup for custom sysroot
|
||||
env_str = setup_custom_sysroot_env() if config.option("sysroot") != "" else ""
|
||||
|
||||
# run cmake
|
||||
base.cmd(env_str + "cmake", cmake_args + cmake_args_ext)
|
||||
|
||||
|
||||
# build
|
||||
if "Unix Makefiles" in cmake_args_ext:
|
||||
base.cmd(env_str + "make", ["-j4"])
|
||||
@ -213,6 +214,7 @@ def make_x265(base_dir, build_type):
|
||||
"-DENABLE_CLI=OFF", # do not build standalone CLI app
|
||||
"-DENABLE_SHARED=OFF", # do not build shared libs
|
||||
"-DENABLE_ASSEMBLY=OFF", # disable assembly optimizations
|
||||
"-DENABLE_LIBNUMA=OFF", # disable libnuma usage (affects Linux only)
|
||||
]
|
||||
|
||||
# lib build function
|
||||
|
||||
@ -129,7 +129,6 @@ def make():
|
||||
os.chdir("icu/cross_build")
|
||||
command_configure = "./../source/runConfigureICU"
|
||||
command_compile_addon = "-static-libstdc++ -static-libgcc"
|
||||
ld_library_path_copy = ''
|
||||
if "1" == config.option("use-clang"):
|
||||
command_configure = "CXXFLAGS=-stdlib=libc++ " + command_configure
|
||||
command_compile_addon = "-stdlib=libc++"
|
||||
@ -137,9 +136,7 @@ def make():
|
||||
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)
|
||||
else:
|
||||
if 'LD_LIBRARY_PATH' in os.environ:
|
||||
ld_library_path_copy = os.environ['LD_LIBRARY_PATH']
|
||||
os.environ['LD_LIBRARY_PATH'] = config.get_custom_sysroot_lib()
|
||||
base.set_sysroot_env()
|
||||
base.cmd_exe("./../source/configure", ["--prefix=" + base_dir + "/icu/cross_build_install",
|
||||
"CC=" + config.get_custom_sysroot_bin() + "/gcc", "CXX=" + config.get_custom_sysroot_bin() + "/g++",
|
||||
"AR=" + config.get_custom_sysroot_bin() + "/ar", "RANLIB=" + config.get_custom_sysroot_bin() + "/ranlib",
|
||||
@ -153,7 +150,7 @@ def make():
|
||||
else:
|
||||
base.cmd_exe("make", ["-j4"])
|
||||
base.cmd_exe("make", ["install"], True)
|
||||
os.environ['LD_LIBRARY_PATH'] = ld_library_path_copy
|
||||
base.restore_sysroot_env()
|
||||
|
||||
base.create_dir(base_dir + "/linux_64")
|
||||
base.create_dir(base_dir + "/linux_64/build")
|
||||
|
||||
@ -87,9 +87,7 @@ def make():
|
||||
# -------------------------------------------------------------------------------------------------------
|
||||
return
|
||||
|
||||
if (-1 != config.option("platform").find("linux")) and not base.is_dir("../build/linux_64"):
|
||||
ld_library_path_copy = ''
|
||||
|
||||
if (-1 != config.option("platform").find("linux")) and not base.is_dir("../build/linux_64"):
|
||||
base.cmd("./config", ["enable-md2", "no-shared", "no-asm", "--prefix=" + old_cur_dir + "/build/linux_64", "--openssldir=" + old_cur_dir + "/build/linux_64"])
|
||||
if "1" == config.option("use-clang"):
|
||||
base.replaceInFile("./Makefile", "CC=$(CROSS_COMPILE)gcc", "CC=$(CROSS_COMPILE)clang")
|
||||
@ -101,9 +99,6 @@ def make():
|
||||
base.replaceInFile("./Makefile", "CFLAGS=-Wall -O3", "CFLAGS=-Wall -O3 -fvisibility=hidden")
|
||||
base.replaceInFile("./Makefile", "CXXFLAGS=-Wall -O3", "CXXFLAGS=-Wall -O3 -fvisibility=hidden")
|
||||
else:
|
||||
if 'LD_LIBRARY_PATH' in os.environ:
|
||||
ld_library_path_copy = os.environ['LD_LIBRARY_PATH']
|
||||
os.environ['LD_LIBRARY_PATH'] = config.get_custom_sysroot_lib()
|
||||
base.replaceInFile("./Makefile", "CROSS_COMPILE=", "CROSS_COMPILE=" + config.get_custom_sysroot_bin() + "/")
|
||||
base.replaceInFile("./Makefile", "CFLAGS=-Wall -O3", "CFLAGS=-Wall -O3 -fvisibility=hidden --sysroot=" + config.option("sysroot"))
|
||||
base.replaceInFile("./Makefile", "CXXFLAGS=-Wall -O3", "CXXFLAGS=-Wall -O3 -fvisibility=hidden --sysroot=" + config.option("sysroot"))
|
||||
@ -113,11 +108,11 @@ def make():
|
||||
base.cmd("make", ["install"])
|
||||
base.cmd("make", ["clean"], True)
|
||||
else:
|
||||
base.set_sysroot_env()
|
||||
base.cmd_exe("make", [])
|
||||
base.cmd_exe("make", ["install"])
|
||||
base.cmd_exe("make", ["clean"], True)
|
||||
os.environ['LD_LIBRARY_PATH'] = ld_library_path_copy
|
||||
# TODO: support x86
|
||||
base.restore_sysroot_env()
|
||||
|
||||
if (-1 != config.option("platform").find("linux_arm64")) and not base.is_dir("../build/linux_arm64"):
|
||||
if ("x86_64" != platform.machine()):
|
||||
|
||||
@ -206,12 +206,7 @@ def make():
|
||||
"treat_warnings_as_errors=false"]
|
||||
|
||||
if config.check_option("platform", "linux_64"):
|
||||
ld_library_path_copy = ''
|
||||
if config.option("sysroot") != "":
|
||||
if 'LD_LIBRARY_PATH' in os.environ:
|
||||
ld_library_path_copy = os.environ['LD_LIBRARY_PATH']
|
||||
os.environ['LD_LIBRARY_PATH'] = config.get_custom_sysroot_lib()
|
||||
|
||||
src_replace = "config(\"compiler\") {\n asmflags = []\n cflags = []\n cflags_c = []\n cflags_cc = []\n cflags_objc = []\n cflags_objcc = []\n ldflags = []"
|
||||
dst_replace = "config(\"compiler\") {\n asmflags = []\n cflags = [\"--sysroot=" + config.option("sysroot") + "\"]" + "\n cflags_c = []\n cflags_cc = [\"--sysroot=" + config.option("sysroot") + "\"]" + "\n cflags_objc = []\n cflags_objcc = []\n ldflags = [\"--sysroot=" + config.option("sysroot") + "\"]"
|
||||
base.replaceInFile("build/config/compiler/BUILD.gn", src_replace, dst_replace)
|
||||
@ -219,10 +214,16 @@ def make():
|
||||
src_replace = "gcc_toolchain(\"x64\") {\n cc = \"gcc\"\n cxx = \"g++\""
|
||||
dst_replace = "gcc_toolchain(\"x64\") {\n cc = \""+ config.get_custom_sysroot_bin() + "/gcc\"\n cxx = \"" + config.get_custom_sysroot_bin() + "/g++\""
|
||||
base.replaceInFile("build/toolchain/linux/BUILD.gn", src_replace, dst_replace)
|
||||
|
||||
old_env = dict(os.environ)
|
||||
base.set_sysroot_env()
|
||||
base.cmd2("gn", ["gen", "out.gn/linux_64", make_args(gn_args, "linux")], False)
|
||||
base.cmd2("ninja", ["-C", "out.gn/linux_64"], False)
|
||||
base.restore_sysroot_env()
|
||||
else:
|
||||
base.cmd2("gn", ["gen", "out.gn/linux_64", make_args(gn_args, "linux")], False)
|
||||
base.cmd2("ninja", ["-C", "out.gn/linux_64"], False)
|
||||
|
||||
base.cmd2("gn", ["gen", "out.gn/linux_64", make_args(gn_args, "linux")], False)
|
||||
base.cmd2("ninja", ["-C", "out.gn/linux_64"], False)
|
||||
os.environ['LD_LIBRARY_PATH'] = ld_library_path_copy
|
||||
|
||||
if config.check_option("platform", "linux_32"):
|
||||
base.cmd2("gn", ["gen", "out.gn/linux_32", make_args(gn_args, "linux", False)])
|
||||
|
||||
208
scripts/core_common/modules/webp.py
Normal file
208
scripts/core_common/modules/webp.py
Normal file
@ -0,0 +1,208 @@
|
||||
import sys
|
||||
sys.path.append('../..')
|
||||
import base
|
||||
import os
|
||||
import config
|
||||
|
||||
ARCHES = {"win_64" : "x64",
|
||||
"win_32" : "x86",
|
||||
"linux_64" : "x86_64-linux-gnu",
|
||||
"linux_arm64" : "aarch64-linux-gnu",
|
||||
"mac_64" : "x86_64-apple-darwin",
|
||||
"mac_arm64" : "arm-apple-darwin",
|
||||
"android_arm64_v8a" : "aarch64-linux-android",
|
||||
"android_armv7" : "armv7a-linux-androideabi",
|
||||
"android_x86" : "i686-linux-android",
|
||||
"android_x86_64" : "x86_64-linux-android",
|
||||
"ios" : "arm-apple-darwin",
|
||||
"ios_simulator" : "x86_64-apple-darwin"}
|
||||
|
||||
def get_xcode_sdk(platform):
|
||||
xcode_sdk = "iphoneos"
|
||||
if "simulator" in platform:
|
||||
xcode_sdk = "iphonesimulator"
|
||||
return xcode_sdk
|
||||
|
||||
def get_ios_min_version(platform):
|
||||
res = " -miphoneos-version-min=11.0"
|
||||
if "simulator" in platform:
|
||||
res = " -mios-simulator-version-min=11.0"
|
||||
return res
|
||||
|
||||
def fetch_repo():
|
||||
base_dir = base.get_script_dir() + "/../../core/Common/3dParty/webp"
|
||||
if not base.is_dir(base_dir):
|
||||
base.create_dir(base_dir)
|
||||
old_dir = os.getcwd()
|
||||
os.chdir(base_dir)
|
||||
|
||||
if (base.is_dir("libwebp")):
|
||||
base.delete_dir_with_access_error("libwebp")
|
||||
|
||||
if not base.is_dir("libwebp"):
|
||||
base.cmd("git", ["clone", "--branch","v1.6.0", "https://chromium.googlesource.com/webm/libwebp"])
|
||||
os.chdir(base_dir + "/libwebp")
|
||||
return old_dir
|
||||
|
||||
def create_build_dir(platform, build_type) -> str:
|
||||
build_dir = ""
|
||||
if "win" in platform:
|
||||
target_file = "libwebp"
|
||||
if build_type == "debug":
|
||||
target_file += "-debug"
|
||||
target_file += ".lib"
|
||||
build_dir = "./../build/" + platform + "/"
|
||||
if not base.is_dir(build_dir):
|
||||
base.create_dir(build_dir)
|
||||
elif base.is_file(build_dir + build_type + "/" + ARCHES[platform] + "/lib/" + target_file):
|
||||
build_dir = ""
|
||||
else:
|
||||
build_dir = "./../build/" + platform + "/" + build_type
|
||||
if not base.is_dir(build_dir):
|
||||
base.create_dir(build_dir)
|
||||
if base.is_file(build_dir + "/src/.libs/libwebp.a"):
|
||||
build_dir = ""
|
||||
return build_dir
|
||||
|
||||
# get custom sysroot vars as str
|
||||
def setup_custom_sysroot_env() -> str:
|
||||
env_vars = []
|
||||
env_vars += ['LD_LIBRARY_PATH=\"' + config.get_custom_sysroot_lib() + "\""]
|
||||
env_vars += ['PATH=\"' + config.option("sysroot") + "/usr/bin:" + base.get_env("PATH") + "\""]
|
||||
env_vars += ['CC=\"' + config.get_custom_sysroot_bin() + "/gcc\""]
|
||||
env_vars += ['CXX=\"' + config.get_custom_sysroot_bin() + "/g++\""]
|
||||
env_vars += ['AR=\"' + config.get_custom_sysroot_bin() + "/ar\""]
|
||||
env_vars += ['RABLIB=\"' + config.get_custom_sysroot_bin() + "/ranlib\""]
|
||||
env_vars += ['CFLAGS=\"' + "--sysroot=" + config.option("sysroot") + "\""]
|
||||
env_vars += ['CXXFLAGS=\"' + "--sysroot=" + config.option("sysroot") + "\""]
|
||||
env_vars += ['LDFLAGS=\"' + "--sysroot=" + config.option("sysroot") + "\""]
|
||||
|
||||
env_str = ""
|
||||
for env_var in env_vars:
|
||||
env_str += env_var + " "
|
||||
|
||||
return env_str
|
||||
|
||||
def get_args(platform, build_type, build_dir):
|
||||
if "win" in platform:
|
||||
args = []
|
||||
args.append("call \"" + config.option("vs-path") + "/vcvarsall.bat\" " + ARCHES[platform])
|
||||
args.append("call nmake /f Makefile.vc CFG=" + build_type + "-static" + " OBJDIR=" + build_dir)
|
||||
return args
|
||||
elif "linux" in platform:
|
||||
cflags = "-O3 -DNDEBUG"
|
||||
if build_type == "debug":
|
||||
cflags = "-O0 -g"
|
||||
|
||||
if config.option("sysroot") != "":
|
||||
cflags += " --sysroot=" + config.option("sysroot")
|
||||
|
||||
cross_arm64 = ""
|
||||
if platform == "linux_arm64":
|
||||
cross_cimpile_arm64 = config.option("arm64-toolchain-bin")
|
||||
if "" == cross_cimpile_arm64:
|
||||
cross_cimpile_arm64 = "/usr/bin"
|
||||
cross_arm64 = "--cross-compile-prefix=" + cross_cimpile_arm64 + "/" + base.get_prefix_cross_compiler_arm64()
|
||||
|
||||
return ["--host=" + ARCHES[platform], "--enable-static", "--disable-shared",
|
||||
"--disable-libwebpdecoder", "--disable-libwebpdemux",
|
||||
"--disable-libwebpmux", "--disable-libwebpextras",
|
||||
cross_arm64, "CFLAGS=" + cflags, "LDFLAGS=-static"]
|
||||
elif "mac" in platform:
|
||||
arch = ARCHES[platform]
|
||||
short_arch = arch[:arch.find("-")]
|
||||
if short_arch == "arm":
|
||||
short_arch += "64"
|
||||
|
||||
cflags = "-O3 -DNDEBUG -arch " + short_arch + " -fPIC"
|
||||
if build_type == "debug":
|
||||
cflags = "-O0 -g -arch " + short_arch + " -fPIC"
|
||||
|
||||
return ["--host=" + arch, "--enable-static", "--disable-shared",
|
||||
"--disable-libwebpdecoder", "--disable-libwebpdemux",
|
||||
"--disable-libwebpmux", "--disable-libwebpextras",
|
||||
"CFLAGS=" + cflags, "LDFLAGS=-arch " + short_arch]
|
||||
elif "ios" in platform:
|
||||
arch = ARCHES[platform]
|
||||
short_arch = arch[:arch.find("-")]
|
||||
if short_arch == "arm":
|
||||
short_arch += "64"
|
||||
|
||||
xcode_sdk = get_xcode_sdk(platform)
|
||||
version_min = get_ios_min_version(platform)
|
||||
cflags = "-O3 -DNDEBUG -arch " + short_arch + version_min + " -fembed-bitcode"
|
||||
if build_type == "debug":
|
||||
cflags = "-O0 -g -arch " + short_arch + version_min + " -fembed-bitcode"
|
||||
|
||||
return ["--host=" + arch, "--enable-static", "--disable-shared",
|
||||
"--disable-libwebpdecoder", "--disable-libwebpdemux",
|
||||
"--disable-libwebpmux", "--disable-libwebpextras",
|
||||
"CC=clang -arch " + short_arch + " -isysroot $(xcrun --sdk " + xcode_sdk + " --show-sdk-path)",
|
||||
"CFLAGS=" + cflags]
|
||||
elif "android" in platform:
|
||||
cflags = "-O3 -DNDEBUG"
|
||||
if build_type == "debug":
|
||||
cflags = "-O0 -g"
|
||||
|
||||
return ["--host=" + ARCHES[platform], "--enable-static", "--disable-shared",
|
||||
"--disable-libwebpdecoder", "--disable-libwebpdemux",
|
||||
"--disable-libwebpmux", "--disable-libwebpextras",
|
||||
"CFLAGS=" + cflags, "LDFLAGS=-static"]
|
||||
|
||||
def make():
|
||||
print("[fetch & build]: webp")
|
||||
|
||||
old_dir = fetch_repo()
|
||||
build_type = "release"
|
||||
if -1 != config.option("config").lower().find("debug"):
|
||||
build_type = "debug"
|
||||
platform = config.option("platform")
|
||||
build_dir = create_build_dir(platform, build_type)
|
||||
|
||||
if -1 != platform.find("ios"):
|
||||
args_simulator = get_args("iossimulator", build_type, build_dir)
|
||||
args = get_args(platform, build_type, build_dir)
|
||||
|
||||
if build_dir == "":
|
||||
return
|
||||
|
||||
# WINDOWS
|
||||
if "windows" == base.host_platform():
|
||||
base.run_as_bat(args, True)
|
||||
|
||||
# LINUX
|
||||
elif -1 != platform.find("linux"):
|
||||
base.cmd("./autogen.sh")
|
||||
os.chdir(build_dir)
|
||||
|
||||
if config.option("sysroot") != "":
|
||||
args += ["CROSS_COMPILE=" + config.get_custom_sysroot_bin() + "/"]
|
||||
|
||||
env_str = setup_custom_sysroot_env() if config.option("sysroot") != "" else ""
|
||||
base.cmd(env_str + "./../../../libwebp/configure", args)
|
||||
base.cmd(env_str + "make", ["-j$(nproc)"])
|
||||
|
||||
# MAC, ANDROID
|
||||
elif -1 != platform.find("mac") or -1 != platform.find("ios") or -1 != platform.find("android"):
|
||||
base.cmd("./autogen.sh")
|
||||
os.chdir(build_dir)
|
||||
base.cmd("./../../../libwebp/configure", args)
|
||||
base.cmd("make", ["-j$(sysctl -n hw.ncpu)"])
|
||||
|
||||
# IOS
|
||||
elif -1 != platform.find("ios"):
|
||||
base.cmd("./autogen.sh")
|
||||
os.chdir(build_dir + "/ios")
|
||||
base.cmd("./../../../libwebp/configure", args)
|
||||
base.cmd("make", ["-j$(sysctl -n hw.ncpu)"])
|
||||
os.chdir(build_dir + "/iossimulator")
|
||||
base.cmd("./../../../libwebp/configure", args_simulator)
|
||||
base.cmd("make", ["-j$(sysctl -n hw.ncpu)"])
|
||||
os.chdir(build_dir)
|
||||
base.cmd("lipo", ["-create", "/ios/src/.libs/libwebp.a", "/iossimulator/src/.libs/libwebp.a", "-output", "/libwebp.a"])
|
||||
base.cmd("lipo", ["-create", "/ios/src/.libs/libwebpdecoder.a", "/iossimulator/src/.libs/libwebpdecoder.a", "-output", "/libwebpdecoder.a"])
|
||||
base.cmd("lipo", ["-create", "/ios/src/.libs/libwebpdemux.a", "/iossimulator/src/.libs/libwebpdemux.a", "-output", "/libwebpdemux.a"])
|
||||
base.cmd("lipo", ["-create", "/ios/src/.libs/libwebpmux.a", "/iossimulator/src/.libs/libwebpmux.a", "-output", "/libwebpmux.a"])
|
||||
|
||||
os.chdir(old_dir)
|
||||
return
|
||||
@ -186,8 +186,6 @@ def make():
|
||||
base.copy_file(git_dir + "/desktop-apps/win-linux/extras/projicons/" + apps_postfix + "/projicons.exe", root_dir + "/DesktopEditors.exe")
|
||||
if not isWindowsXP:
|
||||
base.copy_file(git_dir + "/desktop-apps/win-linux/extras/update-daemon/" + apps_postfix + "/updatesvc.exe", root_dir + "/updatesvc.exe")
|
||||
else:
|
||||
base.copy_file(git_dir + "/desktop-apps/win-linux/extras/online-installer/" + apps_postfix + "/online-installer.exe", root_dir + "/online-installer.exe")
|
||||
base.copy_file(git_dir + "/desktop-apps/win-linux/" + apps_postfix + "/DesktopEditors.exe", root_dir + "/editors.exe")
|
||||
base.copy_file(git_dir + "/desktop-apps/win-linux/res/icons/desktopeditors.ico", root_dir + "/app.ico")
|
||||
elif (0 == platform.find("linux")):
|
||||
@ -267,11 +265,6 @@ def make():
|
||||
else:
|
||||
base.copy_dir(git_dir + "/desktop-apps/common/loginpage/providers", root_dir + "/providers")
|
||||
|
||||
# license
|
||||
if (0 == platform.find("mac")):
|
||||
base.create_dir(root_dir + "/license")
|
||||
base.copy_file(git_dir + "/desktop-apps/common/package/license/opensource/EULA.html", root_dir + "/license/EULA.html")
|
||||
|
||||
isUseJSC = False
|
||||
if (0 == platform.find("mac")):
|
||||
doctrenderer_lib = "libdoctrenderer.dylib"
|
||||
|
||||
@ -75,9 +75,6 @@ def make_windows():
|
||||
make_prepare("xp")
|
||||
make_zip("xp")
|
||||
make_inno("xp")
|
||||
# Disable build online installer
|
||||
# if common.platform == "windows_x86_xp":
|
||||
# make_online()
|
||||
|
||||
utils.set_cwd(common.workspace_dir)
|
||||
return
|
||||
@ -169,18 +166,6 @@ def make_advinst(edition = "opensource"):
|
||||
utils.set_summary("desktop advinst " + edition + " deploy", ret)
|
||||
return
|
||||
|
||||
def make_online():
|
||||
online_file = utils.glob_file("OnlineInstaller-" + package_version + "*.exe")
|
||||
utils.log_h2("desktop online installer build")
|
||||
ret = utils.is_file(online_file)
|
||||
utils.set_summary("desktop online installer build", ret)
|
||||
|
||||
if common.deploy and ret:
|
||||
utils.log_h2("desktop online installer deploy")
|
||||
ret = s3_upload([online_file], "desktop/win/online/")
|
||||
utils.set_summary("desktop online installer deploy", ret)
|
||||
return
|
||||
|
||||
#
|
||||
# macOS
|
||||
#
|
||||
|
||||
@ -101,9 +101,7 @@ def make(platform, project, qmake_config_addon="", is_no_errors=False):
|
||||
build_params.append("-spec")
|
||||
build_params.append("linux-clang-libc++")
|
||||
if "" != config.option("sysroot"):
|
||||
os.environ['LD_LIBRARY_PATH'] = config.get_custom_sysroot_lib()
|
||||
os.environ['QMAKE_CUSTOM_SYSROOT'] = config.option("sysroot")
|
||||
os.environ['PKG_CONFIG_PATH'] = config.get_custom_sysroot_lib() + "/pkgconfig"
|
||||
base.set_sysroot_env()
|
||||
base.cmd_exe(qmake_app, build_params) # calls cmd_exe to pass os.env
|
||||
else:
|
||||
base.cmd(qmake_app, build_params)
|
||||
|
||||
@ -54,6 +54,7 @@ def download_sysroot():
|
||||
apt_libs += ["libxkbcommon-dev"]
|
||||
apt_libs += ["libxkbcommon-x11-dev"]
|
||||
apt_libs += ["libnotify-dev"]
|
||||
apt_libs += ["gtk+-3.0-dev"]
|
||||
|
||||
apt_libs_str = ""
|
||||
for apt_lib in apt_libs:
|
||||
|
||||
Reference in New Issue
Block a user