From 552d65bd5aab6c3f9048ffa0181b410cea99192a Mon Sep 17 00:00:00 2001 From: sulincix Date: Wed, 16 Oct 2024 11:44:09 +0000 Subject: [PATCH] fixes --- app/text/hunspell/ympbuild | 33 ++++++ kde/apps/spectacle/000-no-opencv.patch | 137 ++++++++++++++++++++++ kde/apps/spectacle/001-no-opencv.patch | 86 ++++++++++++++ kde/apps/spectacle/002-fix-qmlcache.patch | 30 +++++ kde/apps/spectacle/spectacle.desktop | 1 + kde/apps/spectacle/ympbuild | 18 ++- kde/frameworks/prison/ympbuild | 2 +- kde/frameworks/sonnet/ympbuild | 2 +- kde/plasma/plasma-workspace/ympbuild | 3 +- media/libs/zxing-cpp/ympbuild | 34 ++++++ 10 files changed, 341 insertions(+), 5 deletions(-) create mode 100644 app/text/hunspell/ympbuild create mode 100644 kde/apps/spectacle/000-no-opencv.patch create mode 100644 kde/apps/spectacle/001-no-opencv.patch create mode 100644 kde/apps/spectacle/002-fix-qmlcache.patch create mode 100644 media/libs/zxing-cpp/ympbuild diff --git a/app/text/hunspell/ympbuild b/app/text/hunspell/ympbuild new file mode 100644 index 00000000..c1afcaa1 --- /dev/null +++ b/app/text/hunspell/ympbuild @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +name='hunspell' +release='1' +version='1.7.2' +url='https://github.com/hunspell/hunspell' +description='Spell checker, morphological analyzer library and command-line tool' +email='aliriza.keskin@pardus.org.tr' +maintainer='aliriza' +license=('GPLv3') +source=("https://github.com/hunspell/hunspell/archive/refs/tags/v$version.tar.gz") +depends=(ncurses readline) +makedepends=() +sha256sums=('69fa312d3586c988789266eaf7ffc9861d9f6396c31fc930a014d551b59bbd6e') +group=(app.text) +uses=() +arch=('x86_64') + +cd $name-$version + +setup () { + autoreconf -fvi + ./configure --prefix=/usr \ + --libdir=/usr/lib64/ +} + +build () { + make $jobs +} + +package () { + make install $jobs +} + diff --git a/kde/apps/spectacle/000-no-opencv.patch b/kde/apps/spectacle/000-no-opencv.patch new file mode 100644 index 00000000..a2630616 --- /dev/null +++ b/kde/apps/spectacle/000-no-opencv.patch @@ -0,0 +1,137 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8921996..64ae5ee 100755 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -80,7 +80,6 @@ find_package(Wayland REQUIRED COMPONENTS Client) + find_package(PlasmaWaylandProtocols REQUIRED) + find_package(LayerShellQt REQUIRED) + find_package(KPipeWire) +-find_package(OpenCV REQUIRED core imgproc) + + set_package_properties(KPipeWire PROPERTIES DESCRIPTION + "Used to record pipewire streams into a file" +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 66fda75..2565192 100755 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -89,11 +89,6 @@ ki18n_wrap_ui(spectacle + Gui/SettingsDialog/VideoSaveOptions.ui + ) + +-# Needed to compile with OpenCV +-target_compile_options (spectacle PRIVATE -fexceptions) +- +-target_include_directories(spectacle PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src ${OpenCV_INCLUDE_DIRS}) +- + target_link_libraries(spectacle PRIVATE + Qt::Concurrent + Qt::DBus +@@ -121,7 +116,6 @@ target_link_libraries(spectacle PRIVATE + K::KPipeWireRecord + Wayland::Client + LayerShellQt::Interface +- ${OpenCV_LIBRARIES} + ) + + set_source_files_properties(Gui/QmlUtils.qml PROPERTIES +diff --git a/src/QtCV.h b/src/QtCV.h +deleted file mode 100755 +index 2b87599..0000000 +--- a/src/QtCV.h ++++ /dev/null +@@ -1,95 +0,0 @@ +-/* SPDX-FileCopyrightText: 2024 Noah Davis +- * SPDX-License-Identifier: LGPL-2.0-or-later +- */ +- +-#pragma once +- +-#include +-#include +- +-/** +- * Convenience functions for using OpenCV with Qt APIs. +- */ +-namespace QtCV +-{ +-static constexpr int INVALID_MAT_TYPE = -1; +-static_assert(CV_8U == 0); +-static_assert(std::same_as); +- +-inline constexpr int matType(QPixelFormat::TypeInterpretation typeInterpretation) +-{ +- switch (typeInterpretation) { +- case QPixelFormat::UnsignedByte: +- return CV_8U; +- case QPixelFormat::UnsignedShort: +- return CV_16U; +- case QPixelFormat::FloatingPoint: +- return CV_32F; +- default: +- return INVALID_MAT_TYPE; +- } +-} +- +-inline constexpr int matType(QPixelFormat pixelFormat) +-{ +- const auto baseType = matType(pixelFormat.typeInterpretation()); +- if (baseType == INVALID_MAT_TYPE) { +- return INVALID_MAT_TYPE; +- } +- return CV_MAKETYPE(baseType, pixelFormat.channelCount()); +-} +- +-// Get a cv::Mat that reuses the data of a QImage. +-// Use cv::Mat::clone() if the owner of the data might be destroyed before you're done using it. +-// Expects an image with the right format. If the image has an ARGB32 format (premultiplied or not), +-// it needs to be converted to BGRA. RGBX8888 and RGBA8888 formats shouldn't need to be converted. +-inline cv::Mat qImageToMat(QImage &image) +-{ +- const auto type = matType(image.pixelFormat()); +- if (type == INVALID_MAT_TYPE) { +- return {}; +- } +- // Use the constructor with cv::Size as the first arg to avoid type ambiguity in the args. +- return cv::Mat(cv::Size{image.width(), image.height()}, type, image.bits(), image.bytesPerLine()); +-} +- +-// Same as qImageToMat, but with cv::Ptr (subclass of std::shared_ptr). +-inline cv::Ptr qImageToMatPtr(QImage &image) +-{ +- const auto type = matType(image.pixelFormat()); +- if (type == INVALID_MAT_TYPE) { +- return nullptr; +- } +- return cv::makePtr(cv::Size{image.width(), image.height()}, type, image.bits(), image.bytesPerLine()); +-} +- +-// For use with filters that require odd kernel dimensions. +-template +-inline auto sigmaToKSize(Number value) +-{ +- return cvRound(value + 1) | 1; +-} +- +-// Stack blur looks like Gaussian blur, but doesn't become as slow with larger kernel sizes. +-// Stack blur is unavailable in OpenCV versions before 4.7. +-// We need this because of the FreeBSD 14 CI pipeline. FreeBSD 14 is only on OpenCV 4.6. +-inline void stackOrGaussianBlurCompatibility(cv::InputArray &in, cv::OutputArray &out, cv::Size ksize, double sigmaX, double sigmaY = 0, [[maybe_unused]] int borderType = cv::BORDER_DEFAULT) +-{ +-#if CV_MAJOR_VERSION > 4 || (CV_MAJOR_VERSION == 4 && CV_MINOR_VERSION >= 7) +- // Replicate the behavior of cv::GaussianBlur with automatic kernel size. +- const auto gaussianKSizeFactor = (in.depth() == CV_8U ? 3 : 4) * 2; +- if( ksize.width <= 0 && sigmaX > 0 ) { +- ksize.width = sigmaToKSize(sigmaX * gaussianKSizeFactor); +- } +- if( ksize.height <= 0 && sigmaY > 0 ) { +- ksize.height = sigmaToKSize(sigmaY * gaussianKSizeFactor); +- } +- cv::stackBlur(in, out, ksize); +-#else +- cv::GaussianBlur(in, out, ksize, sigmaX, sigmaY, borderType); +-#endif +-} +-} +- +- +- diff --git a/kde/apps/spectacle/001-no-opencv.patch b/kde/apps/spectacle/001-no-opencv.patch new file mode 100644 index 00000000..6a91c859 --- /dev/null +++ b/kde/apps/spectacle/001-no-opencv.patch @@ -0,0 +1,86 @@ +diff --git a/src/Gui/Annotations/EffectUtils.cpp b/src/Gui/Annotations/EffectUtils.cpp +index 7d505a5..674a24f 100755 +--- a/src/Gui/Annotations/EffectUtils.cpp ++++ b/src/Gui/Annotations/EffectUtils.cpp +@@ -5,7 +5,6 @@ + */ + + #include "EffectUtils.h" +-#include "QtCV.h" + + #include + #include +@@ -147,11 +146,8 @@ QImage shapeShadow(const Traits::OptTuple &traits, qreal devicePixelRatio) + p.drawText(geometryTrait->path.boundingRect(), textTrait->textFlags(), textTrait->text()); + } + p.end(); +- auto mat = QtCV::qImageToMat(shadow); + const qreal sigma = Traits::Shadow::radius * devicePixelRatio; +- const int ksize = QtCV::sigmaToKSize(sigma); + // Do this before converting to Alpha8 because stackBlur gets distorted with Alpha8. +- QtCV::stackOrGaussianBlurCompatibility(mat, mat, {ksize, ksize}, sigma, sigma); + // We only want black shadows with opacity, so we only need black and 8 bits of alpha. + // If we don't do this, color emojis won't have black semi-transparent shadows. + shadow.convertTo(QImage::Format_Alpha8); +diff --git a/src/Gui/Annotations/Traits.cpp b/src/Gui/Annotations/Traits.cpp +index 396d341..807dbc1 100755 +--- a/src/Gui/Annotations/Traits.cpp ++++ b/src/Gui/Annotations/Traits.cpp +@@ -5,7 +5,6 @@ + + #include "Traits.h" + #include "Geometry.h" +-#include "QtCV.h" + #include "settings.h" + #include + #include +@@ -87,7 +86,6 @@ QImage Traits::ImageEffects::Blur::image(const std::function &getImage + } + // RGBA is better for use with OpenCV + m_backingStoreCache.convertTo(QImage::Format_RGBA8888_Premultiplied); +- auto mat = QtCV::qImageToMat(m_backingStoreCache); + // Below this, the effect is nearly invisible. + static const qreal min = 0.5; + // Above this, glitches with color splotches happen. +@@ -96,7 +94,6 @@ QImage Traits::ImageEffects::Blur::image(const std::function &getImage + const qreal dynamicMin = 1 * dpr; + const qreal dynamicMax = 16 * dpr; + const qreal sigma = std::clamp(m_strength * (dynamicMax - dynamicMin) + dynamicMin, min, max); +- QtCV::stackOrGaussianBlurCompatibility(mat, mat, {}, sigma, sigma); + m_backingStoreCache.setDevicePixelRatio(dpr); + m_backingStoreCache.setText(strengthKey, strengthString(m_strength)); + } +diff --git a/src/Platforms/ImagePlatformKWin.cpp b/src/Platforms/ImagePlatformKWin.cpp +index 237130c..69fd9d2 100755 +--- a/src/Platforms/ImagePlatformKWin.cpp ++++ b/src/Platforms/ImagePlatformKWin.cpp +@@ -7,7 +7,6 @@ + #include "ImagePlatformKWin.h" + #include "ExportManager.h" + #include "Geometry.h" +-#include "QtCV.h" + #include "DebugUtils.h" + #include "ImageMetaData.h" + +@@ -107,21 +106,6 @@ QImage combinedImage(const QList &images) + // Not sure what to do if we end up having different formats for different screens. + QImage finalImage{imageRect.size().toSize() * finalDpr, finalFormat}; + finalImage.fill(Qt::transparent); +- auto mainMat = QtCV::qImageToMat(finalImage); +- for (auto &image : images) { +- auto rgbaImage = image.format() == finalImage.format() ? image : image.convertedTo(finalFormat); +- const auto mat = QtCV::qImageToMat(rgbaImage); +- // Region Of Interest to put the image in the main image. +- const auto pos = ImageMetaData::logicalXY(rgbaImage) * finalDpr; +- const auto size = rgbaImage.deviceIndependentSize() * finalDpr; +- // Truncate to ints instead of rounding to prevent ROI from going out of bounds. +- const cv::Rect rect(pos.x(), pos.y(), size.width(), size.height()); +- const auto imageDpr = image.devicePixelRatio(); +- const bool hasIntDpr = static_cast(imageDpr) == imageDpr; +- const auto interpolation = hasIntDpr ? cv::INTER_AREA : cv::INTER_LANCZOS4; +- // Will just copy if there's no difference in size +- cv::resize(mat, mainMat(rect), rect.size(), 0, 0, interpolation); +- } + finalImage.setDevicePixelRatio(finalDpr); + ImageMetaData::setSubGeometryList(finalImage, geometryList); + return finalImage; diff --git a/kde/apps/spectacle/002-fix-qmlcache.patch b/kde/apps/spectacle/002-fix-qmlcache.patch new file mode 100644 index 00000000..c806c2ea --- /dev/null +++ b/kde/apps/spectacle/002-fix-qmlcache.patch @@ -0,0 +1,30 @@ +From 7f0a1cc0e8afb1589fb6f37e17a80c824f17a52f Mon Sep 17 00:00:00 2001 +From: Harald Sitter +Date: Tue, 15 Oct 2024 10:13:51 +0200 +Subject: [PATCH] work around bugged qmlcachegen + +BUG: 494281 +--- + CMakeLists.txt | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 41297b6f..9290cf52 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -58,6 +58,12 @@ find_package( + ) + qt_policy(SET QTP0001 NEW) + ++if(Qt6_VERSION VERSION_EQUAL 6.8.0) ++ # https://bugreports.qt.io/browse/QTBUG-129797 ++ message(NOTICE "Qt6_VERSION: ${Qt6_VERSION} detected. Enabling CAST_FROM_ASCII") ++ remove_definitions(-DQT_NO_CAST_FROM_ASCII) ++endif() ++ + find_package( + KF6 ${KF_MIN_VERSION} REQUIRED + CoreAddons +-- +GitLab + diff --git a/kde/apps/spectacle/spectacle.desktop b/kde/apps/spectacle/spectacle.desktop index d2b79c4a..3d85c753 100755 --- a/kde/apps/spectacle/spectacle.desktop +++ b/kde/apps/spectacle/spectacle.desktop @@ -4,5 +4,6 @@ Comment=Start spectacle DBus service Type=Application Exec=/usr/bin/spectacle --dbus TryExec=/usr/bin/spectacle +OnlyShowIn=KDE; Terminal=false diff --git a/kde/apps/spectacle/ympbuild b/kde/apps/spectacle/ympbuild index 7f502c0d..0b4035d2 100755 --- a/kde/apps/spectacle/ympbuild +++ b/kde/apps/spectacle/ympbuild @@ -1,6 +1,6 @@ #!/usr/bin/env bash name='spectacle' -release='4' +release='2' version='24.08.2' url='https://kde.org/applications/utilities/org.kde.spectacle' description='Application for capturing desktop screenshots' @@ -8,16 +8,31 @@ email='osman.coskun95@gmail.com' maintainer='mergin' license=('GPLv3') source=("https://download.kde.org/stable/release-service/$version/src/spectacle-$version.tar.xz" + 000-no-opencv.patch + 001-no-opencv.patch + 002-fix-qmlcache.patch spectacle.desktop) depends=(qt6-base kwayland kpipewire) makedepends=(extra-cmake-modules ki18n kdoctools) sha256sums=('3f90f8cfe3359ad94f5bb0025a9251805a092c5892cd2a891965c21a0984cbdf' + 'SKIP' + 'SKIP' + 'SKIP' 'SKIP') group=(kde.apps) uses=() arch=('x86_64') cd $name-$version +export PATH=$PATH:/usr/lib64/qt6/libexec/rcc + +export LANG=en_US.UTF-8 + +prepare(){ + patch -Np1 -i ../000-no-opencv.patch + patch -Np1 -i ../001-no-opencv.patch + patch -Np1 -i ../002-fix-qmlcache.patch +} setup(){ cmake -B build -G Ninja \ @@ -39,4 +54,3 @@ package(){ # install autostart file install -Dm644 ../spectacle.desktop -t "$DESTDIR"/etc/xdg/autostart/ } - diff --git a/kde/frameworks/prison/ympbuild b/kde/frameworks/prison/ympbuild index 6fe8bb63..1d133c42 100755 --- a/kde/frameworks/prison/ympbuild +++ b/kde/frameworks/prison/ympbuild @@ -8,7 +8,7 @@ email='aliriza.keskin@pardus.org.tr' maintainer='aliriza' license=('GPLv3') source=("https://download.kde.org/stable/frameworks/${version%.*}/prison-${version}.tar.xz") -depends=(qt6-base libdmtx qrencode qt6-multimedia) +depends=(qt6-base libdmtx qrencode qt6-multimedia zxing-cpp) makedepends=(extra-cmake-modules qt6-tools doxygen) sha256sums=('0a053a80beae232cef5da3f6525b14ee649b275cea64de0c0ffad41c3f2ec260') group=(kde.frameworks) diff --git a/kde/frameworks/sonnet/ympbuild b/kde/frameworks/sonnet/ympbuild index 86a0e2bc..b89debcb 100755 --- a/kde/frameworks/sonnet/ympbuild +++ b/kde/frameworks/sonnet/ympbuild @@ -8,7 +8,7 @@ email='brkt8khn@gmail.com' maintainer='brkt8khn' license=('GPLv3') source=("https://download.kde.org/stable/frameworks/${version%.*}/sonnet-${version}.tar.xz") -depends=(qt6-base) +depends=(qt6-base hunspell) makedepends=(extra-cmake-modules qt6-declarative qt6-tools doxygen) sha256sums=('2f970d490effd668e64dd93ffef344a80db7e63130bb23df4fa0d6b14150e588') group=(kde.frameworks) diff --git a/kde/plasma/plasma-workspace/ympbuild b/kde/plasma/plasma-workspace/ympbuild index 0309d5c3..d4457a44 100755 --- a/kde/plasma/plasma-workspace/ympbuild +++ b/kde/plasma/plasma-workspace/ympbuild @@ -10,7 +10,8 @@ license=('GPLv3') source=("https://download.kde.org/stable/plasma/$version/plasma-workspace-$version.tar.xz") depends=(accountsservice kactivitymanagerd kded kio kquickcharts kwin milou pipewire phonon - plasma-integration qt6-base xdotool qcoro-qt6) + plasma-integration qt6-base xdotool qcoro-qt6 + plasma5support plasma-activities-stats) makedepends=(qt6-tools) sha256sums=('2d4268cbae757631be57d69d34fc02c8d0204762515370c9679ecb2aa2afdf33') group=(kde.plasma) diff --git a/media/libs/zxing-cpp/ympbuild b/media/libs/zxing-cpp/ympbuild new file mode 100644 index 00000000..34c8f678 --- /dev/null +++ b/media/libs/zxing-cpp/ympbuild @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +name='zxing-cpp' +release='1' +version='2.2.1' +url='https://github.com/zxing-cpp/zxing-cpp' +description='C++ Multi-format 1D/2D barcode image processing library' +email='aliriza.keskin@pardus.org.tr' +maintainer='aliriza' +license=('GPLv3') +source=("https://github.com/zxing-cpp/zxing-cpp/archive/refs/tags/v$version.tar.gz") +depends=() +makedepends=(cmake ninja) +sha256sums=('02078ae15f19f9d423a441f205b1d1bee32349ddda7467e2c84e8f08876f8635') +group=(media.libs) +uses=() +arch=('x86_64') + +cd $name-$version + +setup () { + cmake -B build -G Ninja \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_UNIT_TESTS=ON +} + +build () { + ninja -C build $jobs +} + +package () { + ninja -C build install $jobs +} +