diff options
author | Alfred Persson Forsberg <cat@catcream.org> | 2022-07-21 19:07:59 +0200 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2022-07-21 13:10:45 -0400 |
commit | 2aa9aff3223053e2f9463623a307dc9492d711eb (patch) | |
tree | 1f48ffb4efe9963a161f1a2f469f365715a2d122 /dev-qt | |
parent | dev-util/valgrind: patch migrated to ::gentoo (diff) | |
download | musl-2aa9aff3223053e2f9463623a307dc9492d711eb.tar.gz musl-2aa9aff3223053e2f9463623a307dc9492d711eb.tar.bz2 musl-2aa9aff3223053e2f9463623a307dc9492d711eb.zip |
Signed-off-by: Alfred Persson Forsberg <cat@catcream.org> dev-qt/qtwebengine: Add (TEMP) package
This is just a temporary package for blueness.
Will be commited to ::gentoo after some changes.
Signed-off-by: Alfred Persson Forsberg <cat@catcream.org>
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'dev-qt')
28 files changed, 3603 insertions, 0 deletions
diff --git a/dev-qt/qtwebengine/.qtwebengine-5.15.5_p20220618.ebuild.kate-swp b/dev-qt/qtwebengine/.qtwebengine-5.15.5_p20220618.ebuild.kate-swp Binary files differnew file mode 100644 index 00000000..dcbab469 --- /dev/null +++ b/dev-qt/qtwebengine/.qtwebengine-5.15.5_p20220618.ebuild.kate-swp diff --git a/dev-qt/qtwebengine/Manifest b/dev-qt/qtwebengine/Manifest new file mode 100644 index 00000000..282326e1 --- /dev/null +++ b/dev-qt/qtwebengine/Manifest @@ -0,0 +1,4 @@ +DIST qtwebengine-5.15.2-r1-chromium87-ppc64le.tar.xz 28784 BLAKE2B aa101d14446f3282fda8932cc75a249d88b79319f0886d95777292776d94ac5f4fc114c3893b2801fbba6abb14f381172bb14b15b5ffef12413db3a16e4d1ca6 SHA512 3324e0076eb18e2ae2248428d2730cfb3413761514b2bb57e25b8db79248aaaa8098d9f7cebfa08f1a3b39b1d0a382aafed75c5ae8273918909335957921305e +DIST qtwebengine-5.15.2_p20211019-jumbo-build.patch.bz2 2930 BLAKE2B fca1d1406874d04eafb64bb4d8730512a6307ba44fb99d76f428ca1bd4a303758e0c3bd8f92a59f7bcf62e5b767c5a8ed239028bdb74ad7a8b62abf88d38c101 SHA512 61cbfbe4ff340b75ea8d356e031e932ac03fe65dd009999ff897ca4b0185d1d989490daf75ffeaaabb3e92c870c11c7ff8ad2cd6372f5363b3d774b8ecca6d89 +DIST qtwebengine-5.15.3_p20220406-patchset.tar.xz 35480 BLAKE2B ce6aeebbb3255196611130d04ee7a3907ba45d6d2a283f2433e2176cf67e473e74137b180de0a9998762cc54439bb06825815e81e9f95f9413ce2956ac9308b7 SHA512 47e29a1429dce2db324929af91c8ef8421c75ae48f5a491db71b434f8017a5b1e7475e9938989e331e8e012220852848565242e09747892e1a8a8d3ab7386840 +DIST qtwebengine-5.15.5_p20220618.tar.xz 320131236 BLAKE2B 842322c94737cdf647277ccf226c0d015ac0b362af54c4298cbad6b4494aa4ef0e73830577fb391be31c91b4331b85f407ec58641897a7cc7237e7623043577d SHA512 b1bab7aa5edc7f7b9d4f8338a05dbbd55ae6e0312e1a7e6061895bd7a98c67780127c20db1dbbc81664bf483a5b8f7ed887cedd1baaa1a0259e28fd4b13d6944 diff --git a/dev-qt/qtwebengine/files/qtwebengine-5.15.2-disable-fatal-warnings.patch b/dev-qt/qtwebengine/files/qtwebengine-5.15.2-disable-fatal-warnings.patch new file mode 100644 index 00000000..b0f5f3d3 --- /dev/null +++ b/dev-qt/qtwebengine/files/qtwebengine-5.15.2-disable-fatal-warnings.patch @@ -0,0 +1,12 @@ +diff --git a/src/buildtools/config/common.pri b/src/buildtools/config/common.pri +index cf990c79..910a88ca 100644 +--- a/src/buildtools/config/common.pri ++++ b/src/buildtools/config/common.pri +@@ -26,6 +26,7 @@ gn_args += \ + skia_use_dawn=false \ + toolkit_views=false \ + treat_warnings_as_errors=false \ ++ fatal_linker_warnings=false \ + use_allocator_shim=false \ + use_allocator=\"none\" \ + use_custom_libcxx=false \ diff --git a/dev-qt/qtwebengine/files/qtwebengine-5.15.2-enable-ppc64.patch b/dev-qt/qtwebengine/files/qtwebengine-5.15.2-enable-ppc64.patch new file mode 100644 index 00000000..4fb19ccd --- /dev/null +++ b/dev-qt/qtwebengine/files/qtwebengine-5.15.2-enable-ppc64.patch @@ -0,0 +1,37 @@ +From 463f1234c57a36e78ff666bd55094a9d4e68f296 Mon Sep 17 00:00:00 2001 +From: q66 <daniel@octaforge.org> +Date: Sat, 18 Jan 2020 23:52:55 +0100 +Subject: [PATCH 1/3] Enable ppc64 builds + +--- + configure.pri | 1 + + mkspecs/features/functions.prf | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/configure.pri b/configure.pri +index 3a144e3f8..cabe8b24a 100644 +--- a/configure.pri 2021-02-24 10:45:58.000000000 +0100 ++++ - 2021-03-07 21:18:43.124754796 +0100 +@@ -144,6 +144,7 @@ + contains(QT_ARCH, "arm")|contains(QT_ARCH, "arm64"): return(true) + contains(QT_ARCH, "mips"): return(true) + contains(QT_ARCH, "mips64"): return(true) ++ contains(QT_ARCH, "power64"): return(true) + qtLog("Architecture not supported.") + return(false) + } +diff --git a/mkspecs/features/functions.prf b/mkspecs/features/functions.prf +index 512e2523b..e31123654 100644 +--- a/mkspecs/features/functions.prf 2021-02-24 10:45:58.000000000 +0100 ++++ - 2021-03-07 21:19:21.345036293 +0100 +@@ -107,6 +107,7 @@ + contains(qtArch, "mips"): return(mipsel) + contains(qtArch, "mips64"): return(mips64el) + contains(qtArch, "mips64el"): return(mips64el) ++ contains(qtArch, "power64"): return(ppc64) + return(unknown) + } + +-- +2.26.0 + diff --git a/dev-qt/qtwebengine/files/qtwebengine-5.15.2_p20210224-chromium-87-v8-icu68.patch b/dev-qt/qtwebengine/files/qtwebengine-5.15.2_p20210224-chromium-87-v8-icu68.patch new file mode 100644 index 00000000..a6856975 --- /dev/null +++ b/dev-qt/qtwebengine/files/qtwebengine-5.15.2_p20210224-chromium-87-v8-icu68.patch @@ -0,0 +1,192 @@ +From b0a7f5691113534c2cf771f2dd3cece5e93bc7d4 Mon Sep 17 00:00:00 2001 +From: Frank Tang <ftang@chromium.org> +Date: Tue, 03 Nov 2020 23:20:37 -0800 +Subject: [PATCH] Update to ICU68-1 + +ICU68-1 change the output skeleton format. So we need to change +resolvedOptions code for 68 migration. + +Chromium roll +https://chromium-review.googlesource.com/c/chromium/src/+/2474093 + +Bug: v8:10945 +Change-Id: I3b2c7fbe8abb22df8fa51287c498ca3245b8c55b +Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2477431 +Commit-Queue: Frank Tang <ftang@chromium.org> +Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> +Reviewed-by: Shu-yu Guo <syg@chromium.org> +Cr-Commit-Position: refs/heads/master@{#70972} + +(ported to work with <ICU-68.1 and rebased chromium) +--- + +diff --git a/src/3rdparty/chromium/v8/src/objects/js-number-format.cc b/src/3rdparty/chromium/v8/src/objects/js-number-format.cc +index 45b0eab..d18b133 100644 +--- a/src/3rdparty/chromium/v8/src/objects/js-number-format.cc ++++ b/src/3rdparty/chromium/v8/src/objects/js-number-format.cc +@@ -389,17 +389,20 @@ Handle<String> CurrencySignString(Isolate* isolate, + Handle<String> UnitDisplayString(Isolate* isolate, + const icu::UnicodeString& skeleton) { + // Ex: skeleton as +- // "measure-unit/length-meter .### rounding-mode-half-up unit-width-full-name" ++ // <ICU-68.1: "measure-unit/length-meter .### rounding-mode-half-up unit-width-full-name". ++ // >=ICU-68.1: "unit/length-meter .### rounding-mode-half-up unit-width-full-name" + if (skeleton.indexOf("unit-width-full-name") >= 0) { + return ReadOnlyRoots(isolate).long_string_handle(); + } + // Ex: skeleton as +- // "measure-unit/length-meter .### rounding-mode-half-up unit-width-narrow". ++ // <ICU-68.1: "measure-unit/length-meter .### rounding-mode-half-up unit-width-narrow". ++ // >=ICU-68.1: "unit/length-meter .### rounding-mode-half-up unit-width-narrow". + if (skeleton.indexOf("unit-width-narrow") >= 0) { + return ReadOnlyRoots(isolate).narrow_string_handle(); + } + // Ex: skeleton as +- // "measure-unit/length-foot .### rounding-mode-half-up" ++ // <ICU-68.1: "measure-unit/length-foot .### rounding-mode-half-up" ++ // >=ICU-68.1: "unit/length-foot .### rounding-mode-half-up" + return ReadOnlyRoots(isolate).short_string_handle(); + } + +@@ -422,7 +425,8 @@ Notation NotationFromSkeleton(const icu::UnicodeString& skeleton) { + return Notation::COMPACT; + } + // Ex: skeleton as +- // "measure-unit/length-foot .### rounding-mode-half-up" ++ // <ICU-68.1: "measure-unit/length-foot .### rounding-mode-half-up" ++ // >=ICU-68.1: "unit/length-foot .### rounding-mode-half-up" + return Notation::STANDARD; + } + +@@ -562,14 +566,23 @@ namespace { + + // Ex: percent .### rounding-mode-half-up + // Special case for "percent" +-// Ex: "measure-unit/length-kilometer per-measure-unit/duration-hour .### +-// rounding-mode-half-up" should return "kilometer-per-unit". +-// Ex: "measure-unit/duration-year .### rounding-mode-half-up" should return +-// "year". ++// <ICU-68.1: ++// Ex: "measure-unit/length-kilometer per-measure-unit/duration-hour .### ++// rounding-mode-half-up" should return "kilometer-per-unit". ++// Ex: "measure-unit/duration-year .### rounding-mode-half-up" should return ++// >=ICU-68.1: ++// Ex: "unit/milliliter-per-acre .### rounding-mode-half-up" ++// should return "milliliter-per-acre". ++// Ex: "unit/year .### rounding-mode-half-up" should return ++// "year". + std::string UnitFromSkeleton(const icu::UnicodeString& skeleton) { + std::string str; + str = skeleton.toUTF8String<std::string>(str); ++#if U_ICU_VERSION_MAJOR_NUM < 68 + std::string search("measure-unit/"); ++#else ++ std::string search("unit/"); ++#endif + size_t begin = str.find(search); + if (begin == str.npos) { + // Special case for "percent". +@@ -578,20 +591,41 @@ std::string UnitFromSkeleton(const icu::UnicodeString& skeleton) { + } + return ""; + } ++#if U_ICU_VERSION_MAJOR_NUM < 68 + // Skip the type (ex: "length"). + // "measure-unit/length-kilometer per-measure-unit/duration-hour" + // b + begin = str.find("-", begin + search.size()); ++#else ++ // Ex: ++ // "unit/acre .### rounding-mode-half-up" ++ // b ++ // Ex: ++ // "unit/milliliter-per-acre .### rounding-mode-half-up" ++ // b ++ begin += search.size(); ++#endif + if (begin == str.npos) { + return ""; + } ++#if U_ICU_VERSION_MAJOR_NUM < 68 + begin++; // Skip the '-'. ++#endif + // Find the end of the subtype. + size_t end = str.find(" ", begin); +- // "measure-unit/length-kilometer per-measure-unit/duration-hour" +- // b e ++ // <ICU-68.1: ++ // "measure-unit/length-kilometer per-measure-unit/duration-hour" ++ // b e ++ // >=ICU-68.1: ++ // Ex: ++ // "unit/acre .### rounding-mode-half-up" ++ // b e ++ // Ex: ++ // "unit/milliliter-per-acre .### rounding-mode-half-up" ++ // b e + if (end == str.npos) { + end = str.size(); ++#if U_ICU_VERSION_MAJOR_NUM < 68 + return str.substr(begin, end - begin); + } + // "measure-unit/length-kilometer per-measure-unit/duration-hour" +@@ -625,17 +659,36 @@ std::string UnitFromSkeleton(const icu::UnicodeString& skeleton) { + // "measure-unit/length-kilometer per-measure-unit/duration-hour" + // [result ] b e + return result + "-per-" + str.substr(begin, end - begin); ++#else ++ } ++ return str.substr(begin, end - begin); ++#endif + } + + Style StyleFromSkeleton(const icu::UnicodeString& skeleton) { + if (skeleton.indexOf("currency/") >= 0) { + return Style::CURRENCY; + } ++#if U_ICU_VERSION_MAJOR_NUM < 68 + if (skeleton.indexOf("measure-unit/") >= 0) { + if (skeleton.indexOf("scale/100") >= 0 && + skeleton.indexOf("measure-unit/concentr-percent") >= 0) { ++#else ++ if (skeleton.indexOf("percent") >= 0) { ++ // percent precision-integer rounding-mode-half-up scale/100 ++ if (skeleton.indexOf("scale/100") >= 0) { ++#endif + return Style::PERCENT; ++#if U_ICU_VERSION_MAJOR_NUM >= 68 ++ } else { ++ return Style::UNIT; ++#endif + } ++#if U_ICU_VERSION_MAJOR_NUM >= 68 ++ } ++ // Before ICU68: "measure-unit/", since ICU68 "unit/" ++ if (skeleton.indexOf("unit/") >= 0) { ++#endif + return Style::UNIT; + } + return Style::DECIMAL; +diff --git a/src/3rdparty/chromium/v8/src/objects/js-relative-time-format.cc b/src/3rdparty/chromium/v8/src/objects/js-relative-time-format.cc +index 267343aaae..64d56a1c12 100644 +--- a/src/3rdparty/chromium/v8/src/objects/js-relative-time-format.cc ++++ b/src/3rdparty/chromium/v8/src/objects/js-relative-time-format.cc +@@ -195,9 +195,18 @@ MaybeHandle<JSRelativeTimeFormat> JSRelativeTimeFormat::New( + } + } + ++#if U_ICU_VERSION_MAJOR_NUM < 68 + icu::DecimalFormat* decimal_format = + static_cast<icu::DecimalFormat*>(number_format); + decimal_format->setMinimumGroupingDigits(-2); ++#else ++ if (number_format->getDynamicClassID() == ++ icu::DecimalFormat::getStaticClassID()) { ++ icu::DecimalFormat* decimal_format = ++ static_cast<icu::DecimalFormat*>(number_format); ++ decimal_format->setMinimumGroupingDigits(-2); ++ } ++#endif + + // Change UDISPCTX_CAPITALIZATION_NONE to other values if + // ECMA402 later include option to change capitalization. diff --git a/dev-qt/qtwebengine/files/qtwebengine-5.15.2_p20210224-disable-git.patch b/dev-qt/qtwebengine/files/qtwebengine-5.15.2_p20210224-disable-git.patch new file mode 100644 index 00000000..c31e8970 --- /dev/null +++ b/dev-qt/qtwebengine/files/qtwebengine-5.15.2_p20210224-disable-git.patch @@ -0,0 +1,15 @@ +generate_gni.sh: update_readme() runs git at the end of process, prevent it. + +Thanks-to: Georgy Yakovlev <gyakovlev@gentoo.org> + +--- a/src/3rdparty/chromium/third_party/libvpx/generate_gni.sh 2021-02-07 12:51:49.438514897 +0100 ++++ b/src/3rdparty/chromium/third_party/libvpx/generate_gni.sh 2021-02-21 16:23:38.375724515 +0100 +@@ -519,8 +519,3 @@ + + gn format --in-place $BASE_DIR/BUILD.gn + gn format --in-place $BASE_DIR/libvpx_srcs.gni +- +-cd $BASE_DIR/$LIBVPX_SRC_DIR +-update_readme +- +-cd $BASE_DIR diff --git a/dev-qt/qtwebengine/files/qtwebengine-5.15.2_p20210521-clang-libc++.patch b/dev-qt/qtwebengine/files/qtwebengine-5.15.2_p20210521-clang-libc++.patch new file mode 100644 index 00000000..fdcc7879 --- /dev/null +++ b/dev-qt/qtwebengine/files/qtwebengine-5.15.2_p20210521-clang-libc++.patch @@ -0,0 +1,10 @@ +--- a/src/buildtools/gn.pro ++++ b/src/buildtools/gn.pro +@@ -25,6 +25,7 @@ + msvc:!clang_cl: gn_gen_args += --use-lto + + gn_configure = $$system_quote($$gn_bootstrap) $$gn_gen_args ++ gn_configure += --no-static-libstdc++ + macos { + gn_configure += --isysroot \"$$QMAKE_MAC_SDK_PATH\" + } diff --git a/dev-qt/qtwebengine/files/qtwebengine-5.15.2_p20211015-pdfium-system-lcms2.patch b/dev-qt/qtwebengine/files/qtwebengine-5.15.2_p20211015-pdfium-system-lcms2.patch new file mode 100644 index 00000000..b3c2ffb3 --- /dev/null +++ b/dev-qt/qtwebengine/files/qtwebengine-5.15.2_p20211015-pdfium-system-lcms2.patch @@ -0,0 +1,79 @@ +Description: Use system lcms2 +Author: Sandro Knauß <hefee@debian.org> +Origin: Debian +Forwarded: https://bugreports.qt.io/browse/QTBUG-61746 +Reviewed-by: Sandro Knauß <hefee@debian.org> +Last-Update: 2021-03-08 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/src/3rdparty/chromium/third_party/pdfium/third_party/BUILD.gn ++++ b/src/3rdparty/chromium/third_party/pdfium/third_party/BUILD.gn +@@ -239,58 +239,19 @@ if (!pdf_use_skia && !pdf_use_skia_paths + } + } + +-config("fx_lcms2_warnings") { +- visibility = [ ":*" ] +- if (is_clang) { +- cflags = [ +- # cmslut.cc is sloppy with aggregate initialization. Version 2.7 of this +- # library doesn't appear to have this problem. +- "-Wno-missing-braces", +- ] +- } ++import("//build/shim_headers.gni") ++ ++shim_headers("lcms2_shim") { ++ root_path = "lcms/include" ++ headers = [ ++ "lcms2.h", ++ "lcms2_plugin.h", ++ ] + } + + source_set("fx_lcms2") { +- configs -= [ "//build/config/compiler:chromium_code" ] +- configs += [ +- "//build/config/compiler:no_chromium_code", +- "//build/config/sanitizers:cfi_icall_generalize_pointers", +- ":pdfium_third_party_config", +- +- # Must be after no_chromium_code for warning flags to be ordered correctly. +- ":fx_lcms2_warnings", +- ] +- sources = [ +- "lcms/include/lcms2.h", +- "lcms/include/lcms2_plugin.h", +- "lcms/src/cmsalpha.c", +- "lcms/src/cmscam02.c", +- "lcms/src/cmscgats.c", +- "lcms/src/cmscnvrt.c", +- "lcms/src/cmserr.c", +- "lcms/src/cmsgamma.c", +- "lcms/src/cmsgmt.c", +- "lcms/src/cmshalf.c", +- "lcms/src/cmsintrp.c", +- "lcms/src/cmsio0.c", +- "lcms/src/cmsio1.c", +- "lcms/src/cmslut.c", +- "lcms/src/cmsmd5.c", +- "lcms/src/cmsmtrx.c", +- "lcms/src/cmsnamed.c", +- "lcms/src/cmsopt.c", +- "lcms/src/cmspack.c", +- "lcms/src/cmspcs.c", +- "lcms/src/cmsplugin.c", +- "lcms/src/cmsps2.c", +- "lcms/src/cmssamp.c", +- "lcms/src/cmssm.c", +- "lcms/src/cmstypes.c", +- "lcms/src/cmsvirt.c", +- "lcms/src/cmswtpnt.c", +- "lcms/src/cmsxform.c", +- ] +- deps = [ "../core/fxcrt" ] ++ deps = [ ":lcms2_shim" ] ++ libs = ["lcms2"] + } + + if (!build_with_chromium) { diff --git a/dev-qt/qtwebengine/files/qtwebengine-5.15.3_p20220329-clang14.patch b/dev-qt/qtwebengine/files/qtwebengine-5.15.3_p20220329-clang14.patch new file mode 100644 index 00000000..c1a98d09 --- /dev/null +++ b/dev-qt/qtwebengine/files/qtwebengine-5.15.3_p20220329-clang14.patch @@ -0,0 +1,42 @@ +From 0825e7bc64e47d87e1f1026cc80c933550f114f5 Mon Sep 17 00:00:00 2001 +From: Dimitry Andric <dim@FreeBSD.org> +Date: Mon, 14 Feb 2022 13:55:25 +0100 +Subject: www/qt5-webengine: fix build with clang 14 + +Fixes compile error: + +In file included from gen/third_party/blink/renderer/platform/platform_jumbo_63.cc:8: +src/3rdparty/chromium/third_party/blink/renderer/platform/text/text_break_iterator_icu.cc:122:15: error: anonymous non-C-compatible type given name for linkage purposes by typedef declaration after its linkage was computed; add a tag name here to establish linkage prior to definition +typedef struct { + ^ + UTextWithBuffer +src/3rdparty/chromium/third_party/blink/renderer/platform/text/text_break_iterator_icu.cc:123:3: note: type is not C-compatible due to this member declaration + DISALLOW_NEW(); + ^~~~~~~~~~~~~~ +src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/allocator/allocator.h:40:2: note: expanded from macro 'DISALLOW_NEW' + public: \ + ^~~~~~~ +src/3rdparty/chromium/third_party/blink/renderer/platform/text/text_break_iterator_icu.cc:126:3: note: type is given name 'UTextWithBuffer' for linkage purposes by this typedef declaration +} UTextWithBuffer; + ^ + +PR: 261949 +Approved by: adridg (maintainer) +MFH: 2022Q1 + +--- a/src/3rdparty/chromium/third_party/blink/renderer/platform/text/text_break_iterator_icu.cc ++++ b/src/3rdparty/chromium/third_party/blink/renderer/platform/text/text_break_iterator_icu.cc +@@ -119,11 +119,11 @@ enum TextContext { kNoContext, kPriorContext, kPrimary + + const int kTextBufferCapacity = 16; + +-typedef struct { ++struct UTextWithBuffer { + DISALLOW_NEW(); + UText text; + UChar buffer[kTextBufferCapacity]; +-} UTextWithBuffer; ++}; + + static inline int64_t TextPinIndex(int64_t& index, int64_t limit) { + if (index < 0) diff --git a/dev-qt/qtwebengine/files/qtwebengine-5.15.3_p20220406-ffmpeg5.patch b/dev-qt/qtwebengine/files/qtwebengine-5.15.3_p20220406-ffmpeg5.patch new file mode 100644 index 00000000..15c19266 --- /dev/null +++ b/dev-qt/qtwebengine/files/qtwebengine-5.15.3_p20220406-ffmpeg5.patch @@ -0,0 +1,169 @@ +From 05f6ffbbce0a2aad01dc05d682cbe4a1ec44fad5 Mon Sep 17 00:00:00 2001 +From: Antonio Rojas <arojas@archlinux.org> +Date: Tue, 25 Jan 2022 10:51:58 +0000 +Subject: [PATCH] Fix build with ffmpeg 5 + +--- + chromium/media/ffmpeg/ffmpeg_common.h | 1 + + chromium/media/filters/audio_file_reader.cc | 2 +- + chromium/media/filters/ffmpeg_audio_decoder.cc | 2 +- + chromium/media/filters/ffmpeg_demuxer.cc | 12 ++++++------ + chromium/media/filters/ffmpeg_glue.cc | 4 ---- + chromium/media/filters/ffmpeg_video_decoder.cc | 2 +- + chromium/media/filters/media_file_checker.cc | 2 +- + .../video_coding/codecs/h264/h264_decoder_impl.cc | 2 +- + 8 files changed, 12 insertions(+), 15 deletions(-) + +diff --git a/chromium/media/ffmpeg/ffmpeg_common.h b/chromium/media/ffmpeg/ffmpeg_common.h +index 2734a485cbd..70b1877a43c 100644 +--- a/src/3rdparty/chromium/media/ffmpeg/ffmpeg_common.h ++++ b/src/3rdparty/chromium/media/ffmpeg/ffmpeg_common.h +@@ -29,6 +29,7 @@ extern "C" { + #include <libavformat/avformat.h> + #include <libavformat/avio.h> + #include <libavutil/avutil.h> ++#include <libavutil/channel_layout.h> + #include <libavutil/imgutils.h> + #include <libavutil/log.h> + #include <libavutil/mastering_display_metadata.h> +diff --git a/chromium/media/filters/audio_file_reader.cc b/chromium/media/filters/audio_file_reader.cc +index cb81d920def..bd73908d0ca 100644 +--- a/src/3rdparty/chromium/media/filters/audio_file_reader.cc ++++ b/src/3rdparty/chromium/media/filters/audio_file_reader.cc +@@ -85,7 +85,7 @@ bool AudioFileReader::OpenDemuxer() { + } + + bool AudioFileReader::OpenDecoder() { +- AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id); ++ const AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id); + if (codec) { + // MP3 decodes to S16P which we don't support, tell it to use S16 instead. + if (codec_context_->sample_fmt == AV_SAMPLE_FMT_S16P) +diff --git a/chromium/media/filters/ffmpeg_audio_decoder.cc b/chromium/media/filters/ffmpeg_audio_decoder.cc +index 0d825ed791b..72fac6167ef 100644 +--- a/src/3rdparty/chromium/media/filters/ffmpeg_audio_decoder.cc ++++ b/src/3rdparty/chromium/media/filters/ffmpeg_audio_decoder.cc +@@ -329,7 +329,7 @@ bool FFmpegAudioDecoder::ConfigureDecoder(const AudioDecoderConfig& config) { + } + } + +- AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id); ++ const AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id); + if (!codec || + avcodec_open2(codec_context_.get(), codec, &codec_options) < 0) { + DLOG(ERROR) << "Could not initialize audio decoder: " +diff --git a/chromium/media/filters/ffmpeg_demuxer.cc b/chromium/media/filters/ffmpeg_demuxer.cc +index d34db63f3ef..427565b00c1 100644 +--- a/src/3rdparty/chromium/media/filters/ffmpeg_demuxer.cc ++++ b/src/3rdparty/chromium/media/filters/ffmpeg_demuxer.cc +@@ -98,12 +98,12 @@ static base::TimeDelta ExtractStartTime(AVStream* stream) { + + // Next try to use the first DTS value, for codecs where we know PTS == DTS + // (excludes all H26x codecs). The start time must be returned in PTS. +- if (stream->first_dts != kNoFFmpegTimestamp && ++ if (av_stream_get_first_dts(stream) != kNoFFmpegTimestamp && + stream->codecpar->codec_id != AV_CODEC_ID_HEVC && + stream->codecpar->codec_id != AV_CODEC_ID_H264 && + stream->codecpar->codec_id != AV_CODEC_ID_MPEG4) { + const base::TimeDelta first_pts = +- ConvertFromTimeBase(stream->time_base, stream->first_dts); ++ ConvertFromTimeBase(stream->time_base, av_stream_get_first_dts(stream)); + if (first_pts < start_time) + start_time = first_pts; + } +@@ -408,11 +408,11 @@ void FFmpegDemuxerStream::EnqueuePacket(ScopedAVPacket packet) { + scoped_refptr<DecoderBuffer> buffer; + + if (type() == DemuxerStream::TEXT) { +- int id_size = 0; ++ size_t id_size = 0; + uint8_t* id_data = av_packet_get_side_data( + packet.get(), AV_PKT_DATA_WEBVTT_IDENTIFIER, &id_size); + +- int settings_size = 0; ++ size_t settings_size = 0; + uint8_t* settings_data = av_packet_get_side_data( + packet.get(), AV_PKT_DATA_WEBVTT_SETTINGS, &settings_size); + +@@ -424,7 +424,7 @@ void FFmpegDemuxerStream::EnqueuePacket(ScopedAVPacket packet) { + buffer = DecoderBuffer::CopyFrom(packet->data, packet->size, + side_data.data(), side_data.size()); + } else { +- int side_data_size = 0; ++ size_t side_data_size = 0; + uint8_t* side_data = av_packet_get_side_data( + packet.get(), AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL, &side_data_size); + +@@ -485,7 +485,7 @@ void FFmpegDemuxerStream::EnqueuePacket(ScopedAVPacket packet) { + packet->size - data_offset); + } + +- int skip_samples_size = 0; ++ size_t skip_samples_size = 0; + const uint32_t* skip_samples_ptr = + reinterpret_cast<const uint32_t*>(av_packet_get_side_data( + packet.get(), AV_PKT_DATA_SKIP_SAMPLES, &skip_samples_size)); +diff --git a/chromium/media/filters/ffmpeg_glue.cc b/chromium/media/filters/ffmpeg_glue.cc +index 0ef3521473d..8483ecc348f 100644 +--- a/src/3rdparty/chromium/media/filters/ffmpeg_glue.cc ++++ b/src/3rdparty/chromium/media/filters/ffmpeg_glue.cc +@@ -59,7 +59,6 @@ static int64_t AVIOSeekOperation(void* opaque, int64_t offset, int whence) { + } + + void FFmpegGlue::InitializeFFmpeg() { +- av_register_all(); + } + + static void LogContainer(bool is_local_file, +@@ -95,9 +94,6 @@ FFmpegGlue::FFmpegGlue(FFmpegURLProtocol* protocol) { + // Enable fast, but inaccurate seeks for MP3. + format_context_->flags |= AVFMT_FLAG_FAST_SEEK; + +- // Ensures we can read out various metadata bits like vp8 alpha. +- format_context_->flags |= AVFMT_FLAG_KEEP_SIDE_DATA; +- + // Ensures format parsing errors will bail out. From an audit on 11/2017, all + // instances were real failures. Solves bugs like http://crbug.com/710791. + format_context_->error_recognition |= AV_EF_EXPLODE; +diff --git a/chromium/media/filters/ffmpeg_video_decoder.cc b/chromium/media/filters/ffmpeg_video_decoder.cc +index ef12477ee89..7996606f5f9 100644 +--- a/src/3rdparty/chromium/media/filters/ffmpeg_video_decoder.cc ++++ b/src/3rdparty/chromium/media/filters/ffmpeg_video_decoder.cc +@@ -391,7 +391,7 @@ bool FFmpegVideoDecoder::ConfigureDecoder(const VideoDecoderConfig& config, + if (decode_nalus_) + codec_context_->flags2 |= AV_CODEC_FLAG2_CHUNKS; + +- AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id); ++ const AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id); + if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { + ReleaseFFmpegResources(); + return false; +diff --git a/chromium/media/filters/media_file_checker.cc b/chromium/media/filters/media_file_checker.cc +index 59c2a2fc618..1a9872c7acb 100644 +--- a/src/3rdparty/chromium/media/filters/media_file_checker.cc ++++ b/src/3rdparty/chromium/media/filters/media_file_checker.cc +@@ -68,7 +68,7 @@ bool MediaFileChecker::Start(base::TimeDelta check_time) { + auto context = AVStreamToAVCodecContext(format_context->streams[i]); + if (!context) + continue; +- AVCodec* codec = avcodec_find_decoder(cp->codec_id); ++ const AVCodec* codec = avcodec_find_decoder(cp->codec_id); + if (codec && avcodec_open2(context.get(), codec, nullptr) >= 0) { + auto loop = std::make_unique<FFmpegDecodingLoop>(context.get()); + stream_contexts[i] = {std::move(context), std::move(loop)}; +diff --git a/chromium/third_party/webrtc/modules/video_coding/codecs/h264/h264_decoder_impl.cc b/chromium/third_party/webrtc/modules/video_coding/codecs/h264/h264_decoder_impl.cc +index 9002b874611..d12fade8b63 100644 +--- a/src/3rdparty/chromium/third_party/webrtc/modules/video_coding/codecs/h264/h264_decoder_impl.cc ++++ b/src/3rdparty/chromium/third_party/webrtc/modules/video_coding/codecs/h264/h264_decoder_impl.cc +@@ -203,7 +203,7 @@ int32_t H264DecoderImpl::InitDecode(const VideoCodec* codec_settings, + // a pointer |this|. + av_context_->opaque = this; + +- AVCodec* codec = avcodec_find_decoder(av_context_->codec_id); ++ const AVCodec* codec = avcodec_find_decoder(av_context_->codec_id); + if (!codec) { + // This is an indication that FFmpeg has not been initialized or it has not + // been compiled/initialized with the correct set of codecs. +-- +2.35.1 + diff --git a/dev-qt/qtwebengine/files/qtwebengine-5.15.3_p20220406-gcc12-includes.patch b/dev-qt/qtwebengine/files/qtwebengine-5.15.3_p20220406-gcc12-includes.patch new file mode 100644 index 00000000..cd476564 --- /dev/null +++ b/dev-qt/qtwebengine/files/qtwebengine-5.15.3_p20220406-gcc12-includes.patch @@ -0,0 +1,32 @@ +https://build.opensuse.org/package/view_file/KDE:Qt:5.15/libqt5-qtwebengine/0001-skia-Some-includes-to-fix-build-with-GCC-12.patch?expand=1 +https://bugs.gentoo.org/840326 + +From 68799a1e0815b20ca59ce354a55280399257a201 Mon Sep 17 00:00:00 2001 +From: Fabian Vogt <fvogt@suse.de> +Date: Fri, 25 Mar 2022 15:29:28 +0100 +Subject: [PATCH] skia: Some includes to fix build with GCC 12 + +Those includes got introduced upstream for other reasons and fixed building +with GCC 12 as a side effect. +--- a/src/3rdparty/chromium/third_party/skia/include/core/SkColor.h ++++ b/src/3rdparty/chromium/third_party/skia/include/core/SkColor.h +@@ -12,6 +12,8 @@ + #include "include/core/SkScalar.h" + #include "include/core/SkTypes.h" + ++#include <array> ++ + /** \file SkColor.h + + Types, consts, functions, and macros for colors. +--- a/src/3rdparty/chromium/third_party/skia/src/utils/SkParseColor.cpp ++++ b/src/3rdparty/chromium/third_party/skia/src/utils/SkParseColor.cpp +@@ -8,6 +8,8 @@ + + #include "include/utils/SkParse.h" + ++#include <algorithm> // std::lower_bound ++ + static constexpr const char* gColorNames[] = { + "aliceblue", + "antiquewhite", diff --git a/dev-qt/qtwebengine/files/qtwebengine-5.15.3_p20220505-extra-gn.patch b/dev-qt/qtwebengine/files/qtwebengine-5.15.3_p20220505-extra-gn.patch new file mode 100644 index 00000000..a319f521 --- /dev/null +++ b/dev-qt/qtwebengine/files/qtwebengine-5.15.3_p20220505-extra-gn.patch @@ -0,0 +1,10 @@ +--- a/src/core/gn_run.pro ++++ b/src/core/gn_run.pro +@@ -64,6 +64,7 @@ + } + } else { + gn_args+= "qtwebengine_target=\"$$system_path($$OUT_PWD/$$getConfigDir()):QtWebEngineCore\"" ++ gn_args += $$(EXTRA_GN) + gn_args = $$system_quote($$gn_args) + gn_build_root = $$system_quote($$system_path($$OUT_PWD/$$getConfigDir())) + gn_run = $$gn_binary gen $$gn_build_root $$gn_python --args=$$gn_args --root=$$gn_src_root diff --git a/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-backtrace-execinfo.patch b/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-backtrace-execinfo.patch new file mode 100644 index 00000000..1e827e59 --- /dev/null +++ b/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-backtrace-execinfo.patch @@ -0,0 +1,121 @@ +The backtrace api is not available in musl libc. This can be added with +libexecinfo but that needs changes in the build system. As qmake is being swapped +for CMake in Qt6 it makes sense to just check for glibc + +--- + src/3rdparty/chromium/base/debug/stack_trace.cc | 4 ++-- + .../chromium/base/debug/stack_trace_posix.cc | 16 ++++++++-------- + src/3rdparty/chromium/base/logging.cc | 2 +- + 3 files changed, 11 insertions(+), 11 deletions(-) + +diff --git a/src/3rdparty/chromium/base/debug/stack_trace.cc b/src/3rdparty/chromium/base/debug/stack_trace.cc +index f5e2dbba1..f0bb80ad0 100644 +--- a/src/3rdparty/chromium/base/debug/stack_trace.cc ++++ b/src/3rdparty/chromium/base/debug/stack_trace.cc +@@ -225,14 +225,14 @@ std::string StackTrace::ToString() const { + } + std::string StackTrace::ToStringWithPrefix(const char* prefix_string) const { + std::stringstream stream; +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if defined(__GLIBC__) && !defined(_AIX) + OutputToStreamWithPrefix(&stream, prefix_string); + #endif + return stream.str(); + } + + std::ostream& operator<<(std::ostream& os, const StackTrace& s) { +-#if !defined(__UCLIBC__) & !defined(_AIX) ++#if defined(__GLIBC__) & !defined(_AIX) + s.OutputToStream(&os); + #else + os << "StackTrace::OutputToStream not implemented."; +diff --git a/src/3rdparty/chromium/base/debug/stack_trace_posix.cc b/src/3rdparty/chromium/base/debug/stack_trace_posix.cc +index 6a1531e13..0b2b2e6a6 100644 +--- a/src/3rdparty/chromium/base/debug/stack_trace_posix.cc ++++ b/src/3rdparty/chromium/base/debug/stack_trace_posix.cc +@@ -27,7 +27,7 @@ + #if !defined(USE_SYMBOLIZE) + #include <cxxabi.h> + #endif +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if defined(__GLIBC__) && !defined(_AIX) + #include <execinfo.h> + #endif + +@@ -88,7 +88,7 @@ void DemangleSymbols(std::string* text) { + // Note: code in this function is NOT async-signal safe (std::string uses + // malloc internally). + +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if defined(__GLIBC__) && !defined(_AIX) + std::string::size_type search_from = 0; + while (search_from < text->size()) { + // Look for the start of a mangled symbol, from search_from. +@@ -123,7 +123,7 @@ void DemangleSymbols(std::string* text) { + search_from = mangled_start + 2; + } + } +-#endif // !defined(__UCLIBC__) && !defined(_AIX) ++#endif // defined(__GLIBC__) && !defined(_AIX) + } + #endif // !defined(USE_SYMBOLIZE) + +@@ -135,7 +135,7 @@ class BacktraceOutputHandler { + virtual ~BacktraceOutputHandler() = default; + }; + +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if defined(__GLIBC__) && !defined(_AIX) + void OutputPointer(void* pointer, BacktraceOutputHandler* handler) { + // This should be more than enough to store a 64-bit number in hex: + // 16 hex digits + 1 for null-terminator. +@@ -218,7 +218,7 @@ void ProcessBacktrace(void* const* trace, + } + #endif // defined(USE_SYMBOLIZE) + } +-#endif // !defined(__UCLIBC__) && !defined(_AIX) ++#endif // defined(__GLIBC__) && !defined(_AIX) + + void PrintToStderr(const char* output) { + // NOTE: This code MUST be async-signal safe (it's used by in-process +@@ -834,7 +834,7 @@ size_t CollectStackTrace(void** trace, size_t count) { + // NOTE: This code MUST be async-signal safe (it's used by in-process + // stack dumping signal handler). NO malloc or stdio is allowed here. + +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if defined(__GLIBC__) && !defined(_AIX) + // Though the backtrace API man page does not list any possible negative + // return values, we take no chance. + return base::saturated_cast<size_t>(backtrace(trace, count)); +@@ -847,13 +847,13 @@ void StackTrace::PrintWithPrefix(const char* prefix_string) const { + // NOTE: This code MUST be async-signal safe (it's used by in-process + // stack dumping signal handler). NO malloc or stdio is allowed here. + +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if defined(__GLIBC__) && !defined(_AIX) + PrintBacktraceOutputHandler handler; + ProcessBacktrace(trace_, count_, prefix_string, &handler); + #endif + } + +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if defined(__GLIBC__) && !defined(_AIX) + void StackTrace::OutputToStreamWithPrefix(std::ostream* os, + const char* prefix_string) const { + StreamBacktraceOutputHandler handler(os); +diff --git a/src/3rdparty/chromium/base/logging.cc b/src/3rdparty/chromium/base/logging.cc +index b5cf2c493..4be936d32 100644 +--- a/src/3rdparty/chromium/base/logging.cc ++++ b/src/3rdparty/chromium/base/logging.cc +@@ -548,7 +548,7 @@ LogMessage::LogMessage(const char* file, int line, const char* condition) + + LogMessage::~LogMessage() { + size_t stack_start = stream_.tellp(); +-#if !defined(OFFICIAL_BUILD) && !defined(OS_NACL) && !defined(__UCLIBC__) && \ ++#if !defined(OFFICIAL_BUILD) && !defined(OS_NACL) && defined(__GLIBC__) && \ + !defined(OS_AIX) + if (severity_ == LOG_FATAL && !base::debug::BeingDebugged()) { + // Include a stack trace on a fatal, unless a debugger is attached. +-- +2.35.1 + diff --git a/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-fix-sys-queue.h b/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-fix-sys-queue.h new file mode 100644 index 00000000..57ca2cdf --- /dev/null +++ b/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-fix-sys-queue.h @@ -0,0 +1,1020 @@ +From 005bce88c9b1c70b108c66a85335ca434a3c8f27 Mon Sep 17 00:00:00 2001 +From: Your Name <you@example.com> +Date: Mon, 18 Jul 2022 21:39:44 +0200 +Subject: [PATCH] fix libevent sys/queue.h + +--- + .../third_party/libevent/compat_sys_queue.h | 846 ++++++++++++++++++ + .../base/third_party/libevent/epoll.c | 4 + + .../base/third_party/libevent/event.c | 7 + + .../base/third_party/libevent/event_tagging.c | 4 + + .../base/third_party/libevent/evrpc.c | 4 + + .../base/third_party/libevent/evutil.c | 4 + + .../chromium/base/third_party/libevent/http.c | 4 + + .../chromium/base/third_party/libevent/poll.c | 4 + + .../base/third_party/libevent/select.c | 4 + + .../base/third_party/libevent/signal.c | 4 + + 10 files changed, 885 insertions(+) + create mode 100644 src/3rdparty/chromium/base/third_party/libevent/compat_sys_queue.h + +diff --git a/src/3rdparty/chromium/base/third_party/libevent/compat_sys_queue.h b/src/3rdparty/chromium/base/third_party/libevent/compat_sys_queue.h +new file mode 100644 +index 000000000..99d01a55b +--- /dev/null ++++ b/src/3rdparty/chromium/base/third_party/libevent/compat_sys_queue.h +@@ -0,0 +1,846 @@ ++/* $NetBSD: queue.h,v 1.68 2014/11/19 08:10:01 uebayasi Exp $ */ ++ ++/* ++ * Copyright (c) 1991, 1993 ++ * The Regents of the University of California. All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * 2. Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * 3. Neither the name of the University nor the names of its contributors ++ * may be used to endorse or promote products derived from this software ++ * without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE ++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++ * SUCH DAMAGE. ++ * ++ * @(#)queue.h 8.5 (Berkeley) 8/20/94 ++ */ ++ ++#ifndef _SYS_QUEUE_H_ ++#define _SYS_QUEUE_H_ ++ ++/* ++ * This file defines five types of data structures: singly-linked lists, ++ * lists, simple queues, tail queues, and circular queues. ++ * ++ * A singly-linked list is headed by a single forward pointer. The ++ * elements are singly linked for minimum space and pointer manipulation ++ * overhead at the expense of O(n) removal for arbitrary elements. New ++ * elements can be added to the list after an existing element or at the ++ * head of the list. Elements being removed from the head of the list ++ * should use the explicit macro for this purpose for optimum ++ * efficiency. A singly-linked list may only be traversed in the forward ++ * direction. Singly-linked lists are ideal for applications with large ++ * datasets and few or no removals or for implementing a LIFO queue. ++ * ++ * A list is headed by a single forward pointer (or an array of forward ++ * pointers for a hash table header). The elements are doubly linked ++ * so that an arbitrary element can be removed without a need to ++ * traverse the list. New elements can be added to the list before ++ * or after an existing element or at the head of the list. A list ++ * may only be traversed in the forward direction. ++ * ++ * A simple queue is headed by a pair of pointers, one the head of the ++ * list and the other to the tail of the list. The elements are singly ++ * linked to save space, so elements can only be removed from the ++ * head of the list. New elements can be added to the list after ++ * an existing element, at the head of the list, or at the end of the ++ * list. A simple queue may only be traversed in the forward direction. ++ * ++ * A tail queue is headed by a pair of pointers, one to the head of the ++ * list and the other to the tail of the list. The elements are doubly ++ * linked so that an arbitrary element can be removed without a need to ++ * traverse the list. New elements can be added to the list before or ++ * after an existing element, at the head of the list, or at the end of ++ * the list. A tail queue may be traversed in either direction. ++ * ++ * A circle queue is headed by a pair of pointers, one to the head of the ++ * list and the other to the tail of the list. The elements are doubly ++ * linked so that an arbitrary element can be removed without a need to ++ * traverse the list. New elements can be added to the list before or after ++ * an existing element, at the head of the list, or at the end of the list. ++ * A circle queue may be traversed in either direction, but has a more ++ * complex end of list detection. ++ * ++ * For details on the use of these macros, see the queue(3) manual page. ++ */ ++ ++/* ++ * Include the definition of NULL only on NetBSD because sys/null.h ++ * is not available elsewhere. This conditional makes the header ++ * portable and it can simply be dropped verbatim into any system. ++ * The caveat is that on other systems some other header ++ * must provide NULL before the macros can be used. ++ */ ++#ifdef __NetBSD__ ++#include <sys/null.h> ++#endif ++ ++#if defined(QUEUEDEBUG) ++# if defined(_KERNEL) ++# define QUEUEDEBUG_ABORT(...) panic(__VA_ARGS__) ++# else ++# include <err.h> ++# define QUEUEDEBUG_ABORT(...) err(1, __VA_ARGS__) ++# endif ++#endif ++ ++/* ++ * Singly-linked List definitions. ++ */ ++#define SLIST_HEAD(name, type) \ ++struct name { \ ++ struct type *slh_first; /* first element */ \ ++} ++ ++#define SLIST_HEAD_INITIALIZER(head) \ ++ { NULL } ++ ++#define SLIST_ENTRY(type) \ ++struct { \ ++ struct type *sle_next; /* next element */ \ ++} ++ ++/* ++ * Singly-linked List access methods. ++ */ ++#define SLIST_FIRST(head) ((head)->slh_first) ++#define SLIST_END(head) NULL ++#define SLIST_EMPTY(head) ((head)->slh_first == NULL) ++#define SLIST_NEXT(elm, field) ((elm)->field.sle_next) ++ ++#define SLIST_FOREACH(var, head, field) \ ++ for((var) = (head)->slh_first; \ ++ (var) != SLIST_END(head); \ ++ (var) = (var)->field.sle_next) ++ ++#define SLIST_FOREACH_SAFE(var, head, field, tvar) \ ++ for ((var) = SLIST_FIRST((head)); \ ++ (var) != SLIST_END(head) && \ ++ ((tvar) = SLIST_NEXT((var), field), 1); \ ++ (var) = (tvar)) ++ ++/* ++ * Singly-linked List functions. ++ */ ++#define SLIST_INIT(head) do { \ ++ (head)->slh_first = SLIST_END(head); \ ++} while (/*CONSTCOND*/0) ++ ++#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \ ++ (elm)->field.sle_next = (slistelm)->field.sle_next; \ ++ (slistelm)->field.sle_next = (elm); \ ++} while (/*CONSTCOND*/0) ++ ++#define SLIST_INSERT_HEAD(head, elm, field) do { \ ++ (elm)->field.sle_next = (head)->slh_first; \ ++ (head)->slh_first = (elm); \ ++} while (/*CONSTCOND*/0) ++ ++#define SLIST_REMOVE_AFTER(slistelm, field) do { \ ++ (slistelm)->field.sle_next = \ ++ SLIST_NEXT(SLIST_NEXT((slistelm), field), field); \ ++} while (/*CONSTCOND*/0) ++ ++#define SLIST_REMOVE_HEAD(head, field) do { \ ++ (head)->slh_first = (head)->slh_first->field.sle_next; \ ++} while (/*CONSTCOND*/0) ++ ++#define SLIST_REMOVE(head, elm, type, field) do { \ ++ if ((head)->slh_first == (elm)) { \ ++ SLIST_REMOVE_HEAD((head), field); \ ++ } \ ++ else { \ ++ struct type *curelm = (head)->slh_first; \ ++ while(curelm->field.sle_next != (elm)) \ ++ curelm = curelm->field.sle_next; \ ++ curelm->field.sle_next = \ ++ curelm->field.sle_next->field.sle_next; \ ++ } \ ++} while (/*CONSTCOND*/0) ++ ++ ++/* ++ * List definitions. ++ */ ++#define LIST_HEAD(name, type) \ ++struct name { \ ++ struct type *lh_first; /* first element */ \ ++} ++ ++#define LIST_HEAD_INITIALIZER(head) \ ++ { NULL } ++ ++#define LIST_ENTRY(type) \ ++struct { \ ++ struct type *le_next; /* next element */ \ ++ struct type **le_prev; /* address of previous next element */ \ ++} ++ ++/* ++ * List access methods. ++ */ ++#define LIST_FIRST(head) ((head)->lh_first) ++#define LIST_END(head) NULL ++#define LIST_EMPTY(head) ((head)->lh_first == LIST_END(head)) ++#define LIST_NEXT(elm, field) ((elm)->field.le_next) ++ ++#define LIST_FOREACH(var, head, field) \ ++ for ((var) = ((head)->lh_first); \ ++ (var) != LIST_END(head); \ ++ (var) = ((var)->field.le_next)) ++ ++#define LIST_FOREACH_SAFE(var, head, field, tvar) \ ++ for ((var) = LIST_FIRST((head)); \ ++ (var) != LIST_END(head) && \ ++ ((tvar) = LIST_NEXT((var), field), 1); \ ++ (var) = (tvar)) ++ ++#define LIST_MOVE(head1, head2) do { \ ++ LIST_INIT((head2)); \ ++ if (!LIST_EMPTY((head1))) { \ ++ (head2)->lh_first = (head1)->lh_first; \ ++ LIST_INIT((head1)); \ ++ } \ ++} while (/*CONSTCOND*/0) ++ ++/* ++ * List functions. ++ */ ++#if defined(QUEUEDEBUG) ++#define QUEUEDEBUG_LIST_INSERT_HEAD(head, elm, field) \ ++ if ((head)->lh_first && \ ++ (head)->lh_first->field.le_prev != &(head)->lh_first) \ ++ QUEUEDEBUG_ABORT("LIST_INSERT_HEAD %p %s:%d", (head), \ ++ __FILE__, __LINE__); ++#define QUEUEDEBUG_LIST_OP(elm, field) \ ++ if ((elm)->field.le_next && \ ++ (elm)->field.le_next->field.le_prev != \ ++ &(elm)->field.le_next) \ ++ QUEUEDEBUG_ABORT("LIST_* forw %p %s:%d", (elm), \ ++ __FILE__, __LINE__); \ ++ if (*(elm)->field.le_prev != (elm)) \ ++ QUEUEDEBUG_ABORT("LIST_* back %p %s:%d", (elm), \ ++ __FILE__, __LINE__); ++#define QUEUEDEBUG_LIST_POSTREMOVE(elm, field) \ ++ (elm)->field.le_next = (void *)1L; \ ++ (elm)->field.le_prev = (void *)1L; ++#else ++#define QUEUEDEBUG_LIST_INSERT_HEAD(head, elm, field) ++#define QUEUEDEBUG_LIST_OP(elm, field) ++#define QUEUEDEBUG_LIST_POSTREMOVE(elm, field) ++#endif ++ ++#define LIST_INIT(head) do { \ ++ (head)->lh_first = LIST_END(head); \ ++} while (/*CONSTCOND*/0) ++ ++#define LIST_INSERT_AFTER(listelm, elm, field) do { \ ++ QUEUEDEBUG_LIST_OP((listelm), field) \ ++ if (((elm)->field.le_next = (listelm)->field.le_next) != \ ++ LIST_END(head)) \ ++ (listelm)->field.le_next->field.le_prev = \ ++ &(elm)->field.le_next; \ ++ (listelm)->field.le_next = (elm); \ ++ (elm)->field.le_prev = &(listelm)->field.le_next; \ ++} while (/*CONSTCOND*/0) ++ ++#define LIST_INSERT_BEFORE(listelm, elm, field) do { \ ++ QUEUEDEBUG_LIST_OP((listelm), field) \ ++ (elm)->field.le_prev = (listelm)->field.le_prev; \ ++ (elm)->field.le_next = (listelm); \ ++ *(listelm)->field.le_prev = (elm); \ ++ (listelm)->field.le_prev = &(elm)->field.le_next; \ ++} while (/*CONSTCOND*/0) ++ ++#define LIST_INSERT_HEAD(head, elm, field) do { \ ++ QUEUEDEBUG_LIST_INSERT_HEAD((head), (elm), field) \ ++ if (((elm)->field.le_next = (head)->lh_first) != LIST_END(head))\ ++ (head)->lh_first->field.le_prev = &(elm)->field.le_next;\ ++ (head)->lh_first = (elm); \ ++ (elm)->field.le_prev = &(head)->lh_first; \ ++} while (/*CONSTCOND*/0) ++ ++#define LIST_REMOVE(elm, field) do { \ ++ QUEUEDEBUG_LIST_OP((elm), field) \ ++ if ((elm)->field.le_next != NULL) \ ++ (elm)->field.le_next->field.le_prev = \ ++ (elm)->field.le_prev; \ ++ *(elm)->field.le_prev = (elm)->field.le_next; \ ++ QUEUEDEBUG_LIST_POSTREMOVE((elm), field) \ ++} while (/*CONSTCOND*/0) ++ ++#define LIST_REPLACE(elm, elm2, field) do { \ ++ if (((elm2)->field.le_next = (elm)->field.le_next) != NULL) \ ++ (elm2)->field.le_next->field.le_prev = \ ++ &(elm2)->field.le_next; \ ++ (elm2)->field.le_prev = (elm)->field.le_prev; \ ++ *(elm2)->field.le_prev = (elm2); \ ++ QUEUEDEBUG_LIST_POSTREMOVE((elm), field) \ ++} while (/*CONSTCOND*/0) ++ ++/* ++ * Simple queue definitions. ++ */ ++#define SIMPLEQ_HEAD(name, type) \ ++struct name { \ ++ struct type *sqh_first; /* first element */ \ ++ struct type **sqh_last; /* addr of last next element */ \ ++} ++ ++#define SIMPLEQ_HEAD_INITIALIZER(head) \ ++ { NULL, &(head).sqh_first } ++ ++#define SIMPLEQ_ENTRY(type) \ ++struct { \ ++ struct type *sqe_next; /* next element */ \ ++} ++ ++/* ++ * Simple queue access methods. ++ */ ++#define SIMPLEQ_FIRST(head) ((head)->sqh_first) ++#define SIMPLEQ_END(head) NULL ++#define SIMPLEQ_EMPTY(head) ((head)->sqh_first == SIMPLEQ_END(head)) ++#define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next) ++ ++#define SIMPLEQ_FOREACH(var, head, field) \ ++ for ((var) = ((head)->sqh_first); \ ++ (var) != SIMPLEQ_END(head); \ ++ (var) = ((var)->field.sqe_next)) ++ ++#define SIMPLEQ_FOREACH_SAFE(var, head, field, next) \ ++ for ((var) = ((head)->sqh_first); \ ++ (var) != SIMPLEQ_END(head) && \ ++ ((next = ((var)->field.sqe_next)), 1); \ ++ (var) = (next)) ++ ++/* ++ * Simple queue functions. ++ */ ++#define SIMPLEQ_INIT(head) do { \ ++ (head)->sqh_first = NULL; \ ++ (head)->sqh_last = &(head)->sqh_first; \ ++} while (/*CONSTCOND*/0) ++ ++#define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \ ++ if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \ ++ (head)->sqh_last = &(elm)->field.sqe_next; \ ++ (head)->sqh_first = (elm); \ ++} while (/*CONSTCOND*/0) ++ ++#define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \ ++ (elm)->field.sqe_next = NULL; \ ++ *(head)->sqh_last = (elm); \ ++ (head)->sqh_last = &(elm)->field.sqe_next; \ ++} while (/*CONSTCOND*/0) ++ ++#define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ ++ if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\ ++ (head)->sqh_last = &(elm)->field.sqe_next; \ ++ (listelm)->field.sqe_next = (elm); \ ++} while (/*CONSTCOND*/0) ++ ++#define SIMPLEQ_REMOVE_HEAD(head, field) do { \ ++ if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \ ++ (head)->sqh_last = &(head)->sqh_first; \ ++} while (/*CONSTCOND*/0) ++ ++#define SIMPLEQ_REMOVE_AFTER(head, elm, field) do { \ ++ if (((elm)->field.sqe_next = (elm)->field.sqe_next->field.sqe_next) \ ++ == NULL) \ ++ (head)->sqh_last = &(elm)->field.sqe_next; \ ++} while (/*CONSTCOND*/0) ++ ++#define SIMPLEQ_REMOVE(head, elm, type, field) do { \ ++ if ((head)->sqh_first == (elm)) { \ ++ SIMPLEQ_REMOVE_HEAD((head), field); \ ++ } else { \ ++ struct type *curelm = (head)->sqh_first; \ ++ while (curelm->field.sqe_next != (elm)) \ ++ curelm = curelm->field.sqe_next; \ ++ if ((curelm->field.sqe_next = \ ++ curelm->field.sqe_next->field.sqe_next) == NULL) \ ++ (head)->sqh_last = &(curelm)->field.sqe_next; \ ++ } \ ++} while (/*CONSTCOND*/0) ++ ++#define SIMPLEQ_CONCAT(head1, head2) do { \ ++ if (!SIMPLEQ_EMPTY((head2))) { \ ++ *(head1)->sqh_last = (head2)->sqh_first; \ ++ (head1)->sqh_last = (head2)->sqh_last; \ ++ SIMPLEQ_INIT((head2)); \ ++ } \ ++} while (/*CONSTCOND*/0) ++ ++#define SIMPLEQ_LAST(head, type, field) \ ++ (SIMPLEQ_EMPTY((head)) ? \ ++ NULL : \ ++ ((struct type *)(void *) \ ++ ((char *)((head)->sqh_last) - offsetof(struct type, field)))) ++ ++/* ++ * Tail queue definitions. ++ */ ++#define _TAILQ_HEAD(name, type, qual) \ ++struct name { \ ++ qual type *tqh_first; /* first element */ \ ++ qual type *qual *tqh_last; /* addr of last next element */ \ ++} ++#define TAILQ_HEAD(name, type) _TAILQ_HEAD(name, struct type,) ++ ++#define TAILQ_HEAD_INITIALIZER(head) \ ++ { TAILQ_END(head), &(head).tqh_first } ++ ++#define _TAILQ_ENTRY(type, qual) \ ++struct { \ ++ qual type *tqe_next; /* next element */ \ ++ qual type *qual *tqe_prev; /* address of previous next element */\ ++} ++#define TAILQ_ENTRY(type) _TAILQ_ENTRY(struct type,) ++ ++/* ++ * Tail queue access methods. ++ */ ++#define TAILQ_FIRST(head) ((head)->tqh_first) ++#define TAILQ_END(head) (NULL) ++#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) ++#define TAILQ_LAST(head, headname) \ ++ (*(((struct headname *)((head)->tqh_last))->tqh_last)) ++#define TAILQ_PREV(elm, headname, field) \ ++ (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) ++#define TAILQ_EMPTY(head) (TAILQ_FIRST(head) == TAILQ_END(head)) ++ ++ ++#define TAILQ_FOREACH(var, head, field) \ ++ for ((var) = ((head)->tqh_first); \ ++ (var) != TAILQ_END(head); \ ++ (var) = ((var)->field.tqe_next)) ++ ++#define TAILQ_FOREACH_SAFE(var, head, field, next) \ ++ for ((var) = ((head)->tqh_first); \ ++ (var) != TAILQ_END(head) && \ ++ ((next) = TAILQ_NEXT(var, field), 1); (var) = (next)) ++ ++#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ ++ for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last));\ ++ (var) != TAILQ_END(head); \ ++ (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last))) ++ ++#define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, prev) \ ++ for ((var) = TAILQ_LAST((head), headname); \ ++ (var) != TAILQ_END(head) && \ ++ ((prev) = TAILQ_PREV((var), headname, field), 1); (var) = (prev)) ++ ++/* ++ * Tail queue functions. ++ */ ++#if defined(QUEUEDEBUG) ++#define QUEUEDEBUG_TAILQ_INSERT_HEAD(head, elm, field) \ ++ if ((head)->tqh_first && \ ++ (head)->tqh_first->field.tqe_prev != &(head)->tqh_first) \ ++ QUEUEDEBUG_ABORT("TAILQ_INSERT_HEAD %p %s:%d", (head), \ ++ __FILE__, __LINE__); ++#define QUEUEDEBUG_TAILQ_INSERT_TAIL(head, elm, field) \ ++ if (*(head)->tqh_last != NULL) \ ++ QUEUEDEBUG_ABORT("TAILQ_INSERT_TAIL %p %s:%d", (head), \ ++ __FILE__, __LINE__); ++#define QUEUEDEBUG_TAILQ_OP(elm, field) \ ++ if ((elm)->field.tqe_next && \ ++ (elm)->field.tqe_next->field.tqe_prev != \ ++ &(elm)->field.tqe_next) \ ++ QUEUEDEBUG_ABORT("TAILQ_* forw %p %s:%d", (elm), \ ++ __FILE__, __LINE__); \ ++ if (*(elm)->field.tqe_prev != (elm)) \ ++ QUEUEDEBUG_ABORT("TAILQ_* back %p %s:%d", (elm), \ ++ __FILE__, __LINE__); ++#define QUEUEDEBUG_TAILQ_PREREMOVE(head, elm, field) \ ++ if ((elm)->field.tqe_next == NULL && \ ++ (head)->tqh_last != &(elm)->field.tqe_next) \ ++ QUEUEDEBUG_ABORT("TAILQ_PREREMOVE head %p elm %p %s:%d",\ ++ (head), (elm), __FILE__, __LINE__); ++#define QUEUEDEBUG_TAILQ_POSTREMOVE(elm, field) \ ++ (elm)->field.tqe_next = (void *)1L; \ ++ (elm)->field.tqe_prev = (void *)1L; ++#else ++#define QUEUEDEBUG_TAILQ_INSERT_HEAD(head, elm, field) ++#define QUEUEDEBUG_TAILQ_INSERT_TAIL(head, elm, field) ++#define QUEUEDEBUG_TAILQ_OP(elm, field) ++#define QUEUEDEBUG_TAILQ_PREREMOVE(head, elm, field) ++#define QUEUEDEBUG_TAILQ_POSTREMOVE(elm, field) ++#endif ++ ++#define TAILQ_INIT(head) do { \ ++ (head)->tqh_first = TAILQ_END(head); \ ++ (head)->tqh_last = &(head)->tqh_first; \ ++} while (/*CONSTCOND*/0) ++ ++#define TAILQ_INSERT_HEAD(head, elm, field) do { \ ++ QUEUEDEBUG_TAILQ_INSERT_HEAD((head), (elm), field) \ ++ if (((elm)->field.tqe_next = (head)->tqh_first) != TAILQ_END(head))\ ++ (head)->tqh_first->field.tqe_prev = \ ++ &(elm)->field.tqe_next; \ ++ else \ ++ (head)->tqh_last = &(elm)->field.tqe_next; \ ++ (head)->tqh_first = (elm); \ ++ (elm)->field.tqe_prev = &(head)->tqh_first; \ ++} while (/*CONSTCOND*/0) ++ ++#define TAILQ_INSERT_TAIL(head, elm, field) do { \ ++ QUEUEDEBUG_TAILQ_INSERT_TAIL((head), (elm), field) \ ++ (elm)->field.tqe_next = TAILQ_END(head); \ ++ (elm)->field.tqe_prev = (head)->tqh_last; \ ++ *(head)->tqh_last = (elm); \ ++ (head)->tqh_last = &(elm)->field.tqe_next; \ ++} while (/*CONSTCOND*/0) ++ ++#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ ++ QUEUEDEBUG_TAILQ_OP((listelm), field) \ ++ if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != \ ++ TAILQ_END(head)) \ ++ (elm)->field.tqe_next->field.tqe_prev = \ ++ &(elm)->field.tqe_next; \ ++ else \ ++ (head)->tqh_last = &(elm)->field.tqe_next; \ ++ (listelm)->field.tqe_next = (elm); \ ++ (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ ++} while (/*CONSTCOND*/0) ++ ++#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ ++ QUEUEDEBUG_TAILQ_OP((listelm), field) \ ++ (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ ++ (elm)->field.tqe_next = (listelm); \ ++ *(listelm)->field.tqe_prev = (elm); \ ++ (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ ++} while (/*CONSTCOND*/0) ++ ++#define TAILQ_REMOVE(head, elm, field) do { \ ++ QUEUEDEBUG_TAILQ_PREREMOVE((head), (elm), field) \ ++ QUEUEDEBUG_TAILQ_OP((elm), field) \ ++ if (((elm)->field.tqe_next) != TAILQ_END(head)) \ ++ (elm)->field.tqe_next->field.tqe_prev = \ ++ (elm)->field.tqe_prev; \ ++ else \ ++ (head)->tqh_last = (elm)->field.tqe_prev; \ ++ *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ ++ QUEUEDEBUG_TAILQ_POSTREMOVE((elm), field); \ ++} while (/*CONSTCOND*/0) ++ ++#define TAILQ_REPLACE(head, elm, elm2, field) do { \ ++ if (((elm2)->field.tqe_next = (elm)->field.tqe_next) != \ ++ TAILQ_END(head)) \ ++ (elm2)->field.tqe_next->field.tqe_prev = \ ++ &(elm2)->field.tqe_next; \ ++ else \ ++ (head)->tqh_last = &(elm2)->field.tqe_next; \ ++ (elm2)->field.tqe_prev = (elm)->field.tqe_prev; \ ++ *(elm2)->field.tqe_prev = (elm2); \ ++ QUEUEDEBUG_TAILQ_POSTREMOVE((elm), field); \ ++} while (/*CONSTCOND*/0) ++ ++#define TAILQ_CONCAT(head1, head2, field) do { \ ++ if (!TAILQ_EMPTY(head2)) { \ ++ *(head1)->tqh_last = (head2)->tqh_first; \ ++ (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \ ++ (head1)->tqh_last = (head2)->tqh_last; \ ++ TAILQ_INIT((head2)); \ ++ } \ ++} while (/*CONSTCOND*/0) ++ ++/* ++ * Singly-linked Tail queue declarations. ++ */ ++#define STAILQ_HEAD(name, type) \ ++struct name { \ ++ struct type *stqh_first; /* first element */ \ ++ struct type **stqh_last; /* addr of last next element */ \ ++} ++ ++#define STAILQ_HEAD_INITIALIZER(head) \ ++ { NULL, &(head).stqh_first } ++ ++#define STAILQ_ENTRY(type) \ ++struct { \ ++ struct type *stqe_next; /* next element */ \ ++} ++ ++/* ++ * Singly-linked Tail queue access methods. ++ */ ++#define STAILQ_FIRST(head) ((head)->stqh_first) ++#define STAILQ_END(head) NULL ++#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next) ++#define STAILQ_EMPTY(head) (STAILQ_FIRST(head) == STAILQ_END(head)) ++ ++/* ++ * Singly-linked Tail queue functions. ++ */ ++#define STAILQ_INIT(head) do { \ ++ (head)->stqh_first = NULL; \ ++ (head)->stqh_last = &(head)->stqh_first; \ ++} while (/*CONSTCOND*/0) ++ ++#define STAILQ_INSERT_HEAD(head, elm, field) do { \ ++ if (((elm)->field.stqe_next = (head)->stqh_first) == NULL) \ ++ (head)->stqh_last = &(elm)->field.stqe_next; \ ++ (head)->stqh_first = (elm); \ ++} while (/*CONSTCOND*/0) ++ ++#define STAILQ_INSERT_TAIL(head, elm, field) do { \ ++ (elm)->field.stqe_next = NULL; \ ++ *(head)->stqh_last = (elm); \ ++ (head)->stqh_last = &(elm)->field.stqe_next; \ ++} while (/*CONSTCOND*/0) ++ ++#define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ ++ if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\ ++ (head)->stqh_last = &(elm)->field.stqe_next; \ ++ (listelm)->field.stqe_next = (elm); \ ++} while (/*CONSTCOND*/0) ++ ++#define STAILQ_REMOVE_HEAD(head, field) do { \ ++ if (((head)->stqh_first = (head)->stqh_first->field.stqe_next) == NULL) \ ++ (head)->stqh_last = &(head)->stqh_first; \ ++} while (/*CONSTCOND*/0) ++ ++#define STAILQ_REMOVE(head, elm, type, field) do { \ ++ if ((head)->stqh_first == (elm)) { \ ++ STAILQ_REMOVE_HEAD((head), field); \ ++ } else { \ ++ struct type *curelm = (head)->stqh_first; \ ++ while (curelm->field.stqe_next != (elm)) \ ++ curelm = curelm->field.stqe_next; \ ++ if ((curelm->field.stqe_next = \ ++ curelm->field.stqe_next->field.stqe_next) == NULL) \ ++ (head)->stqh_last = &(curelm)->field.stqe_next; \ ++ } \ ++} while (/*CONSTCOND*/0) ++ ++#define STAILQ_FOREACH(var, head, field) \ ++ for ((var) = ((head)->stqh_first); \ ++ (var); \ ++ (var) = ((var)->field.stqe_next)) ++ ++#define STAILQ_FOREACH_SAFE(var, head, field, tvar) \ ++ for ((var) = STAILQ_FIRST((head)); \ ++ (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \ ++ (var) = (tvar)) ++ ++#define STAILQ_CONCAT(head1, head2) do { \ ++ if (!STAILQ_EMPTY((head2))) { \ ++ *(head1)->stqh_last = (head2)->stqh_first; \ ++ (head1)->stqh_last = (head2)->stqh_last; \ ++ STAILQ_INIT((head2)); \ ++ } \ ++} while (/*CONSTCOND*/0) ++ ++#define STAILQ_LAST(head, type, field) \ ++ (STAILQ_EMPTY((head)) ? \ ++ NULL : \ ++ ((struct type *)(void *) \ ++ ((char *)((head)->stqh_last) - offsetof(struct type, field)))) ++ ++ ++#ifndef _KERNEL ++/* ++ * Circular queue definitions. Do not use. We still keep the macros ++ * for compatibility but because of pointer aliasing issues their use ++ * is discouraged! ++ */ ++ ++/* ++ * __launder_type(): We use this ugly hack to work around the the compiler ++ * noticing that two types may not alias each other and elide tests in code. ++ * We hit this in the CIRCLEQ macros when comparing 'struct name *' and ++ * 'struct type *' (see CIRCLEQ_HEAD()). Modern compilers (such as GCC ++ * 4.8) declare these comparisons as always false, causing the code to ++ * not run as designed. ++ * ++ * This hack is only to be used for comparisons and thus can be fully const. ++ * Do not use for assignment. ++ * ++ * If we ever choose to change the ABI of the CIRCLEQ macros, we could fix ++ * this by changing the head/tail sentinal values, but see the note above ++ * this one. ++ */ ++static __inline const void * __launder_type(const void *); ++static __inline const void * ++__launder_type(const void *__x) ++{ ++ __asm __volatile("" : "+r" (__x)); ++ return __x; ++} ++ ++#if defined(QUEUEDEBUG) ++#define QUEUEDEBUG_CIRCLEQ_HEAD(head, field) \ ++ if ((head)->cqh_first != CIRCLEQ_ENDC(head) && \ ++ (head)->cqh_first->field.cqe_prev != CIRCLEQ_ENDC(head)) \ ++ QUEUEDEBUG_ABORT("CIRCLEQ head forw %p %s:%d", (head), \ ++ __FILE__, __LINE__); \ ++ if ((head)->cqh_last != CIRCLEQ_ENDC(head) && \ ++ (head)->cqh_last->field.cqe_next != CIRCLEQ_ENDC(head)) \ ++ QUEUEDEBUG_ABORT("CIRCLEQ head back %p %s:%d", (head), \ ++ __FILE__, __LINE__); ++#define QUEUEDEBUG_CIRCLEQ_ELM(head, elm, field) \ ++ if ((elm)->field.cqe_next == CIRCLEQ_ENDC(head)) { \ ++ if ((head)->cqh_last != (elm)) \ ++ QUEUEDEBUG_ABORT("CIRCLEQ elm last %p %s:%d", \ ++ (elm), __FILE__, __LINE__); \ ++ } else { \ ++ if ((elm)->field.cqe_next->field.cqe_prev != (elm)) \ ++ QUEUEDEBUG_ABORT("CIRCLEQ elm forw %p %s:%d", \ ++ (elm), __FILE__, __LINE__); \ ++ } \ ++ if ((elm)->field.cqe_prev == CIRCLEQ_ENDC(head)) { \ ++ if ((head)->cqh_first != (elm)) \ ++ QUEUEDEBUG_ABORT("CIRCLEQ elm first %p %s:%d", \ ++ (elm), __FILE__, __LINE__); \ ++ } else { \ ++ if ((elm)->field.cqe_prev->field.cqe_next != (elm)) \ ++ QUEUEDEBUG_ABORT("CIRCLEQ elm prev %p %s:%d", \ ++ (elm), __FILE__, __LINE__); \ ++ } ++#define QUEUEDEBUG_CIRCLEQ_POSTREMOVE(elm, field) \ ++ (elm)->field.cqe_next = (void *)1L; \ ++ (elm)->field.cqe_prev = (void *)1L; ++#else ++#define QUEUEDEBUG_CIRCLEQ_HEAD(head, field) ++#define QUEUEDEBUG_CIRCLEQ_ELM(head, elm, field) ++#define QUEUEDEBUG_CIRCLEQ_POSTREMOVE(elm, field) ++#endif ++ ++#define CIRCLEQ_HEAD(name, type) \ ++struct name { \ ++ struct type *cqh_first; /* first element */ \ ++ struct type *cqh_last; /* last element */ \ ++} ++ ++#define CIRCLEQ_HEAD_INITIALIZER(head) \ ++ { CIRCLEQ_END(&head), CIRCLEQ_END(&head) } ++ ++#define CIRCLEQ_ENTRY(type) \ ++struct { \ ++ struct type *cqe_next; /* next element */ \ ++ struct type *cqe_prev; /* previous element */ \ ++} ++ ++/* ++ * Circular queue functions. ++ */ ++#define CIRCLEQ_INIT(head) do { \ ++ (head)->cqh_first = CIRCLEQ_END(head); \ ++ (head)->cqh_last = CIRCLEQ_END(head); \ ++} while (/*CONSTCOND*/0) ++ ++#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ ++ QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \ ++ QUEUEDEBUG_CIRCLEQ_ELM((head), (listelm), field) \ ++ (elm)->field.cqe_next = (listelm)->field.cqe_next; \ ++ (elm)->field.cqe_prev = (listelm); \ ++ if ((listelm)->field.cqe_next == CIRCLEQ_ENDC(head)) \ ++ (head)->cqh_last = (elm); \ ++ else \ ++ (listelm)->field.cqe_next->field.cqe_prev = (elm); \ ++ (listelm)->field.cqe_next = (elm); \ ++} while (/*CONSTCOND*/0) ++ ++#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \ ++ QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \ ++ QUEUEDEBUG_CIRCLEQ_ELM((head), (listelm), field) \ ++ (elm)->field.cqe_next = (listelm); \ ++ (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \ ++ if ((listelm)->field.cqe_prev == CIRCLEQ_ENDC(head)) \ ++ (head)->cqh_first = (elm); \ ++ else \ ++ (listelm)->field.cqe_prev->field.cqe_next = (elm); \ ++ (listelm)->field.cqe_prev = (elm); \ ++} while (/*CONSTCOND*/0) ++ ++#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \ ++ QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \ ++ (elm)->field.cqe_next = (head)->cqh_first; \ ++ (elm)->field.cqe_prev = CIRCLEQ_END(head); \ ++ if ((head)->cqh_last == CIRCLEQ_ENDC(head)) \ ++ (head)->cqh_last = (elm); \ ++ else \ ++ (head)->cqh_first->field.cqe_prev = (elm); \ ++ (head)->cqh_first = (elm); \ ++} while (/*CONSTCOND*/0) ++ ++#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \ ++ QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \ ++ (elm)->field.cqe_next = CIRCLEQ_END(head); \ ++ (elm)->field.cqe_prev = (head)->cqh_last; \ ++ if ((head)->cqh_first == CIRCLEQ_ENDC(head)) \ ++ (head)->cqh_first = (elm); \ ++ else \ ++ (head)->cqh_last->field.cqe_next = (elm); \ ++ (head)->cqh_last = (elm); \ ++} while (/*CONSTCOND*/0) ++ ++#define CIRCLEQ_REMOVE(head, elm, field) do { \ ++ QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \ ++ QUEUEDEBUG_CIRCLEQ_ELM((head), (elm), field) \ ++ if ((elm)->field.cqe_next == CIRCLEQ_ENDC(head)) \ ++ (head)->cqh_last = (elm)->field.cqe_prev; \ ++ else \ ++ (elm)->field.cqe_next->field.cqe_prev = \ ++ (elm)->field.cqe_prev; \ ++ if ((elm)->field.cqe_prev == CIRCLEQ_ENDC(head)) \ ++ (head)->cqh_first = (elm)->field.cqe_next; \ ++ else \ ++ (elm)->field.cqe_prev->field.cqe_next = \ ++ (elm)->field.cqe_next; \ ++ QUEUEDEBUG_CIRCLEQ_POSTREMOVE((elm), field) \ ++} while (/*CONSTCOND*/0) ++ ++#define CIRCLEQ_FOREACH(var, head, field) \ ++ for ((var) = ((head)->cqh_first); \ ++ (var) != CIRCLEQ_ENDC(head); \ ++ (var) = ((var)->field.cqe_next)) ++ ++#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \ ++ for ((var) = ((head)->cqh_last); \ ++ (var) != CIRCLEQ_ENDC(head); \ ++ (var) = ((var)->field.cqe_prev)) ++ ++/* ++ * Circular queue access methods. ++ */ ++#define CIRCLEQ_FIRST(head) ((head)->cqh_first) ++#define CIRCLEQ_LAST(head) ((head)->cqh_last) ++/* For comparisons */ ++#define CIRCLEQ_ENDC(head) (__launder_type(head)) ++/* For assignments */ ++#define CIRCLEQ_END(head) ((void *)(head)) ++#define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next) ++#define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev) ++#define CIRCLEQ_EMPTY(head) \ ++ (CIRCLEQ_FIRST(head) == CIRCLEQ_ENDC(head)) ++ ++#define CIRCLEQ_LOOP_NEXT(head, elm, field) \ ++ (((elm)->field.cqe_next == CIRCLEQ_ENDC(head)) \ ++ ? ((head)->cqh_first) \ ++ : (elm->field.cqe_next)) ++#define CIRCLEQ_LOOP_PREV(head, elm, field) \ ++ (((elm)->field.cqe_prev == CIRCLEQ_ENDC(head)) \ ++ ? ((head)->cqh_last) \ ++ : (elm->field.cqe_prev)) ++#endif /* !_KERNEL */ ++ ++#endif /* !_SYS_QUEUE_H_ */ +diff --git a/src/3rdparty/chromium/base/third_party/libevent/epoll.c b/src/3rdparty/chromium/base/third_party/libevent/epoll.c +index 4387ef896..91be4c644 100644 +--- a/src/3rdparty/chromium/base/third_party/libevent/epoll.c ++++ b/src/3rdparty/chromium/base/third_party/libevent/epoll.c +@@ -36,7 +36,11 @@ + #else + #include <sys/_libevent_time.h> + #endif ++#if __has_include(<sys/queue.h>) + #include <sys/queue.h> ++#else ++#include "compat_sys_queue.h" ++#endif + #include <sys/epoll.h> + #include <signal.h> + #include <stdio.h> +diff --git a/src/3rdparty/chromium/base/third_party/libevent/event.c b/src/3rdparty/chromium/base/third_party/libevent/event.c +index 4aa326e0e..2f228aa92 100644 +--- a/src/3rdparty/chromium/base/third_party/libevent/event.c ++++ b/src/3rdparty/chromium/base/third_party/libevent/event.c +@@ -39,6 +39,13 @@ + #else + #include <sys/_libevent_time.h> + #endif ++ ++#if __has_include(<sys/queue.h>) ++#include <sys/queue.h> ++#else ++#include "compat_sys_queue.h" ++#endif ++ + #include <sys/queue.h> + #include <stdio.h> + #include <stdlib.h> +diff --git a/src/3rdparty/chromium/base/third_party/libevent/event_tagging.c b/src/3rdparty/chromium/base/third_party/libevent/event_tagging.c +index d436e3fd6..777fb037f 100644 +--- a/src/3rdparty/chromium/base/third_party/libevent/event_tagging.c ++++ b/src/3rdparty/chromium/base/third_party/libevent/event_tagging.c +@@ -45,7 +45,11 @@ + #include <sys/ioctl.h> + #endif + ++#if __has_include(<sys/queue.h>) + #include <sys/queue.h> ++#else ++#include "compat_sys_queue.h" ++#endif + #ifdef HAVE_SYS_TIME_H + #include <sys/time.h> + #endif +diff --git a/src/3rdparty/chromium/base/third_party/libevent/evrpc.c b/src/3rdparty/chromium/base/third_party/libevent/evrpc.c +index 070fd9e71..f63a43ca4 100644 +--- a/src/3rdparty/chromium/base/third_party/libevent/evrpc.c ++++ b/src/3rdparty/chromium/base/third_party/libevent/evrpc.c +@@ -42,7 +42,11 @@ + #ifdef HAVE_SYS_TIME_H + #include <sys/time.h> + #endif ++#if __has_include(<sys/queue.h>) + #include <sys/queue.h> ++#else ++#include "compat_sys_queue.h" ++#endif + #include <stdio.h> + #include <stdlib.h> + #ifndef WIN32 +diff --git a/src/3rdparty/chromium/base/third_party/libevent/evutil.c b/src/3rdparty/chromium/base/third_party/libevent/evutil.c +index cc6d0f46a..13de43bb6 100644 +--- a/src/3rdparty/chromium/base/third_party/libevent/evutil.c ++++ b/src/3rdparty/chromium/base/third_party/libevent/evutil.c +@@ -55,7 +55,11 @@ + #include <stdio.h> + #include <signal.h> + ++#if __has_include(<sys/queue.h>) + #include <sys/queue.h> ++#else ++#include "compat_sys_queue.h" ++#endif + #include "event.h" + #include "event-internal.h" + #include "evutil.h" +diff --git a/src/3rdparty/chromium/base/third_party/libevent/http.c b/src/3rdparty/chromium/base/third_party/libevent/http.c +index 4abce2393..ac4d74798 100644 +--- a/src/3rdparty/chromium/base/third_party/libevent/http.c ++++ b/src/3rdparty/chromium/base/third_party/libevent/http.c +@@ -50,7 +50,11 @@ + #include <sys/wait.h> + #endif + ++#if __has_include(<sys/queue.h>) + #include <sys/queue.h> ++#else ++#include "compat_sys_queue.h" ++#endif + + #ifndef WIN32 + #include <netinet/in.h> +diff --git a/src/3rdparty/chromium/base/third_party/libevent/poll.c b/src/3rdparty/chromium/base/third_party/libevent/poll.c +index 2aa245b37..9aa3e4833 100644 +--- a/src/3rdparty/chromium/base/third_party/libevent/poll.c ++++ b/src/3rdparty/chromium/base/third_party/libevent/poll.c +@@ -36,7 +36,11 @@ + #else + #include <sys/_libevent_time.h> + #endif ++#if __has_include(<sys/queue.h>) + #include <sys/queue.h> ++#else ++#include "compat_sys_queue.h" ++#endif + #include <poll.h> + #include <signal.h> + #include <stdio.h> +diff --git a/src/3rdparty/chromium/base/third_party/libevent/select.c b/src/3rdparty/chromium/base/third_party/libevent/select.c +index 3f7333131..6f8b9edfb 100644 +--- a/src/3rdparty/chromium/base/third_party/libevent/select.c ++++ b/src/3rdparty/chromium/base/third_party/libevent/select.c +@@ -39,7 +39,11 @@ + #ifdef HAVE_SYS_SELECT_H + #include <sys/select.h> + #endif ++#if __has_include(<sys/queue.h>) + #include <sys/queue.h> ++#else ++#include "compat_sys_queue.h" ++#endif + #include <signal.h> + #include <stdio.h> + #include <stdlib.h> +diff --git a/src/3rdparty/chromium/base/third_party/libevent/signal.c b/src/3rdparty/chromium/base/third_party/libevent/signal.c +index b8d51ab51..230b053eb 100644 +--- a/src/3rdparty/chromium/base/third_party/libevent/signal.c ++++ b/src/3rdparty/chromium/base/third_party/libevent/signal.c +@@ -40,7 +40,11 @@ + #ifdef HAVE_SYS_TIME_H + #include <sys/time.h> + #endif ++#if __has_include(<sys/queue.h>) + #include <sys/queue.h> ++#else ++#include "compat_sys_queue.h" ++#endif + #ifdef HAVE_SYS_SOCKET_H + #include <sys/socket.h> + #endif +-- +2.35.1 + diff --git a/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-fix-sys-queue.h.patch b/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-fix-sys-queue.h.patch new file mode 100644 index 00000000..57ca2cdf --- /dev/null +++ b/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-fix-sys-queue.h.patch @@ -0,0 +1,1020 @@ +From 005bce88c9b1c70b108c66a85335ca434a3c8f27 Mon Sep 17 00:00:00 2001 +From: Your Name <you@example.com> +Date: Mon, 18 Jul 2022 21:39:44 +0200 +Subject: [PATCH] fix libevent sys/queue.h + +--- + .../third_party/libevent/compat_sys_queue.h | 846 ++++++++++++++++++ + .../base/third_party/libevent/epoll.c | 4 + + .../base/third_party/libevent/event.c | 7 + + .../base/third_party/libevent/event_tagging.c | 4 + + .../base/third_party/libevent/evrpc.c | 4 + + .../base/third_party/libevent/evutil.c | 4 + + .../chromium/base/third_party/libevent/http.c | 4 + + .../chromium/base/third_party/libevent/poll.c | 4 + + .../base/third_party/libevent/select.c | 4 + + .../base/third_party/libevent/signal.c | 4 + + 10 files changed, 885 insertions(+) + create mode 100644 src/3rdparty/chromium/base/third_party/libevent/compat_sys_queue.h + +diff --git a/src/3rdparty/chromium/base/third_party/libevent/compat_sys_queue.h b/src/3rdparty/chromium/base/third_party/libevent/compat_sys_queue.h +new file mode 100644 +index 000000000..99d01a55b +--- /dev/null ++++ b/src/3rdparty/chromium/base/third_party/libevent/compat_sys_queue.h +@@ -0,0 +1,846 @@ ++/* $NetBSD: queue.h,v 1.68 2014/11/19 08:10:01 uebayasi Exp $ */ ++ ++/* ++ * Copyright (c) 1991, 1993 ++ * The Regents of the University of California. All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * 2. Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * 3. Neither the name of the University nor the names of its contributors ++ * may be used to endorse or promote products derived from this software ++ * without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE ++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++ * SUCH DAMAGE. ++ * ++ * @(#)queue.h 8.5 (Berkeley) 8/20/94 ++ */ ++ ++#ifndef _SYS_QUEUE_H_ ++#define _SYS_QUEUE_H_ ++ ++/* ++ * This file defines five types of data structures: singly-linked lists, ++ * lists, simple queues, tail queues, and circular queues. ++ * ++ * A singly-linked list is headed by a single forward pointer. The ++ * elements are singly linked for minimum space and pointer manipulation ++ * overhead at the expense of O(n) removal for arbitrary elements. New ++ * elements can be added to the list after an existing element or at the ++ * head of the list. Elements being removed from the head of the list ++ * should use the explicit macro for this purpose for optimum ++ * efficiency. A singly-linked list may only be traversed in the forward ++ * direction. Singly-linked lists are ideal for applications with large ++ * datasets and few or no removals or for implementing a LIFO queue. ++ * ++ * A list is headed by a single forward pointer (or an array of forward ++ * pointers for a hash table header). The elements are doubly linked ++ * so that an arbitrary element can be removed without a need to ++ * traverse the list. New elements can be added to the list before ++ * or after an existing element or at the head of the list. A list ++ * may only be traversed in the forward direction. ++ * ++ * A simple queue is headed by a pair of pointers, one the head of the ++ * list and the other to the tail of the list. The elements are singly ++ * linked to save space, so elements can only be removed from the ++ * head of the list. New elements can be added to the list after ++ * an existing element, at the head of the list, or at the end of the ++ * list. A simple queue may only be traversed in the forward direction. ++ * ++ * A tail queue is headed by a pair of pointers, one to the head of the ++ * list and the other to the tail of the list. The elements are doubly ++ * linked so that an arbitrary element can be removed without a need to ++ * traverse the list. New elements can be added to the list before or ++ * after an existing element, at the head of the list, or at the end of ++ * the list. A tail queue may be traversed in either direction. ++ * ++ * A circle queue is headed by a pair of pointers, one to the head of the ++ * list and the other to the tail of the list. The elements are doubly ++ * linked so that an arbitrary element can be removed without a need to ++ * traverse the list. New elements can be added to the list before or after ++ * an existing element, at the head of the list, or at the end of the list. ++ * A circle queue may be traversed in either direction, but has a more ++ * complex end of list detection. ++ * ++ * For details on the use of these macros, see the queue(3) manual page. ++ */ ++ ++/* ++ * Include the definition of NULL only on NetBSD because sys/null.h ++ * is not available elsewhere. This conditional makes the header ++ * portable and it can simply be dropped verbatim into any system. ++ * The caveat is that on other systems some other header ++ * must provide NULL before the macros can be used. ++ */ ++#ifdef __NetBSD__ ++#include <sys/null.h> ++#endif ++ ++#if defined(QUEUEDEBUG) ++# if defined(_KERNEL) ++# define QUEUEDEBUG_ABORT(...) panic(__VA_ARGS__) ++# else ++# include <err.h> ++# define QUEUEDEBUG_ABORT(...) err(1, __VA_ARGS__) ++# endif ++#endif ++ ++/* ++ * Singly-linked List definitions. ++ */ ++#define SLIST_HEAD(name, type) \ ++struct name { \ ++ struct type *slh_first; /* first element */ \ ++} ++ ++#define SLIST_HEAD_INITIALIZER(head) \ ++ { NULL } ++ ++#define SLIST_ENTRY(type) \ ++struct { \ ++ struct type *sle_next; /* next element */ \ ++} ++ ++/* ++ * Singly-linked List access methods. ++ */ ++#define SLIST_FIRST(head) ((head)->slh_first) ++#define SLIST_END(head) NULL ++#define SLIST_EMPTY(head) ((head)->slh_first == NULL) ++#define SLIST_NEXT(elm, field) ((elm)->field.sle_next) ++ ++#define SLIST_FOREACH(var, head, field) \ ++ for((var) = (head)->slh_first; \ ++ (var) != SLIST_END(head); \ ++ (var) = (var)->field.sle_next) ++ ++#define SLIST_FOREACH_SAFE(var, head, field, tvar) \ ++ for ((var) = SLIST_FIRST((head)); \ ++ (var) != SLIST_END(head) && \ ++ ((tvar) = SLIST_NEXT((var), field), 1); \ ++ (var) = (tvar)) ++ ++/* ++ * Singly-linked List functions. ++ */ ++#define SLIST_INIT(head) do { \ ++ (head)->slh_first = SLIST_END(head); \ ++} while (/*CONSTCOND*/0) ++ ++#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \ ++ (elm)->field.sle_next = (slistelm)->field.sle_next; \ ++ (slistelm)->field.sle_next = (elm); \ ++} while (/*CONSTCOND*/0) ++ ++#define SLIST_INSERT_HEAD(head, elm, field) do { \ ++ (elm)->field.sle_next = (head)->slh_first; \ ++ (head)->slh_first = (elm); \ ++} while (/*CONSTCOND*/0) ++ ++#define SLIST_REMOVE_AFTER(slistelm, field) do { \ ++ (slistelm)->field.sle_next = \ ++ SLIST_NEXT(SLIST_NEXT((slistelm), field), field); \ ++} while (/*CONSTCOND*/0) ++ ++#define SLIST_REMOVE_HEAD(head, field) do { \ ++ (head)->slh_first = (head)->slh_first->field.sle_next; \ ++} while (/*CONSTCOND*/0) ++ ++#define SLIST_REMOVE(head, elm, type, field) do { \ ++ if ((head)->slh_first == (elm)) { \ ++ SLIST_REMOVE_HEAD((head), field); \ ++ } \ ++ else { \ ++ struct type *curelm = (head)->slh_first; \ ++ while(curelm->field.sle_next != (elm)) \ ++ curelm = curelm->field.sle_next; \ ++ curelm->field.sle_next = \ ++ curelm->field.sle_next->field.sle_next; \ ++ } \ ++} while (/*CONSTCOND*/0) ++ ++ ++/* ++ * List definitions. ++ */ ++#define LIST_HEAD(name, type) \ ++struct name { \ ++ struct type *lh_first; /* first element */ \ ++} ++ ++#define LIST_HEAD_INITIALIZER(head) \ ++ { NULL } ++ ++#define LIST_ENTRY(type) \ ++struct { \ ++ struct type *le_next; /* next element */ \ ++ struct type **le_prev; /* address of previous next element */ \ ++} ++ ++/* ++ * List access methods. ++ */ ++#define LIST_FIRST(head) ((head)->lh_first) ++#define LIST_END(head) NULL ++#define LIST_EMPTY(head) ((head)->lh_first == LIST_END(head)) ++#define LIST_NEXT(elm, field) ((elm)->field.le_next) ++ ++#define LIST_FOREACH(var, head, field) \ ++ for ((var) = ((head)->lh_first); \ ++ (var) != LIST_END(head); \ ++ (var) = ((var)->field.le_next)) ++ ++#define LIST_FOREACH_SAFE(var, head, field, tvar) \ ++ for ((var) = LIST_FIRST((head)); \ ++ (var) != LIST_END(head) && \ ++ ((tvar) = LIST_NEXT((var), field), 1); \ ++ (var) = (tvar)) ++ ++#define LIST_MOVE(head1, head2) do { \ ++ LIST_INIT((head2)); \ ++ if (!LIST_EMPTY((head1))) { \ ++ (head2)->lh_first = (head1)->lh_first; \ ++ LIST_INIT((head1)); \ ++ } \ ++} while (/*CONSTCOND*/0) ++ ++/* ++ * List functions. ++ */ ++#if defined(QUEUEDEBUG) ++#define QUEUEDEBUG_LIST_INSERT_HEAD(head, elm, field) \ ++ if ((head)->lh_first && \ ++ (head)->lh_first->field.le_prev != &(head)->lh_first) \ ++ QUEUEDEBUG_ABORT("LIST_INSERT_HEAD %p %s:%d", (head), \ ++ __FILE__, __LINE__); ++#define QUEUEDEBUG_LIST_OP(elm, field) \ ++ if ((elm)->field.le_next && \ ++ (elm)->field.le_next->field.le_prev != \ ++ &(elm)->field.le_next) \ ++ QUEUEDEBUG_ABORT("LIST_* forw %p %s:%d", (elm), \ ++ __FILE__, __LINE__); \ ++ if (*(elm)->field.le_prev != (elm)) \ ++ QUEUEDEBUG_ABORT("LIST_* back %p %s:%d", (elm), \ ++ __FILE__, __LINE__); ++#define QUEUEDEBUG_LIST_POSTREMOVE(elm, field) \ ++ (elm)->field.le_next = (void *)1L; \ ++ (elm)->field.le_prev = (void *)1L; ++#else ++#define QUEUEDEBUG_LIST_INSERT_HEAD(head, elm, field) ++#define QUEUEDEBUG_LIST_OP(elm, field) ++#define QUEUEDEBUG_LIST_POSTREMOVE(elm, field) ++#endif ++ ++#define LIST_INIT(head) do { \ ++ (head)->lh_first = LIST_END(head); \ ++} while (/*CONSTCOND*/0) ++ ++#define LIST_INSERT_AFTER(listelm, elm, field) do { \ ++ QUEUEDEBUG_LIST_OP((listelm), field) \ ++ if (((elm)->field.le_next = (listelm)->field.le_next) != \ ++ LIST_END(head)) \ ++ (listelm)->field.le_next->field.le_prev = \ ++ &(elm)->field.le_next; \ ++ (listelm)->field.le_next = (elm); \ ++ (elm)->field.le_prev = &(listelm)->field.le_next; \ ++} while (/*CONSTCOND*/0) ++ ++#define LIST_INSERT_BEFORE(listelm, elm, field) do { \ ++ QUEUEDEBUG_LIST_OP((listelm), field) \ ++ (elm)->field.le_prev = (listelm)->field.le_prev; \ ++ (elm)->field.le_next = (listelm); \ ++ *(listelm)->field.le_prev = (elm); \ ++ (listelm)->field.le_prev = &(elm)->field.le_next; \ ++} while (/*CONSTCOND*/0) ++ ++#define LIST_INSERT_HEAD(head, elm, field) do { \ ++ QUEUEDEBUG_LIST_INSERT_HEAD((head), (elm), field) \ ++ if (((elm)->field.le_next = (head)->lh_first) != LIST_END(head))\ ++ (head)->lh_first->field.le_prev = &(elm)->field.le_next;\ ++ (head)->lh_first = (elm); \ ++ (elm)->field.le_prev = &(head)->lh_first; \ ++} while (/*CONSTCOND*/0) ++ ++#define LIST_REMOVE(elm, field) do { \ ++ QUEUEDEBUG_LIST_OP((elm), field) \ ++ if ((elm)->field.le_next != NULL) \ ++ (elm)->field.le_next->field.le_prev = \ ++ (elm)->field.le_prev; \ ++ *(elm)->field.le_prev = (elm)->field.le_next; \ ++ QUEUEDEBUG_LIST_POSTREMOVE((elm), field) \ ++} while (/*CONSTCOND*/0) ++ ++#define LIST_REPLACE(elm, elm2, field) do { \ ++ if (((elm2)->field.le_next = (elm)->field.le_next) != NULL) \ ++ (elm2)->field.le_next->field.le_prev = \ ++ &(elm2)->field.le_next; \ ++ (elm2)->field.le_prev = (elm)->field.le_prev; \ ++ *(elm2)->field.le_prev = (elm2); \ ++ QUEUEDEBUG_LIST_POSTREMOVE((elm), field) \ ++} while (/*CONSTCOND*/0) ++ ++/* ++ * Simple queue definitions. ++ */ ++#define SIMPLEQ_HEAD(name, type) \ ++struct name { \ ++ struct type *sqh_first; /* first element */ \ ++ struct type **sqh_last; /* addr of last next element */ \ ++} ++ ++#define SIMPLEQ_HEAD_INITIALIZER(head) \ ++ { NULL, &(head).sqh_first } ++ ++#define SIMPLEQ_ENTRY(type) \ ++struct { \ ++ struct type *sqe_next; /* next element */ \ ++} ++ ++/* ++ * Simple queue access methods. ++ */ ++#define SIMPLEQ_FIRST(head) ((head)->sqh_first) ++#define SIMPLEQ_END(head) NULL ++#define SIMPLEQ_EMPTY(head) ((head)->sqh_first == SIMPLEQ_END(head)) ++#define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next) ++ ++#define SIMPLEQ_FOREACH(var, head, field) \ ++ for ((var) = ((head)->sqh_first); \ ++ (var) != SIMPLEQ_END(head); \ ++ (var) = ((var)->field.sqe_next)) ++ ++#define SIMPLEQ_FOREACH_SAFE(var, head, field, next) \ ++ for ((var) = ((head)->sqh_first); \ ++ (var) != SIMPLEQ_END(head) && \ ++ ((next = ((var)->field.sqe_next)), 1); \ ++ (var) = (next)) ++ ++/* ++ * Simple queue functions. ++ */ ++#define SIMPLEQ_INIT(head) do { \ ++ (head)->sqh_first = NULL; \ ++ (head)->sqh_last = &(head)->sqh_first; \ ++} while (/*CONSTCOND*/0) ++ ++#define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \ ++ if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \ ++ (head)->sqh_last = &(elm)->field.sqe_next; \ ++ (head)->sqh_first = (elm); \ ++} while (/*CONSTCOND*/0) ++ ++#define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \ ++ (elm)->field.sqe_next = NULL; \ ++ *(head)->sqh_last = (elm); \ ++ (head)->sqh_last = &(elm)->field.sqe_next; \ ++} while (/*CONSTCOND*/0) ++ ++#define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ ++ if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\ ++ (head)->sqh_last = &(elm)->field.sqe_next; \ ++ (listelm)->field.sqe_next = (elm); \ ++} while (/*CONSTCOND*/0) ++ ++#define SIMPLEQ_REMOVE_HEAD(head, field) do { \ ++ if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \ ++ (head)->sqh_last = &(head)->sqh_first; \ ++} while (/*CONSTCOND*/0) ++ ++#define SIMPLEQ_REMOVE_AFTER(head, elm, field) do { \ ++ if (((elm)->field.sqe_next = (elm)->field.sqe_next->field.sqe_next) \ ++ == NULL) \ ++ (head)->sqh_last = &(elm)->field.sqe_next; \ ++} while (/*CONSTCOND*/0) ++ ++#define SIMPLEQ_REMOVE(head, elm, type, field) do { \ ++ if ((head)->sqh_first == (elm)) { \ ++ SIMPLEQ_REMOVE_HEAD((head), field); \ ++ } else { \ ++ struct type *curelm = (head)->sqh_first; \ ++ while (curelm->field.sqe_next != (elm)) \ ++ curelm = curelm->field.sqe_next; \ ++ if ((curelm->field.sqe_next = \ ++ curelm->field.sqe_next->field.sqe_next) == NULL) \ ++ (head)->sqh_last = &(curelm)->field.sqe_next; \ ++ } \ ++} while (/*CONSTCOND*/0) ++ ++#define SIMPLEQ_CONCAT(head1, head2) do { \ ++ if (!SIMPLEQ_EMPTY((head2))) { \ ++ *(head1)->sqh_last = (head2)->sqh_first; \ ++ (head1)->sqh_last = (head2)->sqh_last; \ ++ SIMPLEQ_INIT((head2)); \ ++ } \ ++} while (/*CONSTCOND*/0) ++ ++#define SIMPLEQ_LAST(head, type, field) \ ++ (SIMPLEQ_EMPTY((head)) ? \ ++ NULL : \ ++ ((struct type *)(void *) \ ++ ((char *)((head)->sqh_last) - offsetof(struct type, field)))) ++ ++/* ++ * Tail queue definitions. ++ */ ++#define _TAILQ_HEAD(name, type, qual) \ ++struct name { \ ++ qual type *tqh_first; /* first element */ \ ++ qual type *qual *tqh_last; /* addr of last next element */ \ ++} ++#define TAILQ_HEAD(name, type) _TAILQ_HEAD(name, struct type,) ++ ++#define TAILQ_HEAD_INITIALIZER(head) \ ++ { TAILQ_END(head), &(head).tqh_first } ++ ++#define _TAILQ_ENTRY(type, qual) \ ++struct { \ ++ qual type *tqe_next; /* next element */ \ ++ qual type *qual *tqe_prev; /* address of previous next element */\ ++} ++#define TAILQ_ENTRY(type) _TAILQ_ENTRY(struct type,) ++ ++/* ++ * Tail queue access methods. ++ */ ++#define TAILQ_FIRST(head) ((head)->tqh_first) ++#define TAILQ_END(head) (NULL) ++#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) ++#define TAILQ_LAST(head, headname) \ ++ (*(((struct headname *)((head)->tqh_last))->tqh_last)) ++#define TAILQ_PREV(elm, headname, field) \ ++ (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) ++#define TAILQ_EMPTY(head) (TAILQ_FIRST(head) == TAILQ_END(head)) ++ ++ ++#define TAILQ_FOREACH(var, head, field) \ ++ for ((var) = ((head)->tqh_first); \ ++ (var) != TAILQ_END(head); \ ++ (var) = ((var)->field.tqe_next)) ++ ++#define TAILQ_FOREACH_SAFE(var, head, field, next) \ ++ for ((var) = ((head)->tqh_first); \ ++ (var) != TAILQ_END(head) && \ ++ ((next) = TAILQ_NEXT(var, field), 1); (var) = (next)) ++ ++#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ ++ for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last));\ ++ (var) != TAILQ_END(head); \ ++ (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last))) ++ ++#define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, prev) \ ++ for ((var) = TAILQ_LAST((head), headname); \ ++ (var) != TAILQ_END(head) && \ ++ ((prev) = TAILQ_PREV((var), headname, field), 1); (var) = (prev)) ++ ++/* ++ * Tail queue functions. ++ */ ++#if defined(QUEUEDEBUG) ++#define QUEUEDEBUG_TAILQ_INSERT_HEAD(head, elm, field) \ ++ if ((head)->tqh_first && \ ++ (head)->tqh_first->field.tqe_prev != &(head)->tqh_first) \ ++ QUEUEDEBUG_ABORT("TAILQ_INSERT_HEAD %p %s:%d", (head), \ ++ __FILE__, __LINE__); ++#define QUEUEDEBUG_TAILQ_INSERT_TAIL(head, elm, field) \ ++ if (*(head)->tqh_last != NULL) \ ++ QUEUEDEBUG_ABORT("TAILQ_INSERT_TAIL %p %s:%d", (head), \ ++ __FILE__, __LINE__); ++#define QUEUEDEBUG_TAILQ_OP(elm, field) \ ++ if ((elm)->field.tqe_next && \ ++ (elm)->field.tqe_next->field.tqe_prev != \ ++ &(elm)->field.tqe_next) \ ++ QUEUEDEBUG_ABORT("TAILQ_* forw %p %s:%d", (elm), \ ++ __FILE__, __LINE__); \ ++ if (*(elm)->field.tqe_prev != (elm)) \ ++ QUEUEDEBUG_ABORT("TAILQ_* back %p %s:%d", (elm), \ ++ __FILE__, __LINE__); ++#define QUEUEDEBUG_TAILQ_PREREMOVE(head, elm, field) \ ++ if ((elm)->field.tqe_next == NULL && \ ++ (head)->tqh_last != &(elm)->field.tqe_next) \ ++ QUEUEDEBUG_ABORT("TAILQ_PREREMOVE head %p elm %p %s:%d",\ ++ (head), (elm), __FILE__, __LINE__); ++#define QUEUEDEBUG_TAILQ_POSTREMOVE(elm, field) \ ++ (elm)->field.tqe_next = (void *)1L; \ ++ (elm)->field.tqe_prev = (void *)1L; ++#else ++#define QUEUEDEBUG_TAILQ_INSERT_HEAD(head, elm, field) ++#define QUEUEDEBUG_TAILQ_INSERT_TAIL(head, elm, field) ++#define QUEUEDEBUG_TAILQ_OP(elm, field) ++#define QUEUEDEBUG_TAILQ_PREREMOVE(head, elm, field) ++#define QUEUEDEBUG_TAILQ_POSTREMOVE(elm, field) ++#endif ++ ++#define TAILQ_INIT(head) do { \ ++ (head)->tqh_first = TAILQ_END(head); \ ++ (head)->tqh_last = &(head)->tqh_first; \ ++} while (/*CONSTCOND*/0) ++ ++#define TAILQ_INSERT_HEAD(head, elm, field) do { \ ++ QUEUEDEBUG_TAILQ_INSERT_HEAD((head), (elm), field) \ ++ if (((elm)->field.tqe_next = (head)->tqh_first) != TAILQ_END(head))\ ++ (head)->tqh_first->field.tqe_prev = \ ++ &(elm)->field.tqe_next; \ ++ else \ ++ (head)->tqh_last = &(elm)->field.tqe_next; \ ++ (head)->tqh_first = (elm); \ ++ (elm)->field.tqe_prev = &(head)->tqh_first; \ ++} while (/*CONSTCOND*/0) ++ ++#define TAILQ_INSERT_TAIL(head, elm, field) do { \ ++ QUEUEDEBUG_TAILQ_INSERT_TAIL((head), (elm), field) \ ++ (elm)->field.tqe_next = TAILQ_END(head); \ ++ (elm)->field.tqe_prev = (head)->tqh_last; \ ++ *(head)->tqh_last = (elm); \ ++ (head)->tqh_last = &(elm)->field.tqe_next; \ ++} while (/*CONSTCOND*/0) ++ ++#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ ++ QUEUEDEBUG_TAILQ_OP((listelm), field) \ ++ if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != \ ++ TAILQ_END(head)) \ ++ (elm)->field.tqe_next->field.tqe_prev = \ ++ &(elm)->field.tqe_next; \ ++ else \ ++ (head)->tqh_last = &(elm)->field.tqe_next; \ ++ (listelm)->field.tqe_next = (elm); \ ++ (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ ++} while (/*CONSTCOND*/0) ++ ++#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ ++ QUEUEDEBUG_TAILQ_OP((listelm), field) \ ++ (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ ++ (elm)->field.tqe_next = (listelm); \ ++ *(listelm)->field.tqe_prev = (elm); \ ++ (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ ++} while (/*CONSTCOND*/0) ++ ++#define TAILQ_REMOVE(head, elm, field) do { \ ++ QUEUEDEBUG_TAILQ_PREREMOVE((head), (elm), field) \ ++ QUEUEDEBUG_TAILQ_OP((elm), field) \ ++ if (((elm)->field.tqe_next) != TAILQ_END(head)) \ ++ (elm)->field.tqe_next->field.tqe_prev = \ ++ (elm)->field.tqe_prev; \ ++ else \ ++ (head)->tqh_last = (elm)->field.tqe_prev; \ ++ *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ ++ QUEUEDEBUG_TAILQ_POSTREMOVE((elm), field); \ ++} while (/*CONSTCOND*/0) ++ ++#define TAILQ_REPLACE(head, elm, elm2, field) do { \ ++ if (((elm2)->field.tqe_next = (elm)->field.tqe_next) != \ ++ TAILQ_END(head)) \ ++ (elm2)->field.tqe_next->field.tqe_prev = \ ++ &(elm2)->field.tqe_next; \ ++ else \ ++ (head)->tqh_last = &(elm2)->field.tqe_next; \ ++ (elm2)->field.tqe_prev = (elm)->field.tqe_prev; \ ++ *(elm2)->field.tqe_prev = (elm2); \ ++ QUEUEDEBUG_TAILQ_POSTREMOVE((elm), field); \ ++} while (/*CONSTCOND*/0) ++ ++#define TAILQ_CONCAT(head1, head2, field) do { \ ++ if (!TAILQ_EMPTY(head2)) { \ ++ *(head1)->tqh_last = (head2)->tqh_first; \ ++ (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \ ++ (head1)->tqh_last = (head2)->tqh_last; \ ++ TAILQ_INIT((head2)); \ ++ } \ ++} while (/*CONSTCOND*/0) ++ ++/* ++ * Singly-linked Tail queue declarations. ++ */ ++#define STAILQ_HEAD(name, type) \ ++struct name { \ ++ struct type *stqh_first; /* first element */ \ ++ struct type **stqh_last; /* addr of last next element */ \ ++} ++ ++#define STAILQ_HEAD_INITIALIZER(head) \ ++ { NULL, &(head).stqh_first } ++ ++#define STAILQ_ENTRY(type) \ ++struct { \ ++ struct type *stqe_next; /* next element */ \ ++} ++ ++/* ++ * Singly-linked Tail queue access methods. ++ */ ++#define STAILQ_FIRST(head) ((head)->stqh_first) ++#define STAILQ_END(head) NULL ++#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next) ++#define STAILQ_EMPTY(head) (STAILQ_FIRST(head) == STAILQ_END(head)) ++ ++/* ++ * Singly-linked Tail queue functions. ++ */ ++#define STAILQ_INIT(head) do { \ ++ (head)->stqh_first = NULL; \ ++ (head)->stqh_last = &(head)->stqh_first; \ ++} while (/*CONSTCOND*/0) ++ ++#define STAILQ_INSERT_HEAD(head, elm, field) do { \ ++ if (((elm)->field.stqe_next = (head)->stqh_first) == NULL) \ ++ (head)->stqh_last = &(elm)->field.stqe_next; \ ++ (head)->stqh_first = (elm); \ ++} while (/*CONSTCOND*/0) ++ ++#define STAILQ_INSERT_TAIL(head, elm, field) do { \ ++ (elm)->field.stqe_next = NULL; \ ++ *(head)->stqh_last = (elm); \ ++ (head)->stqh_last = &(elm)->field.stqe_next; \ ++} while (/*CONSTCOND*/0) ++ ++#define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ ++ if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\ ++ (head)->stqh_last = &(elm)->field.stqe_next; \ ++ (listelm)->field.stqe_next = (elm); \ ++} while (/*CONSTCOND*/0) ++ ++#define STAILQ_REMOVE_HEAD(head, field) do { \ ++ if (((head)->stqh_first = (head)->stqh_first->field.stqe_next) == NULL) \ ++ (head)->stqh_last = &(head)->stqh_first; \ ++} while (/*CONSTCOND*/0) ++ ++#define STAILQ_REMOVE(head, elm, type, field) do { \ ++ if ((head)->stqh_first == (elm)) { \ ++ STAILQ_REMOVE_HEAD((head), field); \ ++ } else { \ ++ struct type *curelm = (head)->stqh_first; \ ++ while (curelm->field.stqe_next != (elm)) \ ++ curelm = curelm->field.stqe_next; \ ++ if ((curelm->field.stqe_next = \ ++ curelm->field.stqe_next->field.stqe_next) == NULL) \ ++ (head)->stqh_last = &(curelm)->field.stqe_next; \ ++ } \ ++} while (/*CONSTCOND*/0) ++ ++#define STAILQ_FOREACH(var, head, field) \ ++ for ((var) = ((head)->stqh_first); \ ++ (var); \ ++ (var) = ((var)->field.stqe_next)) ++ ++#define STAILQ_FOREACH_SAFE(var, head, field, tvar) \ ++ for ((var) = STAILQ_FIRST((head)); \ ++ (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \ ++ (var) = (tvar)) ++ ++#define STAILQ_CONCAT(head1, head2) do { \ ++ if (!STAILQ_EMPTY((head2))) { \ ++ *(head1)->stqh_last = (head2)->stqh_first; \ ++ (head1)->stqh_last = (head2)->stqh_last; \ ++ STAILQ_INIT((head2)); \ ++ } \ ++} while (/*CONSTCOND*/0) ++ ++#define STAILQ_LAST(head, type, field) \ ++ (STAILQ_EMPTY((head)) ? \ ++ NULL : \ ++ ((struct type *)(void *) \ ++ ((char *)((head)->stqh_last) - offsetof(struct type, field)))) ++ ++ ++#ifndef _KERNEL ++/* ++ * Circular queue definitions. Do not use. We still keep the macros ++ * for compatibility but because of pointer aliasing issues their use ++ * is discouraged! ++ */ ++ ++/* ++ * __launder_type(): We use this ugly hack to work around the the compiler ++ * noticing that two types may not alias each other and elide tests in code. ++ * We hit this in the CIRCLEQ macros when comparing 'struct name *' and ++ * 'struct type *' (see CIRCLEQ_HEAD()). Modern compilers (such as GCC ++ * 4.8) declare these comparisons as always false, causing the code to ++ * not run as designed. ++ * ++ * This hack is only to be used for comparisons and thus can be fully const. ++ * Do not use for assignment. ++ * ++ * If we ever choose to change the ABI of the CIRCLEQ macros, we could fix ++ * this by changing the head/tail sentinal values, but see the note above ++ * this one. ++ */ ++static __inline const void * __launder_type(const void *); ++static __inline const void * ++__launder_type(const void *__x) ++{ ++ __asm __volatile("" : "+r" (__x)); ++ return __x; ++} ++ ++#if defined(QUEUEDEBUG) ++#define QUEUEDEBUG_CIRCLEQ_HEAD(head, field) \ ++ if ((head)->cqh_first != CIRCLEQ_ENDC(head) && \ ++ (head)->cqh_first->field.cqe_prev != CIRCLEQ_ENDC(head)) \ ++ QUEUEDEBUG_ABORT("CIRCLEQ head forw %p %s:%d", (head), \ ++ __FILE__, __LINE__); \ ++ if ((head)->cqh_last != CIRCLEQ_ENDC(head) && \ ++ (head)->cqh_last->field.cqe_next != CIRCLEQ_ENDC(head)) \ ++ QUEUEDEBUG_ABORT("CIRCLEQ head back %p %s:%d", (head), \ ++ __FILE__, __LINE__); ++#define QUEUEDEBUG_CIRCLEQ_ELM(head, elm, field) \ ++ if ((elm)->field.cqe_next == CIRCLEQ_ENDC(head)) { \ ++ if ((head)->cqh_last != (elm)) \ ++ QUEUEDEBUG_ABORT("CIRCLEQ elm last %p %s:%d", \ ++ (elm), __FILE__, __LINE__); \ ++ } else { \ ++ if ((elm)->field.cqe_next->field.cqe_prev != (elm)) \ ++ QUEUEDEBUG_ABORT("CIRCLEQ elm forw %p %s:%d", \ ++ (elm), __FILE__, __LINE__); \ ++ } \ ++ if ((elm)->field.cqe_prev == CIRCLEQ_ENDC(head)) { \ ++ if ((head)->cqh_first != (elm)) \ ++ QUEUEDEBUG_ABORT("CIRCLEQ elm first %p %s:%d", \ ++ (elm), __FILE__, __LINE__); \ ++ } else { \ ++ if ((elm)->field.cqe_prev->field.cqe_next != (elm)) \ ++ QUEUEDEBUG_ABORT("CIRCLEQ elm prev %p %s:%d", \ ++ (elm), __FILE__, __LINE__); \ ++ } ++#define QUEUEDEBUG_CIRCLEQ_POSTREMOVE(elm, field) \ ++ (elm)->field.cqe_next = (void *)1L; \ ++ (elm)->field.cqe_prev = (void *)1L; ++#else ++#define QUEUEDEBUG_CIRCLEQ_HEAD(head, field) ++#define QUEUEDEBUG_CIRCLEQ_ELM(head, elm, field) ++#define QUEUEDEBUG_CIRCLEQ_POSTREMOVE(elm, field) ++#endif ++ ++#define CIRCLEQ_HEAD(name, type) \ ++struct name { \ ++ struct type *cqh_first; /* first element */ \ ++ struct type *cqh_last; /* last element */ \ ++} ++ ++#define CIRCLEQ_HEAD_INITIALIZER(head) \ ++ { CIRCLEQ_END(&head), CIRCLEQ_END(&head) } ++ ++#define CIRCLEQ_ENTRY(type) \ ++struct { \ ++ struct type *cqe_next; /* next element */ \ ++ struct type *cqe_prev; /* previous element */ \ ++} ++ ++/* ++ * Circular queue functions. ++ */ ++#define CIRCLEQ_INIT(head) do { \ ++ (head)->cqh_first = CIRCLEQ_END(head); \ ++ (head)->cqh_last = CIRCLEQ_END(head); \ ++} while (/*CONSTCOND*/0) ++ ++#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ ++ QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \ ++ QUEUEDEBUG_CIRCLEQ_ELM((head), (listelm), field) \ ++ (elm)->field.cqe_next = (listelm)->field.cqe_next; \ ++ (elm)->field.cqe_prev = (listelm); \ ++ if ((listelm)->field.cqe_next == CIRCLEQ_ENDC(head)) \ ++ (head)->cqh_last = (elm); \ ++ else \ ++ (listelm)->field.cqe_next->field.cqe_prev = (elm); \ ++ (listelm)->field.cqe_next = (elm); \ ++} while (/*CONSTCOND*/0) ++ ++#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \ ++ QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \ ++ QUEUEDEBUG_CIRCLEQ_ELM((head), (listelm), field) \ ++ (elm)->field.cqe_next = (listelm); \ ++ (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \ ++ if ((listelm)->field.cqe_prev == CIRCLEQ_ENDC(head)) \ ++ (head)->cqh_first = (elm); \ ++ else \ ++ (listelm)->field.cqe_prev->field.cqe_next = (elm); \ ++ (listelm)->field.cqe_prev = (elm); \ ++} while (/*CONSTCOND*/0) ++ ++#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \ ++ QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \ ++ (elm)->field.cqe_next = (head)->cqh_first; \ ++ (elm)->field.cqe_prev = CIRCLEQ_END(head); \ ++ if ((head)->cqh_last == CIRCLEQ_ENDC(head)) \ ++ (head)->cqh_last = (elm); \ ++ else \ ++ (head)->cqh_first->field.cqe_prev = (elm); \ ++ (head)->cqh_first = (elm); \ ++} while (/*CONSTCOND*/0) ++ ++#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \ ++ QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \ ++ (elm)->field.cqe_next = CIRCLEQ_END(head); \ ++ (elm)->field.cqe_prev = (head)->cqh_last; \ ++ if ((head)->cqh_first == CIRCLEQ_ENDC(head)) \ ++ (head)->cqh_first = (elm); \ ++ else \ ++ (head)->cqh_last->field.cqe_next = (elm); \ ++ (head)->cqh_last = (elm); \ ++} while (/*CONSTCOND*/0) ++ ++#define CIRCLEQ_REMOVE(head, elm, field) do { \ ++ QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \ ++ QUEUEDEBUG_CIRCLEQ_ELM((head), (elm), field) \ ++ if ((elm)->field.cqe_next == CIRCLEQ_ENDC(head)) \ ++ (head)->cqh_last = (elm)->field.cqe_prev; \ ++ else \ ++ (elm)->field.cqe_next->field.cqe_prev = \ ++ (elm)->field.cqe_prev; \ ++ if ((elm)->field.cqe_prev == CIRCLEQ_ENDC(head)) \ ++ (head)->cqh_first = (elm)->field.cqe_next; \ ++ else \ ++ (elm)->field.cqe_prev->field.cqe_next = \ ++ (elm)->field.cqe_next; \ ++ QUEUEDEBUG_CIRCLEQ_POSTREMOVE((elm), field) \ ++} while (/*CONSTCOND*/0) ++ ++#define CIRCLEQ_FOREACH(var, head, field) \ ++ for ((var) = ((head)->cqh_first); \ ++ (var) != CIRCLEQ_ENDC(head); \ ++ (var) = ((var)->field.cqe_next)) ++ ++#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \ ++ for ((var) = ((head)->cqh_last); \ ++ (var) != CIRCLEQ_ENDC(head); \ ++ (var) = ((var)->field.cqe_prev)) ++ ++/* ++ * Circular queue access methods. ++ */ ++#define CIRCLEQ_FIRST(head) ((head)->cqh_first) ++#define CIRCLEQ_LAST(head) ((head)->cqh_last) ++/* For comparisons */ ++#define CIRCLEQ_ENDC(head) (__launder_type(head)) ++/* For assignments */ ++#define CIRCLEQ_END(head) ((void *)(head)) ++#define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next) ++#define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev) ++#define CIRCLEQ_EMPTY(head) \ ++ (CIRCLEQ_FIRST(head) == CIRCLEQ_ENDC(head)) ++ ++#define CIRCLEQ_LOOP_NEXT(head, elm, field) \ ++ (((elm)->field.cqe_next == CIRCLEQ_ENDC(head)) \ ++ ? ((head)->cqh_first) \ ++ : (elm->field.cqe_next)) ++#define CIRCLEQ_LOOP_PREV(head, elm, field) \ ++ (((elm)->field.cqe_prev == CIRCLEQ_ENDC(head)) \ ++ ? ((head)->cqh_last) \ ++ : (elm->field.cqe_prev)) ++#endif /* !_KERNEL */ ++ ++#endif /* !_SYS_QUEUE_H_ */ +diff --git a/src/3rdparty/chromium/base/third_party/libevent/epoll.c b/src/3rdparty/chromium/base/third_party/libevent/epoll.c +index 4387ef896..91be4c644 100644 +--- a/src/3rdparty/chromium/base/third_party/libevent/epoll.c ++++ b/src/3rdparty/chromium/base/third_party/libevent/epoll.c +@@ -36,7 +36,11 @@ + #else + #include <sys/_libevent_time.h> + #endif ++#if __has_include(<sys/queue.h>) + #include <sys/queue.h> ++#else ++#include "compat_sys_queue.h" ++#endif + #include <sys/epoll.h> + #include <signal.h> + #include <stdio.h> +diff --git a/src/3rdparty/chromium/base/third_party/libevent/event.c b/src/3rdparty/chromium/base/third_party/libevent/event.c +index 4aa326e0e..2f228aa92 100644 +--- a/src/3rdparty/chromium/base/third_party/libevent/event.c ++++ b/src/3rdparty/chromium/base/third_party/libevent/event.c +@@ -39,6 +39,13 @@ + #else + #include <sys/_libevent_time.h> + #endif ++ ++#if __has_include(<sys/queue.h>) ++#include <sys/queue.h> ++#else ++#include "compat_sys_queue.h" ++#endif ++ + #include <sys/queue.h> + #include <stdio.h> + #include <stdlib.h> +diff --git a/src/3rdparty/chromium/base/third_party/libevent/event_tagging.c b/src/3rdparty/chromium/base/third_party/libevent/event_tagging.c +index d436e3fd6..777fb037f 100644 +--- a/src/3rdparty/chromium/base/third_party/libevent/event_tagging.c ++++ b/src/3rdparty/chromium/base/third_party/libevent/event_tagging.c +@@ -45,7 +45,11 @@ + #include <sys/ioctl.h> + #endif + ++#if __has_include(<sys/queue.h>) + #include <sys/queue.h> ++#else ++#include "compat_sys_queue.h" ++#endif + #ifdef HAVE_SYS_TIME_H + #include <sys/time.h> + #endif +diff --git a/src/3rdparty/chromium/base/third_party/libevent/evrpc.c b/src/3rdparty/chromium/base/third_party/libevent/evrpc.c +index 070fd9e71..f63a43ca4 100644 +--- a/src/3rdparty/chromium/base/third_party/libevent/evrpc.c ++++ b/src/3rdparty/chromium/base/third_party/libevent/evrpc.c +@@ -42,7 +42,11 @@ + #ifdef HAVE_SYS_TIME_H + #include <sys/time.h> + #endif ++#if __has_include(<sys/queue.h>) + #include <sys/queue.h> ++#else ++#include "compat_sys_queue.h" ++#endif + #include <stdio.h> + #include <stdlib.h> + #ifndef WIN32 +diff --git a/src/3rdparty/chromium/base/third_party/libevent/evutil.c b/src/3rdparty/chromium/base/third_party/libevent/evutil.c +index cc6d0f46a..13de43bb6 100644 +--- a/src/3rdparty/chromium/base/third_party/libevent/evutil.c ++++ b/src/3rdparty/chromium/base/third_party/libevent/evutil.c +@@ -55,7 +55,11 @@ + #include <stdio.h> + #include <signal.h> + ++#if __has_include(<sys/queue.h>) + #include <sys/queue.h> ++#else ++#include "compat_sys_queue.h" ++#endif + #include "event.h" + #include "event-internal.h" + #include "evutil.h" +diff --git a/src/3rdparty/chromium/base/third_party/libevent/http.c b/src/3rdparty/chromium/base/third_party/libevent/http.c +index 4abce2393..ac4d74798 100644 +--- a/src/3rdparty/chromium/base/third_party/libevent/http.c ++++ b/src/3rdparty/chromium/base/third_party/libevent/http.c +@@ -50,7 +50,11 @@ + #include <sys/wait.h> + #endif + ++#if __has_include(<sys/queue.h>) + #include <sys/queue.h> ++#else ++#include "compat_sys_queue.h" ++#endif + + #ifndef WIN32 + #include <netinet/in.h> +diff --git a/src/3rdparty/chromium/base/third_party/libevent/poll.c b/src/3rdparty/chromium/base/third_party/libevent/poll.c +index 2aa245b37..9aa3e4833 100644 +--- a/src/3rdparty/chromium/base/third_party/libevent/poll.c ++++ b/src/3rdparty/chromium/base/third_party/libevent/poll.c +@@ -36,7 +36,11 @@ + #else + #include <sys/_libevent_time.h> + #endif ++#if __has_include(<sys/queue.h>) + #include <sys/queue.h> ++#else ++#include "compat_sys_queue.h" ++#endif + #include <poll.h> + #include <signal.h> + #include <stdio.h> +diff --git a/src/3rdparty/chromium/base/third_party/libevent/select.c b/src/3rdparty/chromium/base/third_party/libevent/select.c +index 3f7333131..6f8b9edfb 100644 +--- a/src/3rdparty/chromium/base/third_party/libevent/select.c ++++ b/src/3rdparty/chromium/base/third_party/libevent/select.c +@@ -39,7 +39,11 @@ + #ifdef HAVE_SYS_SELECT_H + #include <sys/select.h> + #endif ++#if __has_include(<sys/queue.h>) + #include <sys/queue.h> ++#else ++#include "compat_sys_queue.h" ++#endif + #include <signal.h> + #include <stdio.h> + #include <stdlib.h> +diff --git a/src/3rdparty/chromium/base/third_party/libevent/signal.c b/src/3rdparty/chromium/base/third_party/libevent/signal.c +index b8d51ab51..230b053eb 100644 +--- a/src/3rdparty/chromium/base/third_party/libevent/signal.c ++++ b/src/3rdparty/chromium/base/third_party/libevent/signal.c +@@ -40,7 +40,11 @@ + #ifdef HAVE_SYS_TIME_H + #include <sys/time.h> + #endif ++#if __has_include(<sys/queue.h>) + #include <sys/queue.h> ++#else ++#include "compat_sys_queue.h" ++#endif + #ifdef HAVE_SYS_SOCKET_H + #include <sys/socket.h> + #endif +-- +2.35.1 + diff --git a/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-fixup-CVE-2022-0796.patch b/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-fixup-CVE-2022-0796.patch new file mode 100644 index 00000000..c38bf1bd --- /dev/null +++ b/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-fixup-CVE-2022-0796.patch @@ -0,0 +1,48 @@ +From 7e11d69b957595a172a3eb60db17141daed29d63 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michael=20Br=C3=BCning?= <michael.bruning@qt.io> +Date: Mon, 20 Jun 2022 17:19:58 +0200 +Subject: Fixup: CVE-2022-0796: Use after free in Media + +Commit ecc2bb74f1f accidentally introduced a build break due to an +apparent typo. + +This fixes it. + +Change-Id: I746c6f10ecd2b212b847a291677e24e527d6b922 +Reviewed-by: Michal Klocek <michal.klocek@qt.io> +--- + chromium/content/renderer/media/batching_media_log.h | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/src/3rdparty/chromium/content/renderer/media/batching_media_log.h b/src/3rdparty/chromium/content/renderer/media/batching_media_log.h +index b68535aea42..a28d426878f 100644 +--- a/src/3rdparty/chromium/content/renderer/media/batching_media_log.h ++++ b/src/3rdparty/chromium/content/renderer/media/batching_media_log.h +@@ -72,18 +72,18 @@ class CONTENT_EXPORT BatchingMediaLog : public media::MediaLog { + // guarantees provided by MediaLog, since SendQueuedMediaEvents must also + // be synchronized with respect to AddEvent. + mutable base::Lock lock_; +- const base::TickClock* tick_clock_ GUARDED_BY(LOCK); +- base::TimeTicks last_ipc_send_time_ GUARDED_BY(LOCK); +- std::vector<media::MediaLogRecord> queued_media_events_ GUARDED_BY(LOCK); ++ const base::TickClock* tick_clock_ GUARDED_BY(lock_); ++ base::TimeTicks last_ipc_send_time_ GUARDED_BY(lock_); ++ std::vector<media::MediaLogRecord> queued_media_events_ GUARDED_BY(lock_); + + // impl for sending queued events. +- std::vector<std::unique_ptr<EventHandler>> event_handlers_ GUARDED_BY(LOCK); ++ std::vector<std::unique_ptr<EventHandler>> event_handlers_ GUARDED_BY(lock_); + + // For enforcing max 1 pending send. +- bool ipc_send_pending_ GUARDED_BY(LOCK); ++ bool ipc_send_pending_ GUARDED_BY(lock_); + + // Limits the number of events we send over IPC to one. +- std::unique_ptr<media::MediaLogRecord> last_duration_changed_event_ GUARDED_BY(LOCK); ++ std::unique_ptr<media::MediaLogRecord> last_duration_changed_event_ GUARDED_BY(lock_); + + // Holds the earliest MEDIA_ERROR_LOG_ENTRY event added to this log. This is + // most likely to contain the most specific information available describing +-- +cgit v1.2.1 + diff --git a/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-linux-stack_util-stackstart.patch b/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-linux-stack_util-stackstart.patch new file mode 100644 index 00000000..8c7424ad --- /dev/null +++ b/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-linux-stack_util-stackstart.patch @@ -0,0 +1,31 @@ +https://git.alpinelinux.org/aports/tree/community/qt5-qtwebengine/qt-musl-stackstart.patch?id=65f58742e6e669c7d0f5b23c0764f4f73661980b + +--- + .../third_party/blink/renderer/platform/wtf/stack_util.cc | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/stack_util.cc b/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/stack_util.cc +index 71b901f40..f33aba04b 100644 +--- a/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/stack_util.cc ++++ b/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/stack_util.cc +@@ -29,7 +29,7 @@ size_t GetUnderestimatedStackSize() { + // FIXME: On Mac OSX and Linux, this method cannot estimate stack size + // correctly for the main thread. + +-#elif defined(__GLIBC__) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \ ++#elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \ + defined(OS_FUCHSIA) + // pthread_getattr_np() can fail if the thread is not invoked by + // pthread_create() (e.g., the main thread of blink_unittests). +@@ -97,7 +97,7 @@ return Threading::ThreadStackSize(); + } + + void* GetStackStart() { +-#if defined(__GLIBC__) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \ ++#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \ + defined(OS_FUCHSIA) + pthread_attr_t attr; + int error; +-- +2.35.1 + diff --git a/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-musl-canonicalize-filename.patch b/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-musl-canonicalize-filename.patch new file mode 100644 index 00000000..1d58af61 --- /dev/null +++ b/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-musl-canonicalize-filename.patch @@ -0,0 +1,13 @@ +diff --git a/src/3rdparty/chromium/third_party/nasm/config/config-linux.h b/src/3rdparty/chromium/third_party/nasm/config/config-linux.h +index 7eb7c20ff..3bdc2eb39 100644 +--- a/src/3rdparty/chromium/third_party/nasm/config/config-linux.h ++++ b/src/3rdparty/chromium/third_party/nasm/config/config-linux.h +@@ -139,7 +139,7 @@ + #define HAVE_ACCESS 1 + + /* Define to 1 if you have the `canonicalize_file_name' function. */ +-#define HAVE_CANONICALIZE_FILE_NAME 1 ++// #define HAVE_CANONICALIZE_FILE_NAME 1 + + /* Define to 1 if you have the `cpu_to_le16' intrinsic function. */ + /* #undef HAVE_CPU_TO_LE16 */ diff --git a/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-musl-hacks.patch b/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-musl-hacks.patch new file mode 100644 index 00000000..74908d6c --- /dev/null +++ b/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-musl-hacks.patch @@ -0,0 +1,24 @@ +https://git.alpinelinux.org/aports/tree/community/qt5-qtwebengine/musl-hacks.patch + + + +--- + src/3rdparty/chromium/net/socket/udp_socket_posix.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/3rdparty/chromium/net/socket/udp_socket_posix.cc b/src/3rdparty/chromium/net/socket/udp_socket_posix.cc +index 71265568b..b9043f4d1 100644 +--- a/src/3rdparty/chromium/net/socket/udp_socket_posix.cc ++++ b/src/3rdparty/chromium/net/socket/udp_socket_posix.cc +@@ -1152,7 +1152,7 @@ SendResult UDPSocketPosixSender::InternalSendmmsgBuffers( + msg_iov->push_back({const_cast<char*>(buffer->data()), buffer->length()}); + msgvec->reserve(buffers.size()); + for (size_t j = 0; j < buffers.size(); j++) +- msgvec->push_back({{nullptr, 0, &msg_iov[j], 1, nullptr, 0, 0}, 0}); ++ msgvec->push_back({{nullptr, 0, &msg_iov[j], 1, 0, 0, 0}, 0}); + int result = HANDLE_EINTR(Sendmmsg(fd, &msgvec[0], buffers.size(), 0)); + SendResult send_result(0, 0, std::move(buffers)); + if (result < 0) { +-- +2.35.1 + diff --git a/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-musl-mallinfo.patch b/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-musl-mallinfo.patch new file mode 100644 index 00000000..5895f314 --- /dev/null +++ b/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-musl-mallinfo.patch @@ -0,0 +1,56 @@ +From 95c68a3b5f3bfe018bc38b7e138d47d21cd7e288 Mon Sep 17 00:00:00 2001 +From: Your Name <you@example.com> +Date: Mon, 18 Jul 2022 22:56:44 +0200 +Subject: [PATCH 1/4] mallinfo + +--- + src/3rdparty/chromium/base/process/process_metrics_posix.cc | 4 ++-- + .../chromium/base/trace_event/malloc_dump_provider.cc | 4 +++- + 2 files changed, 5 insertions(+), 3 deletions(-) + +diff --git a/src/3rdparty/chromium/base/process/process_metrics_posix.cc b/src/3rdparty/chromium/base/process/process_metrics_posix.cc +index 9d12c427b..9030de9f6 100644 +--- a/src/3rdparty/chromium/base/process/process_metrics_posix.cc ++++ b/src/3rdparty/chromium/base/process/process_metrics_posix.cc +@@ -119,14 +119,14 @@ size_t ProcessMetrics::GetMallocUsage() { + malloc_statistics_t stats = {0}; + malloc_zone_statistics(nullptr, &stats); + return stats.size_in_use; +-#elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) ++#elif (defined(OS_LINUX) && defined(__GLIBC__)) || defined(OS_CHROMEOS) || defined(OS_ANDROID) + struct mallinfo minfo = mallinfo(); + #if BUILDFLAG(USE_TCMALLOC) + return minfo.uordblks; + #else + return minfo.hblkhd + minfo.arena; + #endif +-#elif defined(OS_FUCHSIA) ++#else //if defined(OS_FUCHSIA) // also musl doesn't do this. + // TODO(fuchsia): Not currently exposed. https://crbug.com/735087. + return 0; + #endif +diff --git a/src/3rdparty/chromium/base/trace_event/malloc_dump_provider.cc b/src/3rdparty/chromium/base/trace_event/malloc_dump_provider.cc +index c327f4865..2717eca5a 100644 +--- a/src/3rdparty/chromium/base/trace_event/malloc_dump_provider.cc ++++ b/src/3rdparty/chromium/base/trace_event/malloc_dump_provider.cc +@@ -132,7 +132,7 @@ bool MallocDumpProvider::OnMemoryDump(const MemoryDumpArgs& args, + } + #elif defined(OS_FUCHSIA) + // TODO(fuchsia): Port, see https://crbug.com/706592. +-#else ++#elif defined(__GLIBC__) + struct mallinfo info = mallinfo(); + // In case of Android's jemalloc |arena| is 0 and the outer pages size is + // reported by |hblkhd|. In case of dlmalloc the total is given by +@@ -142,6 +142,8 @@ bool MallocDumpProvider::OnMemoryDump(const MemoryDumpArgs& args, + + // Total allocated space is given by |uordblks|. + allocated_objects_size = info.uordblks; ++#else ++ // musl libc does not support mallinfo() + #endif + + MemoryAllocatorDump* outer_dump = pmd->CreateAllocatorDump("malloc"); +-- +2.35.1 + diff --git a/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-musl-mojo-strncpy.patch b/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-musl-mojo-strncpy.patch new file mode 100644 index 00000000..b228f21c --- /dev/null +++ b/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-musl-mojo-strncpy.patch @@ -0,0 +1,21 @@ +strncpy is not defined without including string.h + +--- + .../mojo/public/cpp/platform/named_platform_channel_posix.cc | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/3rdparty/chromium/mojo/public/cpp/platform/named_platform_channel_posix.cc b/src/3rdparty/chromium/mojo/public/cpp/platform/named_platform_channel_posix.cc +index 9082ac4da..d039ff83a 100644 +--- a/src/3rdparty/chromium/mojo/public/cpp/platform/named_platform_channel_posix.cc ++++ b/src/3rdparty/chromium/mojo/public/cpp/platform/named_platform_channel_posix.cc +@@ -8,6 +8,7 @@ + #include <sys/socket.h> + #include <sys/un.h> + #include <unistd.h> ++#include <string.h> + + #include "base/files/file_util.h" + #include "base/files/scoped_file.h" +-- +2.35.1 + diff --git a/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-musl-resolv-compat.patch b/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-musl-resolv-compat.patch new file mode 100644 index 00000000..fbf1d36e --- /dev/null +++ b/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-musl-resolv-compat.patch @@ -0,0 +1,80 @@ +https://git.alpinelinux.org/aports/tree/community/qt5-qtwebengine/qt-musl-resolve.patch + +A better method would be to check for these functions in the build system +but as QMake is getting replaced by CMake in Qt6 I did not bother. + +--- + .../net/dns/dns_config_service_posix.cc | 4 +++ + src/3rdparty/chromium/net/dns/dns_reloader.cc | 4 +++ + src/3rdparty/chromium/net/dns/resolv_compat.h | 29 +++++++++++++++++++ + 3 files changed, 37 insertions(+) + create mode 100644 src/3rdparty/chromium/net/dns/resolv_compat.h + +diff --git a/src/3rdparty/chromium/net/dns/dns_config_service_posix.cc b/src/3rdparty/chromium/net/dns/dns_config_service_posix.cc +index 5a4aead0a..0e4480d16 100644 +--- a/src/3rdparty/chromium/net/dns/dns_config_service_posix.cc ++++ b/src/3rdparty/chromium/net/dns/dns_config_service_posix.cc +@@ -8,6 +8,10 @@ + #include <string> + #include <type_traits> + ++#if !defined(__GLIBC__) ++#include "resolv_compat.h" ++#endif ++ + #include "base/bind.h" + #include "base/files/file.h" + #include "base/files/file_path.h" +diff --git a/src/3rdparty/chromium/net/dns/dns_reloader.cc b/src/3rdparty/chromium/net/dns/dns_reloader.cc +index 0672e711a..298489866 100644 +--- a/src/3rdparty/chromium/net/dns/dns_reloader.cc ++++ b/src/3rdparty/chromium/net/dns/dns_reloader.cc +@@ -9,6 +9,10 @@ + + #include <resolv.h> + ++#if !defined(__GLIBC__) ++#include "resolv_compat.h" ++#endif ++ + #include "base/lazy_instance.h" + #include "base/macros.h" + #include "base/notreached.h" +diff --git a/src/3rdparty/chromium/net/dns/resolv_compat.h b/src/3rdparty/chromium/net/dns/resolv_compat.h +new file mode 100644 +index 000000000..4f0e852a1 +--- /dev/null ++++ b/src/3rdparty/chromium/net/dns/resolv_compat.h +@@ -0,0 +1,29 @@ ++#if !defined(__GLIBC__) ++/*************************************************************************** ++ * resolv_compat.h ++ * ++ * Mimick GLIBC's res_ninit() and res_nclose() for musl libc ++ * Note: res_init() is actually deprecated according to ++ * http://docs.oracle.com/cd/E36784_01/html/E36875/res-nclose-3resolv.html ++ **************************************************************************/ ++#include <string.h> ++ ++static inline int res_ninit(res_state statp) ++{ ++ int rc = res_init(); ++ if (statp != &_res) { ++ memcpy(statp, &_res, sizeof(*statp)); ++ } ++ return rc; ++} ++ ++static inline int res_nclose(res_state statp) ++{ ++ if (!statp) ++ return -1; ++ if (statp != &_res) { ++ memset(statp, 0, sizeof(*statp)); ++ } ++ return 0; ++} ++#endif +-- +2.35.1 + diff --git a/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-musl-sandbox.patch b/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-musl-sandbox.patch new file mode 100644 index 00000000..07e5b847 --- /dev/null +++ b/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-musl-sandbox.patch @@ -0,0 +1,109 @@ +From a381e9d12fb3bb489f12e119c3ae6e2318f429e9 Mon Sep 17 00:00:00 2001 +From: Your Name <you@example.com> +Date: Wed, 20 Jul 2022 18:47:15 +0200 +Subject: [PATCH 2/2] musl sandbox + +--- + .../syscall_parameters_restrictions.cc | 22 +++++-------------- + .../linux/seccomp-bpf-helpers/syscall_sets.cc | 5 +++-- + .../policy/linux/bpf_renderer_policy_linux.cc | 4 ++-- + 3 files changed, 11 insertions(+), 20 deletions(-) + +diff --git a/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc b/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc +index 6ae09fb10..57559ee6e 100644 +--- a/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc ++++ b/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc +@@ -127,21 +127,11 @@ namespace sandbox { + // present (as in newer versions of posix_spawn). + ResultExpr RestrictCloneToThreadsAndEPERMFork() { + const Arg<unsigned long> flags(0); +- +- // TODO(mdempsky): Extend DSL to support (flags & ~mask1) == mask2. +- const uint64_t kAndroidCloneMask = CLONE_VM | CLONE_FS | CLONE_FILES | +- CLONE_SIGHAND | CLONE_THREAD | +- CLONE_SYSVSEM; +- const uint64_t kObsoleteAndroidCloneMask = kAndroidCloneMask | CLONE_DETACHED; +- +- const uint64_t kGlibcPthreadFlags = +- CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | CLONE_THREAD | +- CLONE_SYSVSEM | CLONE_SETTLS | CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID; +- const BoolExpr glibc_test = flags == kGlibcPthreadFlags; +- +- const BoolExpr android_test = +- AnyOf(flags == kAndroidCloneMask, flags == kObsoleteAndroidCloneMask, +- flags == kGlibcPthreadFlags); ++ const int required = CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | ++ CLONE_THREAD | CLONE_SYSVSEM; ++ const int safe = CLONE_SETTLS | CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID | ++ CLONE_DETACHED; ++ const BoolExpr thread_clone_ok = (flags&~safe)==required; + + // The following two flags are the two important flags in any vfork-emulating + // clone call. EPERM any clone call that contains both of them. +@@ -151,7 +141,7 @@ ResultExpr RestrictCloneToThreadsAndEPERMFork() { + AnyOf((flags & (CLONE_VM | CLONE_THREAD)) == 0, + (flags & kImportantCloneVforkFlags) == kImportantCloneVforkFlags); + +- return If(IsAndroid() ? android_test : glibc_test, Allow()) ++ return If(thread_clone_ok, Allow()) + .ElseIf(is_fork_or_clone_vfork, Error(EPERM)) + .Else(CrashSIGSYSClone()); + } +diff --git a/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc b/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc +index d1ea8e99a..cb1ff3042 100644 +--- a/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc ++++ b/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc +@@ -399,6 +399,7 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) { + #if defined(__i386__) + case __NR_waitpid: + #endif ++ case __NR_set_tid_address: + return true; + case __NR_clone: // Should be parameter-restricted. + case __NR_setns: // Privileged. +@@ -411,7 +412,6 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) { + #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) + case __NR_set_thread_area: + #endif +- case __NR_set_tid_address: + case __NR_unshare: + #if !defined(__mips__) && !defined(__aarch64__) + case __NR_vfork: +@@ -521,6 +521,8 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) { + case __NR_mlock: + case __NR_munlock: + case __NR_munmap: ++ case __NR_mremap: ++ case __NR_membarrier: + return true; + case __NR_madvise: + case __NR_mincore: +@@ -538,7 +540,6 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) { + case __NR_modify_ldt: + #endif + case __NR_mprotect: +- case __NR_mremap: + case __NR_msync: + case __NR_munlockall: + case __NR_readahead: +diff --git a/src/3rdparty/chromium/sandbox/policy/linux/bpf_renderer_policy_linux.cc b/src/3rdparty/chromium/sandbox/policy/linux/bpf_renderer_policy_linux.cc +index 9fe9575eb..fa1a946f6 100644 +--- a/src/3rdparty/chromium/sandbox/policy/linux/bpf_renderer_policy_linux.cc ++++ b/src/3rdparty/chromium/sandbox/policy/linux/bpf_renderer_policy_linux.cc +@@ -93,11 +93,11 @@ ResultExpr RendererProcessPolicy::EvaluateSyscall(int sysno) const { + case __NR_sysinfo: + case __NR_times: + case __NR_uname: +- return Allow(); +- case __NR_sched_getaffinity: + case __NR_sched_getparam: + case __NR_sched_getscheduler: + case __NR_sched_setscheduler: ++ return Allow(); ++ case __NR_sched_getaffinity: + return RestrictSchedTarget(GetPolicyPid(), sysno); + case __NR_prlimit64: + // See crbug.com/662450 and setrlimit comment above. +-- +2.35.1 + diff --git a/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-pvalloc-patch.patch b/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-pvalloc-patch.patch new file mode 100644 index 00000000..310ea8d3 --- /dev/null +++ b/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-pvalloc-patch.patch @@ -0,0 +1,25 @@ +https://git.alpinelinux.org/aports/tree/community/qt5-qtwebengine/qt-musl-pvalloc.patch?id=65f58742e6e669c7d0f5b23c0764f4f73661980b + +--- + src/core/api/qtbug-61521.cpp | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/core/api/qtbug-61521.cpp b/src/core/api/qtbug-61521.cpp +index 002a1af22..01c81ac8c 100644 +--- a/src/core/api/qtbug-61521.cpp ++++ b/src/core/api/qtbug-61521.cpp +@@ -111,7 +111,11 @@ SHIM_HIDDEN void* ShimValloc(size_t size) { + } + + SHIM_HIDDEN void* ShimPvalloc(size_t size) { ++#if defined(__GLIBC__) + return pvalloc(size); ++#else ++ return valloc((size+4095)&~4095); ++#endif + } + + SHIM_HIDDEN int ShimPosixMemalign(void** r, size_t a, size_t s) { +-- +2.35.1 + diff --git a/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-qmake-remove-glibc-check.patch b/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-qmake-remove-glibc-check.patch new file mode 100644 index 00000000..1d94b6b9 --- /dev/null +++ b/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-qmake-remove-glibc-check.patch @@ -0,0 +1,78 @@ +Qt checks if glibc is available and if not disables large part of Qt5WebEngine and thus cripples functionality. +However these parts work fine with Musl so there is no need to disable them. +Just remove the check so it builds again. Since 5.15.1 is the last version of Qt to be released with this build system it'll be obsolete with Qt6 and there is no real point in fixing this upstream. + + +diff --git a/src/buildtools/config/support.pri b/src/buildtools/config/support.pri +index e7f869a1..de18523d 100644 +--- a/src/buildtools/config/support.pri ++++ b/src/buildtools/config/support.pri +@@ -189,15 +189,6 @@ defineTest(qtwebengine_checkForHostPkgCfg) { + return(true) + } + +-defineTest(qtwebengine_checkForGlibc) { +- module = $$1 +- !qtConfig(webengine-system-glibc) { +- qtwebengine_skipBuild("A suitable version >= 2.27 of libc required to build $${module} could not be found.") +- return(false) +- } +- return(true) +-} +- + defineTest(qtwebengine_checkForKhronos) { + module = $$1 + !qtConfig(webengine-system-khr) { +diff --git a/src/buildtools/configure.json b/src/buildtools/configure.json +index 88d1790c..8623f6d7 100644 +--- a/src/buildtools/configure.json ++++ b/src/buildtools/configure.json +@@ -264,18 +264,6 @@ + "label": "system gn", + "type": "detectGn" + }, +- "webengine-glibc": { +- "label": "glibc > 2.16", +- "type": "compile", +- "test": { +- "include": "features.h", +- "tail": [ +- "#if __GLIBC__ < 2 || __GLIBC_MINOR__ < 17", +- "#error glibc versions below 2.17 are not supported", +- "#endif" +- ] +- } +- }, + "webengine-gperf": { + "label": "gperf", + "type": "detectGperf" +@@ -379,7 +367,6 @@ + && (!config.sanitizer || features.webengine-sanitizer) + && (!config.linux || features.pkg-config) + && (!config.linux || features.webengine-host-pkg-config) +- && (!config.linux || features.webengine-system-glibc) + && (!config.linux || features.webengine-system-khr) + && (!config.linux || features.webengine-system-nss) + && (!config.linux || features.webengine-system-dbus) +@@ -517,11 +504,6 @@ + "condition": "config.unix && !config.darwin && libs.webengine-nss", + "output": [ "privateFeature" ] + }, +- "webengine-system-glibc": { +- "label": "glibc", +- "condition": "config.linux && tests.webengine-glibc", +- "output": [ "privateFeature" ] +- }, + "webengine-system-x11" : { + "label": "x11", + "condition": "config.unix && libs.webengine-x11", +@@ -782,8 +764,7 @@ + "webengine-system-fontconfig", + "webengine-system-dbus", + "webengine-system-nss", +- "webengine-system-khr", +- "webengine-system-glibc" ++ "webengine-system-khr" + ] + }, + { diff --git a/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-sandbox-syscall-x86_64.patch b/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-sandbox-syscall-x86_64.patch new file mode 100644 index 00000000..acdc4322 --- /dev/null +++ b/dev-qt/qtwebengine/files/qtwebengine-5.15.5_p20220618-sandbox-syscall-x86_64.patch @@ -0,0 +1,27 @@ +From ce3c2cee2d0da85dc1a1d9ebc8ebad8dde05c10a Mon Sep 17 00:00:00 2001 +From: Your Name <you@example.com> +Date: Wed, 20 Jul 2022 18:07:19 +0200 +Subject: [PATCH 1/2] sandbox syscall x86_64 + +--- + .../sandbox/linux/system_headers/x86_64_linux_syscalls.h | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/3rdparty/chromium/sandbox/linux/system_headers/x86_64_linux_syscalls.h b/src/3rdparty/chromium/sandbox/linux/system_headers/x86_64_linux_syscalls.h +index e618c6237..c1f6bccf6 100644 +--- a/src/3rdparty/chromium/sandbox/linux/system_headers/x86_64_linux_syscalls.h ++++ b/src/3rdparty/chromium/sandbox/linux/system_headers/x86_64_linux_syscalls.h +@@ -1350,6 +1350,10 @@ + #define __NR_rseq 334 + #endif + ++#if !defined(__NR_membarrier) ++#define __NR_membarrier 324 ++#endif ++ + #if !defined(__NR_pidfd_send_signal) + #define __NR_pidfd_send_signal 424 + #endif +-- +2.35.1 + diff --git a/dev-qt/qtwebengine/metadata.xml b/dev-qt/qtwebengine/metadata.xml new file mode 100644 index 00000000..cbcf0f7a --- /dev/null +++ b/dev-qt/qtwebengine/metadata.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="project"> + <email>qt@gentoo.org</email> + <name>Gentoo Qt Project</name> + </maintainer> + <maintainer type="person"> + <description>ppc64 patchset maintainer</description> + <email>gyakovlev@gentoo.org</email> + <name>Georgy Yakovlev</name> + </maintainer> + <use> + <flag name="designer">Install the QWebEngineView plugin used to add widgets in <pkg>dev-qt/designer</pkg> forms that display web pages.</flag> + <flag name="geolocation">Enable physical position determination via <pkg>dev-qt/qtpositioning</pkg></flag> + <flag name="jumbo-build">Combine source files to speed up build process.</flag> + <flag name="screencast">Enable support for remote desktop and screen cast using <pkg>media-video/pipewire</pkg></flag> + <flag name="system-ffmpeg">Use the system-wide <pkg>media-video/ffmpeg</pkg> instead of bundled.</flag> + <flag name="system-icu">Use the system-wide <pkg>dev-libs/icu</pkg> instead of bundled.</flag> + <flag name="widgets">Enable QtWidgets support</flag> + </use> + <upstream> + <bugs-to>https://bugreports.qt.io/</bugs-to> + <doc>https://doc.qt.io/</doc> + </upstream> + <slots> + <subslots> + Must only be used by packages that are known to use private parts of the Qt API. + </subslots> + </slots> +</pkgmetadata> diff --git a/dev-qt/qtwebengine/qtwebengine-5.15.5_p20220618.ebuild b/dev-qt/qtwebengine/qtwebengine-5.15.5_p20220618.ebuild new file mode 100644 index 00000000..9140a814 --- /dev/null +++ b/dev-qt/qtwebengine/qtwebengine-5.15.5_p20220618.ebuild @@ -0,0 +1,297 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{9,10} ) +PYTHON_REQ_USE="xml(+)" +inherit check-reqs estack flag-o-matic multiprocessing python-any-r1 qt5-build toolchain-funcs + +DESCRIPTION="Library for rendering dynamic web content in Qt5 C++ and QML applications" +HOMEPAGE="https://www.qt.io/" + +if [[ ${QT5_BUILD_TYPE} == release ]]; then + KEYWORDS="amd64 ~arm arm64 ~ppc64 x86" + if [[ ${PV} == ${QT5_PV}_p* ]]; then + SRC_URI="https://dev.gentoo.org/~asturm/distfiles/${P}.tar.xz" + S="${WORKDIR}/${P}" + QT5_BUILD_DIR="${S}_build" + fi +else + EGIT_BRANCH="5.15" + EGIT_REPO_URI=( + "https://code.qt.io/qt/${QT5_MODULE}.git" + "https://github.com/qt/${QT5_MODULE}.git" + ) + inherit git-r3 +fi + +# ppc64 patchset based on https://github.com/chromium-ppc64le releases +SRC_URI+=" https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${PN}-5.15.2_p20211019-jumbo-build.patch.bz2 + https://dev.gentoo.org/~asturm/distfiles/${PN}-5.15.3_p20220406-patchset.tar.xz + ppc64? ( https://dev.gentoo.org/~gyakovlev/distfiles/${PN}-5.15.2-r1-chromium87-ppc64le.tar.xz )" + +IUSE="alsa bindist designer geolocation +jumbo-build kerberos pulseaudio screencast +system-ffmpeg +system-icu widgets" +REQUIRED_USE="designer? ( widgets )" + +RDEPEND=" + app-arch/snappy:= + dev-libs/glib:2 + dev-libs/nspr + dev-libs/nss + dev-libs/expat + dev-libs/libevent:= + dev-libs/libxml2[icu] + dev-libs/libxslt + dev-libs/re2:= + =dev-qt/qtcore-${QT5_PV}* + =dev-qt/qtdeclarative-${QT5_PV}* + =dev-qt/qtgui-${QT5_PV}* + =dev-qt/qtnetwork-${QT5_PV}* + =dev-qt/qtprintsupport-${QT5_PV}* + =dev-qt/qtwebchannel-${QT5_PV}*[qml] + media-libs/fontconfig + media-libs/freetype + media-libs/harfbuzz:= + media-libs/lcms:2 + media-libs/libjpeg-turbo:= + media-libs/libpng:0= + >=media-libs/libvpx-1.5:=[svc(+)] + media-libs/libwebp:= + media-libs/opus + sys-apps/dbus + sys-apps/pciutils + sys-libs/zlib[minizip] + virtual/libudev + x11-libs/libdrm + x11-libs/libX11 + x11-libs/libXcomposite + x11-libs/libXcursor + x11-libs/libXdamage + x11-libs/libXext + x11-libs/libXfixes + x11-libs/libXi + x11-libs/libxkbfile + x11-libs/libXrandr + x11-libs/libXrender + x11-libs/libXScrnSaver + x11-libs/libXtst + alsa? ( media-libs/alsa-lib ) + designer? ( =dev-qt/designer-${QT5_PV}* ) + geolocation? ( =dev-qt/qtpositioning-${QT5_PV}* ) + kerberos? ( virtual/krb5 ) + pulseaudio? ( media-sound/pulseaudio:= ) + screencast? ( media-video/pipewire:= ) + system-ffmpeg? ( media-video/ffmpeg:0= ) + system-icu? ( >=dev-libs/icu-69.1:= ) + widgets? ( + =dev-qt/qtdeclarative-${QT5_PV}*[widgets] + =dev-qt/qtwidgets-${QT5_PV}* + ) +" +DEPEND="${RDEPEND} + media-libs/libglvnd +" +BDEPEND="${PYTHON_DEPS} + dev-util/gperf + dev-util/ninja + dev-util/re2c + net-libs/nodejs[ssl] + sys-devel/bison + sys-devel/flex + ppc64? ( >=dev-util/gn-0.1807 ) +" + +PATCHES=( + "${FILESDIR}/${PN}-5.15.2-disable-fatal-warnings.patch" # downstream, bug 695446 + "${FILESDIR}/${PN}-5.15.3_p20220505-extra-gn.patch" # downstream, bug 774186 + "${FILESDIR}/${PN}-5.15.2_p20210224-chromium-87-v8-icu68.patch" # downstream, bug 757606 + "${FILESDIR}/${PN}-5.15.2_p20210224-disable-git.patch" # downstream snapshot fix + "${FILESDIR}/${PN}-5.15.2_p20211015-pdfium-system-lcms2.patch" # by Debian, QTBUG-61746 + "${FILESDIR}/${PN}-5.15.3_p20220329-clang14.patch" # by FreeBSD, bug 836604 + "${FILESDIR}/${PN}-5.15.3_p20220406-gcc12-includes.patch" # by openSUSE, bug 840326 + "${WORKDIR}/${PN}-5.15.2_p20211019-jumbo-build.patch" # bug 813957 + "${WORKDIR}/${PN}-5.15.3_p20220406-patchset" # bug 698988 (py2--), pipewire-3 + "${FILESDIR}/${P}-fixup-CVE-2022-0796.patch" # bug 853097 + + # for musl libc + "${FILESDIR}"/${PN}-5.15.5_p20220618-qmake-remove-glibc-check.patch + "${FILESDIR}"/${PN}-5.15.5_p20220618-fix-sys-queue.h.patch + "${FILESDIR}"/${PN}-5.15.5_p20220618-musl-canonicalize-filename.patch + "${FILESDIR}"/${PN}-5.15.5_p20220618-musl-mallinfo.patch + "${FILESDIR}"/${PN}-5.15.5_p20220618-musl-mojo-strncpy.patch + "${FILESDIR}"/${PN}-5.15.5_p20220618-musl-resolv-compat.patch + "${FILESDIR}"/${PN}-5.15.5_p20220618-musl-hacks.patch + "${FILESDIR}"/${PN}-5.15.5_p20220618-backtrace-execinfo.patch + "${FILESDIR}"/${PN}-5.15.5_p20220618-pvalloc-patch.patch + "${FILESDIR}"/${PN}-5.15.5_p20220618-linux-stack_util-stackstart.patch + ## runtime + "${FILESDIR}"/${PN}-5.15.5_p20220618-musl-sandbox.patch + "${FILESDIR}"/${PN}-5.15.5_p20220618-sandbox-syscall-x86_64.patch + # "${FILESDIR}"/nasm.patch +) + +qtwebengine_check-reqs() { + # bug #307861 + eshopts_push -s extglob + if is-flagq '-g?(gdb)?([1-9])'; then + ewarn "You have enabled debug info (probably have -g or -ggdb in your CFLAGS/CXXFLAGS)." + ewarn "You may experience really long compilation times and/or increased memory usage." + ewarn "If compilation fails, please try removing -g/-ggdb before reporting a bug." + fi + eshopts_pop + + [[ ${MERGE_TYPE} == binary ]] && return + + # (check-reqs added for bug #570534) + # + # Estimate the amount of RAM required + # Multiplier is *10 because Bash doesn't do floating point maths. + # Let's crudely assume ~2GB per compiler job for GCC. + local multiplier=20 + + # And call it ~1.5GB for Clang. + if tc-is-clang ; then + multiplier=15 + fi + + local CHECKREQS_DISK_BUILD="7G" + local CHECKREQS_DISK_USR="150M" + if ! has "distcc" ${FEATURES} ; then + # bug #830661 + # Not super realistic to come up with good estimates for distcc right now + local CHECKREQS_MEMORY=$(($(makeopts_jobs)*multiplier/10))G + fi + + check-reqs_${EBUILD_PHASE_FUNC} +} + +pkg_pretend() { + qtwebengine_check-reqs +} + +pkg_setup() { + qtwebengine_check-reqs + python-any-r1_pkg_setup +} + +src_unpack() { + case ${QT5_BUILD_TYPE} in + live) git-r3_src_unpack ;& + release) default ;; + esac +} + +src_prepare() { + if [[ ${PV} == ${QT5_PV}_p* ]]; then + # This is made from git, and for some reason will fail w/o .git directories. + mkdir -p .git src/3rdparty/chromium/.git || die + fi + # We need to make sure this integrates well into Qt 5.15.3 installation. + # Otherwise revdeps fail w/o heavy changes. This is the simplest way to do it. + # See also: https://www.qt.io/blog/building-qt-webengine-against-other-qt-versions + sed -E "/^MODULE_VERSION/s/5\.15\.[0-9]+/${QT5_PV}/" -i .qmake.conf || die + + # QTBUG-88657 - jumbo-build could still make trouble + if ! use jumbo-build; then + sed -i -e 's|use_jumbo_build=true|use_jumbo_build=false|' \ + src/buildtools/config/common.pri || die + fi + + # bug 620444 - ensure local headers are used + find "${S}" -type f -name "*.pr[fio]" | \ + xargs sed -i -e 's|INCLUDEPATH += |&$${QTWEBENGINE_ROOT}_build/include $${QTWEBENGINE_ROOT}/include |' || die + + if use system-icu; then + # Sanity check to ensure that bundled copy of ICU is not used. + # Whole src/3rdparty/chromium/third_party/icu directory cannot be deleted because + # src/3rdparty/chromium/third_party/icu/BUILD.gn is used by build system. + # If usage of headers of bundled copy of ICU occurs, then lists of shim headers in + # shim_headers("icui18n_shim") and shim_headers("icuuc_shim") in + # src/3rdparty/chromium/third_party/icu/BUILD.gn should be updated. + local file + while read file; do + echo "#error This file should not be used!" > "${file}" || die + done < <(find src/3rdparty/chromium/third_party/icu -type f "(" -name "*.c" -o -name "*.cpp" -o -name "*.h" ")" 2>/dev/null) + fi + + # src/3rdparty/gn fails with libc++ due to passing of `-static-libstdc++` + if tc-is-clang && has_version 'sys-devel/clang[default-libcxx]'; then + eapply "${FILESDIR}/${PN}-5.15.2_p20210521-clang-libc++.patch" + fi + + if use system-ffmpeg && has_version '>=media-video/ffmpeg-5'; then + eapply "${FILESDIR}/${PN}-5.15.3_p20220406-ffmpeg5.patch" # by Archlinux, bug 831437 + fi + + qt_use_disable_config alsa webengine-alsa src/buildtools/config/linux.pri + qt_use_disable_config pulseaudio webengine-pulseaudio src/buildtools/config/linux.pri + + qt_use_disable_mod designer webenginewidgets src/plugins/plugins.pro + + qt_use_disable_mod widgets widgets src/src.pro + + qt5-build_src_prepare + + # we need to generate ppc64 stuff because upstream does not ship it yet + if use ppc64; then + einfo "Patching for ppc64le and generating build files" + eapply "${FILESDIR}/qtwebengine-5.15.2-enable-ppc64.patch" + pushd src/3rdparty/chromium > /dev/null || die + eapply -p0 "${WORKDIR}/${PN}-ppc64le" + popd > /dev/null || die + pushd src/3rdparty/chromium/third_party/libvpx > /dev/null || die + mkdir -vp source/config/linux/ppc64 || die + mkdir -p source/libvpx/test || die + touch source/libvpx/test/test.mk || die + # clang-format is used to re-format sources + # but we'd rather make it a no-op than introduce a clang dependency + # https://bugs.gentoo.org/849458 + clang-format() { : ; } + export -f clang-format || die + ./generate_gni.sh || die + popd >/dev/null || die + fi +} + +src_configure() { + export NINJA_PATH=/usr/bin/ninja + export NINJAFLAGS="${NINJAFLAGS:--j$(makeopts_jobs "${MAKEOPTS}" 999) -l$(makeopts_loadavg "${MAKEOPTS}" 0) -v}" + + local myqmakeargs=( + -- + -no-build-qtpdf + -printing-and-pdf + -system-opus + -system-webp + $(qt_use alsa) + $(qt_use !bindist proprietary-codecs) + $(qt_use geolocation webengine-geolocation) + $(qt_use kerberos webengine-kerberos) + $(qt_use pulseaudio) + $(usex screencast -webengine-webrtc-pipewire '') + $(usex system-ffmpeg -system-ffmpeg -qt-ffmpeg) + $(qt_use system-icu webengine-icu) + ) + qt5-build_src_configure +} + +src_install() { + qt5-build_src_install + + # bug 601472 + if [[ ! -f ${D}${QT5_LIBDIR}/libQt5WebEngine.so ]]; then + die "${CATEGORY}/${PF} failed to build anything. Please report to https://bugs.gentoo.org/" + fi +} + +pkg_preinst() { + elog "This version of Qt WebEngine is based on Chromium version 87.0.4280.144," + elog "with additional security fixes from newer versions. Extensive as it is, the" + elog "list of backports is impossible to evaluate, but always bound to be behind" + elog "Chromium's release schedule." + elog "In addition, various online services may deny service based on an outdated" + elog "user agent version (and/or other checks). Google is already known to do so." + elog + elog "tldr: Your web browsing experience will be compromised." +} |