Skip to content

Commit

Permalink
libwebrtc
Browse files Browse the repository at this point in the history
-libwebrtc recipe - arm/arm64/x64
-depot_tools: roll version (python 3.11)
-gn.py: create VPYTHON_VIRTUALENV_ROOT directory

Signed-off-by: Joel Winarske <[email protected]>
  • Loading branch information
jwinarske committed Nov 15, 2024
1 parent 89eae46 commit 3194c7a
Show file tree
Hide file tree
Showing 8 changed files with 197 additions and 7 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

Nov 4, 2024
1. libwebrtc
2. roll depot_tools
3. create VPYTHON_VIRTUALENV_ROOT directory in gn fetcher

Nov 1, 2024
1. remove libcamera dynamic layer. Removes requirement for meta-multimedia

Expand Down
2 changes: 1 addition & 1 deletion classes/cipd-fetcher.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ DEPENDS += " \

CURL_CA_BUNDLE ??= "${STAGING_DIR_NATIVE}/etc/ssl/certs/ca-certificates.crt"
DEPOT_TOOLS ??= "${STAGING_DIR_NATIVE}/usr/share/depot_tools"
VPYTHON_VIRTUALENV_ROOT ??= "${WORKDIR}/.vpython-root"
PYTHON3_PATH ??= ".cipd_bin/3.11/bin"
VPYTHON_VIRTUALENV_ROOT ??= "${WORKDIR}/vpython"
do_fetch[depends] += " \
ca-certificates-native:do_populate_sysroot \
depot-tools-native:do_populate_sysroot \
Expand Down
6 changes: 3 additions & 3 deletions classes/gn-fetcher.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ DEPENDS += " \

CURL_CA_BUNDLE ??= "${STAGING_DIR_NATIVE}/etc/ssl/certs/ca-certificates.crt"
DEPOT_TOOLS ??= "${STAGING_DIR_NATIVE}/usr/share/depot_tools"
VPYTHON_VIRTUALENV_ROOT ??= "${WORKDIR}/vpython"
VPYTHON_VIRTUALENV_ROOT ??= "${WORKDIR}/.vpython-root"
PYTHON3_PATH ??= ".cipd_bin/3.11/bin"
EXTRA_GN_SYNC ??= ""
GN_CUSTOM_VARS ??= "{}"
Expand All @@ -40,7 +40,7 @@ do_configure:prepend() {
export HTTP_PROXY=${HTTP_PROXY}
export HTTPS_PROXY=${HTTPS_PROXY}
export NO_PROXY=localhost,127.0.0.1,::1
export PATH=${DEPOT_TOOLS}:${DEPOT_TOOLS}/${PYTHON3_PATH}:${PATH}
export PATH=${DEPOT_TOOLS}/${PYTHON3_PATH}:${DEPOT_TOOLS}:${PATH}
export DEPOT_TOOLS_UPDATE=0
export VPYTHON_VIRTUALENV_ROOT=${VPYTHON_VIRTUALENV_ROOT}
}
Expand All @@ -52,7 +52,7 @@ do_compile:prepend() {
export HTTP_PROXY=${HTTP_PROXY}
export HTTPS_PROXY=${HTTPS_PROXY}
export NO_PROXY=localhost,127.0.0.1,::1
export PATH=${DEPOT_TOOLS}:${DEPOT_TOOLS}/${PYTHON3_PATH}:${PATH}
export PATH=${DEPOT_TOOLS}/${PYTHON3_PATH}:${DEPOT_TOOLS}:${PATH}
export DEPOT_TOOLS_UPDATE=0
export VPYTHON_VIRTUALENV_ROOT=${VPYTHON_VIRTUALENV_ROOT}
}
2 changes: 2 additions & 0 deletions lib/gn.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ def urldata_init(self, ud, d):
ud.basecmd = f'export DEPOT_TOOLS_UPDATE=0; \
export CURL_CA_BUNDLE={curl_ca_bundle}; \
export PATH="{depot_tools_path}:{python3_folder}:$PATH"; \
rm -rf $VPYTHON_VIRTUALENV_ROOT ||true; \
mkdir -p $VPYTHON_VIRTUALENV_ROOT; \
export VPYTHON_VIRTUALENV_ROOT="{vpython_virtualenv_root}"; \
gclient config --spec \'{gclient_config}\'; \
gclient sync --force {sync_opt} --revision {srcrev} {parallel_make} -v'
Expand Down
4 changes: 1 addition & 3 deletions recipes-devtools/depot-tools/depot-tools-native_git.bb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=c2c05f9bdd5fc0b458037c2d1fb8d95e"

SRC_URI = "git://chromium.googlesource.com/chromium/tools/depot_tools;protocol=https;branch=main"

SRCREV = "120efcb475aa5f8c6f38c4598c602f4713015112"
SRCREV = "39b2e4efd608584059aa5bb9af8e65597ca86276"

S = "${WORKDIR}/git"

Expand All @@ -21,8 +21,6 @@ do_configure() {
cd ${S}
export DEPOT_TOOLS_UPDATE=0
export PATH=${S}:$PATH
export VPYTHON_VIRTUALENV_ROOT=${VPYTHON_VIRTUALENV_ROOT}
export CIPD_CACHE_DIR="${WORKDIR}/cipd"

gclient --version
}
Expand Down
26 changes: 26 additions & 0 deletions recipes-graphics/libwebrtc/files/add-libwebrtc-target.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
From fb0f7a0e7ab3d5965126e2572fe1e219187e27ee Mon Sep 17 00:00:00 2001
From: Joel Winarske <[email protected]>
Date: Sat, 2 Nov 2024 20:59:34 -0700
Subject: [PATCH] add libwebrtc target

Signed-off-by: Joel Winarske <[email protected]>
---
BUILD.gn | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BUILD.gn b/BUILD.gn
index 571049f..d2fce89 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -38,7 +38,7 @@ if (!build_with_chromium) {
# 'ninja default' and then 'ninja all', the second build should do no work.
group("default") {
testonly = true
- deps = [ ":webrtc" ]
+ deps = [ ":webrtc","//libwebrtc", ]
if (rtc_build_examples) {
deps += [ "examples" ]
}
--
2.43.5

54 changes: 54 additions & 0 deletions recipes-graphics/libwebrtc/files/toolchain.gn.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Copyright 2013 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/dcheck_always_on.gni")
import("//build/config/ozone.gni")
import("//build/config/sysroot.gni")
import("//build/config/ui.gni")
import("//build/toolchain/gcc_toolchain.gni")

gcc_toolchain("@GN_TARGET_ARCH_NAME@") {
toolprefix = "@TARGET_SYS@-"

cc = "${toolprefix}gcc"
cxx = "${toolprefix}g++"

readelf = "${toolprefix}readelf"
nm = "${toolprefix}nm"
ar = "${toolprefix}ar"
ld = cxx

toolchain_args = {
current_cpu = "@GN_TARGET_ARCH_NAME@"
current_os = "linux"

# reclient does not support gcc.
use_remoteexec = false
is_clang = false
}
}

clang_toolchain("clang_@GN_TARGET_ARCH_NAME@") {
enable_linker_map = true
toolchain_args = {
current_cpu = "@GN_TARGET_ARCH_NAME@"
current_os = "linux"
}
}

template("clang_v8_toolchain") {
clang_toolchain(target_name) {
toolchain_args = {
current_os = "linux"
forward_variables_from(invoker.toolchain_args, "*")
}
}
}

clang_v8_toolchain("clang_x86_v8_@GN_TARGET_ARCH_NAME@") {
toolchain_args = {
current_cpu = "x86"
v8_current_cpu = "@GN_TARGET_ARCH_NAME@"
}
}
105 changes: 105 additions & 0 deletions recipes-graphics/libwebrtc/libwebrtc_125.6422.06.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#
# Copyright (c) 2024 Joel Winarske. All rights reserved.
#

SUMMARY = "libbrtc"
DESCRIPTION = "A C++ wrapper for binary release, mainly used for \
flutter-webrtc desktop (windows, linux, embedded)."
AUTHOR = "webrtc team"
HOMEPAGE = "https://github.com/webrtc-sdk/libwebrtc"
BUGTRACKER = "https://github.com/webrtc-sdk/libwebrtc/issues/list"
SECTION = "graphics"
LICENSE = "BSD-3-Clause & MIT"
LIC_FILES_CHKSUM = "\
file://LICENSE;md5=ad296492125bc71530d06234d9bfebe0 \
file://libwebrtc/LICENSE;md5=166d54ea842ed1a582dabbd844fa4c80 \
"

DEPENDS += "\
glib-2.0 \
gtk+3 \
pipewire \
"

SRCREV = "543121ba1cd47780e92d48546b880333265b37b5"
SRC_URI = "\
gn://github.com/webrtc-sdk/webrtc.git;gn_name=src \
git://github.com/webrtc-sdk/libwebrtc.git;;protocol=https;lfs=0;branch=main;destsuffix=src/libwebrtc;name=libwebrtc \
file://add-libwebrtc-target.patch \
file://toolchain.gn.in \
"

SRCREV_FORMAT .= "_libwebrtc"
SRCREV_libwebrtc = "a6522062f83cac380a4544e036114015cf061ffa"

S = "${WORKDIR}/src"
B = "${WORKDIR}/src/out/Linux-${GN_TARGET_ARCH_NAME}"

inherit gn-fetcher features_check pkgconfig

require conf/include/gn-utils.inc

# For gn.bbclass
EXTRA_GN_SYNC ?= "--shallow --no-history -R -D"

GN_ARGS = '\
target_os=\"linux\" \
target_cpu=\"${GN_TARGET_ARCH_NAME}\" \
target_triple=\"${TARGET_SYS}\" \
target_sysroot=\"${STAGING_DIR_TARGET}\" \
is_debug=false \
rtc_include_tests=false \
rtc_use_h264=true \
ffmpeg_branding=\"Chrome\" \
is_component_build=false \
use_rtti=true \
use_custom_libcxx=true \
rtc_enable_protobuf=false \
ozone_auto_platforms=false \
ozone_platform_wayland=true \
'

do_configure() {

# stage runtime binaries for linking
cd ${STAGING_DIR_TARGET}/usr/lib

test -e crtbeginS.o && rm crtbeginS.o
test -e crtendS.o && rm crtendS.o
test -e libgcc.a && rm libgcc.a

ln -s "$(find -iname crtbeginS.o)" crtbeginS.o
ln -s "$(find -iname crtendS.o)" crtendS.o
ln -s "$(find -iname libgcc.a)" libgcc.a

cd ${S}

#
# configure toolchain file
#

cp ${WORKDIR}/toolchain.gn.in ${S}/build/toolchain/linux/BUILD.gn

sed -i "s|@GN_TARGET_ARCH_NAME@|${GN_TARGET_ARCH_NAME}|g" ${S}/build/toolchain/linux/BUILD.gn
sed -i "s|@TARGET_SYS@|${TARGET_SYS}|g" ${S}/build/toolchain/linux/BUILD.gn

gn gen "${B}" --args="${GN_ARGS}"
}

do_compile() {
ninja -C ${B} libwebrtc $PARALLEL_MAKE
}
do_compile[progress] = "outof:^\[(\d+)/(\d+)\]\s+"

do_install() {

install -d ${D}${libdir}
install -m 0755 ${B}/libwebrtc.so ${D}${libdir}/libwebrtc.so.${PV}

cd ${D}${libdir}
ln -sf libwebrtc.so.${PV} libwebrtc.so.125
ln -sf libwebrtc.so.125 libwebrtc.so

install -d ${D}${includedir}/libwebrtc
cp -R ${S}/libwebrtc/include/* ${D}${includedir}/libwebrtc
}

0 comments on commit 3194c7a

Please sign in to comment.