Skip to content

Commit

Permalink
upgrade to ungoogled-chromium 120.0.6099.129-1, avoid compile errors
Browse files Browse the repository at this point in the history
because of narrowing in static initializers
  • Loading branch information
clickot committed Dec 23, 2023
1 parent dc7cab4 commit 56e08f8
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 6 deletions.
11 changes: 6 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ mkdir -p "${src_dir}/out/Default" "${download_cache}"
"${main_repo}/utils/downloads.py" retrieve -i "${main_repo}/downloads.ini" -c "${download_cache}"
"${main_repo}/utils/downloads.py" unpack -i "${main_repo}/downloads.ini" -c "${download_cache}" "${src_dir}"

# prepare sources
# prepare sources
# ==================================================
## apply ungoogled-chromium patches
"${main_repo}/utils/prune_binaries.py" "${src_dir}" "${main_repo}/pruning.list"
Expand All @@ -45,14 +45,16 @@ patch -Rp1 -i ${patches_dir}/REVERT-clang-version-check.patch
patch -Np1 -i ${patches_dir}/rust-version-check.patch
# revert addition of compiler flag that needs newer clang (taken from ungoogled-chromium-archlinux)
patch -Rp1 -i ${patches_dir}/REVERT-disable-autoupgrading-debug-info.patch
# use the --oauth2-client-id= and --oauth2-client-secret= switches for setting GOOGLE_DEFAULT_CLIENT_ID
# use the --oauth2-client-id= and --oauth2-client-secret= switches for setting GOOGLE_DEFAULT_CLIENT_ID
# and GOOGLE_DEFAULT_CLIENT_SECRET at runtime (taken from ungoogled-chromium-archlinux)
patch -Np1 -i ${patches_dir}/use-oauth2-client-switches-as-default.patch
# Disable kGlobalMediaControlsCastStartStop by default
# https://crbug.com/1314342
patch -Np1 -i ${patches_dir}/disable-GlobalMediaControlsCastStartStop.patch
# fix missing includes in av1_vaapi_video_encoder_delegate.cc
patch -Np1 -i ${patches_dir}/av1_vaapi_video_encoder_delegate.patch
# fix compile error concerning narrowing from/to int/long/unsigned in static initializer (new since latest clang-18 version)
patch -Np1 -i ${patches_dir}/add_casts_in_static_initializers.patch

## Link to system tools required by the build
mkdir -p third_party/node/linux/node-linux-x64/bin && ln -s /usr/bin/node third_party/node/linux/node-linux-x64/bin
Expand All @@ -65,10 +67,10 @@ export CXXFLAGS+=" -resource-dir=${llvm_resource_dir} -B${LLVM_BIN}"
export CPPFLAGS+=" -resource-dir=${llvm_resource_dir} -B${LLVM_BIN}"
export CFLAGS+=" -resource-dir=${llvm_resource_dir} -B${LLVM_BIN}"
#
cat "${main_repo}/flags.gn" "${root_dir}/flags.gn" > "${src_dir}/out/Default/args.gn"
cat "${main_repo}/flags.gn" "${root_dir}/flags.gn" >"${src_dir}/out/Default/args.gn"

# install sysroot if according gn flag is present
if grep -q -F "use_sysroot=true" "${src_dir}/out/Default/args.gn" ; then
if grep -q -F "use_sysroot=true" "${src_dir}/out/Default/args.gn"; then
# adjust host name to download sysroot files from (see e.g. https://github.com/ungoogled-software/ungoogled-chromium/issues/1846)
sed -i 's/commondatastorage.9oo91eapis.qjz9zk/commondatastorage.googleapis.com/g' ./build/linux/sysroot_scripts/sysroots.json
./build/linux/sysroot_scripts/install-sysroot.py --arch=amd64
Expand All @@ -79,4 +81,3 @@ fi
./out/Default/gn gen out/Default --fail-on-unused-args

ninja -C out/Default chrome chrome_sandbox chromedriver

111 changes: 111 additions & 0 deletions patches/add_casts_in_static_initializers.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
--- a/components/power_metrics/energy_metrics_provider_linux.cc
+++ b/components/power_metrics/energy_metrics_provider_linux.cc
@@ -61,9 +61,9 @@
// value of less than 1. Here, we only consider cpu0. See details in
// https://man7.org/linux/man-pages/man2/perf_event_open.2.html.
base::ScopedFD OpenPerfEvent(perf_event_attr* perf_attr) {
- base::ScopedFD perf_fd{syscall(__NR_perf_event_open, perf_attr, /*pid=*/-1,
+ base::ScopedFD perf_fd{(int)syscall(__NR_perf_event_open, perf_attr, /*pid=*/-1,
/*cpu=*/0, /*group_fd=*/-1,
- PERF_FLAG_FD_CLOEXEC)};
+ PERF_FLAG_FD_CLOEXEC)};
return perf_fd;
}

--- a/third_party/webrtc/pc/legacy_stats_collector.cc
+++ b/third_party/webrtc/pc/legacy_stats_collector.cc
@@ -188,9 +188,9 @@
{StatsReport::kStatsValueNameAccelerateRate, info.accelerate_rate},
{StatsReport::kStatsValueNamePreemptiveExpandRate,
info.preemptive_expand_rate},
- {StatsReport::kStatsValueNameTotalAudioEnergy, info.total_output_energy},
+ {StatsReport::kStatsValueNameTotalAudioEnergy, (float)info.total_output_energy},
{StatsReport::kStatsValueNameTotalSamplesDuration,
- info.total_output_duration}};
+ (float)info.total_output_duration}};

const IntForAdd ints[] = {
{StatsReport::kStatsValueNameCurrentDelayMs, info.delay_estimate_ms},
@@ -244,9 +244,9 @@
SetAudioProcessingStats(report, info.apm_statistics);

const FloatForAdd floats[] = {
- {StatsReport::kStatsValueNameTotalAudioEnergy, info.total_input_energy},
+ {StatsReport::kStatsValueNameTotalAudioEnergy, (float)info.total_input_energy},
{StatsReport::kStatsValueNameTotalSamplesDuration,
- info.total_input_duration}};
+ (float)info.total_input_duration}};

RTC_DCHECK_GE(info.audio_level, 0);
const IntForAdd ints[] = {
@@ -340,7 +340,7 @@
{StatsReport::kStatsValueNamePlisSent, info.plis_sent},
{StatsReport::kStatsValueNameRenderDelayMs, info.render_delay_ms},
{StatsReport::kStatsValueNameTargetDelayMs, info.target_delay_ms},
- {StatsReport::kStatsValueNameFramesDecoded, info.frames_decoded},
+ {StatsReport::kStatsValueNameFramesDecoded, (int)info.frames_decoded},
};

for (const auto& i : ints)
@@ -384,15 +384,15 @@
info.encode_usage_percent},
{StatsReport::kStatsValueNameFirsReceived, info.firs_received},
{StatsReport::kStatsValueNameFrameHeightSent, info.send_frame_height},
- {StatsReport::kStatsValueNameFrameRateInput, round(info.framerate_input)},
+ {StatsReport::kStatsValueNameFrameRateInput, (int)round(info.framerate_input)},
{StatsReport::kStatsValueNameFrameRateSent, info.framerate_sent},
{StatsReport::kStatsValueNameFrameWidthSent, info.send_frame_width},
- {StatsReport::kStatsValueNameNacksReceived, info.nacks_received},
+ {StatsReport::kStatsValueNameNacksReceived, (int)info.nacks_received},
{StatsReport::kStatsValueNamePacketsLost, info.packets_lost},
{StatsReport::kStatsValueNamePacketsSent, info.packets_sent},
{StatsReport::kStatsValueNamePlisReceived, info.plis_received},
- {StatsReport::kStatsValueNameFramesEncoded, info.frames_encoded},
- {StatsReport::kStatsValueNameHugeFramesSent, info.huge_frames_sent},
+ {StatsReport::kStatsValueNameFramesEncoded, (int)info.frames_encoded},
+ {StatsReport::kStatsValueNameHugeFramesSent, (int)info.huge_frames_sent},
};

for (const auto& i : ints)
@@ -780,19 +780,19 @@
AddCandidateReport(remote_candidate_stats, false)->id());

const Int64ForAdd int64s[] = {
- {StatsReport::kStatsValueNameBytesReceived, info.recv_total_bytes},
- {StatsReport::kStatsValueNameBytesSent, info.sent_total_bytes},
- {StatsReport::kStatsValueNamePacketsSent, info.sent_total_packets},
- {StatsReport::kStatsValueNameRtt, info.rtt},
+ {StatsReport::kStatsValueNameBytesReceived, (long)info.recv_total_bytes},
+ {StatsReport::kStatsValueNameBytesSent, (long)info.sent_total_bytes},
+ {StatsReport::kStatsValueNamePacketsSent, (long)info.sent_total_packets},
+ {StatsReport::kStatsValueNameRtt, (long)info.rtt},
{StatsReport::kStatsValueNameSendPacketsDiscarded,
- info.sent_discarded_packets},
+ (long)info.sent_discarded_packets},
{StatsReport::kStatsValueNameSentPingRequestsTotal,
- info.sent_ping_requests_total},
+ (long)info.sent_ping_requests_total},
{StatsReport::kStatsValueNameSentPingRequestsBeforeFirstResponse,
- info.sent_ping_requests_before_first_response},
- {StatsReport::kStatsValueNameSentPingResponses, info.sent_ping_responses},
- {StatsReport::kStatsValueNameRecvPingRequests, info.recv_ping_requests},
- {StatsReport::kStatsValueNameRecvPingResponses, info.recv_ping_responses},
+ (long)info.sent_ping_requests_before_first_response},
+ {StatsReport::kStatsValueNameSentPingResponses, (long)info.sent_ping_responses},
+ {StatsReport::kStatsValueNameRecvPingRequests, (long)info.recv_ping_requests},
+ {StatsReport::kStatsValueNameRecvPingResponses, (long)info.recv_ping_responses},
};
for (const auto& i : int64s)
report->AddInt64(i.name, i.value);

--- a/cc/layers/mirror_layer_impl.h
+++ b/cc/layers/mirror_layer_impl.h
@@ -56,7 +56,7 @@
private:
const char* LayerTypeAsString() const override;
viz::CompositorRenderPassId mirrored_layer_render_pass_id() const {
- return viz::CompositorRenderPassId{mirrored_layer_id()};
+ return viz::CompositorRenderPassId{(unsigned long)mirrored_layer_id()};
}

int mirrored_layer_id_ = 0;
2 changes: 1 addition & 1 deletion ungoogled-chromium

0 comments on commit 56e08f8

Please sign in to comment.