Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions .docker/third-party.bake.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
FROM ubuntu:18.04 AS third-party-builder

# Prevent interactive prompts
ENV DEBIAN_FRONTEND=noninteractive

# Install build dependencies for 18.04
# Note: python-is-python3 doesn't exist here, so we link it manually
RUN apt-get update && apt-get install -y \
build-essential \
wget \
tar \
curl \
file \
lsb-release \
procps \
git \
python3 \
python3-pip \
pkg-config \
libgstreamer1.0-dev \
libgstreamer-plugins-base1.0-dev \
libgl1-mesa-dev \
libxcb1-dev \
libdbus-1-dev \
libicu-dev \
libfreetype6-dev \
libfontconfig1-dev \
libharfbuzz-dev \
#libxkbcommon-dev \
#libxkbcommon-x11-dev \
libxcb-xinput-dev \
libsm-dev \
libatspi2.0-dev \
libglib2.0-dev \
libxi-dev \
libasound2-dev \
libpulse-dev \
#libssl-dev \
#libssl1.0-dev \
libcups2-dev \
libgtk-3-dev \
libxcomposite-dev \
libx11-xcb-dev \
libxrender-dev \
libxrandr-dev \
libxinerama-dev \
libxcursor-dev \
libgirepository1.0-dev \
libcairo2-dev \
libnss3-dev \
libgnome-keyring-dev \
libgbm-dev \
gperf \
locales \
uuid-dev \
libcurl4-openssl-dev \
libkrb5-dev \
libpci-dev \
&& ln -s /usr/bin/python3 /usr/bin/python \
&& rm -rf /var/lib/apt/lists/*

RUN apt-get update && apt-get install -y \
wget build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev libffi-dev liblzma-dev \
libncursesw5-dev xz-utils && \
wget -q https://www.python.org/ftp/python/3.10.13/Python-3.10.13.tgz && \
tar xzf Python-3.10.13.tgz && \
cd Python-3.10.13 && \
./configure --prefix=/usr/local && \
make -j"$(nproc)" && \
make altinstall && \
cd .. && rm -rf Python-3.10.13* && \
python3.10 --version

RUN apt-get update && apt-get install -y sudo && \
curl 'https://chromium.googlesource.com/chromium/src/+/refs/tags/109.0.5414.120/build/install-build-deps.sh?format=TEXT' \
| base64 -d > install-build-deps.sh && \
chmod +x install-build-deps.sh && \
./install-build-deps.sh --no-arm --no-chromeos-fonts --no-nacl --no-prompt && \
python3 -m pip install dataclasses importlib_metadata && \
locale-gen en_US.UTF-8 && \
update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 && \
rm -rf /var/lib/apt/lists/*


COPY /core/Common/3dParty /3dParty


RUN --mount=type=secret,id=nextcloud_user \
--mount=type=secret,id=nextcloud_pass \
export NEXTCLOUD_USER="$(cat /run/secrets/nextcloud_user)" && \
export NEXTCLOUD_PASS="$(cat /run/secrets/nextcloud_pass)" && \
python3.10 /3dParty/build_3rdparty.py \
--only=qt,cef \
/third_party/work \
/third_party/install


5 changes: 4 additions & 1 deletion Common/3dParty/build_3rdparty.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
'socketio',
'hunspell',
'v8',
'icu-desktop',
'cef',
'qt'
]

force_redo_subfolders = []
Expand Down Expand Up @@ -154,7 +157,7 @@ def print_help():
time_meas = nc.MeasurementObj( subfolder )

subprocess.run(
[sys.executable, sub_script, work_dir / subfolder, install_dir / subfolder, "force-redo" if force_redo else "" ],
[sys.executable, "-u", sub_script, work_dir / subfolder, install_dir / subfolder, "force-redo" if force_redo else "" ],
check=True,
text=True,
stdout=None,
Expand Down
167 changes: 167 additions & 0 deletions Common/3dParty/cef/nc-build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
#!/usr/bin/env python3
import sys
import shutil
import os
import time
import subprocess
from pathlib import Path

script_path = Path(sys.argv[0]).resolve()
script_dir = script_path.parent

cef_branch = "5414"
cef_checkout = "f1c41e4b1392ef8816171c4d51a2fca308db5501"
automate_git_url = "https://raw.githubusercontent.com/chromiumembedded/cef/master/tools/automate/automate-git.py"

gn_defines = ( "is_official_build=true use_sysroot=true symbol_level=0 "
"is_cfi=false use_thin_lto=true use_vaapi=false "
"use_gtk=true use_dbus=true use_partition_alloc_as_malloc=false" )

max_gclient_retries = 20
max_recovery_tries = 3

third_party_root = ( script_dir / ".." ).resolve()
if str( third_party_root ) not in sys.path:
sys.path.insert( 0, str( third_party_root ) )

import build_3rdparty_common as nc

nc.init_for_dep(
depname = "cef",
workdir = Path( sys.argv[1] ).resolve(),
installdir = Path( sys.argv[2] ).resolve(),
forceredo = len(sys.argv) > 3 and sys.argv[3] == "force-redo"
)

automate_dir = nc.work_dir / "automate"
download_dir = nc.work_dir / "chromium_git"


def fetch_and_patch():
nc.create_workdir()

automate_dir.mkdir( parents = True, exist_ok = True )
download_dir.mkdir( parents = True, exist_ok = True )

nc.run_command(
[ "wget", automate_git_url, "-O", str( automate_dir / "automate-git.py" ) ],
"Download automate-git.py",
automate_dir
)

nc.create_work_dir_ok_marker()
print( "Fetch & patch completed" )


def setup_build_env():
os.environ["LANG"] = "en_US.UTF-8"
os.environ["LC_ALL"] = "en_US.UTF-8"
os.environ["GN_DEFINES"] = gn_defines
os.environ["CEF_ARCHIVE_FORMAT"] = "tar.bz2"


def run_gclient_recovery():
print( "!!! automate-git.py failed. Attempting to recover via gclient sync..." )

# automate-git.py downloads depot_tools inside the download dir.
# Add it to PATH so we can use 'gclient'.
depot_tools_dir = download_dir / "depot_tools"
os.environ["PATH"] = os.environ["PATH"] + os.pathsep + str( depot_tools_dir )

chromium_dir = download_dir / "chromium"

retry_count = 0
while True:
result = subprocess.run(
[ "gclient", "sync", "--force", "--reset",
"--with_branch_heads", "--with_tags" ],
cwd = chromium_dir
)
if result.returncode == 0:
break
retry_count += 1
if retry_count > max_gclient_retries:
nc.abort_op( f"Failed to sync after {max_gclient_retries} attempts" )
print( f"gclient sync failed (Attempt {retry_count}/{max_gclient_retries}). "
"Retrying in 10 seconds..." )
time.sleep( 10 )

print( "!!! gclient sync succeeded. Resuming build..." )

shutil.rmtree( download_dir / "cef", ignore_errors = True )
shutil.rmtree( depot_tools_dir, ignore_errors = True )


def run_automate_git():
# Not using nc.run_command here because failure is expected and
# handled by the recovery loop instead of aborting.
result = subprocess.run(
[ sys.executable,
str( automate_dir / "automate-git.py" ),
f"--download-dir={download_dir}",
f"--checkout={cef_checkout}",
f"--branch={cef_branch}",
"--minimal-distrib",
"--client-distrib",
"--force-clean",
"--no-chromium-history",
"--build-target=cefsimple",
"--x64-build",
"--with-pgo-profiles"
],
cwd = automate_dir
)
return result.returncode == 0


def find_binary_distrib_dir():
binary_distrib = download_dir / "chromium" / "src" / "cef" / "binary_distrib"
matches = sorted( binary_distrib.glob( "cef_binary_*_linux64" ) )
if not matches:
nc.abort_op( f"No cef_binary_*_linux64 found in {binary_distrib}" )
return matches[0]

def build_and_install():
nc.create_install_dir()

setup_build_env()

# Main build loop: if automate-git.py fails, run gclient recovery and
# retry. After max_recovery_tries failed recoveries, wipe the chromium
# checkout entirely and start over.
recovery_count = 0
while True:
if run_automate_git():
print( "Build completed successfully!" )
break
run_gclient_recovery()
recovery_count += 1
if recovery_count > max_recovery_tries:
print( "!!! Too many failed recoveries. Wiping chromium checkout..." )
shutil.rmtree( download_dir / "chromium", ignore_errors = True )
recovery_count = 0

cef_binary_dir = find_binary_distrib_dir()

# Copy the binary distribution into the install dir
target_dir = nc.install_dir / f"cef"
try:
if target_dir.exists():
shutil.rmtree( target_dir )
shutil.copytree( cef_binary_dir, target_dir, copy_function = shutil.copy2 )
except Exception as e:
nc.abort_op( f"Copy of binary distrib failed: {e}" )

nc.create_install_dir_ok_marker()
nc.fix_terminal_encoding()
print( "Build and install completed" )


def build_all():
if not nc.work_dir_looks_ok():
fetch_and_patch()
if not nc.install_dir_looks_ok():
build_and_install()


nc.ensure_dep( build_all )
6 changes: 6 additions & 0 deletions Common/3dParty/icu-desktop/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*
# Except this file
!.gitignore
!fetch_mobile.sh
!icu.pri
!icu_ios.sh
48 changes: 48 additions & 0 deletions Common/3dParty/icu-desktop/fetch_mobile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

ICU_MAJOR_VER=62
ICU_MINOR_VER=1

SHARED_LIB_VER=$ICU_MAJOR_VER.$ICU_MINOR_VER

os=$(uname -s)
platform=""

case "$os" in
Linux*)
platform="linux"
BUILD_PLATFORM=Linux
SHARED_LIB_EXT=.so.$SHARED_LIB_VER
SHARED_LIB_SHORT_EXT=.so.$ICU_MAJOR_VER
;;
Darwin*)
platform="mac"
BUILD_PLATFORM=MacOSX
SHARED_LIB_EXT=.$SHARED_LIB_VER.dylib
SHARED_LIB_SHORT_EXT=.$ICU_MAJOR_VER.dylib
;;
*) exit ;;
esac


architecture=$(uname -m)
arch=""

case "$architecture" in
x86_64*) arch="_64" ;;
*) arch="_32" ;;
esac

rm -rf "$SCRIPTPATH/$platform$arch"

if [[ -d "$SCRIPTPATH/$platform$arch" ]]
then
echo
else
mkdir "$SCRIPTPATH/$platform$arch"
fi

cd "$SCRIPTPATH/$platform$arch"

svn export https://github.com/unicode-org/icu/tags/release-$ICU_MAJOR_VER-$ICU_MINOR_VER/icu4c ./icu
Loading
Loading