From 56e08f85fae2160121d355c2fb92a77d2869fe08 Mon Sep 17 00:00:00 2001 From: Clickot Date: Fri, 22 Dec 2023 14:12:53 +0100 Subject: [PATCH] upgrade to ungoogled-chromium 120.0.6099.129-1, avoid compile errors because of narrowing in static initializers --- build.sh | 11 +- .../add_casts_in_static_initializers.patch | 111 ++++++++++++++++++ ungoogled-chromium | 2 +- 3 files changed, 118 insertions(+), 6 deletions(-) create mode 100644 patches/add_casts_in_static_initializers.patch diff --git a/build.sh b/build.sh index e500cbc..d932081 100755 --- a/build.sh +++ b/build.sh @@ -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" @@ -45,7 +45,7 @@ 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 @@ -53,6 +53,8 @@ patch -Np1 -i ${patches_dir}/use-oauth2-client-switches-as-default.patch 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 @@ -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 @@ -79,4 +81,3 @@ fi ./out/Default/gn gen out/Default --fail-on-unused-args ninja -C out/Default chrome chrome_sandbox chromedriver - diff --git a/patches/add_casts_in_static_initializers.patch b/patches/add_casts_in_static_initializers.patch new file mode 100644 index 0000000..411115d --- /dev/null +++ b/patches/add_casts_in_static_initializers.patch @@ -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; diff --git a/ungoogled-chromium b/ungoogled-chromium index 643004f..814a883 160000 --- a/ungoogled-chromium +++ b/ungoogled-chromium @@ -1 +1 @@ -Subproject commit 643004f3cd7ea285448286d6e53a1507651483a3 +Subproject commit 814a883c62f29e0ceae518c23f371c63e40631d5